On Sun, Jul 31, 2016 at 8:38 PM, Assaf Gordon <assafgor...@gmail.com> wrote:
> Hello,
>
>> On Jul 31, 2016, at 21:15, Jim Meyering <j...@meyering.net> wrote:
>>
>> Here's a new snapshot:
>> [...]
>> http://meyering.net/diff/diffutils-3.3.52-e974.tar.xz
>>
>> Changes in diffutils since 3.3.50-0353:
>>
>> Jim Meyering (2):
>>      tests: colors: fix a portability problem and work around a shell bug
>>      maint: remove gl/lib/reg*.c.diff; no longer needed
>
> With this update, no more failures on the tested gnu/linux system, but few 
> failures on others (BSDs, Mac OS X, AIX, OpenSolaris).
>
> For BSD/Mac OS X/AIX, it seems the 'color' test uses 'touch --date' which is 
> a gnu extension and is not available.
> Perhaps that leads to other failures.
>
> For OpenSolaris 5.10 (both i86pc and sparc) 'make check' does not complete 
> (perhaps an old shell syntax issue).
>
> For GNU Hurd 0.7, the test 'brief-vs-stat-zero-kernel-lies' fails.

Great! Thanks again for all of that quick feedback.
So far I've only looked at the solaris 5.10 build failure, and wrote
the attached that I hope will fix it. It upgrades to the
infrastructure (forgot I hadn't yet done it for diffutils) that is
used already to good effect in at least grep, sed, coreutils. Would
you please let me know if this fixes it?
From 4575d0926fbaac87a910527852d9fa80f5ead962 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyer...@fb.com>
Date: Sun, 31 Jul 2016 21:29:21 -0700
Subject: [PATCH] test: improve test infrastructure

* tests/envvar-check: New file, copied from grep, with the addition
of the EDITOR envvar name.
* tests/Makefile.am (EXTRA_DIST): Add it.
(TESTS_ENVIRONMENT): Revamp, to be more like that of grep.
---
 tests/Makefile.am  | 71 ++++++++++++++++++++++++++++++++++++------------------
 tests/envvar-check | 64 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 112 insertions(+), 23 deletions(-)
 create mode 100644 tests/envvar-check

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5457d3a..e8a36ac 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -20,34 +20,59 @@ TESTS = \
   colors

 EXTRA_DIST = \
-  $(TESTS) init.sh t-local.sh
+  $(TESTS) init.sh t-local.sh envvar-check

 # Note that the first lines are statements.  They ensure that environment
 # variables that can perturb tests are unset or set to expected values.
 # The rest are envvar settings that propagate build-related Makefile
 # variables to test scripts.
-TESTS_ENVIRONMENT =                                                    \
-  tmp__=$$TMPDIR; test -d "$$tmp__" || tmp__=.;                                
\
-  TMPDIR=$$tmp__; export TMPDIR;                                       \
-  VERSION='$(VERSION)'; export VERSION;                                        
\
-  abs_top_builddir='$(abs_top_builddir)'; export abs_top_builddir;     \
-  abs_top_srcdir='$(abs_top_srcdir)'; export abs_top_srcdir;           \
-  abs_srcdir='$(abs_srcdir)'; export abs_srcdir;                       \
-  built_programs="`$(built_programs)`"                                 \
-  srcdir='$(srcdir)'; export built_programs;                           \
-  top_srcdir='$(top_srcdir)'; export top_srcdir;                       \
-  CC='$(CC)'; export CC;                                               \
-  MAKE=$(MAKE); export MAKE;                                           \
-  PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)'; export PACKAGE_BUGREPORT;  \
-  PACKAGE_VERSION=$(PACKAGE_VERSION); export PACKAGE_VERSION;          \
-  CONFIG_HEADER='$(abs_top_builddir)/lib/config.h'; export CONFIG_HEADER; \
-  ENABLE_DEVICE_MAPPER=$(ENABLE_DEVICE_MAPPER); export ENABLE_DEVICE_MAPPER; \
-  PERL='$(PERL)'; export PERL;                                         \
-  PREFERABLY_POSIX_SHELL='$(PREFERABLY_POSIX_SHELL)';                  \
-    export PREFERABLY_POSIX_SHELL;                                     \
-  REPLACE_GETCWD=$(REPLACE_GETCWD); export REPLACE_GETCWD;             \
-  PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH"; export PATH \
-  stderr_fileno_=9; export stderr_fileno                               \
+TESTS_ENVIRONMENT =                                    \
+  tmp__=$${TMPDIR-/tmp};                               \
+  test -d "$$tmp__" && test -w "$$tmp__" || tmp__=.;   \
+  . $(srcdir)/envvar-check;                            \
+  TMPDIR=$$tmp__; export TMPDIR;                       \
+                                                       \
+  if test -n "$$BASH_VERSION" || (eval "export v=x") 2>/dev/null; then \
+    export_with_values () { export "$$@"; };           \
+  else                                                 \
+    export_with_values ()                              \
+    {                                                  \
+      sed_extract_var='s/=.*//';                       \
+      sed_quote_value="s/'/'\\\\''/g;s/=\\(.*\\)/='\\1'/";\
+      for arg in "$$@"; do                             \
+        var=`echo "$$arg" | sed "$$sed_extract_var"`;  \
+        arg=`echo "$$arg" | sed "$$sed_quote_value"`;  \
+        eval "$$arg";                                  \
+        export "$$var";                                        \
+      done;                                            \
+    };                                                 \
+  fi;                                                  \
+                                                       \
+  export_with_values                                   \
+  VERSION='$(VERSION)'                                 \
+  LOCALE_FR='$(LOCALE_FR)'                             \
+  LOCALE_FR_UTF8='$(LOCALE_FR_UTF8)'                   \
+  AWK=$(AWK)                                           \
+  GREP_OPTIONS=''                                      \
+  LC_ALL=C                                             \
+  abs_top_builddir='$(abs_top_builddir)'               \
+  abs_top_srcdir='$(abs_top_srcdir)'                   \
+  abs_srcdir='$(abs_srcdir)'                           \
+  built_programs="`$(built_programs)`"                 \
+  srcdir='$(srcdir)'                                   \
+  top_srcdir='$(top_srcdir)'                           \
+  CC='$(CC)'                                           \
+  DIFFUTILS_TEST_NAME=`echo $$tst|sed 's,^\./,,;s,/,-,g'` \
+  MAKE=$(MAKE)                                         \
+  MALLOC_PERTURB_=$(MALLOC_PERTURB_)                   \
+  PACKAGE_BUGREPORT='$(PACKAGE_BUGREPORT)'             \
+  PACKAGE_VERSION=$(PACKAGE_VERSION)                   \
+  PERL='$(PERL)'                                       \
+  SHELL='$(SHELL)'                                     \
+  PREFERABLY_POSIX_SHELL='$(PREFERABLY_POSIX_SHELL)'   \
+  REPLACE_GETCWD=$(REPLACE_GETCWD)                     \
+  PATH='$(abs_top_builddir)/src$(PATH_SEPARATOR)'"$$PATH"      \
+  stderr_fileno_=9                                     \
   ; 9>&2

 LOG_COMPILER= $(SHELL)
