bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

pipe-filter tests on Solaris


From: Bruno Haible
Subject: pipe-filter tests on Solaris
Date: Sun, 16 Aug 2009 22:43:23 +0200
User-agent: KMail/1.9.9

On Solaris 10, the tests test-pipe-filter-ii1.sh, test-pipe-filter-gi1.sh
fail, because they use the "tr" program in the PATH. I happened to have
/usr/bin in my $PATH, and not /usr/xpg4/bin.

This should fix it.


2009-08-16  Bruno Haible  <address@hidden>

        Fix test failures on Solaris 10.
        * tests/test-pipe-filter-ii1.sh: Determine the filename of a working
        'tr' program and pass it as first argument.
        * tests/test-pipe-filter-gi1.sh: Likewise.
        * tests/test-pipe-filter-ii1.c (main): Except the filename of a 'tr'
        program as first argument.
        * tests/test-pipe-filter-gi1.c (main): Likewise.

--- tests/test-pipe-filter-gi1.c.orig   2009-08-16 22:36:57.000000000 +0200
+++ tests/test-pipe-filter-gi1.c        2009-08-16 22:32:54.000000000 +0200
@@ -83,16 +83,19 @@
 int
 main (int argc, char *argv[])
 {
+  const char *tr_program;
   const char *input_filename;
   size_t input_size;
   char *input;
 
   set_program_name (argv[0]);
 
-  ASSERT (argc == 2);
+  ASSERT (argc == 3);
+
+  tr_program = argv[1];
 
   /* Read some text from a file.  */
-  input_filename = argv[1];
+  input_filename = argv[2];
   input = read_binary_file (input_filename, &input_size);
   ASSERT (input != NULL);
 
@@ -106,12 +109,12 @@
     l.input = input;
     l.nread = 0;
 
-    argv[0] = "tr";
+    argv[0] = tr_program;
     argv[1] = "a-z";
     argv[2] = "A-Z";
     argv[3] = NULL;
 
-    f = pipe_filter_gi_create ("tr", "tr", argv, false, true,
+    f = pipe_filter_gi_create ("tr", tr_program, argv, false, true,
                               prepare_read, done_read, &l);
     ASSERT (f != NULL);
     result = pipe_filter_gi_write (f, input, input_size);
--- tests/test-pipe-filter-gi1.sh.orig  2009-08-16 22:36:57.000000000 +0200
+++ tests/test-pipe-filter-gi1.sh       2009-08-16 22:30:42.000000000 +0200
@@ -1,7 +1,16 @@
 #!/bin/sh
+
+# Find a 'tr' program that supports character ranges in the POSIX syntax.
+# Solaris /usr/bin/tr does not.
+if test -f /usr/xpg4/bin/tr; then
+  TR=/usr/xpg4/bin/tr
+else
+  TR=tr
+fi
+
 # A small file.
-./test-pipe-filter-gi1${EXEEXT} "${srcdir}/test-pipe-filter-gi1.sh" || exit 1
+./test-pipe-filter-gi1${EXEEXT} ${TR} "${srcdir}/test-pipe-filter-gi1.sh" || 
exit 1
 # A medium-sized file.
-./test-pipe-filter-gi1${EXEEXT} "${srcdir}/test-pipe-filter-gi1.c" || exit 1
+./test-pipe-filter-gi1${EXEEXT} ${TR} "${srcdir}/test-pipe-filter-gi1.c" || 
exit 1
 # A large file.
-./test-pipe-filter-gi1${EXEEXT} "${srcdir}/test-vasnprintf-posix.c" || exit 1
+./test-pipe-filter-gi1${EXEEXT} ${TR} "${srcdir}/test-vasnprintf-posix.c" || 
exit 1
--- tests/test-pipe-filter-ii1.c.orig   2009-08-16 22:36:57.000000000 +0200
+++ tests/test-pipe-filter-ii1.c        2009-08-16 22:32:54.000000000 +0200
@@ -105,16 +105,19 @@
 int
 main (int argc, char *argv[])
 {
+  const char *tr_program;
   const char *input_filename;
   size_t input_size;
   char *input;
 
   set_program_name (argv[0]);
 
-  ASSERT (argc == 2);
+  ASSERT (argc == 3);
+
+  tr_program = argv[1];
 
   /* Read some text from a file.  */
-  input_filename = argv[1];
+  input_filename = argv[2];
   input = read_binary_file (input_filename, &input_size);
   ASSERT (input != NULL);
 
@@ -129,12 +132,12 @@
     l.nwritten = 0;
     l.nread = 0;
 
-    argv[0] = "tr";
+    argv[0] = tr_program;
     argv[1] = "a-z";
     argv[2] = "A-Z";
     argv[3] = NULL;
 
-    result = pipe_filter_ii_execute ("tr", "tr", argv, false, true,
+    result = pipe_filter_ii_execute ("tr", tr_program, argv, false, true,
                                     prepare_write, done_write,
                                     prepare_read, done_read,
                                     &l);
--- tests/test-pipe-filter-ii1.sh.orig  2009-08-16 22:36:57.000000000 +0200
+++ tests/test-pipe-filter-ii1.sh       2009-08-16 22:30:42.000000000 +0200
@@ -1,7 +1,16 @@
 #!/bin/sh
+
+# Find a 'tr' program that supports character ranges in the POSIX syntax.
+# Solaris /usr/bin/tr does not.
+if test -f /usr/xpg4/bin/tr; then
+  TR=/usr/xpg4/bin/tr
+else
+  TR=tr
+fi
+
 # A small file.
-./test-pipe-filter-ii1${EXEEXT} "${srcdir}/test-pipe-filter-ii1.sh" || exit 1
+./test-pipe-filter-ii1${EXEEXT} ${TR} "${srcdir}/test-pipe-filter-ii1.sh" || 
exit 1
 # A medium-sized file.
-./test-pipe-filter-ii1${EXEEXT} "${srcdir}/test-pipe-filter-ii1.c" || exit 1
+./test-pipe-filter-ii1${EXEEXT} ${TR} "${srcdir}/test-pipe-filter-ii1.c" || 
exit 1
 # A large file.
-./test-pipe-filter-ii1${EXEEXT} "${srcdir}/test-vasnprintf-posix.c" || exit 1
+./test-pipe-filter-ii1${EXEEXT} ${TR} "${srcdir}/test-vasnprintf-posix.c" || 
exit 1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]