delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/10/21/07:04:25.1

Sender: rich AT phekda DOT freeserve DOT co DOT uk
Message-ID: <3BD2AAB2.CAF5D96B@phekda.freeserve.co.uk>
Date: Sun, 21 Oct 2001 12:00:02 +0100
From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.19 i586)
X-Accept-Language: de,fr
MIME-Version: 1.0
To: DJGPP workers <djgpp-workers AT delorie DOT com>
Subject: Some build fixes for the test suite
Reply-To: djgpp-workers AT delorie DOT com

Hello.

Some of the tests do not currently build with gcc 2.95.3. Below is a diff
that fixes some of the tests.

The only objection I can see is that the putpath test now strdup's a bunch
of strings, but does not free them when the test exits. But these strings
are freed automatically on exit, right?

OK to commit?

Thanks, bye, Rich =]

-- 
Richard Dawe
http://www.phekda.freeserve.co.uk/richdawe/

Index: tests/libc/ansi/stdio/filbuf.c
===================================================================
RCS file: /cvs/djgpp/djgpp/tests/libc/ansi/stdio/filbuf.c,v
retrieving revision 1.1
diff -p -c -3 -r1.1 filbuf.c
*** tests/libc/ansi/stdio/filbuf.c      1997/11/14 20:52:52     1.1
--- tests/libc/ansi/stdio/filbuf.c      2001/10/14 21:01:36
*************** main(void)
*** 12,18 ****
    {
      if (f->_cnt > last_count)
      {
!       printf("Count: %5d  Fill: %5d  Bufsiz: %5d  SoFar: %5d\n",
             f->_cnt, f->_fillsize, f->_bufsiz, so_far);
      }
      last_count = f->_cnt;
--- 12,18 ----
    {
      if (f->_cnt > last_count)
      {
!       printf("Count: %5d  Fill: %5ld  Bufsiz: %5ld  SoFar: %5d\n",
             f->_cnt, f->_fillsize, f->_bufsiz, so_far);
      }
      last_count = f->_cnt;
Index: tests/libc/ansi/stdio/file.c
===================================================================
RCS file: /cvs/djgpp/djgpp/tests/libc/ansi/stdio/file.c,v
retrieving revision 1.1
diff -p -c -3 -r1.1 file.c
*** tests/libc/ansi/stdio/file.c        1996/02/05 01:46:12     1.1
--- tests/libc/ansi/stdio/file.c        2001/10/14 21:01:36
*************** debug_file(FILE *f, const char *remarks)
*** 29,35 ****
    putchar(f->_flag & 001000  ? 'M' : ' ');
    putchar(f->_flag & 000020  ? 'W' : ' ');
    putchar(f->_flag & 000010  ? 'R' : ' ');
!   printf("  %5d %7p %8p %8d", f->_cnt, f->_ptr, f->_base, f->_bufsiz);
  #endif
    printf("  %s\n", remarks);
  }
--- 29,35 ----
    putchar(f->_flag & 001000  ? 'M' : ' ');
    putchar(f->_flag & 000020  ? 'W' : ' ');
    putchar(f->_flag & 000010  ? 'R' : ' ');
!   printf("  %5d %7p %8p %8ld", f->_cnt, f->_ptr, f->_base, f->_bufsiz);
  #endif
    printf("  %s\n", remarks);
  }
