pspp-dev
[Top][All Lists]
Advanced

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

windows "make check" fix, for testing


From: Ben Pfaff
Subject: windows "make check" fix, for testing
Date: Thu, 26 May 2011 10:14:10 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Here's a patch that may help make "make check" to be more useful
on Windows.  I've already provided this to Harry Thijssen, but he
has not reported results yet.

--8<--------------------------cut here-------------------------->8--

From: Ben Pfaff <address@hidden>
Date: Wed, 25 May 2011 22:39:16 -0700
Subject: [PATCH] tests: Use shell aliases to transparently invoke .exe files.

---
 tests/automake.mk |    1 +
 tests/exeext.at   |   86 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 87 insertions(+), 0 deletions(-)
 create mode 100644 tests/exeext.at

diff --git a/tests/automake.mk b/tests/automake.mk
index d02c59f..3aa97c3 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -248,6 +248,7 @@ EXTRA_DIST += \
        $(TESTSUITE)
 
 TESTSUITE_AT = \
+       tests/exeext.at \
        tests/data/calendar.at \
        tests/data/data-in.at \
        tests/data/data-out.at \
diff --git a/tests/exeext.at b/tests/exeext.at
new file mode 100644
index 0000000..e980148
--- /dev/null
+++ b/tests/exeext.at
@@ -0,0 +1,86 @@
+# For each <name>.exe file in $AUTOTEST_PATH, this code creates a
+# shell alias <name>.
+#
+# This is from tests/init.sh in Gnulib, originally with the following
+# license statement:
+
+# Copyright (C) 2009-2011 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/>.
+
+m4_divert_push([PREPARE_TESTS])
+[
+# Given a directory name, DIR, if every entry in it that matches *.exe
+# contains only the specified bytes (see the case stmt below), then print
+# a space-separated list of those names and return 0.  Otherwise, don't
+# print anything and return 1.  Naming constraints apply also to DIR.
+find_exe_basenames_ ()
+{
+  feb_dir_=$1
+  feb_fail_=0
+  feb_result_=
+  feb_sp_=
+  for feb_file_ in $feb_dir_/*.exe; do
+    # If there was no *.exe file, or there existed a file named "*.exe" that
+    # was deleted between the above glob expansion and the existence test
+    # below, just skip it.
+    test "x$feb_file_" = "x$feb_dir_/*.exe" && test ! -f "$feb_file_" \
+      && continue
+    case $feb_file_ in
+      *[!-a-zA-Z/0-9_.+]*) feb_fail_=1; break;;
+      *) # Remove leading file name components as well as the .exe suffix.
+         feb_file_=${feb_file_##*/}
+         feb_file_=${feb_file_%.exe}
+         feb_result_="$feb_result_$feb_sp_$feb_file_";;
+    esac
+    feb_sp_=' '
+  done
+  test $feb_fail_ = 0 && printf %s "$feb_result_"
+  return $feb_fail_
+}
+
+# Consider the files in directory, $1.
+# For each file name of the form PROG.exe, create an alias named
+# PROG that simply invokes PROG.exe, then return 0.  If any selected
+# file name or the directory name, $1, contains an unexpected character,
+# define no alias and return 1.
+create_exe_shims_ ()
+{
+  case $EXEEXT in
+    '') return 0 ;;
+    .exe) ;;
+    *) echo "$0: unexpected \$EXEEXT value: $EXEEXT" 1>&2; return 1 ;;
+  esac
+
+  base_names_=`find_exe_basenames_ $1` \
+    || { echo "$0 (exe_shim): skipping directory: $1" 1>&2; return 0; }
+
+  if test -n "$base_names_"; then
+    for base_ in $base_names_; do
+      alias "$base_"="$base_$EXEEXT"
+    done
+  fi
+
+  return 0
+}
+
+save_IFS=$IFS; IFS=:
+for dir in $AUTOTEST_PATH
+do
+    IFS=$save_IFS
+    create_exe_shims_ "$abs_top_builddir/$dir"
+done
+IFS=$save_IFS
+]
+m4_divert_pop([PREPARE_TESTS])
-- 
1.7.2.5


-- 
Ben Pfaff 
http://benpfaff.org



reply via email to

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