OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [sim/] [testsuite/] [sim/] [cris/] [c/] [rename2.c] - Diff between revs 24 and 157

Only display areas with differences | Details | Blame | View Log

Rev 24 Rev 157
/* 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;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.