*************** do_mode(const char *rmode, const char *w
*** 54,60 ****
      setvbuf(f, 0, _IOFBF , 512);
  
  #ifdef __DJGPP__
!     printf("\n---- %s File, Read, bufsiz=%d ----\n", description,
f->_bufsiz);
      do_headers();
  #endif
  
--- 54,60 ----
      setvbuf(f, 0, _IOFBF , 512);
  
  #ifdef __DJGPP__
!     printf("\n---- %s File, Read, bufsiz=%ld ----\n", description,
f->_bufsiz);
      do_headers();
  #endif
  
*************** do_mode(const char *rmode, const char *w
*** 122,128 ****
      setvbuf(f, 0, _IOFBF , 512);
  
  #ifdef __DJGPP__
!     printf("\n---- %s File, Write, bufsiz=%d ----\n", description,
f->_bufsiz);
      do_headers();
  #endif
  
--- 122,129 ----
      setvbuf(f, 0, _IOFBF , 512);
  
  #ifdef __DJGPP__
!     printf("\n---- %s File, Write, bufsiz=%ld ----\n",
!          description, f->_bufsiz);
      do_headers();
  #endif
  
Index: tests/libc/ansi/time/strftime.c
===================================================================
RCS file: /cvs/djgpp/djgpp/tests/libc/ansi/time/strftime.c,v
retrieving revision 1.1
diff -p -c -3 -r1.1 strftime.c
*** tests/libc/ansi/time/strftime.c     1997/11/02 15:23:56     1.1
--- tests/libc/ansi/time/strftime.c     2001/10/14 21:01:37
*************** compare (const char *fmt, const struct t
*** 28,33 ****
--- 28,35 ----
  int
  main (void)
  {
+ #undef TZ
+   char TZ[] = "TZ=GMT0";
    int n_fail = 0;
    struct tm *tm;
    time_t t = 738367; /* Fri Jan  9 13:06:07 1970 */
*************** main (void)
*** 35,41 ****
  
    /* This is necessary to make strftime give consistent zone strings and
       e.g., seconds since the epoch (%s).  */
!   putenv ("TZ=GMT0");
  
  #undef CMP
  #define CMP(Fmt, Expected) n_fail += compare ((Fmt), tm, (Expected))
--- 37,43 ----
  
    /* This is necessary to make strftime give consistent zone strings and
       e.g., seconds since the epoch (%s).  */
!   putenv (TZ);
  
  #undef CMP
  #define CMP(Fmt, Expected) n_fail += compare ((Fmt), tm, (Expected))
Index: tests/libc/dos/io/putpath.c
===================================================================
RCS file: /cvs/djgpp/djgpp/tests/libc/dos/io/putpath.c,v
retrieving revision 1.2
diff -p -c -3 -r1.2 putpath.c
*** tests/libc/dos/io/putpath.c 1999/05/24 10:19:52     1.2
--- tests/libc/dos/io/putpath.c 2001/10/14 21:01:38
***************
*** 1,7 ****
! /* A test program for the various /dev/* transformations inside
_put_path().
     Written by Markus F.X.J. Oberhumer.  */
  
  #include <stdio.h>
  #include <libc/environ.h>
  extern char **environ;
  
--- 1,12 ----
! /* A test program for the various /dev/... transformations inside
_put_path().
     Written by Markus F.X.J. Oberhumer.  */
  
  #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <errno.h>
+ #include <go32.h>
+ #include <libc/dosio.h>
  #include <libc/environ.h>
  extern char **environ;
  
*************** static void p2(const char *path)
*** 26,39 ****
    free(tmp);
  }
  
! int main()
  {
    /* first clear the environment the quick way */
    environ = (char **) calloc(1, sizeof(char *));
    __environ_changed++;
    /* setup out test environment */
!   putenv("DJDIR=c:/djgpp2");
!   putenv("HOME=c:\\home");
  
    /* normal dir tests */
    p2("/dir1/dir2");
--- 31,45 ----
    free(tmp);
  }
  
! int
! main (void)
  {
    /* first clear the environment the quick way */
    environ = (char **) calloc(1, sizeof(char *));
    __environ_changed++;
    /* setup out test environment */
!   putenv(strdup("DJDIR=c:/djgpp2"));
!   putenv(strdup("HOME=c:\\home"));
  
    /* normal dir tests */
    p2("/dir1/dir2");
*************** int main()
*** 95,104 ****
    printf("\n");
  
    /* deeply nested tests */
!   putenv("X2=/dev/env/X1");
!   putenv("X3=/dev/env/foo~/dev/env/X1~");
!   putenv("X4=/dev/env/foo~/dev/env/X2~");
!   putenv("X5=/dev/env/foo~/dev/env/X4~");
    {
      const char **x;
      static const char *x1[] = {
--- 101,110 ----
    printf("\n");
  
    /* deeply nested tests */
!   putenv(strdup("X2=/dev/env/X1"));
!   putenv(strdup("X3=/dev/env/foo~/dev/env/X1~"));
!   putenv(strdup("X4=/dev/env/foo~/dev/env/X2~"));
!   putenv(strdup("X5=/dev/env/foo~/dev/env/X4~"));
    {
      const char **x;
      static const char *x1[] = {
*************** int main()
*** 110,116 ****
      for (x = x1; *x; x++)
      {
        printf("%s\n", *x);
!       putenv(*x);
        p("/dev/env/X1");
        p("/dev/env/X2");
        p("/dev/env/X3");
--- 116,122 ----
      for (x = x1; *x; x++)
      {
        printf("%s\n", *x);
!       putenv(strdup(*x));
        p("/dev/env/X1");
        p("/dev/env/X2");
        p("/dev/env/X3");
*************** int main()
*** 123,139 ****
    /* infinite recursion tests */
    /* these all should print an error message with ENOMEM
       and should *not* crash */
!   putenv("A1=/dev/env/A1");
    errno = 0;
    p("/dev/env/A1");
    if (errno) perror("/dev/env/A1");
    errno = 0;
!   putenv("A1=/dev/env/foo~/dev/env/A1~");
    p("/dev/env/A1");
    if (errno) perror("/dev/env/A1");
    errno = 0;
!   putenv("A1=/dev/env/foo~/dev/env/A2~");
!   putenv("A2=/dev/env/foo~/dev/env/A1~");
    p("/dev/env/A1");
    if (errno) perror("/dev/env/A1");
  
--- 129,145 ----
    /* infinite recursion tests */
    /* these all should print an error message with ENOMEM
       and should *not* crash */
!   putenv(strdup("A1=/dev/env/A1"));
    errno = 0;
    p("/dev/env/A1");
    if (errno) perror("/dev/env/A1");
    errno = 0;
!   putenv(strdup("A1=/dev/env/foo~/dev/env/A1~"));
    p("/dev/env/A1");
    if (errno) perror("/dev/env/A1");
    errno = 0;
!   putenv(strdup("A1=/dev/env/foo~/dev/env/A2~"));
!   putenv(strdup("A2=/dev/env/foo~/dev/env/A1~"));
    p("/dev/env/A1");
    if (errno) perror("/dev/env/A1");

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019