]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
Convert tests/misc/ to use test-lib.sh, too.
authorJim Meyering <jim@meyering.net>
Sat, 8 Sep 2007 10:26:55 +0000 (12:26 +0200)
committerJim Meyering <jim@meyering.net>
Sat, 15 Sep 2007 06:40:38 +0000 (08:40 +0200)
38 files changed:
tests/misc/arch
tests/misc/cat-proc
tests/misc/chcon
tests/misc/chcon-fail
tests/misc/close-stdout
tests/misc/csplit
tests/misc/date-sec
tests/misc/df
tests/misc/df-P
tests/misc/false-status
tests/misc/fmt-long-line
tests/misc/groups-version
tests/misc/head-c
tests/misc/head-pos
tests/misc/ls-time
tests/misc/mknod
tests/misc/nice
tests/misc/nl
tests/misc/nohup
tests/misc/pathchk1
tests/misc/pr
tests/misc/printf
tests/misc/printf-hex
tests/misc/pwd-long
tests/misc/pwd-unreadable-parent
tests/misc/runcon-no-reorder
tests/misc/selinux
tests/misc/shuf
tests/misc/sort-compress
tests/misc/sort-rand
tests/misc/split-a
tests/misc/split-fail
tests/misc/split-l
tests/misc/stat-fmt
tests/misc/tac-continue
tests/misc/wc-files0
tests/misc/wc-files0-from
tests/misc/xstrtol

index 7ad48521aae4b475010ea435004c95dfb3598ca1..942fa933dd7f7212f8cde2d1bf76cdd751a709f7 100755 (executable)
@@ -27,26 +27,14 @@ if test "$VERBOSE" = yes; then
   arch --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
+
 
 fail=0
 
 arch > out || fail=1
 uname -m > exp || fail=1
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 975188b9e9f2c4c9f0aa00f64f97c58141be369c..84265e18e84b01d74dfccee5bea6884482e79fe2 100755 (executable)
@@ -22,19 +22,8 @@ if test "$VERBOSE" = yes; then
   cat --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
+
 
 f=/proc/cpuinfo
 test -f $f \
@@ -52,7 +41,6 @@ fail=0
 cat -E $f | sed 's/[0-9][0-9]*/D/g' | tr -d '$' > out || fail=1
 cat    $f | sed 's/[0-9][0-9]*/D/g' | tr -d '$' > exp || fail=1
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 88c009bafdbccf501a25cc5bbf25c0e273feb8a9..46aaf87e31b3d6c36919d65d4a8d34161db4ac3c 100755 (executable)
@@ -8,22 +8,9 @@ fi
 
 . $srcdir/../lang-default
 PRIV_CHECK_ARG=require-root . $srcdir/../priv-check
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-mkdir -p d/sub/s2 || framework_failure=1
-touch f g d/sub/1 d/sub/2 || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
+mkdir -p d/sub/s2 || framework_failure
+touch f g d/sub/1 d/sub/2 || framework_failure
 
 fail=0
 
@@ -67,7 +54,6 @@ f|-robject_r|root:object_r:file_t:SystemLow-SystemHigh
 f|-ttmp_t|root:object_r:tmp_t:SystemLow-SystemHigh
 EOF
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index d639e86b563aa403fbdcf07565c2accb6c679b3d..865b1b996032ae6d9198578a6fba22df89e5b79d 100755 (executable)
@@ -8,20 +8,7 @@ if test "$VERBOSE" = yes; then
 fi
 
 . $srcdir/../lang-default
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
 
 fail=0
 
index 0f8c2eaabdd9fc204608210639e27ef6be5ea5d4..301c8ecb51f37613f19aff445711d0124506932e 100755 (executable)
@@ -2,7 +2,7 @@
 # Ensure that several programs work fine, even with stdout initially closed.
 # This is effectively a test of closeout.c's close_stdout function.
 
-# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2006, 2007 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
@@ -22,22 +22,9 @@ if test "$VERBOSE" = yes; then
   rm --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
+. $srcdir/../test-lib.sh
 
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
-
-PATH="$pwd/../..:$PATH"
-export PATH
+p="$abs_top_builddir"
 
 fail=0
 
@@ -54,21 +41,21 @@ mv d e >&- || fail=1
 rmdir e >&- || fail=1
 touch e >&- || fail=1
 sleep 0 >&- || fail=1
-"$pwd/../../src/true" >&- || fail=1
-"$pwd/../../src/printf" '' >&- || fail=1
+"$p/src/true" >&- || fail=1
+"$p/src/printf" '' >&- || fail=1
 
 # If >&- works, ensure these fail, because stdout is closed and they
 # *do* generate output.  >&- apparently does not work in HP-UX 11.23.
 # This test is ineffective unless /dev/stdout also works.
