automake-patches
[Top][All Lists]
Advanced

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

[FYI] {GSoC} testsuite: one more use of TAP in our own tests


From: Stefano Lattarini
Subject: [FYI] {GSoC} testsuite: one more use of TAP in our own tests
Date: Wed, 3 Aug 2011 14:35:15 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

* tests/tap-bad-prog.test, tests/tap-bad-prog2.test: Merged
into ...
* tests/tap-bad-prog.tap: ... this TAP-generating test.
* tests/Makefile.am (tap_other_tests): Remove plan-bad-prog.test
and plan-bad-prog2.test.
(XFAIL_TESTS): Remove plan-bad-prog2.test.
(plan-bad-prog2.log): Remove.
---
 ChangeLog                                     |   11 ++++++
 tests/Makefile.am                             |    6 +---
 tests/Makefile.in                             |   11 ++----
 tests/{tap-bad-prog.test => tap-bad-prog.tap} |   42 +++++++++++++++++-------
 tests/tap-bad-prog2.test                      |   30 -----------------
 5 files changed, 46 insertions(+), 54 deletions(-)
 rename tests/{tap-bad-prog.test => tap-bad-prog.tap} (58%)
 delete mode 100755 tests/tap-bad-prog2.test

diff --git a/ChangeLog b/ChangeLog
index b9d97c6..0abd470 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2011-08-03  Stefano Lattarini  <address@hidden>
 
+       testsuite: one more use of TAP in our own tests
+       * tests/tap-bad-prog.test, tests/tap-bad-prog2.test: Merged
+       into ...
+       * tests/tap-bad-prog.tap: ... this TAP-generating test.
+       * tests/Makefile.am (tap_other_tests): Remove plan-bad-prog.test
+       and plan-bad-prog2.test.
+       (XFAIL_TESTS): Remove plan-bad-prog2.test.
+       (plan-bad-prog2.log): Remove.
+
+2011-08-03  Stefano Lattarini  <address@hidden>
+
        testsuite: scaffolding to allow use of TAP in our own tests
        Now that Automake has initial support for the TAP test protocol,
        we can start "eating our own dog food" and rewrite some tests to
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3e9267b..43ada56 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -31,7 +31,6 @@ gcj6.test \
 override-conditional-2.test \
 pr8365-remake-timing.test \
 yacc-dist-nobuild-subdir.test \
-tap-bad-prog2.test \
 tap-plan-corner2.test \
 tap-message-0.test \
 tap-signal.test \
@@ -1185,8 +1184,7 @@ EXTRA_DIST += tap-setup.sh
 # Other tests on TAP support.
 tap_other_tests = \
 tap-common-setup.test \
-tap-bad-prog.test \
-tap-bad-prog2.test \
+tap-bad-prog.tap \
 tap-basic.test \
 tap-doc.test \
 tap-doc2.test \
@@ -1197,8 +1195,6 @@ tap-recheck.test \
 tap-summary.test \
 tap-summary-color.test
 
-tap-bad-prog2.log: tap-bad-prog.log
-
 tap-summary.log tap-summary-color.log: tap-summary-aux.sh
 EXTRA_DIST += tap-summary-aux.sh
 
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 8f7809d..9052c93 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -285,9 +285,9 @@ EXTRA_DIST = ChangeLog-old gen-parallel-tests 
instspc-tests.sh \
        extract-testsuite-summary tap-setup.sh tap-summary-aux.sh
 XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test \
        override-conditional-2.test pr8365-remake-timing.test \
-       yacc-dist-nobuild-subdir.test tap-bad-prog2.test \
-       tap-plan-corner2.test tap-message-0.test tap-signal.test \
-       txinfo5.test $(instspc_xfail_tests)
+       yacc-dist-nobuild-subdir.test tap-plan-corner2.test \
+       tap-message-0.test tap-signal.test txinfo5.test \
+       $(instspc_xfail_tests)
 parallel_tests = backcompat5-p.test check-exported-srcdir-p.test \
        check-fd-redirect-p.test check-tests-in-builddir-p.test \
        check-p.test check11-p.test check12-p.test check2-p.test \
