From 74ffe86ed05cd6bab4b9d31d63cf94637f867c04 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 8 Sep 2007 09:22:49 +0200 Subject: Convert tests/install/, too. --- tests/install/Makefile.am | 2 ++ tests/install/basic-1 | 41 ++++++++++------------------------------- tests/install/create-leading | 13 +++---------- tests/install/d-slashdot | 16 ++-------------- tests/install/trap | 20 ++++---------------- 5 files changed, 21 insertions(+), 71 deletions(-) (limited to 'tests') diff --git a/tests/install/Makefile.am b/tests/install/Makefile.am index 5544d7d50..c97252dfe 100644 --- a/tests/install/Makefile.am +++ b/tests/install/Makefile.am @@ -5,3 +5,5 @@ TESTS_ENVIRONMENT = \ EXEEXT='$(EXEEXT)' \ CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \ PATH="$(VG_PATH_PREFIX)`pwd`/../../src$(PATH_SEPARATOR)$$PATH" + +include $(top_srcdir)/tests/check.mk diff --git a/tests/install/basic-1 b/tests/install/basic-1 index f413567e7..89d14d228 100755 --- a/tests/install/basic-1 +++ b/tests/install/basic-1 @@ -21,37 +21,16 @@ if test "$VERBOSE" = yes; then ginstall --version fi -# Make sure we get English translations. -LANGUAGE=C -export LANGUAGE -LC_ALL=C -export LC_ALL -LANG=C -export LANG - -. $srcdir/../envvar-check PRIV_CHECK_ARG=require-non-root . $srcdir/../priv-check +. $srcdir/../lang-default +. $srcdir/../test-lib.sh dir=dir file=file -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 - -rm -rf $dir $file || framework_failure=1 -mkdir -p $dir || framework_failure=1 -echo foo > $file || framework_failure=1 - -if test $framework_failure = 1; then - echo 'failure in testing framework' - exit 1 -fi +rm -rf $dir $file || framework_failure +mkdir -p $dir || framework_failure +echo foo > $file || framework_failure fail=0 ginstall $file $dir || fail=1 @@ -64,7 +43,7 @@ test -f $dir/$file || fail=1 dd=dd$EXEEXT dd2=dd2$EXEEXT -just_built_dd=$pwd/../../src/$dd +just_built_dd=$abs_top_builddir/src/$dd test -r "$just_built_dd" || \ { @@ -109,11 +88,11 @@ test -d newdir2 || fail=1 test -d newdir3 || fail=1 # This fails because mkdir-p.c's make_dir_parents fails to return to its -# initial working directory ($abs) after creating the first argument, and +# initial working directory ($iwd) after creating the first argument, and # hence cannot do anything meaningful with the following relative-named dirs. -abs=$pwd/$tmp +iwd=`pwd` mkdir sub || fail=1 -(cd sub && chmod 0 . && ginstall -d "$abs/xx/yy" rel/sub1 rel/sub2 2> /dev/null) && fail=1 +(cd sub && chmod 0 . && ginstall -d "$iwd/xx/yy" rel/sub1 rel/sub2 2> /dev/null) && fail=1 chmod 755 sub # Ensure that the first argument-dir has been created. @@ -131,7 +110,7 @@ test -d xx/rel && fail=1 if df --local . >/dev/null 2>&1; then mkdir -p sub1/d || fail=1 (cd sub1/d && chmod a-r . && chmod a-rx .. && - ginstall -d "$abs/xx/zz" rel/a rel/b) || fail=1 + ginstall -d "$iwd/xx/zz" rel/a rel/b) || fail=1 chmod 755 sub1 sub1/d || fail=1 test -d xx/zz || fail=1 test -d sub1/d/rel/a || fail=1 diff --git a/tests/install/create-leading b/tests/install/create-leading index e4441687c..c639dc554 100755 --- a/tests/install/create-leading +++ b/tests/install/create-leading @@ -1,7 +1,7 @@ #! /bin/sh # Test -D option. -# Copyright (C) 2000, 2001, 2006 Free Software Foundation, Inc. +# Copyright (C) 2000, 2001, 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,17 +24,10 @@ if test "$VERBOSE" = yes; then ginstall --version fi -. $srcdir/../envvar-check - -pwd=`pwd` -dir=install-D$$ - -trap 'cd "$pwd" && rm -rf $dir' 0 1 2 3 15 - -mkdir $dir +. $srcdir/../test-lib.sh fail=0 -cd $dir + file=file echo foo > $file diff --git a/tests/install/d-slashdot b/tests/install/d-slashdot index 1e3ef245c..eb2a9146c 100755 --- a/tests/install/d-slashdot +++ b/tests/install/d-slashdot @@ -1,7 +1,7 @@ #!/bin/sh # Ensure that ginstall -d works with arguments specified with a trailing "/.". -# 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,19 +21,7 @@ if test "$VERBOSE" = yes; then install --version fi -pwd=`pwd` -tmp=`echo "$0"|sed 's,.*/,,'`.tmp -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/install/trap b/tests/install/trap index 12e3b5f86..a4f9fa868 100755 --- a/tests/install/trap +++ b/tests/install/trap @@ -2,7 +2,7 @@ # Ensure that `install -s' doesn't infloop when its parent # process traps CHLD signal. -# Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. +# Copyright (C) 2004-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,29 +22,17 @@ if test "$VERBOSE" = yes; then ginstall --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 # Use a subshell and an exec to work around a bug in FreeBSD 5.0 /bin/sh. ( # ash doesn't support "trap '' CHLD"; it knows only signal numbers. - sig=`"$pwd/../../src/kill" -l CHLD 2>/dev/null` && trap '' $sig + sig=`"$abs_top_builddir/src/kill" -l CHLD 2>/dev/null` && trap '' $sig # Before 2004-04-21, install would infloop, in the `while (wait...' loop: - exec ginstall -s "$pwd/../../src/ginstall$EXEEXT" . + exec ginstall -s "$abs_top_builddir/src/ginstall$EXEEXT" . ) (exit $fail); exit $fail -- cgit v1.2.3-54-g00ecf