-if "$pwd/../../src/test" -w /dev/stdout >/dev/null &&
-   "$pwd/../../src/test" ! -w /dev/stdout >&-; then
-  "$pwd/../../src/printf" 'foo' >&- 2>/dev/null && fail=1
+if "$p/src/test" -w /dev/stdout >/dev/null &&
+   "$p/src/test" ! -w /dev/stdout >&-; then
+  "$p/src/printf" 'foo' >&- 2>/dev/null && fail=1
   cp --verbose a b >&- 2>/dev/null && fail=1
 fi
 
 # Likewise for /dev/full, if /dev/full works.
 if test -w /dev/full && test -c /dev/full; then
-  "$pwd/../../src/printf" 'foo' >/dev/full 2>/dev/null && fail=1
+  "$p/src/printf" 'foo' >/dev/full 2>/dev/null && fail=1
   cp --verbose a b >/dev/full 2>/dev/null && fail=1
 fi
 
index 65a9cca51c3932bac491afa377200bd5c1c2523c..defff67d70c2e0ed3dcfe7b405de850a14867ab2 100755 (executable)
@@ -1,8 +1,7 @@
 #!/bin/sh
 # various csplit tests
 
-# Copyright (C) 2001, 2002, 2003, 2004, 2005 2006 Free Software
-# Foundation, Inc.
+# Copyright (C) 2001-2007 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
@@ -23,20 +22,7 @@ if test "$VERBOSE" = yes; then
 fi
 
 . $srcdir/../lang-default
-
-pwd=`pwd`
-tmp=csplit.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
 
 fail=0
 
@@ -48,16 +34,14 @@ cat <<EOF > exp
 0
 2
 EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 rm -f in out exp
 
 # Ensure that xx02 contains just two newlines.
 # This would fail due to reading from freed buffer with coreutils-5.0.91.
 printf '\n\n' > exp
 cp xx02 out || fail=1
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 rm -f in out exp
 
 # csplit would infloop
@@ -67,8 +51,7 @@ cat <<EOF > exp
 0
 3
 EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 rm -f in out exp
 
 # `echo |csplit - 1 1' used to abort.
@@ -79,13 +62,11 @@ cat <<EOF > exp
 0
 1
 EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 cat <<\EOF > experr
 csplit: warning: line number `1' is the same as preceding line number
 EOF
-cmp err experr || fail=1
-test $fail = 1 && diff err experr 2> /dev/null
+compare err experr || fail=1
 rm -f in out exp err experr
 
 # make sure `csplit FILE 0' fails.
