[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-gettext] [PATCH] Add a test wrapper to avoid temp file name collisi
From: |
Daiki Ueno |
Subject: |
[bug-gettext] [PATCH] Add a test wrapper to avoid temp file name collision. |
Date: |
Tue, 28 May 2013 19:21:46 +0900 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Daiki Ueno <address@hidden> writes:
> Hmm, that's unfortunate indeed. Okay, let's remove the filename
> conflicts either by adding a test script wrapper or sanitizing all the
> tests.
Here is a patch in the former approach (might be a bit hacky).
Regards,
--
Daiki Ueno
>From b91aafd6b9bc8d1b9d637a346a3ce31e6fad8cae Mon Sep 17 00:00:00 2001
From: Daiki Ueno <address@hidden>
Date: Tue, 28 May 2013 19:09:05 +0900
Subject: [PATCH] Add a test wrapper to avoid temp file name collision.
---
gettext-tools/configure.ac | 1 +
gettext-tools/tests/Makefile.am | 6 ++++--
gettext-tools/tests/runtest.in | 29 +++++++++++++++++++++++++++++
3 files changed, 34 insertions(+), 2 deletions(-)
create mode 100644 gettext-tools/tests/runtest.in
diff --git a/gettext-tools/configure.ac b/gettext-tools/configure.ac
index 373d3cc..ab12412 100644
--- a/gettext-tools/configure.ac
+++ b/gettext-tools/configure.ac
@@ -548,6 +548,7 @@ AC_CONFIG_FILES([man/x-to-1])
AC_CONFIG_FILES([m4/Makefile])
AC_CONFIG_FILES([tests/Makefile])
+AC_CONFIG_FILES([tests/runtest], [chmod a+x tests/runtest])
AC_CONFIG_FILES([gnulib-tests/Makefile])
diff --git a/gettext-tools/tests/Makefile.am b/gettext-tools/tests/Makefile.am
index f2c4848..0e4a03d 100644
--- a/gettext-tools/tests/Makefile.am
+++ b/gettext-tools/tests/Makefile.am
@@ -19,6 +19,7 @@
AUTOMAKE_OPTIONS = 1.11 gnits no-dependencies color-tests
EXTRA_DIST =
MOSTLYCLEANFILES = core *.stackdump
+DISTCLEANFILES = runtest
TESTS = gettext-1 gettext-2 gettext-3 gettext-4 gettext-5 gettext-6 gettext-7 \
gettext-8 \
@@ -147,7 +148,8 @@ EXTRA_DIST += $(TESTS) \
ChangeLog.0 \
gettext-3-1.po gettext-3-2.po gettext-4.po gettext-5.po \
gettext-6-1.po gettext-6-2.po gettext-7.po \
- gettextpo-1.de.po
+ gettextpo-1.de.po \
+ runtest.in
XGETTEXT = ../src/xgettext
@@ -196,7 +198,7 @@ TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) \
LOCALE_JA='@LOCALE_JA@' \
host_os='@host_os@' \
CONFIG_SHELL='$(SHELL)' \
- $(SHELL)
+ $(SHELL) runtest
# Update the expected test results.
update-expected: xg-c-1.ok.po
diff --git a/gettext-tools/tests/runtest.in b/gettext-tools/tests/runtest.in
new file mode 100644
index 0000000..bd8c44b
--- /dev/null
+++ b/gettext-tools/tests/runtest.in
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+tmpfiles=
+trap 'rm -fr $tmpfiles' 1 2 3 15
+
+# Override top_srcdir and srcdir with the absolute paths, as we run
+# the test in a different directory than builddir.
address@hidden@
address@hidden@
+
+tst=$1; shift
+
+case "$tst" in
+ */*)
+ tst=`expr "$tst" : '.*/\(.*\)'`
+ ;;
+esac
+
+tmpfiles="$tmpfiles tmp-$tst"
+
+mkdir "tmp-$tst"
+
+# Some tests depend on the fact that the name of builddir is "tests".
+# For example, msgfmt-1 does: TEXTDOMAINDIR=.. LANGUAGE=tests ${GETTEXT}
+mkdir "tmp-$tst/tests"
+
+(cd "tmp-$tst/tests" && "$srcdir/$tst" ${1+"$@"})
+
+rm -fr $tmpfiles
--
1.8.2.1
- Re: [bug-gettext] [PATCH] build: enable parallel tests harness from Automake, Daiki Ueno, 2013/05/27
- Re: [bug-gettext] [PATCH] build: enable parallel tests harness from Automake, Stefano Lattarini, 2013/05/28
- Re: [bug-gettext] [PATCH] build: enable parallel tests harness from Automake, Daiki Ueno, 2013/05/28
- [bug-gettext] [PATCH] Add a test wrapper to avoid temp file name collision.,
Daiki Ueno <=
- Re: [bug-gettext] [PATCH] Add a test wrapper to avoid temp file name collision., Stefano Lattarini, 2013/05/28
- Re: [bug-gettext] [PATCH] Add a test wrapper to avoid temp file name collision., Daiki Ueno, 2013/05/28
- Re: [bug-gettext] [PATCH] Add a test wrapper to avoid temp file name collision., Daiki Ueno, 2013/05/30
- Re: [bug-gettext] [PATCH] Add a test wrapper to avoid temp file name collision., Stefano Lattarini, 2013/05/30
- Re: [bug-gettext] [PATCH] Add a test wrapper to avoid temp file name collision., Daiki Ueno, 2013/05/30
- Re: [bug-gettext] [PATCH] Add a test wrapper to avoid temp file name collision., Stefano Lattarini, 2013/05/31