automake-patches
[Top][All Lists]
Advanced

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

New tests for `parallel-tests'. [3/4]


From: Ralf Wildenhues
Subject: New tests for `parallel-tests'. [3/4]
Date: Sun, 12 Oct 2008 22:36:13 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

    New tests for `parallel-tests'.
    
    * tests/parallel-tests.test: New file, to expose a bunch of
    features of `parallel-tests': VERBOSE, clean, TEST_SUITE_LOG,
    test dependencies, DISABLE_HARD_ERRORS, LAZY_TEST_SUITE.
    * tests/parallel-tests2.test: New file, test check-html.
    * tests/parallel-tests3.test: New file, test concurrency.
    * tests/parallel-tests4.test: New file, test suffix rules.
    * tests/parallel-tests5.test: New file, demonstrate compile/test
    concurrency.
    * tests/defs.in: Add a `required' check for rst2html.
    * tests/Makefile.am: Update.

diff --git a/tests/Makefile.am b/tests/Makefile.am
index b56e7e0..482eaa5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -466,6 +466,11 @@ output13.test \
 output-order.test \
 overrid.test \
 parallel-am.test \
+parallel-tests.test \
+parallel-tests2.test \
+parallel-tests3.test \
+parallel-tests4.test \
+parallel-tests5.test \
 parse.test \
 percent.test \
 percent2.test \
diff --git a/tests/defs.in b/tests/defs.in
index 1e91183..13b25e2 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -186,6 +186,16 @@ do
       rm -rf $ro_dir_temp
       test $create_status = 0 && exit 77
       ;;
+    rst2html)
+      # Try the variants that are tried in check.am.
+      while :; do
+       for r2h in $RST2HTML rst2html rst2html.py; do
+         echo "$me: running $r2h --version"
+         $r2h --version && break 2
+       done
+       exit 77
+      done
+      ;;
     runtest)
       # DejaGnu's runtest program. We rely on being able to specify
       # the program on the runtest command-line. This requires
diff --git a/tests/parallel-tests.test b/tests/parallel-tests.test
new file mode 100755
index 0000000..f7767af
--- /dev/null
+++ b/tests/parallel-tests.test
@@ -0,0 +1,112 @@
+#! /bin/sh
+# Copyright (C) 2008  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, 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/>.
+
+# Check parallel-tests features:
+# - VERBOSE
+# - clean
+# - TEST_SUITE_LOG
+# - dependencies between tests
+# - DISABLE_HARD_ERRORS
+# - LAZY_TEST_SUITE
+
+. ./defs-p || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_SUITE_LOG = mylog.log
+TESTS = foo.test bar.test baz.test
+foo.log: bar.log
+bar.log: baz.log
+END
+
+cat >>foo.test <<'END'
+#! /bin/sh
+echo "this is $0"
+exit 0
+END
+cat >>bar.test <<'END'
+#! /bin/sh
+echo "this is $0"
+exit 99
+END
+cat >>baz.test <<'END'
+#! /bin/sh
+echo "this is $0"
+exit 1
+END
+chmod a+x foo.test bar.test baz.test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+unset TESTS || :
+
+./configure
+# No hard errors: all tests should be run, there should be two failures.
+DISABLE_HARD_ERRORS=yes $MAKE -e check >stdout && { cat stdout; Exit 1; }
+cat stdout
+test `grep -c FAIL stdout` -eq 2
+test -f mylog.log
+test `grep -c FAIL mylog.log` -eq 2
+test -f baz.log
+test -f bar.log
+test -f foo.log
+
+# clean should remove all log files (but not more).
+: > unrelated.log
+$MAKE clean
+test ! -f baz.log
+test ! -f bar.log
+test ! -f foo.log
+test ! -f mylog.log
+test -f unrelated.log
+
+# Check dependencies: baz.test needs to run before bar.test.
+env DISABLE_HARD_ERRORS=yes TESTS='bar.test' $MAKE -e check && Exit 1
+test -f baz.log
+test -f bar.log
+test ! -f foo.log
+test -f mylog.log
+
+$MAKE clean
+$MAKE check && Exit 1
+test -f baz.log
+test -f bar.log
+# foo depends upon bar, but the latter issues a hard error, so foo
+# should not be run.
+test ! -f foo.log
+
+# However, upon a lazy rerun, it should be run, but the others shouldn't.
+# Note that the lazy rerun still exits with a failure, due to the previous
+# test failures.
+LAZY_TEST_SUITE=yes $MAKE -e check > stdout && { cat stdout; Exit 1; }
+cat stdout
+test -f foo.log
+grep foo.test stdout
+grep bar.test stdout && Exit 1
+grep baz.test stdout && Exit 1
+
+env VERBOSE=yes DISABLE_HARD_ERRORS=yes $MAKE -e check > stdout && { cat 
stdout; Exit 1; }
+cat stdout
+grep 'this is.*bar.test' stdout
+grep 'this is.*baz.test' stdout
+:
diff --git a/tests/parallel-tests2.test b/tests/parallel-tests2.test
new file mode 100755
index 0000000..fe23be4
--- /dev/null
+++ b/tests/parallel-tests2.test
@@ -0,0 +1,62 @@
+#! /bin/sh
+# Copyright (C) 2008  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, 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/>.
+
+# Check parallel-tests features:
+# - check-html
+
+required=rst2html
+. ./defs-p || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TEST_SUITE_LOG = mylog.log
+TESTS = foo.test bar.test baz.test
+END
+
+cat >>foo.test <<'END'
+#! /bin/sh
+echo "this is $0"
+exit 0
+END
+cat >>bar.test <<'END'
+#! /bin/sh
+echo "this is $0"
+exit 99
+END
+cat >>baz.test <<'END'
+#! /bin/sh
+echo "this is $0"
+exit 1
+END
+chmod a+x foo.test bar.test baz.test
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+unset TESTS || :
+
+./configure
+# No hard errors: all tests should be run, there should be two failures.
+DISABLE_HARD_ERRORS=yes $MAKE -e check-html >stdout && { cat stdout; Exit 1; }
+cat stdout
+test -f mylog.html
+:
diff --git a/tests/parallel-tests3.test b/tests/parallel-tests3.test
new file mode 100755
index 0000000..286dee8
--- /dev/null
+++ b/tests/parallel-tests3.test
@@ -0,0 +1,69 @@
+#! /bin/sh
+# Copyright (C) 2008  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, 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/>.
+
+# Check parallel-tests features:
+# - concurrent parallel execution
+
+required=GNUmake
+. ./defs-p || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS =
+END
+
+for i in 1 2 3 4 5 6 7 8; do
+  echo "TESTS += foo$i.test" >> Makefile.am
+  cat >foo$i.test <<'END'
+#! /bin/sh
+echo "this is $0"
+# hack around maintainer-check check:
+sleep='sleep '1
+$sleep
+exit 0
+END
+  chmod a+x foo$i.test
+done
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+unset TESTS || :
+
+for build in serial parallel; do
+  mkdir $build
+  cd $build
+  ../configure
+  $MAKE
+  cd ..
+done
+
+cd serial
+$MAKE -j1 check &
+cd ../parallel
+$sleep
+$MAKE -j4 check > stdout
+cd ..
+kill $!
+cat parallel/stdout
+test `grep -c PASS parallel/stdout` -eq 8
+:
diff --git a/tests/parallel-tests4.test b/tests/parallel-tests4.test
new file mode 100755
index 0000000..5550646
--- /dev/null
+++ b/tests/parallel-tests4.test
@@ -0,0 +1,70 @@
+#! /bin/sh
+# Copyright (C) 2008  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, 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/>.
+
+# Check parallel-tests features:
+# - suffix rules
+
+. ./defs-p || Exit 1
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+## Note that automake should not match the '/test' part
+## of 'sub/test' as '.test' suffix.
+TESTS = foo.chk bar.test $(check_PROGRAMS) sub/test
+check_PROGRAMS = baz bla.test bli.suff
+TEST_SUFFIXES = .chk .test
+END
+
+mkdir sub
+
+cat >foo.chk << 'END'
+#! /bin/sh
+exit 0
+END
+chmod a+x foo.chk
+cp foo.chk bar.test
+cp foo.chk sub/test
+
+cat >baz.c << 'END'
+int main (void)
+{
+  return 0;
+}
+END
+cp baz.c bla.c
+cp baz.c bli.c
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+unset TESTS || :
+
+./configure
+$MAKE
+$MAKE check
+test -f foo.log
+test -f bar.log
+test -f baz.log
+test -f bla.log
+test -f bli.suff.log
+test -f sub/test.log
+:
diff --git a/tests/parallel-tests5.test b/tests/parallel-tests5.test
new file mode 100755
index 0000000..b685677
--- /dev/null
+++ b/tests/parallel-tests5.test
@@ -0,0 +1,68 @@
+#! /bin/sh
+# Copyright (C) 2008  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, 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/>.
+
+# Check parallel-tests features:
+# - concurrent program compilation and testing (with EXTRA_PROGRAMS)
+#
+# Actually, this test doesn't ensure that things happen concurrently.
+# It merely serves as demonstration.  :-)
+
+required=GNUmake
+. ./defs-p || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+TESTS = $(programs) $(scripts)
+EXTRA_PROGRAMS = $(programs)
+CLEANFILES = $(EXTRA_PROGRAMS)
+dist_noinst_SCRIPTS = $(scripts)
+programs =
+scripts =
+END
+
+for i in 1 2 3 4 5 6 7 8; do
+  echo "scripts += foo$i.test" >> Makefile.am
+  echo "programs += foo$i.prog" >> Makefile.am
+  cat >foo$i.test <<'END'
+#! /bin/sh
+echo "this is $0"
+exit 0
+END
+  cat >foo$i.c <<'END'
+int main()
+{
+  return 0;
+}
+END
+  chmod a+x foo$i.test
+done
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+unset TESTS || :
+
+./configure
+$MAKE -j4 check
+$MAKE distcheck
+:




reply via email to

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