@@ -99,8 +80,7 @@ csplit: line number `1' is smaller than preceding line number, 2
 csplit: warning: line number `3' is the same as preceding line number
 csplit: `3': line number out of range
 EOF
-cmp err experr || fail=1
-test $fail = 1 && diff err experr 2> /dev/null
+compare err experr || fail=1
 
 # Ensure that lines longer than the initial buffer length don't cause
 # trouble (e.g. reading from freed memory, resulting in corrupt output).
@@ -109,6 +89,6 @@ test $fail = 1 && diff err experr 2> /dev/null
 rm -f in out exp err experr xx??
 printf 'x%8199s\nx\n%8199s\nx\n' x x > in
 csplit in '/x\{1\}/' '{*}' > /dev/null || fail=1
-cat xx?? | cmp - in || fail=1
+cat xx?? | compare - in || fail=1
 
 (exit $fail); exit $fail
index d389e7272b3126425a493814f041d7114a86854d..445326dc5d22c9f112605e721cd9d9200573a24c 100755 (executable)
@@ -23,19 +23,8 @@ if test "$VERBOSE" = yes; then
   date --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
+. $srcdir/../test-lib.sh
 
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
 
 fail=0
 
index 6138beaab1af44d17800a05f3834001a50a6904c..84050f375fdc32624e1d4f37f6679468699f3446 100755 (executable)
@@ -21,6 +21,8 @@ if test "$VERBOSE" = yes; then
   df --version
 fi
 
+. $srcdir/../test-lib.sh
+
 case `df .` in
 *'
 '*)
index 4fffd499b1a60a8035aa312caac14dff9b425a59..a27abf0b923abdbc8458d00038604dc921262cba 100755 (executable)
@@ -21,22 +21,8 @@ if test "$VERBOSE" = yes; then
   df --version
 fi
 
-. $srcdir/../envvar-check
 . $srcdir/../lang-default
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
 
 fail=0
 
@@ -52,7 +38,6 @@ BLOCK_SIZE=1M df -P . > t2 || fail=1
 head -n1 t1 > exp || fail=1
 head -n1 t2 > out || fail=1
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index f5b158a6a504c9f63c3b56f4224abd5007ae17af..b6b22a6ac218da10912b0c8fd6755b5b1f11fcb6 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # ensure that false exits nonzero even with --help or --version
 
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 2007 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
@@ -21,22 +21,9 @@ if test "$VERBOSE" = yes; then
   false --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
 
 fail=0
-
 false --version > /dev/null && fail=1
 false --help > /dev/null && fail=1
 
index 547b02f3c97a25e57402b7c845aa8bc9bf77d8e5..aae1fa8bed2dae4cfdad62829fa0b6f080ef8988 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # make sure fmt -s works even on long lines
 
-# Copyright (C) 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2006, 2007 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
@@ -21,17 +21,11 @@ if test "$VERBOSE" = yes; then
   fmt --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
+. $srcdir/../test-lib.sh
 
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-(echo ' '; yes) | head -n1000 | tr '\n' ' ' > in || framework_failure=1
+(echo ' '; yes) | head -n1000 | tr '\n' ' ' > in || framework_failure
 
-cat <<\EOF > exp || framework_failure=1
+cat <<\EOF > exp || framework_failure
   y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
   y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
   y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
@@ -64,16 +58,10 @@ cat <<\EOF > exp || framework_failure=1
   y y
 EOF
 
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
-
 fail=0
 
 fmt -s in > out || fail=1
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 407a251747b3a207194608cbe1ef18dc9243ac74..15327be324fb898185c19ccecac84a189b7a6305 100755 (executable)
@@ -22,27 +22,12 @@ if test "$VERBOSE" = yes; then
 fi
 
 . $srcdir/../lang-default
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
 
 fail=0
-
 groups --version | sed 's/^groups/id/; /^$/q' > out || fail=1
 id --version | sed '/^$/q' > exp || fail=1
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index c75b0541cf623a161e482ea65cd1411c03872c10..1520ea610304cfb6e5b781add3020006d5aba1ca 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # exercise the fix of 2001-08-18, based on test case from Ian Bruce
 
-# Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2004, 2006, 2007 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
@@ -21,23 +21,11 @@ if test "$VERBOSE" = yes; then
   head --version
 fi
 
-pwd=`pwd`
-tmp=head-c.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
+. $srcdir/../test-lib.sh
 
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-echo abc > in || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo 'failure in testing framework' 1>&2
-  (exit 1); exit 1
-fi
+echo abc > in || framework_failure
 
 fail=0
-
 (head -c1; head -c1) < in > out || fail=1
 case "`cat out`" in
   ab) ;;
index 3a27d3e8ec4b7973c5d465d43f63ad9ec16bfe5f..b78a42d43261958f11331f6917c6962b6279b457 100755 (executable)
@@ -2,7 +2,7 @@
 # When reading a specified number of lines, ensure that the output
 # file pointer is positioned just after those lines.
 
-# Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2006, 2007 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
@@ -22,20 +22,9 @@ if test "$VERBOSE" = yes; then
   head --version
 fi
 
-pwd=`pwd`
-tmp=head-pos.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
+. $srcdir/../test-lib.sh
 
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-(echo a; echo b) > in || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+(echo a; echo b) > in || framework_failure
 
 fail=0
 (head -n 1 >/dev/null; cat) < in > out || fail=1
@@ -43,7 +32,6 @@ cat <<EOF > exp
 b
 EOF
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 9456411bdf643a313af8607a3f87bcc7d2bb91fa..4099e6b99979d110b331fbe36a719195981cd9c1 100755 (executable)
@@ -22,33 +22,13 @@ if test "$VERBOSE" = yes; then
   ls --version
 fi
 
-. $srcdir/../envvar-check
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
 
 # Avoid any possible glitches due to daylight-saving changes near the
 # time stamps used during the test.
 TZ=UTC0
 export TZ
 
-tmp=t-ls.$$
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
 t1='1998-01-15 21:00'
 t2='1998-01-15 22:00'
 t3='1998-01-15 23:00'
@@ -57,15 +37,15 @@ u1='1998-01-14 11:00'
 u2='1998-01-14 12:00'
 u3='1998-01-14 13:00'
 
-touch -m -d "$t3" a || framework_failure=1
-touch -m -d "$t2" b || framework_failure=1
-touch -m -d "$t1" c || framework_failure=1
+touch -m -d "$t3" a || framework_failure
+touch -m -d "$t2" b || framework_failure
+touch -m -d "$t1" c || framework_failure
 
-touch -a -d "$u3" c || framework_failure=1
-touch -a -d "$u2" b || framework_failure=1
+touch -a -d "$u3" c || framework_failure
+touch -a -d "$u2" b || framework_failure
 # Make sure A has ctime at least 1 second more recent than C's.
 sleep 2
-touch -a -d "$u1" a || framework_failure=1
+touch -a -d "$u1" a || framework_failure
 
 fail=0
 
@@ -78,7 +58,7 @@ test "$*" = 'a c' || fail=1
 sleep 2
 
 # Create a link, updating c's ctime.
-ln c d || framework_failure=1
+ln c d || framework_failure
 
 # Before we go any further, verify that touch's -m option works.
 set -- `ls --full -l a`
@@ -95,7 +75,7 @@ have been $t3.
 EOF
   #`
   ls --full -l a