diff --git a/tests/envvar-check b/tests/envvar-check
new file mode 100644
index 0000000..9787cdf
--- /dev/null
+++ b/tests/envvar-check
@@ -0,0 +1,64 @@
+# -*- sh -*-
+# Check environment variables for sane values while testing.
+
+# Copyright (C) 2000-2016 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+envvar_check_fail=0
+vars='
+  _POSIX2_VERSION
+  _STDBUF_E
+  _STDBUF_I
+  _STDBUF_O
+  BASH_ENV
+  BLOCKSIZE
+  BLOCK_SIZE
+  CDPATH
+  COLUMNS
+  DF_BLOCK_SIZE
+  DU_BLOCK_SIZE
+  EDITOR
+  ENV
+  LANGUAGE
+  LS_BLOCK_SIZE
+  LS_COLORS
+  OMP_NUM_THREADS
+  POSIXLY_CORRECT
+  QUOTING_STYLE
+  SIMPLE_BACKUP_SUFFIX
+  TABSIZE
+  TERM
+  COLORTERM
+  TIME_STYLE
+  TMPDIR
+  VERSION_CONTROL
+'
+for var in $vars
+do
+  $as_unset $var
+  if eval test \"\${$var+set}\" = set; then
+    echo "$0: the $var environment variable is set --" \
+      ' unset it and rerun this test' >&2
+    envvar_check_fail=1
+  fi
+done
+
+test "$envvar_check_fail" = 1 && exit 1
-- 
2.8.0-rc2

Reply via email to