Changeset 2076


Ignore:
Timestamp:
Jun 26, 2005, 12:42:04 AM (20 years ago)
Author:
bird
Message:

libc adjustments. extending some testcases.

Location:
trunk/src/libctests
Files:
1 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libctests/glibc/Makefile

    • Property cvs2svn:cvs-rev changed from 1.5 to 1.6
    r2075 r2076  
    11# $Id$
    2            
    3            
    4 # default rule       
    5 all: test-logged
     2       
     3       
     4# default rule 
     5all: tests-logged
    66
    77#
     
    1212LOG    = $(OUTDIR)/$(1)-$(TS).log
    1313CC     = gcc
     14LDFLAGS=
    1415CFLAGS = -O -D_GNU_SOURCE -std=gnu99 -DOBJPFX=\"$(OUTDIR)/\"
    1516ifeq ($(shell uname -m),amd64)
     
    2425#
    2526ifeq ($(TARGET),)
    26 TARGET     := bsd
     27TARGET     := innoteklibc
    2728endif
    2829
    2930ifeq ($(TARGET),glibc)
    30 SKIPPED    := 
    31 EXCEPTIONS :=
     31SKIPPED    :=
     32EXPECTED   :=
    3233_TARGET_OK := ok
    3334CFLAGS     += \
     
    4445
    4546ifeq ($(TARGET),innoteklibc)
    46 SKIPPED    :=
    47 EXCEPTIONS :=
     47SKIPPED    := \
     48        \
     49        string/test-ffs.c \
     50        string/test-stpncpy.c \
     51        string/tst-bswap.c \
     52        string/tst-strfry.c \
     53        \
     54        time/tst_wcsftime.c \
     55        time/tst-ftime_l.c \
     56        time/tst-getdate.c \
     57        \
     58        timezone/test-tz.c \
     59        timezone/tst-timezone.c \
     60        \
     61        wcsmbs/tst-wcpncpy.c \
     62        wcsmbs/tst-wcsnlen.c \
     63
     64EXPECTED   := \
     65        wcsmbs/tst-mbrtowc.c \
     66        wcsmbs/tst-wcrtomb.c \
     67        time/tst-posixtz.c
     68       
     69CFLAGS     += -Zomf -g \
     70        -DHAVE_STRNLEN \
     71        -DHAVE_MEMPCPY
     72LDFLAGS    += -Zstack 512
    4873_TARGET_OK := ok
    4974endif
     
    7297        string/tst-strfry.c
    7398EXCEPTIONS := \
    74         catgets/test-gencat.c 
     99        catgets/test-gencat.c
    75100_TARGET_OK := ok
    76101CFLAGS     += -I sysdeps/unix/bsd -D__BSD__
     
    85110        @echo TS=$(TS)
    86111
    87        
     112
    88113#
    89114# The test.
     
    135160
    136161GRP := \
    137         grp/testgrp.c 
     162        grp/testgrp.c
    138163#       grp/tst_fgetgrent.c
    139164       
     
    213238        libio/tst_wprintf2.c \
    214239        libio/tst_wscanf.c
    215          
     240       
    216241libio/tst-widetext.c_INPUT = libio/tst-widetext.input
    217242libio/tst_getwc.c_INPUT = libio/tst_getwc.input
     
    240265        malloc/tst-valloc.c
    241266#        malloc/tst-mtrace.c
    242 #        malloc/tst-mtrace.sh 
     267#        malloc/tst-mtrace.sh
    243268
    244269MATH := \
     
    260285        math/test-tgmath.c \
    261286        math/tst-definitions.c
    262 #        math/atest-exp2.c 
    263 #        math/atest-sincos.c 
    264 #         math/atest-exp.c 
     287#        math/atest-exp2.c
     288#        math/atest-sincos.c
     289#         math/atest-exp.c
    265290#         math/gen-libm-test.pl
    266291$(foreach t,$(MATH),$(eval $(t)_LDFLAGS := -lm))
     
    369394#        posix/tst-sysconf.c - too new?
    370395# todo:
    371 #        posix/wordexp-test.c 
    372 #        posix/wordexp-tst.sh 
    373 #        posix/globtest.c 
    374 #        posix/globtest.sh 
    375 #        posix/tst-getconf.sh 
     396#        posix/wordexp-test.c
     397#        posix/wordexp-tst.sh
     398#        posix/globtest.c
     399#        posix/globtest.sh
     400#        posix/tst-getconf.sh
    376401
    377402posix/tst-fnmatch.c_INPUT = posix/tst-fnmatch.input
     
    387412posix/bug-glob1.c_ARGS = "$(OBJDIR)/posix/"
    388413posix/tst-execvp3.c_ARGS = --test-dir="$(OBJDIR)/posix/"
    389          
     414       
    390415
    391416PWD := \
     
    444469stdio-common/tstgetln.c_INPUT = stdio-common/tstgetln.input
    445470stdio-common/tstscanf.c_INPUT = stdio-common/tstscanf.input
    446 #        stdio-common/tst-printf.c 
    447 #        stdio-common/tst-printf.sh 
    448 #       stdio-common/tst-unbputc.c 
    449 #        stdio-common/tst-unbputc.sh 
     471#        stdio-common/tst-printf.c
     472#        stdio-common/tst-printf.sh
     473#       stdio-common/tst-unbputc.c
     474#        stdio-common/tst-unbputc.sh
    450475
    451476STDLIB := \
     
    474499        stdlib/testdiv.c
    475500# todo:
    476 #       stdlib/tst-fmtmsg.c 
     501#       stdlib/tst-fmtmsg.c
    477502#       stdlib/tst-fmtmsg.sh
    478503#       stdlib/tst-putenvmod.c
     
    611636#
    612637# Generate test rules
    613 # 
     638#
    614639_TESTS :=
    615640
     
    617642define def_simple
    618643
    619 $(OUTDIR)/$2.exe: $1 $(OUTDIR)/$(dir $1).dir_created $($(1)_DEPS)
    620         @echo "* COMPILING: $1"
    621         @$$(CC) $$(CFLAGS) -o $$@ $($(1)_CFLAGS) $($(1)_LDFLAGS)  $$< || (echo "$$(CC) $$(CFLAGS) -o $$@ $$<" && exit 1)
    622        
    623 $(OUTDIR)/$2.result: $(OUTDIR)/$2.exe
    624         @echo "* TESTING  : $1"
    625         @if LC_ALL=C $($1_ENVS) $$< $($1_ARGS) $(if $($(1)_INPUT), < $($(1)_INPUT),) ; then echo OK > $$@; else echo FAILURE > $$@; fi
    626         @echo "* RESULT   : $1 - `cat $$@`"
     644$(OUTDIR)/$2.result: $1 $(OUTDIR)/$(dir $1).dir_created $($(1)_DEPS)
     645        @echo "########## $1"; \
     646        echo  "##  BUILDING: $$(CC) $$(CFLAGS) -o $(OUTDIR)/$2.exe $($(1)_CFLAGS) $($(1)_LDFLAGS) $$<"; \
     647        if $$(CC) $$(CFLAGS) -o $(OUTDIR)/$2.exe $($(1)_CFLAGS) $($(1)_LDFLAGS) $$<; then \
     648                echo "##  RUNNING : LC_ALL=C $($1_ENVS) $(OUTDIR)/$2.exe $($1_ARGS) $(if $($(1)_INPUT), < $($(1)_INPUT),)"; \
     649                if LC_ALL=C $($1_ENVS) $(OUTDIR)/$2.exe $($1_ARGS) $(if $($(1)_INPUT), < $($(1)_INPUT),); then\
     650                        echo OK > $$@; \
     651                        printf "########## %-26s - SUCCESS\n" "$1"; \
     652                else \
     653                        echo "##  rc=$$$$?"; \
     654                        printf "########## %-26s - $(if $(filter $1,$(EXPECTED)),EXPECTED FAILURE,FAILURE)\n" "$1"; \
     655                        echo "$(if $(filter $1,$(EXPECTED)),EXPECTED,FAILURE)" > $$@; \
     656                fi \
     657        else \
     658                echo "##  rc=$$$$? "; \
     659                echo "##  $$(CC) $$(CFLAGS) -o $(OUTDIR)/$2.exe $($(1)_CFLAGS) $($(1)_LDFLAGS) $$<"; \
     660                printf "########## %-26s - BUILD FAILURE\n" "$1";  \
     661                echo "FAILURE - $$(CC) $$(CFLAGS) -o $(OUTDIR)/$2.exe $($(1)_CFLAGS) $($(1)_LDFLAGS) $$<" > $$@; \
     662        fi
     663       
     664$2: $(OUTDIR)/$2.result
     665        @
    627666       
    628667_TESTS += $(OUTDIR)/$2.result
     
    633672define def_skipped
    634673$(OUTDIR)/$2.result:
    635         @echo "* SKIPPING : $1"
    636         @echo "SKIPPED" > $$@
     674        @printf "########## %-26s - SKIPPED\n" "$1"; \
     675        echo "SKIPPED" > $$@
    637676       
    638677_TESTS += $(OUTDIR)/$2.result
     
    656695        @echo " SUCCESS : `cat /dev/null $$^ | grep OK | wc -l`"
    657696        @echo " SKIPPED : `cat /dev/null $$^ | grep SKIPPED | wc -l`"
     697        @echo " EXPECTED: `cat /dev/null $$^ | grep EXPECTED | wc -l`"
    658698        @echo " FAILURES: `cat /dev/null $$^ | grep FAILURE | wc -l`"
    659699
     
    664704
    665705
    666 #       
    667 # generate directory rules               
     706#
     707# generate directory rules             
    668708#
    669709define def_dir
    670710$1.dir_created:
    671         mkdir -p $1
    672         echo > $$@
     711        @mkdir -p $1
     712        @echo > $$@
    673713endef
    674714
     
    679719#
    680720# All tests (expect the ones in the next sections).
    681 # 
     721#
    682722tests: $(_TESTS)
    683723        @echo "***************"
    684724        @echo " SUCCESS : `cat /dev/null $^ | grep OK | wc -l`"
    685725        @echo " SKIPPED : `cat /dev/null $^ | grep SKIPPED | wc -l`"
     726        @echo " EXPECTED: `cat /dev/null $^ | grep EXPECTED | wc -l`"
    686727        @echo " FAILURES: `cat /dev/null $^ | grep FAILURE | wc -l`"
    687728
  • trunk/src/libctests/glibc/string/test-string.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r2075 r2076  
    2525  long test;
    2626} impl_t;
     27
     28#ifdef __EMX__ /* aout based */
     29#include <stdint.h>
     30extern uintptr_t __impls__;
     31asm (".stabs  \"___impls__\", 21, 0, 0, 0xffffffff");
     32
     33#define IMPL(name, test) \
     34  impl_t tst_ ## name = { #name, (void (*) (void))name, test }; \
     35   asm (".stabs \"___impls__\", 25, 0, 0, _tst_" #name);
     36#else
    2737extern impl_t __start_impls[], __stop_impls[];
    28 
    2938#define IMPL(name, test) \
    3039  impl_t tst_ ## name                                                   \
    3140  __attribute__ ((section ("impls"), aligned (sizeof (void *))))        \
    3241    = { #name, (void (*) (void))name, test };
     42#endif
    3343
    3444#ifdef TEST_MAIN
     
    7080    return psz - psz2;
    7181}
    72 #endif 
     82#endif
    7383
    7484
     
    124134  (* (proto_t) (impl)->fn) (__VA_ARGS__)
    125135
     136#ifdef __EMX__
     137#define FOR_EACH_IMPL(impl, notall) \
     138    for (uintptr_t *_ptrfirst = __impls__ == -1 ? &__impls__ - 1 : &__impls__; \
     139         _ptrfirst; \
     140         _ptrfirst = NULL) \
     141      for (uintptr_t *_ptr = *_ptrfirst == -2 ? _ptrfirst + 1 :  _ptrfirst + 2; \
     142           _ptr && *_ptr != NULL; \
     143           _ptr = *_ptrfirst == -2 /* emxomf */ || (_ptr - _ptrfirst < *_ptrfirst /* a.out */ ) ? _ptr + 1 : NULL) \
     144        for (impl_t *impl = *(impl_t **)_ptr; impl; impl = NULL) \
     145          if (!notall || impl->test)
     146#else
    126147#define FOR_EACH_IMPL(impl, notall) \
    127148  for (impl_t *impl = __start_impls; impl < __stop_impls; ++impl)       \
    128149    if (!notall || impl->test)
     150#endif
    129151
    130152#define HP_TIMING_BEST(best_time, start, end)   \
     
    146168    page_size = MIN_PAGE_SIZE;
    147169#endif
     170#ifdef HAVE_MMAP
    148171  buf1 = mmap (0, 2 * page_size, PROT_READ | PROT_WRITE,
    149172               MAP_PRIVATE | MAP_ANON, -1, 0);
    150173  if (buf1 == MAP_FAILED)
    151174    error (EXIT_FAILURE, errno, "mmap failed");
     175#else
     176  buf1 = memalign (getpagesize (), 2 * page_size);
     177  if (!buf1)
     178    error (EXIT_FAILURE, errno, "memalign failed");
     179#endif
    152180  if (mprotect (buf1 + page_size, page_size, PROT_NONE))
    153181    error (EXIT_FAILURE, errno, "mprotect failed");
     182#ifdef HAVE_MMAP
    154183  buf2 = mmap (0, 2 * page_size, PROT_READ | PROT_WRITE,
    155184               MAP_PRIVATE | MAP_ANON, -1, 0);
    156185  if (buf2 == MAP_FAILED)
    157186    error (EXIT_FAILURE, errno, "mmap failed");
     187#else
     188  buf2 = memalign (getpagesize (), 2 * page_size);
     189  if (!buf2)
     190    error (EXIT_FAILURE, errno, "memalign failed");
     191#endif
    158192  if (mprotect (buf2 + page_size, page_size, PROT_NONE))
    159193    error (EXIT_FAILURE, errno, "mprotect failed");
  • trunk/src/libctests/glibc/string/tst-strxfrm.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r2075 r2076  
    66
    77
    8 char const string[] = "";
    9 
    10 
    118static int
    12 test (const char *locale)
     9test (const char *locale, const char *string)
    1310{
    1411  size_t bufsize;
     
    1815#ifdef HAVE_NEWLOCALE
    1916  locale_t loc;
    20 #endif 
     17#endif
    2118  int result = 0;
    2219
     
    5552
    5653  freelocale (loc);
    57 #endif 
     54#endif
    5855
    5956  free (buf);
     
    6865  int result = 0;
    6966
    70   result |= test ("C");
    71 #ifdef __BSD__ /* bsd is missing the aliases. loosers. */
    72   result |= test ("en_US.ISO8859-1");
     67  result |= test ("C", "");
     68  result |= test ("C", "abcABCxyzXYZ|+-/*(%$");
     69#ifdef __BSD__ /* BSD is missing the aliases. loosers. */
     70  result |= test ("en_US.ISO8859-1", "");
     71  result |= test ("en_US.ISO8859-1", "abcABCxyzXYZ|+-/*(%$");
    7372#else
    74   result |= test ("en_US.ISO-8859-1");
    75 #endif
    76   result |= test ("de_DE.UTF-8");
     73  result |= test ("en_US.ISO-8859-1", "");
     74  result |= test ("en_US.ISO-8859-1", "abcABCxyzXYZ|+-/*(%$");
     75#endif
     76  result |= test ("de_DE.UTF-8", "");
     77  result |= test ("de_DE.UTF-8", "abcABCxyzXYZ|+-/*(%$");
    7778
    7879  return result;
  • trunk/src/libctests/glibc/sysdeps/i386/i686/hp-timing.h

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r2075 r2076  
    2727#include <stdio-common/_itoa.h>
    2828#else
     29#ifdef __EMX__
     30#include <stdlib.h>
     31#else
    2932extern char *_itoa(int, char *, int, int);
    30 #endif
     33#endif
     34#endif
    3135
    3236/* The macros defined here use the timestamp counter in i586 and up versions
  • trunk/src/libctests/glibc/test-skeleton.c

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r2075 r2076  
    5050    char q_data[1];
    5151  };
    52 #endif 
     52#endif
    5353
    5454/* The test function is normally called `do_test' and it is called
     
    220220#if 0 /* bird */
    221221  mallopt (M_PERTURB, 42);
    222 #endif 
     222#endif
    223223
    224224#ifdef STDOUT_UNBUFFERED
     
    321321                                       data_limit.rlim_max);
    322322          if (setrlimit (RLIMIT_DATA, &data_limit) < 0)
     323#ifndef __EMX__
    323324            perror ("setrlimit: RLIMIT_DATA");
     325#else
     326            ;
     327#endif
    324328        }
    325329      else
  • trunk/src/libctests/glibc/time/tst-strptime.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2075 r2076  
    4747  { "en_US.ISO-8859-1", "2000-01-01 08:12:21 PM", "%Y-%m-%d %I:%M:%S %p",
    4848    6, 0, 0, 1 },
     49#ifndef __EMX__ /* locale mismatch */
    4950  { "ja_JP.EUC-JP", "2001 20 \xb7\xee", "%Y %U %a", 1, 140, 4, 21 },
    5051  { "ja_JP.EUC-JP", "2001 21 \xb7\xee", "%Y %W %a", 1, 140, 4, 21 },
     52#endif
    5153};
    5254
  • trunk/src/libctests/glibc/wctype/test_wctype.c

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.2
    r2075 r2076  
    2121#include <stdlib.h>
    2222#include <wctype.h>
     23#include <locale.h>
    2324
    24 int
    25 main (int argc, char *argv[])
     25int do_tests()
    2626{
    2727  int result = 0;
     
    4949#define TEST(test) \
    5050      do                                                                      \
    51         {                                                                     \
    52           if ((is##test (ch) == 0) != (iswctype (ch, bit_##test) == 0))       \
    53             {                                                                 \
    54               printf ("`iswctype' class `%s' test "                           \
    55                       "for character \\%o failed\n", #test, ch);              \
    56               result = 1;                                                     \
    57             }                                                                 \
    58           if ((is##test (ch) == 0) != (isw##test (ch) == 0))                  \
    59             {                                                                 \
    60               printf ("`isw%s' test for character \\%o failed\n",             \
    61                       #test, ch);                                             \
    62               result = 1;                                                     \
    63             }                                                                 \
    64         }                                                                    \
     51        {                                                                     \
     52          if ((is##test (ch) == 0) != (iswctype (ch, bit_##test) == 0))       \
     53            {                                                                 \
     54              printf ("`iswctype' class `%s' test "                           \
     55                      "for character \\%o failed\n", #test, ch);              \
     56              result = 1;                                                     \
     57            }                                                                 \
     58          if ((is##test (ch) == 0) != (isw##test (ch) == 0))                  \
     59            {                                                                 \
     60              printf ("`isw%s' test for character \\%o failed\n",             \
     61                      #test, ch);                                             \
     62              result = 1;                                                     \
     63            }                                                                 \
     64        }                                                                    \
    6565      while (0)
    6666
     
    7777      TEST (xdigit);
    7878    }
     79  return result;
     80}
    7981
     82int
     83main (int argc, char *argv[])
     84{
     85  int result = do_tests();
     86  /* bird: test switching back and forth makes any difference. */
     87  setlocale (LC_CTYPE, "en_US");
     88  setlocale (LC_CTYPE, "en_US.UTF-8");
     89  setlocale (LC_CTYPE, "en_US.UTF8");
     90  setlocale (LC_CTYPE, "de_DE");
     91  setlocale (LC_CTYPE, "de_DE.UTF-8");
     92  setlocale (LC_CTYPE, "no_NO");
     93  if (!setlocale (LC_CTYPE, "C"))
     94    {
     95      puts ("setlocale(LC_CTYPE, C) failed!");
     96      result |= 1;
     97    }
     98  result |= do_tests();
    8099  if (result == 0)
    81100    puts ("All test successful!");
Note: See TracChangeset for help on using the changeset viewer.