-  framework_failure=1
+  framework_failure
   ;;
 esac
 
@@ -117,11 +97,6 @@ EOF
   ;;
 esac
 
-if test $framework_failure = 1; then
-  echo 'failure in testing framework'
-  exit 1
-fi
-
 set `ls -ut a b c`
 test "$*" = 'c b a' && : || fail=1
 test $fail = 1 && ls -l --full-time --time=access a b c
index c9311113adc43dc0d25da996363ef20ff6ebd654..37b33d18d135a19da3ab216ebeb3a3d071154990 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Ensure that mknod, mkfifo, mkdir -m MODE work with a restrictive umask
 
-# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2006, 2007 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
@@ -21,19 +21,7 @@ if test "$VERBOSE" = yes; then
   mknod --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
 
 fail=0
 
index ba6ce1c006c282112ecae454510b8cf3a4923290..6b063daa286da8bd72b8a0fbc10fb55d0494e650 100755 (executable)
@@ -1,7 +1,7 @@
 #! /bin/sh
 # Test "nice".
 
-# Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005-2007 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# This script takes no arguments.
-
-if test -n "$DJDIR"; then
-  echo "$0: cannot test nice on DJGPP" >&2
-  exit 77
+if test "$VERBOSE" = yes; then
+  set -x
+  nice --version
 fi
 
+. $srcdir/../test-lib.sh
+
 tests='
 0 empty 10
 1 -1 1
index 77db3c9a10da693f435cf24bfa64b9da0e15c576..13855fbca5a380f4727298ff3556432efd82aab9 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # exercise nl functionality
 
-# Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2006, 2007 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
@@ -21,19 +21,7 @@ if test "$VERBOSE" = yes; then
   nl --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
 
 fail=0
 
@@ -55,7 +43,6 @@ cat <<\EOF > exp
        $
 EOF
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index c4f971ff5d5c83815ac8cf41f3f1c0661fc270b9..ac9e5e56186123ca357d2a49029194bbb3e6d857 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # test nohup
 
-# Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 2007 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
@@ -21,22 +21,8 @@ if test "$VERBOSE" = yes; then
   nohup --version
 fi
 
-. $srcdir/../envvar-check
 . $srcdir/../lang-default
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
 
 fail=0
 
@@ -62,8 +48,7 @@ else
 fi
 echo 'stderr' >> exp || fail=1
 
-cmp exp err || fail=1
-test $fail = 1 && diff exp err 2> /dev/null
+compare exp err || fail=1
 rm -f nohup.out err exp
 # ----------------------
 
@@ -95,8 +80,7 @@ nohup: appending output to `nohup.out'
 nohup: cannot run command `no-such-command': No such file or directory
 EOF
 # Disable these comparisons.  Too much variation in 2nd line.
-# cmp exp err || fail=1
-# test $fail = 1 && diff exp err 2> /dev/null
+# compare exp err || fail=1
 rm -f nohup.out err exp
 # ----------------------
 
@@ -116,8 +100,7 @@ nohup: appending output to `nohup.out'
 nohup: cannot run command `./k': Permission denied
 EOF
 # Disable these comparisons.  Too much variation in 2nd line.
-# cmp exp err || fail=1
-# test $fail = 1 && diff exp err 2> /dev/null
+# compare exp err || fail=1
 
 # Make sure it fails with exit status of 127 when given too few arguments.
 nohup >/dev/null 2>&1
index a2dc8c067052fcc3951d40620f45ca0e5adf1581..ffe917910fe4cfbce4fe1d506c2529a512de5a57 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # pathchk tests
 
-# Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2005, 2006, 2007 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
@@ -22,21 +22,9 @@ if test "$VERBOSE" = yes; then
 fi
 
 PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
+. $srcdir/../test-lib.sh
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-touch file || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+touch file || framework_failure
 
 fail=0
 
index 37ccad0f830df2fb670f25478fe11d08a54d1203..76c32d6b0e6e0e3fec50f574ff37784006d6e984 100755 (executable)
@@ -20,7 +20,6 @@
 : ${PERL=perl}
 : ${srcdir=.}
 
-. $srcdir/../envvar-check
 
 $PERL -e 1 > /dev/null 2>&1 || {
   echo 1>&2 "$0: configure didn't find a usable version of Perl," \
index 6fea4b0bc4ba3552c8f96849e812c56a56260f1d..5637d25f2f39e2188f391274649a98c043472f41 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # basic tests for printf
 
-# Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002-2004, 2006-2007 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-prog=`pwd`/../../src/printf
+prog="$abs_top_builddir/src/printf"
 
 if test "$VERBOSE" = yes; then
   set -x
   "$prog" --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
 
 fail=0
 
@@ -46,8 +34,7 @@ cat <<\EOF > exp
 foo
 EOF
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 rm -f out exp
 # Until coreutils-4.5.10, this would elicit a segfault.
@@ -106,7 +93,6 @@ cat <<\EOF > exp
 11  x
 EOF
 
-cmp out exp || fail=1
-test $fail = 1 && diff -au out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 525d90beb1c8dccdcb31ce40a46d50110764130d..4ece0ac296bdc8aa20ad65aae97f2518ae964371 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # make sure that only two hex. digits are consumed in a \xHHH sequence
 
-# Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004, 2006, 2007 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
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-prog=`pwd`/../../src/printf
+prog="$abs_top_builddir/src/printf"
 
 if test "$VERBOSE" = yes; then
   set -x
   "$prog" --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
+. $srcdir/../test-lib.sh
 
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
 
 fail=0
 
@@ -44,7 +33,6 @@ cat <<\EOF > exp
 ~3
 EOF
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 920c25842f7ad401980e99577abc23c3c85900cc..42a092c24e068952611cd121160f8f42e6225964 100755 (executable)
@@ -24,26 +24,13 @@ $PERL -e 1 > /dev/null 2>&1 || {
   exit 77
 }
 
-framework_failure=0
-pwd=`"${BUILD_SRC_DIR?}"/pwd` || framework_failure=1
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
 
 ARGV_0=$0
 export ARGV_0
 
-CWD=$pwd/$tmp
-export CWD
-
+# Don't use CuTmpdir here, since File::Temp's use of rmtree can't
+# remove the deep tree we create.
 $PERL -Tw -- - <<\EOF
 
 # Show that pwd works even when the length of the resulting
index b79d53d3769750d15bda21de0033dfc51bc89f59..57557c6731d623b7bc8a96b493cb2ecb6deeba00 100755 (executable)
@@ -24,6 +24,8 @@ if test "$VERBOSE" = yes; then
   readlink --version
 fi
 
+. $srcdir/../test-lib.sh
+
 test $host_os != linux-gnu &&
   {
     echo 1>&2 "$0: vendor getcwd may be inadequate; skipping this test"
@@ -38,31 +40,16 @@ test $REPLACE_GETCWD = 1 &&
     (exit 77); exit 77
   }
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-mkdir -p a/b || framework_failure=1
-cd a/b || framework_failure=1
-chmod a=x .. || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+mkdir -p a/b || framework_failure
+cd a/b || framework_failure
+chmod a=x .. || framework_failure
 
-pwd_exe=$pwd/../../src/pwd
+pwd_exe="$abs_top_builddir/src/pwd"
 
 fail=0
 $pwd_exe > exp || fail=1
 readlink -ev . > out || fail=1
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 42828852c8c88ad2dbe606fa514d9357e09b48ae..0fda3b442af5a13819152f177d4fdf697d1d80de 100755 (executable)
@@ -22,25 +22,12 @@ if test "$VERBOSE" = yes; then
 fi
 
 . $srcdir/../lang-default
+. $srcdir/../test-lib.sh
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-cat <<\EOF > exp || framework_failure=1
+cat <<\EOF > exp || framework_failure
 runcon: runcon may be used only on a SELinux kernel
 EOF
 
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
-
 fail=0
 
 # This test works even on systems without SELinux.
@@ -49,7 +36,6 @@ fail=0
 # about -j being an invalid option.
 runcon -t unconfined_t true -j 2> out && : > exp
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 3e2aae5e2ca603a35843472775beda4c097ab00b..90ab2d6c44f0baa989ca917f1609537172bd6044 100755 (executable)
@@ -10,29 +10,15 @@ if test "$VERBOSE" = yes; then
   stat --version
 fi
 
-. $srcdir/../envvar-check
 . $srcdir/../lang-default
 . $srcdir/../selinux
 PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check
-
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd $pwd; chmod -R u+rwx $t0; rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
+. $srcdir/../test-lib.sh
 
 # Create a regular file, dir, fifo.
-touch f || framework_failure=1
-mkdir d s1 s2 || framework_failure=1
-mkfifo p || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+touch f || framework_failure
+mkdir d s1 s2 || framework_failure
+mkfifo p || framework_failure
 
 fail=0
 
index fdbedee6148a28c2bb4496fcf1deeb62979f3305..ac59c55ff7b5c27bf78fb8db03295b8b096acbf8 100755 (executable)
@@ -21,39 +21,27 @@ if test "$VERBOSE" = yes; then
   shuf --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
+. $srcdir/../test-lib.sh
 
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-seq 100 > in || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+seq 100 > in || framework_failure
 
 fail=0
-
 shuf in >out || fail=1
 
 # Fail if the input is the same as the output.
 # This is a probabilistic test :-)
 # However, the odds of failure are very low: 1 in 100! (~ 1 in 10^158)
-cmp in out > /dev/null && { fail=1; echo "not random?" 1>&2; }
+compare in out > /dev/null && { fail=1; echo "not random?" 1>&2; }
 
 # Fail if the sorted output is not the same as the input.
 sort -n out > out1
-cmp in out1 || { fail=1; echo "not a permutation" 1>&2; }
+compare in out1 || { fail=1; echo "not a permutation" 1>&2; }
 
 # Exercise shuf's -i option.
 shuf -i 1-100 > out || fail=1
-cmp in out > /dev/null && { fail=1; echo "not random?" 1>&2; }
+compare in out > /dev/null && { fail=1; echo "not random?" 1>&2; }
 sort -n out > out1
-cmp in out1 || { fail=1; echo "not a permutation" 1>&2; }
+compare in out1 || { fail=1; echo "not a permutation" 1>&2; }
 
 # Exercise shuf's -e option.
 t=`shuf -e a b c d e | sort | fmt`
index 568bfa76257da2c42dfd64148bb95942ac983c24..00aae25c506c4d23308d3a548b598304b8f9ef31 100755 (executable)
@@ -21,22 +21,11 @@ if test "$VERBOSE" = yes; then
   sort --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-seq -w 2000 > exp || framework_failure=1
-tac exp > in || framework_failure=1
-SORT=$abs_top_builddir/src/sort
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
+
+seq -w 2000 > exp || framework_failure
+tac exp > in || framework_failure
+SORT="$abs_top_builddir/src/sort"
 
 # Ensure that $TMPDIR is valid.
 TMPDIR=.; export TMPDIR
@@ -45,8 +34,7 @@ fail=0
 
 # This should force the use of temp files compressed with the default gzip
 sort -S 1k in > out || fail=1
-cmp exp out || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare exp out || fail=1
 
 # Create our own gzip program that will be used as the default
 cat <<\EOF > gzip || fail=1
@@ -59,35 +47,30 @@ chmod +x gzip
 
 # This will find our new gzip in PATH
 PATH=.:$PATH sort -S 1k --compress-program=gzip in > out || fail=1
-cmp exp out || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare exp out || fail=1
 test -f ok || fail=1
 rm -f ok
 
 # This is to make sure it works with no compression.
 PATH=.:$PATH sort -S 1k in > out || fail=1
-cmp exp out || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare exp out || fail=1
 test -f ok && fail=1
 
 # This is to make sure we can use something other than gzip
 mv gzip dzip || fail=1
 sort --compress-program=./dzip -S 1k in > out || fail=1
-cmp exp out || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare exp out || fail=1
 test -f ok || fail=1
 rm -f ok
 
 # Make sure it can find other programs in PATH correctly
 PATH=.:$PATH sort --compress-program=dzip -S 1k in > out || fail=1
-cmp exp out || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare exp out || fail=1
 test -f ok || fail=1
 rm -f dzip ok
 
 # This is to make sure sort functions if it can't find the default gzip
 PATH=. "$SORT" -S 1k in > out || fail=1
-cmp exp out || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare exp out || fail=1
 
 (exit $fail); exit $fail
index c6dd597e3b152c250b9163785cb4edb24295e08b..8b9fb2df0b90388bc9bbe6b130cae47e76504232 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Ensure that sort --sort-random doesn't sort.
 
-# Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2005-2007 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
@@ -21,20 +21,9 @@ if test "$VERBOSE" = yes; then
   sort --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
+. $srcdir/../test-lib.sh
 
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-seq 100 > in || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+seq 100 > in || framework_failure
 
 fail=0
 
@@ -43,11 +32,11 @@ sort --random-sort in > out || fail=1
 # Fail if the input is the same as the output.
 # This is a probabilistic test :-)
 # However, the odds of failure are very low: 1 in 100! (~ 1 in 10^158)
-cmp in out > /dev/null && { fail=1; echo "not random?" 1>&2; }
+compare in out > /dev/null && { fail=1; echo "not random?" 1>&2; }
 
 # Fail if the sorted output is not the same as the input.
 sort -n out > out1
-cmp in out1 || { fail=1; echo "not a permutation" 1>&2; }
+compare in out1 || { fail=1; echo "not a permutation" 1>&2; }
 
 # If locale is available then use it to find a random non-C locale.
 if (locale --version) > /dev/null 2>&1; then
@@ -56,11 +45,11 @@ if (locale --version) > /dev/null 2>&1; then
   LC_ALL=$locale sort --random-sort in > out2 || fail=1
 
   # Fail if the output "randomly" is the same twice in a row.
-  cmp out1 out2 > /dev/null && { fail=1; echo "not random with LC_ALL=$locale" 1>&2; }
+  compare out1 out2 > /dev/null && { fail=1; echo "not random with LC_ALL=$locale" 1>&2; }
 
   # Fail if the sorted output is not the same as the input.
   sort -n out > out1
-  cmp in out1 || { fail=1; echo "not a permutation with LC_ALL=$locale" 1>&2; }
+  compare in out1 || { fail=1; echo "not a permutation with LC_ALL=$locale" 1>&2; }
 fi
 
 (exit $fail); exit $fail
index 3f13b9db0fcd6e65744f8d9078fdf2e95d5c76a3..794115f5c4ddec18ed42226442e0ecd4a57ffc0c 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Show that split -a works.
 
-# Copyright (C) 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002-2007 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
@@ -22,20 +22,7 @@ if test "$VERBOSE" = yes; then
 fi
 
 . $srcdir/../lang-default
-
-pwd=`pwd`
-tmp=split-a.$$
-trap 'status=$?; cd "$pwd" && rm -rf $tmp && exit $status' 0
-trap '(exit $?); exit' 1 2 13 15
-
-framework_failure=0
-mkdir $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
 
 fail=0
 
@@ -88,7 +75,6 @@ creating file `xaz'
 creating file `xba'
 EOF
 
-cmp err exp || fail=1
-test $fail = 1 && diff err exp 2> /dev/null
+compare err exp || fail=1
 
 (exit $fail); exit $fail
index 84491e1e826fc0a06c73e041a75e2bf24093797c..5cc6d73efb45001b2d8f240327df6e2cdd71e9c6 100755 (executable)
@@ -22,21 +22,9 @@ if test "$VERBOSE" = yes; then
 fi
 
 . $srcdir/../lang-default
+. $srcdir/../test-lib.sh
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-touch in || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+touch in || framework_failure
 
 fail=0
 
@@ -85,8 +73,7 @@ mv -f out-t out
 cat <<\EOF > exp
 split: line count option -99*... is too large
 EOF
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 
 (exit $fail); exit $fail
index 0a9d80069b10a668271b226860889efbde81153e..2460289b8153828ecb76b946ba95cd578671c22a 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # show that `split --lines=2' works.
 
-# Copyright (C) 2002, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2006, 2007 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
@@ -21,23 +21,11 @@ if test "$VERBOSE" = yes; then
   ln --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
+. $srcdir/../test-lib.sh
 
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-printf '1\n2\n3\n4\n5\n' > in || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+printf '1\n2\n3\n4\n5\n' > in || framework_failure
 
 fail=0
-
 split --lines=2 in > out || fail=1
 cat <<\EOF > exp-1
 1
@@ -51,12 +39,9 @@ cat <<\EOF > exp-3
 5
 EOF
 
-cmp xaa exp-1 || fail=1
-test $fail = 1 && diff xaa exp 2> /dev/null
-cmp xab exp-2 || fail=1
-test $fail = 2 && diff xab exp 2> /dev/null
-cmp xac exp-3 || fail=1
-test $fail = 3 && diff xac exp 2> /dev/null
+compare xaa exp-1 || fail=1
+compare xab exp-2 || fail=1
+compare xac exp-3 || fail=1
 test -f xad && fail=1
 
 (exit $fail); exit $fail
index 3fbaefe4d54fd364d904e1edee72644ad4f39f05..ebc3b880ceb19bd437404b1c7df2cc14d421e667 100755 (executable)
@@ -21,19 +21,8 @@ if test "$VERBOSE" = yes; then
   stat --version
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+. $srcdir/../test-lib.sh
+
 
 fail=0
 
index 47b7d3e8975b1845a03ea2cb3615e17b35b8fef9..aa8f69d1ead9132a7544a3e3365c066171584365 100755 (executable)
@@ -3,7 +3,7 @@
 # when it encounters an error with say the first one.
 # With coreutils-5.2.1 and earlier, this test would fail.
 
-# Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+# Copyright (C) 2004, 2006, 2007 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
@@ -24,6 +24,7 @@ if test "$VERBOSE" = yes; then
 fi
 
 . $srcdir/../lang-default
+. $srcdir/../test-lib.sh
 
 # See if the envvar is defined.
 if test x = "x$FULL_PARTITION_TMPDIR"; then
@@ -37,17 +38,8 @@ if ! test -d "$FULL_PARTITION_TMPDIR"; then
   (exit 1); exit 1
 fi
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
 
 fp_tmp="$FULL_PARTITION_TMPDIR/tac-cont-$$"
-t0="$t0 $fp_tmp"
 # Make sure we can create an empty file there (i.e. no shortage of inodes).
 if ! touch $fp_tmp; then
   echo "$0: $fp_tmp: cannot create empty file" 1>&2
@@ -63,11 +55,6 @@ fi
 
 seq 5 > in
 
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
-
 fail=0
 
 # Give tac a fifo command line argument.
@@ -84,7 +71,6 @@ cat <<\EOF > exp || fail=1
 1
 EOF
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 (exit $fail); exit $fail
index 35da2f45f5cbf527f9c953ef4eb9f55a6ff54bfe..44bf84ffe40273958d82a6c017e4bcbf44b29225 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Show that wc's new --files0-from option works.
 
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2007 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
@@ -22,24 +22,11 @@ if test "$VERBOSE" = yes; then
 fi
 
 . $srcdir/../lang-default
+. $srcdir/../test-lib.sh
 
-pwd=`pwd`
-t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
-trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
-trap '(exit $?); exit $?' 1 2 13 15
-
-framework_failure=0
-mkdir -p $tmp || framework_failure=1
-cd $tmp || framework_failure=1
-
-echo 2 > 2b || framework_failure=1
-echo 2 words > 2w || framework_failure=1
-printf '2b\n2w\n' |tr '\n' '\0' > names || framework_failure=1
-
-if test $framework_failure = 1; then
-  echo "$0: failure in testing framework" 1>&2
-  (exit 1); exit 1
-fi
+echo 2 > 2b || framework_failure
+echo 2 words > 2w || framework_failure
+printf '2b\n2w\n' |tr '\n' '\0' > names || framework_failure
 
 fail=0
 
@@ -50,15 +37,13 @@ cat <<\EOF > exp || fail=1
  2  3 10 total
 EOF
 
-cmp out exp || fail=1
-test $fail = 1 && diff out exp 2> /dev/null
+compare out exp || fail=1
 
 if test "$fail" = ''; then
   # Repeat the above test, but read the file name list from stdin.
   rm -f out
   wc --files0-from=- < names > out || fail=1
-  cmp out exp || fail=1
-  test $fail = 1 && diff out exp 2> /dev/null
+  compare out exp || fail=1
 fi
 
 (exit $fail); exit $fail
index 53511c84acfa2b67e4506c7798117a1e8fa1e0a9..1d46b2a346fe45a61f4ed684d9db71d8ff56fa60 100755 (executable)
@@ -21,7 +21,6 @@
 : ${PERL=perl}
 : ${srcdir=.}
 
-. $srcdir/../envvar-check
 
 PROG=`echo $0|sed 's,.*/,,'`; export PROG
 
index 4d26ef6ca0a31fd511bddbe2101deb3ae823a089..aa2b8a7b54a0e8868fac8d1c4874dc4e97ebd1a6 100755 (executable)
@@ -21,8 +21,6 @@ if test "$VERBOSE" = yes; then
   pr --version
 fi
 
-. $srcdir/../envvar-check
-
 : ${PERL=perl}
 : ${srcdir=.}