URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 24 |
Rev 33 |
/* Test some execution paths for error cases.
|
/* Test some execution paths for error cases.
|
#cc: additional_flags=-Wl,--section-start=.startup=0x8000
|
#cc: additional_flags=-Wl,--section-start=.startup=0x8000
|
The linker option is for sake of newlib, where the default program
|
The linker option is for sake of newlib, where the default program
|
layout starts at address 0. We need to change the layout so
|
layout starts at address 0. We need to change the layout so
|
there's no memory at 0, as all sim error checking is "lazy",
|
there's no memory at 0, as all sim error checking is "lazy",
|
depending on lack of memory mapping. */
|
depending on lack of memory mapping. */
|
|
|
#include <stdio.h>
|
#include <stdio.h>
|
#include <stdlib.h>
|
#include <stdlib.h>
|
#include <errno.h>
|
#include <errno.h>
|
|
|
void err (const char *s)
|
void err (const char *s)
|
{
|
{
|
perror (s);
|
perror (s);
|
abort ();
|
abort ();
|
}
|
}
|
|
|
int main (int argc, char *argv[])
|
int main (int argc, char *argv[])
|
{
|
{
|
/* Avoid getting files with random characters due to errors
|
/* Avoid getting files with random characters due to errors
|
elsewhere. */
|
elsewhere. */
|
if (argc != 1
|
if (argc != 1
|
|| (argv[0][0] != '.' && argv[0][0] != '/' && argv[0][0] != 'r'))
|
|| (argv[0][0] != '.' && argv[0][0] != '/' && argv[0][0] != 'r'))
|
abort ();
|
abort ();
|
|
|
if (rename (argv[0], NULL) != -1
|
if (rename (argv[0], NULL) != -1
|
|| errno != EFAULT)
|
|| errno != EFAULT)
|
err ("rename 1 ");
|
err ("rename 1 ");
|
|
|
errno = 0;
|
errno = 0;
|
|
|
if (rename (NULL, argv[0]) != -1
|
if (rename (NULL, argv[0]) != -1
|
|| errno != EFAULT)
|
|| errno != EFAULT)
|
err ("rename 2");
|
err ("rename 2");
|
|
|
printf ("pass\n");
|
printf ("pass\n");
|
return 0;
|
return 0;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.