Changeset 2089 for trunk


Ignore:
Timestamp:
Jun 27, 2005, 5:05:29 AM (20 years ago)
Author:
bird
Message:

testcase adjustments.

Location:
trunk/src/libctests/glibc
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libctests/glibc/stdio-common/test-fseek.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2088 r2089  
    2828
    2929  puts ("\nFile seek test");
    30   fp = fopen (TESTFILE, "w");
     30  fp = fopen (TESTFILE, "wb");
    3131  if (fp == NULL)
    3232    {
     
    3737  for (i = 0; i < 256; i++)
    3838    putc (i, fp);
    39   if (freopen (TESTFILE, "r", fp) != fp)
     39  if (freopen (TESTFILE, "rb", fp) != fp)
    4040    {
    4141      perror ("Cannot open file for reading");
  • trunk/src/libctests/glibc/stdio-common/test-fwrite.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2088 r2089  
    3535  line = NULL;
    3636  linesz = 0;
     37#ifdef HAVE_GETLINE
    3738  if (getline (&line, &linesz, f) != 5)
    3839    {
     
    4041      return 1;
    4142    }
     43#else
     44  char fgetbuf [80];
     45  line = fgets (fgetbuf, sizeof(fgetbuf), f);
     46  if (!line)
     47    {
     48      perror ("gets");
     49      return 1;
     50    }
     51#endif
    4252  if (strcmp (line, "line\n"))
    4353    {
     
    5868    }
    5969
     70#ifdef HAVE_ASPRINTF
    6071  asprintf (&line, "\
    6172GDB is free software and you are welcome to distribute copies of it\n\
     
    6374There is absolutely no warranty for GDB; type \"show warranty\" for details.\n\
    6475");
     76#endif
    6577
    6678  puts ("Test succeeded.");
  • trunk/src/libctests/glibc/stdio-common/test-vfprintf.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2088 r2089  
    2020
    2121#include <locale.h>
     22#ifdef HAVE_MCHECK_H
    2223#include <mcheck.h>
     24#endif
    2325#include <stdint.h>
    2426#include <stdio.h>
     
    4648  int fd;
    4749
     50#ifdef HAVE_MCHECK_H
    4851  mtrace ();
     52#endif
    4953
    5054  strcpy (buf, "/tmp/test-vfprintfXXXXXX");
     
    5559      exit (1);
    5660    }
    57   unlink (buf);
    5861
    5962  for (i = 0; i < nlocs; ++i)
     
    7578          exit (1);
    7679        }
    77 
    7880      if (ftruncate (fd2, 0) != 0)
    7981        {
     
    120122    }
    121123
     124#ifdef __EMX__
    122125  close (fd);
    123 
     126  unlink (buf);
     127#else
     128  unlink (buf);
     129  close (fd);
     130#endif
    124131  return res;
    125132}
  • trunk/src/libctests/glibc/stdio-common/test_rdwr.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2088 r2089  
    3535  int lose = 0;
    3636
     37#ifdef __EMX__
     38  if (!name)
     39    name = strrchr (*argv, '\\');
     40  if (!name)
     41    name = strrchr (*argv, ':');
     42#endif
    3743  if (name != NULL)
    3844    ++name;
  • trunk/src/libctests/glibc/stdio-common/tst-fseek.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2088 r2089  
    2828#include <sys/stat.h>
    2929
     30#ifndef HAVE_64BIT_FILEIO_TYPES
     31#define stat64 stat
     32#define fstat64 fstat
     33#endif
    3034
    3135int
     
    4246  struct stat64 st2;
    4347  int result = 0;
     48#ifdef __EMX__
     49   extern int _fmode_bin;
     50   _fmode_bin = 0;
     51#endif
    4452
    4553  tmpdir = getenv ("TMPDIR");
     
    4755    tmpdir = "/tmp";
    4856
     57#ifdef HAVE_ASPRINTF
    4958  asprintf (&fname, "%s/tst-fseek.XXXXXX", tmpdir);
     59#else
     60  sprintf (buf, "%s/tst-fseek.XXXXXX", tmpdir);
     61  fname = strdup(buf);
     62#endif
    5063  if (fname == NULL)
    5164    error (EXIT_FAILURE, errno, "cannot generate name for temporary file");
     
    5669    error (EXIT_FAILURE, errno, "cannot open temporary file");
    5770
    58   fp = fdopen (fd, "w+");
     71  fp = fdopen (fd, "w+b");
    5972  if (fp == NULL)
    6073    error (EXIT_FAILURE, errno, "cannot get FILE for temporary file");
     
    349362              result = 1;
    350363            }
     364#ifndef __EMX__ /* TODO: figure out what the hell they are getting at here. There's not writing or
     365                         anything which should case any of those two to be changed... */
    351366          if (st1.st_ctime >= st2.st_ctime)
    352367            {
     
    359374              result = 1;
    360375            }
     376#endif
    361377        }
    362378    }
  • trunk/src/libctests/glibc/stdio-common/tst-rndseek.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2088 r2089  
    44#include <unistd.h>
    55
     6#ifndef HAVE_64BIT_FILEIO_TYPES
     7#define fopen64 fopen
     8#endif
    69
    710static char fname[] = "/tmp/rndseek.XXXXXX";
  • trunk/src/libctests/glibc/stdio-common/tst-sscanf.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2088 r2089  
    4242{
    4343  "-12345678987654321123456789987654321123456789987654321",
     44#ifndef __EMX__
    4445  "-12345678987654321123456789987654321123456789987654321",
    4546  "-12,345,678987,654,321123,456,789987,654,321123,456,789987,654,321",
    4647  "-12,345,678987,654,321123,456,789987,654,321123,456,789987,654,321"
     48#endif
    4749};
    4850
     
    5052{
    5153  "%9ld%9ld%9ld%9ld%9ld%9ld",
     54#ifndef __EMX__
    5255  "%I9ld%I9ld%I9ld%I9ld%I9ld%I9ld",
    5356  "%'11ld%'11ld%'11ld%'11ld%'11ld%'11ld",
    5457  "%I'11ld%I'11ld%I'11ld%I'11ld%I'11ld%I'11ld"
     58#endif
    5559};
    5660
     
    6569  const char *fmt;
    6670  int retval;
    67 } int_tests[] = 
     71} int_tests[] =
    6872{
    6973  { "foo\n", "foo\nbar", -1 },
     
    131135    }
    132136
     137#ifdef __EMX__
     138  for (i = 0; i < 1; ++i)
     139#else
    133140  for (i = 0; i < 4; ++i)
     141#endif
    134142    {
    135143      if (sscanf (str_long[i], fmt_long[i],
  • trunk/src/libctests/glibc/stdio-common/tstdiomisc.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2088 r2089  
    6363  printf ("expected \"inf INF\", got \"%s\"\n", buf);
    6464
     65#ifdef HAVE_SWPRINTF
    6566  swprintf (wbuf, sizeof wbuf / sizeof (wbuf[0]), L"%f %F",
    6667            DBL_MAX * DBL_MAX - DBL_MAX * DBL_MAX,
     
    7374  result |= wcscmp (wbuf, L"inf INF") != 0;
    7475  printf ("expected L\"inf INF\", got L\"%S\"\n", wbuf);
     76#endif
    7577
    7678  return result;
  • trunk/src/libctests/glibc/stdio-common/tstscanf.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2088 r2089  
    339339
    340340    res = sscanf ("-InF", "%f", &value);
    341     if (res != 1 || isinf (value) != -1)
     341    if (res != 1 || isinf (value) == 0/*!= -1*/) /* (the standard doesn't define -1 and 1, only non-zero. bsd doesn't do this.) */
    342342      {
    343343        fputs ("test failed!\n", stdout);
     
    346346
    347347    res = sscanf ("+InfiNiTY", "%f", &value);
    348     if (res != 1 || isinf (value) != 1)
     348    if (res != 1 || isinf (value) == 0/* != 1*/)
    349349      {
    350350        fputs ("test failed!\n", stdout);
  • trunk/src/libctests/glibc/stdlib/bug-strtod.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2088 r2089  
    2222#include <stdlib.h>
    2323#include <string.h>
     24#ifdef __EMX__ /* one of the above seems to be declaring ssize_t... glibc feat I guess. */
     25#include <sys/types.h>
     26#endif
    2427
    2528
  • trunk/src/libctests/glibc/stdlib/test-canon.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2088 r2089  
    112112            && strcmp (result + cwd_len, expected + 1) == 0);
    113113  else
    114     good = (strcmp (expected, result) == 0);
     114    {
     115      good = (strcmp (expected, result) == 0);
     116#ifdef __EMX__
     117      if (!good && expected[0] == '/' && result[1] == ':' && result[2] == '/')
     118        good = (strcmp (expected, result + 2) == 0);
     119#endif
     120    }
    115121
    116122  return good;
     
    158164    symlink (symlinks[i].value, symlinks[i].name);
    159165
     166  int rmdir_etc = mkdir ("/etc", 0777) == 0;
     167
    160168  int has_dir = mkdir ("doesExist", 0777) == 0;
    161169
     
    213221    }
    214222
     223#ifdef __EMX__
     224  if (fd >= 0) /* cannot unlink open files */
     225    close (fd);
     226#endif
    215227  if (fd >= 0)
    216228    unlink ("doesExist/someFile");
     
    218230  if (has_dir)
    219231    rmdir ("doesExist");
     232
     233  if (rmdir_etc)
     234    rmdir ("/etc");
    220235
    221236  for (i = 0; i < (int) (sizeof (symlinks) / sizeof (symlinks[0])); ++i)
  • trunk/src/libctests/glibc/stdlib/testsort.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2088 r2089  
    1010
    1111int
    12 main (void)
     12main (int argc, char **argv)
    1313{
    1414  char bufs[500][20];
     
    1616  size_t lens[500];
    1717  size_t i, j;
     18  int errors;
    1819
    1920  srandom (1);
     
    3031  qsort (lines, 500, sizeof (char *), compare);
    3132
    32   for (i = 0; i < 500 && lines[i] != NULL; ++i)
    33     puts (lines[i]);
     33  for (i = 0, errors = 0; i < 499; ++i)
     34    if (!lines[i] || !lines[i + 1] || strcmp(lines[i], lines[i + 1]) > 0)
     35      errors++;
    3436
    35   return 0;
     37  if (errors)
     38    {
     39      printf("%s: %d errors!\n", argv[0], errors);
     40      for (i = 0; i < 500 && lines[i] != NULL; ++i)
     41        puts (lines[i]);
     42    }
     43
     44  return !!errors;
    3645}
  • trunk/src/libctests/glibc/stdlib/tst-strtod.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2088 r2089  
    222222locale_test (void)
    223223{
     224#ifdef HAVE___STRTOD_INTERNAL
    224225  static const struct
    225226  {
     
    272273  if (result == 0)
    273274    puts ("all OK");
    274 
    275275  return result;
    276 }
     276#else /* NO __strtod_internal */
     277  return 0;
     278#endif
     279}
Note: See TracChangeset for help on using the changeset viewer.