OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gdb/] [gdb-6.8/] [gdb-6.8.openrisc-2.1/] [sim/] [testsuite/] [sim/] [cris/] [c/] [openpf3.c] - Diff between revs 24 and 33

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

Rev 24 Rev 33
/* Basic file operations (rename, unlink); once without sysroot.  We
/* Basic file operations (rename, unlink); once without sysroot.  We
   also test that the simulator has chdir:ed to PREFIX, when defined.  */
   also test that the simulator has chdir:ed to PREFIX, when defined.  */
 
 
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <errno.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <unistd.h>
#include <unistd.h>
 
 
#ifndef PREFIX
#ifndef PREFIX
#define PREFIX
#define PREFIX
#endif
#endif
 
 
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[])
{
{
  FILE *f;
  FILE *f;
  struct stat buf;
  struct stat buf;
 
 
  unlink (PREFIX "testfoo2.tmp");
  unlink (PREFIX "testfoo2.tmp");
 
 
  f = fopen ("testfoo1.tmp", "w");
  f = fopen ("testfoo1.tmp", "w");
  if (f == NULL)
  if (f == NULL)
    err ("open");
    err ("open");
  fclose (f);
  fclose (f);
 
 
  if (rename (PREFIX "testfoo1.tmp", PREFIX "testfoo2.tmp") != 0)
  if (rename (PREFIX "testfoo1.tmp", PREFIX "testfoo2.tmp") != 0)
    err ("rename");
    err ("rename");
 
 
  if (stat (PREFIX "testfoo2.tmp", &buf) != 0
  if (stat (PREFIX "testfoo2.tmp", &buf) != 0
      || !S_ISREG (buf.st_mode))
      || !S_ISREG (buf.st_mode))
    err ("stat 1");
    err ("stat 1");
 
 
  if (stat ("testfoo2.tmp", &buf) != 0
  if (stat ("testfoo2.tmp", &buf) != 0
      || !S_ISREG (buf.st_mode))
      || !S_ISREG (buf.st_mode))
    err ("stat 2");
    err ("stat 2");
 
 
  if (unlink (PREFIX "testfoo2.tmp") != 0)
  if (unlink (PREFIX "testfoo2.tmp") != 0)
    err ("unlink");
    err ("unlink");
 
 
  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.