From 0539705768992ebcc290bc859f64e27898c7f958 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 11 Sep 2007 23:30:49 +0200 Subject: [PATCH] Move all tests from test/{od,sha1sum,shred,stty} to tests/misc/. Reflect these renamings: od/od-N misc/od-N od/x8 misc/od-x8 sha1sum/basic-1 misc/sha1sum sha1sum/sample-vec misc/sha1sum-vec shred/exact misc/shred-exact shred/remove misc/shred-remove stty/basic-1 misc/stty stty/invalid misc/stty-invalid stty/row-col-1 misc/stty-row-col * tests/misc/Makefile.am (TESTS): Add the new files. * tests/Makefile.am (SUBDIRS): Remove the dir names. * tests/od, tests/sha1sum, tests/shred, tests/stty: Remove the directories. * configure.ac (AC_CONFIG_FILES): Remove the corresponding Makefile names. --- .x-sc_prohibit_atoi_atof | 2 +- configure.ac | 4 ---- tests/Makefile.am | 4 ++-- tests/misc/Makefile.am | 10 ++++++++++ tests/misc/ls-time | 3 --- tests/{od => misc}/od-N | 22 ++++------------------ tests/{od/x8 => misc/od-x8} | 22 +++++----------------- tests/{sha1sum/basic-1 => misc/sha1sum} | 4 ++-- tests/{sha1sum/sample-vec => misc/sha1sum-vec} | 4 ++-- tests/{shred/exact => misc/shred-exact} | 16 ++-------------- tests/{shred/remove => misc/shred-remove} | 21 ++++----------------- tests/{stty/basic-1 => misc/stty} | 5 ++--- tests/{stty/invalid => misc/stty-invalid} | 15 +-------------- tests/{stty/row-col-1 => misc/stty-row-col} | 4 ++-- tests/od/Makefile.am | 12 ------------ tests/sha1sum/Makefile.am | 13 ------------- tests/shred/Makefile.am | 12 ------------ tests/stty/Makefile.am | 6 ------ 18 files changed, 37 insertions(+), 142 deletions(-) rename tests/{od => misc}/od-N (65%) rename tests/{od/x8 => misc/od-x8} (66%) rename tests/{sha1sum/basic-1 => misc/sha1sum} (95%) rename tests/{sha1sum/sample-vec => misc/sha1sum-vec} (99%) rename tests/{shred/exact => misc/shred-exact} (74%) rename tests/{shred/remove => misc/shred-remove} (70%) rename tests/{stty/basic-1 => misc/stty} (96%) rename tests/{stty/invalid => misc/stty-invalid} (82%) rename tests/{stty/row-col-1 => misc/stty-row-col} (96%) delete mode 100644 tests/od/Makefile.am delete mode 100644 tests/sha1sum/Makefile.am delete mode 100644 tests/shred/Makefile.am delete mode 100644 tests/stty/Makefile.am diff --git a/.x-sc_prohibit_atoi_atof b/.x-sc_prohibit_atoi_atof index c7b8603..40feeb7 100644 --- a/.x-sc_prohibit_atoi_atof +++ b/.x-sc_prohibit_atoi_atof @@ -8,4 +8,4 @@ ChangeLog ^lib/group-member\.c$ ^Makefile\.maint$ ^doc/coreutils.texi$ -^tests/stty/invalid$ +^tests/misc/stty-invalid$ diff --git a/configure.ac b/configure.ac index 8743729..3240bd5 100644 --- a/configure.ac +++ b/configure.ac @@ -352,15 +352,11 @@ AC_CONFIG_FILES( tests/misc/Makefile tests/mkdir/Makefile tests/mv/Makefile - tests/od/Makefile tests/pr/Makefile tests/readlink/Makefile tests/rm/Makefile tests/rmdir/Makefile - tests/sha1sum/Makefile - tests/shred/Makefile tests/sort/Makefile - tests/stty/Makefile tests/tac/Makefile tests/tail-2/Makefile tests/tail/Makefile diff --git a/tests/Makefile.am b/tests/Makefile.am index b1865b3..d3cfb93 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -45,8 +45,8 @@ EXTRA_DIST = \ ## There are too many already. Put new tests in misc/. SUBDIRS = \ chgrp chmod chown cp cut dd du head \ - install join ln ls ls-2 misc mkdir mv od pr readlink rm rmdir \ - sha1sum shred sort stty tac tail tail-2 test touch tr \ + install join ln ls ls-2 misc mkdir mv pr readlink rm rmdir \ + sort tac tail tail-2 test touch tr \ uniq wc ## N O T E :: Please do not add new directories. diff --git a/tests/misc/Makefile.am b/tests/misc/Makefile.am index 6998353..a08b719 100644 --- a/tests/misc/Makefile.am +++ b/tests/misc/Makefile.am @@ -81,6 +81,8 @@ TESTS = \ nice \ nl \ nohup \ + od-N \ + od-x8 \ paste-no-nl \ pathchk1 \ printf \ @@ -88,10 +90,14 @@ TESTS = \ pwd-long \ runcon-no-reorder \ seq \ + sha1sum \ + sha1sum-vec \ sha224sum \ sha256sum \ sha384sum \ sha512sum \ + shred-exact \ + shred-remove \ shuf \ sort-compress \ sort-merge \ @@ -101,6 +107,9 @@ TESTS = \ split-l \ stat-fmt \ stat-printf \ + stty \ + stty-invalid \ + stty-row-col \ sum \ sum-sysv \ tac-continue \ @@ -111,4 +120,5 @@ TESTS = \ tty-eof \ unexpand + include $(top_srcdir)/tests/check.mk diff --git a/tests/misc/ls-time b/tests/misc/ls-time index 4099e6b..7aee580 100755 --- a/tests/misc/ls-time +++ b/tests/misc/ls-time @@ -124,7 +124,4 @@ EOF fail=1 fi -cd .. -rm -rf $tmp - exit $fail diff --git a/tests/od/od-N b/tests/misc/od-N similarity index 65% rename from tests/od/od-N rename to tests/misc/od-N index 341ff0a..0cff509 100755 --- a/tests/od/od-N +++ b/tests/misc/od-N @@ -1,7 +1,7 @@ #!/bin/sh # Verify that `od -N N' reads no more than N bytes of input. -# Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2001, 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 @@ -21,20 +21,9 @@ if test "$VERBOSE" = yes; then od --version fi -pwd=`pwd` -tmp=od-N.$$ -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 abcdefg > in || framework_failure=1 - -if test $framework_failure = 1; then - echo 'failure in testing framework' 1>&2 - (exit 1); exit 1 -fi +echo abcdefg > in || framework_failure fail=0 @@ -43,9 +32,6 @@ cat < exp || fail=1 a b c d e f EOF -cmp out exp || { - fail=1 - diff out exp 2> /dev/null - } +compare out exp || fail=1 (exit $fail); exit $fail diff --git a/tests/od/x8 b/tests/misc/od-x8 similarity index 66% rename from tests/od/x8 rename to tests/misc/od-x8 index 0f33f58..dc1ec00 100755 --- a/tests/od/x8 +++ b/tests/misc/od-x8 @@ -2,7 +2,7 @@ # verify that od -t x8 works properly # This would fail before coreutils-4.5.2. -# Copyright (C) 2002, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2002, 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 @@ -22,25 +22,14 @@ if test "$VERBOSE" = yes; then od --version fi +. $srcdir/../test-lib.sh + od -t x8 /dev/null >/dev/null || { echo >&2 "$0: 8-byte test skipped" 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 -echo abcdefgh |tr -d '\n' > in || framework_failure=1 - -if test $framework_failure = 1; then - echo "$0: failure in testing framework" 1>&2 - (exit 1); exit 1 -fi +echo abcdefgh |tr -d '\n' > in || framework_failure fail=0 @@ -56,7 +45,6 @@ od -An -t x1 in \ | sort -n \ > exp -cmp out exp || fail=1 -test $fail = 1 && diff out exp 2> /dev/null +compare out exp || fail=1 (exit $fail); exit $fail diff --git a/tests/sha1sum/basic-1 b/tests/misc/sha1sum similarity index 95% rename from tests/sha1sum/basic-1 rename to tests/misc/sha1sum index 7cee37e..975c570 100755 --- a/tests/sha1sum/basic-1 +++ b/tests/misc/sha1sum @@ -1,7 +1,7 @@ #!/bin/sh # Test "sha1sum". -# Copyright (C) 2000, 2003, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2000, 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 @@ -84,7 +84,7 @@ foreach $t (@Tests) my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n"; +my $prog = 'sha1sum'; my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose); exit $fail; EOF diff --git a/tests/sha1sum/sample-vec b/tests/misc/sha1sum-vec similarity index 99% rename from tests/sha1sum/sample-vec rename to tests/misc/sha1sum-vec index fa83aed..d209041 100755 --- a/tests/sha1sum/sample-vec +++ b/tests/misc/sha1sum-vec @@ -1,7 +1,7 @@ #!/bin/sh # Sample vectors for "sha1sum". -# Copyright (C) 2000, 2001, 2003, 2005 Free Software Foundation, Inc. +# Copyright (C) 2000, 2001, 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 @@ -541,7 +541,7 @@ foreach $t (@Tests) my $save_temps = $ENV{DEBUG}; my $verbose = $ENV{VERBOSE}; -my $prog = $ENV{PROG} || die "$0: \$PROG not specified in environment\n"; +my $prog = 'sha1sum'; my $fail = run_tests ($program_name, $prog, \@Tests, $save_temps, $verbose); exit $fail; EOF diff --git a/tests/shred/exact b/tests/misc/shred-exact similarity index 74% rename from tests/shred/exact rename to tests/misc/shred-exact index eee2112..e0fef39 100755 --- a/tests/shred/exact +++ b/tests/misc/shred-exact @@ -1,7 +1,7 @@ #!/bin/sh # make sure that neither --exact nor --zero gobbles a command line argument -# Copyright (C) 2000, 2003, 2004, 2006 Free Software Foundation, Inc. +# Copyright (C) 2000, 2003, 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 shred --version fi -pwd=`pwd` -tmp=exact.$$ -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 'failure in testing framework' - (exit 1); exit 1 -fi +. $srcdir/../test-lib.sh fail=0 diff --git a/tests/shred/remove b/tests/misc/shred-remove similarity index 70% rename from tests/shred/remove rename to tests/misc/shred-remove index 4afa63b..ae7443b 100755 --- a/tests/shred/remove +++ b/tests/misc/shred-remove @@ -1,7 +1,7 @@ #!/bin/sh # Exercise a bug that was fixed in shred-4.0l -# Copyright (C) 1999, 2000, 2003, 2006 Free Software Foundation, Inc. +# Copyright (C) 1999, 2000, 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 @@ -22,27 +22,14 @@ if test "$VERBOSE" = yes; then fi 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 # The length of the basename is what matters. # In this case, shred would try to rename the file 256^10 times # before terminating. file=0123456789 -touch $file || framework_failure=1 -chmod u-w $file || framework_failure=1 - -if test $framework_failure = 1; then - echo 'failure in testing framework' - exit 1 -fi +touch $file || framework_failure +chmod u-w $file || framework_failure fail=0 diff --git a/tests/stty/basic-1 b/tests/misc/stty similarity index 96% rename from tests/stty/basic-1 rename to tests/misc/stty index 160e436..c9fd67d 100755 --- a/tests/stty/basic-1 +++ b/tests/misc/stty @@ -1,8 +1,7 @@ #! /bin/sh # Make sure stty can parse most of its options. -# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006 Free -# Software Foundation, Inc. +# Copyright (C) 1998-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 +23,7 @@ fi # Make sure there's a tty on stdin. . $srcdir/../input-tty +. $srcdir/../test-lib.sh # The following list of reversible options was generated with # grep -w REV stty.c|sed -n '/^ {"/{s//REV_/;s/".*/=1/;p;}'|fmt @@ -99,6 +99,5 @@ if test -n "$RUN_LONG_TESTS"; then fi stty `cat $saved_state` -rm -f $saved_state exit $fail diff --git a/tests/stty/invalid b/tests/misc/stty-invalid similarity index 82% rename from tests/stty/invalid rename to tests/misc/stty-invalid index 9378934..a2a636d 100755 --- a/tests/stty/invalid +++ b/tests/misc/stty-invalid @@ -23,20 +23,7 @@ fi # Make sure there's a tty on stdin. . $srcdir/../input-tty - -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 diff --git a/tests/stty/row-col-1 b/tests/misc/stty-row-col similarity index 96% rename from tests/stty/row-col-1 rename to tests/misc/stty-row-col index 65fc91e..3fb3871 100755 --- a/tests/stty/row-col-1 +++ b/tests/misc/stty-row-col @@ -1,8 +1,7 @@ #! /bin/sh # Test "stty" with rows and columns. -# Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006 Free -# Software Foundation, Inc. +# Copyright (C) 1998-2001, 2003-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 @@ -39,6 +38,7 @@ export LC_ALL # Make sure there's a tty on stdin. . $srcdir/../input-tty +. $srcdir/../test-lib.sh # Versions of GNU stty from shellutils-1.9.2c and earlier failed # tests #2 and #4 when run on SunOS 4.1.3. diff --git a/tests/od/Makefile.am b/tests/od/Makefile.am deleted file mode 100644 index 21396a9..0000000 --- a/tests/od/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -## Process this file with automake to produce Makefile.in -*-Makefile-*-. - -EXTRA_DIST = $(TESTS) - -TESTS_ENVIRONMENT = \ - top_srcdir=$(top_srcdir) \ - srcdir=$(srcdir) \ - PERL="$(PERL)" \ - CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \ - PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH" - -TESTS = od-N x8 diff --git a/tests/sha1sum/Makefile.am b/tests/sha1sum/Makefile.am deleted file mode 100644 index 920dd1a..0000000 --- a/tests/sha1sum/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -## Process this file with automake to produce Makefile.in -*-Makefile-*-. - -EXTRA_DIST = $(TESTS) - -TESTS_ENVIRONMENT = \ - top_srcdir=$(top_srcdir) \ - srcdir=$(srcdir) \ - PERL="$(PERL)" \ - CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \ - PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH" \ - PROG=sha1sum - -TESTS = basic-1 sample-vec diff --git a/tests/shred/Makefile.am b/tests/shred/Makefile.am deleted file mode 100644 index 190cc4b..0000000 --- a/tests/shred/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -## Process this file with automake to produce Makefile.in -*-Makefile-*-. - -EXTRA_DIST = $(TESTS) - -TESTS_ENVIRONMENT = \ - top_srcdir=$(top_srcdir) \ - srcdir=$(srcdir) \ - PERL="$(PERL)" \ - CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \ - PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH" - -TESTS = remove exact diff --git a/tests/stty/Makefile.am b/tests/stty/Makefile.am deleted file mode 100644 index b3c460e..0000000 --- a/tests/stty/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -## Process this file with automake to produce Makefile.in -*-Makefile-*-. -TESTS = invalid row-col-1 basic-1 -EXTRA_DIST = $(TESTS) -TESTS_ENVIRONMENT = \ - CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \ - PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH" -- 2.7.4