[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] tests: Use shell aliases to transparently invoke .exe files.
From: |
Ben Pfaff |
Subject: |
[PATCH] tests: Use shell aliases to transparently invoke .exe files. |
Date: |
Tue, 9 Aug 2011 19:51:29 -0700 |
---
INSTALL | 10 ++++++
tests/automake.mk | 1 +
tests/exeext.at | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 97 insertions(+), 0 deletions(-)
create mode 100644 tests/exeext.at
diff --git a/INSTALL b/INSTALL
index 1d63d4b..7f3b5e8 100644
--- a/INSTALL
+++ b/INSTALL
@@ -159,6 +159,16 @@ release.
address@hidden with the details, to give the PSPP
developers an opportunity to fix the problem in the next release.
+ Ordinarily `make check' cannot work when cross-compiling. It can
+ work, however, if the system on which you do the build can run
+ the binaries. This is commonly true when a GNU/Linux machine
+ building Windows binaries has Wine installed, so that it can run
+ .exe files. In this situation, if the system is configured to
+ automatically run Windows .exe files using Wine, `make check'
+ should work transparently. If the system needs .exe files to be
+ invoked explicitly through the `wine' binary, run `make check
+ RUNEXE=wine' instead.
+
4. Type `make install' to install the programs and any data files
and documentation. Ordinarily you will need root permissions to
do this. The "su" and "sudo" commands are common ways to obtain
diff --git a/tests/automake.mk b/tests/automake.mk
index 1614f05..64a6aba 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -222,6 +222,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..0ae5e1b
--- /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_"="$RUNEXE $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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] tests: Use shell aliases to transparently invoke .exe files.,
Ben Pfaff <=