[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
hello-2.1.91: no skip test
From: |
Bruno Haible |
Subject: |
hello-2.1.91: no skip test |
Date: |
Tue, 22 Aug 2006 14:41:24 +0200 |
User-agent: |
KMail/1.9.1 |
Hi,
I think GNU hello should also show how to deal with skipped tests.
1) to learn about the magic code 77,
2) to print a reason why the test is skipped. (I did this wrong in GNU
gettext for years. When I added such an explanation message to all
skipped tests, I discovered a few bugs.)
Here is a test that
- is skipped most of the time,
- still does something useful,
- does not require new features to be added to the hello program.
The new test file should be subject to "chmod a+x" before "cvs commit".
tests/ChangeLog:
2006-08-21 Bruno Haible <address@hidden>
* greeting-2: New file.
* Makefile.am (TESTS): Add it.
*** tests/Makefile.am.bak Sun Aug 13 17:00:40 2006
--- tests/Makefile.am Tue Aug 22 02:57:07 2006
***************
*** 17,23 ****
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
! TESTS = greeting-1 hello-1 traditional-1
EXTRA_DIST = $(TESTS)
--- 17,23 ----
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
! TESTS = greeting-1 greeting-2 hello-1 traditional-1
EXTRA_DIST = $(TESTS)
*** /dev/null Tue Aug 22 04:09:25 2006
--- tests/greeting-2 Tue Aug 22 04:08:05 2006
***************
*** 0 ****
--- 1,41 ----
+ #! /bin/sh
+ # Test very long --greeting argument.
+ #
+ # Copyright (C) 2001, 2006 Free Software Foundation, Inc.
+ #
+ # Copying and distribution of this file, with or without modification,
+ # are permitted in any medium without royalty provided the copyright
+ # notice and this notice are preserved.
+
+ trap 'rm -fr $tmpfiles' 1 2 3 15
+
+ tmpfiles="greeting-test2.ok"
+ cat <<EOF > greeting-test2.ok
+
Wuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuhhh!
+ EOF
+
+ # Werewolves cry at full moon only.
+ set - `TZ=GMT date +"%Y %j %H %M %S"`
+ year=$1; day=$2; hours=$3; minutes=$4; seconds=$5
+ years_since_2000=`expr $year - 2000`
+ days_since_2000=`expr '(' $years_since_2000 '*' 365 ')' + '(' '('
$years_since_2000 - 1 ')' / 4 ')' + $day`
+ seconds_since_2000=`expr '(' '(' '(' '(' '(' $days_since_2000 '*' 24 ')' +
$hours ')' '*' 60 ')' + $minutes ')' '*' 60 ')' + $seconds`
+ # A moon period is ca. 2551442.8 seconds.
+ remainder=`expr $seconds_since_2000 % 2551443`
+ # Full moon is around remainder = 1760000, oscillating between ca. 1720000
+ # and ca. 1805000. Allow a tolerance of +/- 24 h.
+ if test `expr $remainder '>' 1650000` = 0 || test `expr $remainder '<'
1890000` = 0; then
+ { echo "Skipping test: not a full moon night"; rm -fr $tmpfiles; exit 77; }
+ fi
+
+ tmpfiles="$tmpfiles greeting-test2.out"
+ : ${HELLO=hello}
+ ${HELLO} -g
'Wuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuhhh!'
> greeting-test2.out
+
+ : ${DIFF=diff}
+ ${DIFF} greeting-test2.ok greeting-test2.out
+ result=$?
+
+ rm -fr $tmpfiles
+
+ exit $result
- Re: hello-2.1.91 and CR/LF, (continued)
- Re: hello-2.1.91 and CR/LF, Karl Berry, 2006/08/28
- Re: hello-2.1.91 and CR/LF, Ralf Wildenhues, 2006/08/29
- Re: hello-2.1.91 and CR/LF, Karl Berry, 2006/08/29
- Re: hello-2.1.91 build failure on MacOS X, Bruno Haible, 2006/08/24
- Re: hello-2.1.91 build failure on MacOS X, Karl Berry, 2006/08/24
hello-2.1.91 testsuite failure, Bruno Haible, 2006/08/22
hello-2.1.91: tweak tests, Bruno Haible, 2006/08/22
hello-2.1.91: no skip test,
Bruno Haible <=