@@ -1417,8 +1417,7 @@ tap_with_common_setup_logs = 
$(tap_with_common_setup_tests:.test=.log)
 # Other tests on TAP support.
 tap_other_tests = \
 tap-common-setup.test \
-tap-bad-prog.test \
-tap-bad-prog2.test \
+tap-bad-prog.tap \
 tap-basic.test \
 tap-doc.test \
 tap-doc2.test \
@@ -1893,8 +1892,6 @@ testsuite-summary-count-many.log: 
extract-testsuite-summary
 # Their dependencies.
 $(tap_with_common_setup_logs): tap-common-setup.log tap-setup.sh
 
-tap-bad-prog2.log: tap-bad-prog.log
-
 tap-summary.log tap-summary-color.log: tap-summary-aux.sh
 
 # Dependencies valid for each test case.
diff --git a/tests/tap-bad-prog.test b/tests/tap-bad-prog.tap
similarity index 58%
rename from tests/tap-bad-prog.test
rename to tests/tap-bad-prog.tap
index 4c070ce..2dee975 100755
--- a/tests/tap-bad-prog.test
+++ b/tests/tap-bad-prog.tap
@@ -18,9 +18,6 @@
 #  - missing, unreadable, or not-executable test scripts cause proper
 #    error reports
 
-# The files created by this test will be required also by the sister
-# test `tap-bad-prog2.test', so we can't remove the test directory.
-keep_testdirs=yes
 parallel_tests=yes
 . ./defs || Exit 1
 
@@ -44,25 +41,46 @@ echo 1..1
 ok 1
 END
 
-./noexec.test && skip_ "can't have non-executable files"
-
 cp noexec.test noread.test
 chmod a-r noread.test
 
-test -r noread.test && skip_ "you can still read unreadable files"
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
 ./configure
 
-$MAKE check >stdout && { cat stdout; Exit 1; }
+if $MAKE check >stdout; then r='not ok'; else r='ok'; fi
 cat stdout
+result_ "$r" '"make check" returns non-zero exit status'
+
+# FIXME: maybe grep for stricter error messages in the next checks?
+
+command_ok_ "non-existent test is reported" \
+            grep '^ERROR: none\.test' stdout
+
+desc="non-executable test is reported"
+if ./noexec.test; then
+  skip_ -r "any file is executable" "$desc"
+else
+  command_ok_ "$desc" -- grep '^ERROR: noexec\.test' stdout
+fi
+
+desc="non-readable test is reported"
+if test -r noread.test; then
+  skip_ -r "any file is readable" "$desc"
+else
+  command_ok_ "$desc" -- grep '^ERROR: noread\.test' stdout
+fi
 
-# FIXME: maybe better error messages?
-grep '^ERROR: none\.test' stdout
-grep '^ERROR: noexec\.test' stdout
-grep '^ERROR: noread\.test' stdout
+# Check that no spurious test results is reported.  This is lower-priority
+# (and in fact the check currently fails.
+if count_test_results total=3 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=3
+then
+  r='ok'
+else
+  r='not ok'
+fi
+result_ "$r" 'no spurious results # TODO still get "missing plan"'
 
 :
diff --git a/tests/tap-bad-prog2.test b/tests/tap-bad-prog2.test
deleted file mode 100755
index 5d4a47e..0000000
--- a/tests/tap-bad-prog2.test
+++ /dev/null
@@ -1,30 +0,0 @@
-#! /bin/sh
-# Copyright (C) 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 2, 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/>.
-
-# TAP support:
-#  - missing, unreadable, or not-executable test scripts cause the
-#    proper amount of "ERROR" results
-
-. ./defs || Exit 1
-
-# For this test, we completely rely on the data obtained by sister test
-# `tap-bad-prog.test'.
-cp ../tap-bad-prog.dir/stdout . \
-  || fatal_ "can't get data from sister test 'test-bad-prog'"
-cat stdout
-count_test_results total=3 pass=0 fail=0 xpass=0 xfail=0 skip=0 error=3
-
-:
-- 
1.7.2.3




reply via email to

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