From 1222bfbc2cbf164f7ece4ff952c6798a1d5eb585 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Mon, 13 Jun 2011 12:21:52 +0200 Subject: [PATCH] tests: test mdate-sh with /bin/sh too * tests/mdate5.test: Fetch the `mdate-sh' script using the `get_shell_script' function, and run it directly instead of using `$SHELL'. * tests/mdate6.test: Likewise. Since we are at it, make checks on the `mdate-sh' output stricter, remove now unneeded calls to aclocal and automake and creation/extension of `configure.in', `Makefile.am' and `textutils.tex' files, and add a trailing `:' command. * tests/Makefile.am (config_shell_tests): Add `mdate5-w.shtst' and `mdate6-w.shtst'. --- ChangeLog | 14 ++++++++++++++ tests/Makefile.am | 2 ++ tests/Makefile.in | 2 ++ tests/mdate5.test | 33 ++++++++++++++++++--------------- tests/mdate6.test | 5 +++-- 5 files changed, 39 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9c88d7d..c202a6d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2011-06-13 Stefano Lattarini + + tests: test mdate-sh with /bin/sh too + * tests/mdate5.test: Fetch the `mdate-sh' script using the + `get_shell_script' function, and run it directly instead of + using `$SHELL'. + * tests/mdate6.test: Likewise. Since we are at it, make checks + on the `mdate-sh' output stricter, remove now unneeded calls to + aclocal and automake and creation/extension of `configure.in', + `Makefile.am' and `textutils.tex' files, and add a trailing `:' + command. + * tests/Makefile.am (config_shell_tests): Add `mdate5-w.shtst' + and `mdate6-w.shtst'. + 2011-06-07 Stefano Lattarini tests: `lib/' shell scripts transparently tested also with $SHELL diff --git a/tests/Makefile.am b/tests/Makefile.am index 91f1a9b..77c4570 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -110,6 +110,8 @@ config_shell_tests = \ instsh2-w.shtst \ instsh3-w.shtst \ mkinst3-w.shtst \ + mdate5-w.shtst \ + mdate6-w.shtst \ missing-w.shtst \ missing2-w.shtst \ missing3-w.shtst \ diff --git a/tests/Makefile.in b/tests/Makefile.in index eba4d1c..532765e 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -401,6 +401,8 @@ config_shell_tests = \ instsh2-w.shtst \ instsh3-w.shtst \ mkinst3-w.shtst \ + mdate5-w.shtst \ + mdate6-w.shtst \ missing-w.shtst \ missing2-w.shtst \ missing3-w.shtst \ diff --git a/tests/mdate5.test b/tests/mdate5.test index dc6ede1..f7c7cfe 100755 --- a/tests/mdate5.test +++ b/tests/mdate5.test @@ -18,25 +18,28 @@ # Test to make sure mdate-sh works correctly. . ./defs || Exit 1 -cat >> configure.in << 'END' -AC_OUTPUT -END -cat > Makefile.am << 'END' -info_TEXINFOS = textutils.texi -END +get_shell_script mdate-sh -cat > textutils.texi << 'END' -@include version.texi -@setfilename textutils.info -END - -$ACLOCAL -$AUTOMAKE --add-missing - -set x `$SHELL ./mdate-sh Makefile.am` +set x `./mdate-sh install-sh` shift +echo "$*" # For debugging. + # Check that mdate output looks like a date: test $# = 3 case $1$3 in *[!0-9]*) Exit 1;; esac test $1 -lt 32 +# Hopefully automake will be obsolete in 80 years ;-) +case $3 in 20[0-9][0-9]) :;; *) Exit 1;; esac +case $2 in + January|February|March|April|May|June|July|August) ;; + September|October|November|December) ;; + *) Exit 1 +esac + +# Stricter checks on the year required a POSIX date(1) command. +if year=`date +%Y` && test $year -gt 2010; then + test $year = $3 || Exit 1 +fi + +: diff --git a/tests/mdate6.test b/tests/mdate6.test index 94ddb4d..70360e7 100755 --- a/tests/mdate6.test +++ b/tests/mdate6.test @@ -23,8 +23,9 @@ file='file name $a' ( : > "$file" ) \ || skip_ "file name with spaces and metacharacters not accepted" -cp "$top_testsrcdir/lib/mdate-sh" . -$SHELL ./mdate-sh "$file" >stdout 2>stderr || +get_shell_script mdate-sh + +./mdate-sh "$file" >stdout 2>stderr || { cat stdout; cat stderr >&2; Exit 1; } cat stdout cat stderr >&2 -- 2.7.4