[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[coreutils] [PATCH] tests: remove obsolete uses of "$$" in temporary fil
From: |
Jim Meyering |
Subject: |
[coreutils] [PATCH] tests: remove obsolete uses of "$$" in temporary file names |
Date: |
Fri, 28 Jan 2011 23:27:54 +0100 |
FYI, here's some clean-up I pushed along the way...
>From 68a734d66bbe72d5d4133c386fa77069dd77fb8c Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Fri, 28 Jan 2011 19:23:21 +0100
Subject: [PATCH] tests: remove obsolete uses of "$$" in temporary file names
Those were useful when tests might have been run in the same
directory and in parallel. Now, each test is run in a newly-
created empty directory.
* tests/cp/backup-1: Remove obsolete uses of "$$".
* tests/cp/same-file: Likewise.
* tests/dd/misc: Likewise.
* tests/mv/part-symlink: Likewise.
* tests/mv/to-symlink: Likewise.
* tests/touch/fail-diag: Likewise.
---
tests/cp/backup-1 | 4 +---
tests/cp/same-file | 9 +++------
tests/dd/misc | 8 ++++----
tests/mv/part-symlink | 9 +++------
tests/mv/to-symlink | 4 +---
tests/touch/fail-diag | 10 +++-------
6 files changed, 15 insertions(+), 29 deletions(-)
diff --git a/tests/cp/backup-1 b/tests/cp/backup-1
index a3ed9c3..34670bd 100755
--- a/tests/cp/backup-1
+++ b/tests/cp/backup-1
@@ -21,10 +21,8 @@
print_ver_ cp
suffix=.b
-file=b1.$$
+file=F
file_backup="$file$suffix"
-temp_files="$file $file_backup"
-rm -f $temp_files
echo test > $file || fail=1
diff --git a/tests/cp/same-file b/tests/cp/same-file
index 7bb605a..da4fce3 100755
--- a/tests/cp/same-file
+++ b/tests/cp/same-file
@@ -39,10 +39,7 @@ test $hard_link_to_symlink_does_the_deref = yes \
&& remove_these_sed='/^0 -[bf]*l .*sl1 ->/d' \
|| remove_these_sed='/^ELIDE NO TEST OUTPUT/d'
-actual=actual-$$
-expected=expected-$$
-
-exec 3>&1 1> $actual
+exec 3>&1 1> actual
# FIXME: This should be bigger: like more than 8k
contents=XYZ
@@ -130,7 +127,7 @@ for args in 'foo symlink' 'symlink foo' 'foo foo' 'sl1 sl2'
'foo hardlink'; do
echo
done
-cat <<\EOF | sed "$remove_these_sed" > $expected
+cat <<\EOF | sed "$remove_these_sed" > expected
1 [cp: `foo' and `symlink' are the same file] (foo symlink -> foo)
1 -d [cp: `foo' and `symlink' are the same file] (foo symlink -> foo)
1 -f [cp: `foo' and `symlink' are the same file] (foo symlink -> foo)
@@ -218,6 +215,6 @@ EOF
exec 1>&3 3>&-
-compare $expected $actual 1>&2 || fail=1
+compare expected actual 1>&2 || fail=1
Exit $fail
diff --git a/tests/dd/misc b/tests/dd/misc
index f6efde2..820984c 100755
--- a/tests/dd/misc
+++ b/tests/dd/misc
@@ -20,10 +20,10 @@
. "${srcdir=.}/init.sh"; path_prepend_ ../src
print_ver_ dd
-tmp_in=dd-in.$$
-tmp_in2=dd-in2.$$
-tmp_sym=dd-sym.$$
-tmp_out=dd-out.$$
+tmp_in=dd-in
+tmp_in2=dd-in2
+tmp_sym=dd-sym
+tmp_out=dd-out
warn=0
echo data > $tmp_in || framework_failure
diff --git a/tests/mv/part-symlink b/tests/mv/part-symlink
index de8ece0..ec523b8 100755
--- a/tests/mv/part-symlink
+++ b/tests/mv/part-symlink
@@ -45,10 +45,7 @@ pwd_tmp=`pwd`
# Exercise those four cases for each of
# cp and mv, with lots of combinations of options.
-actual=actual-$$
-expected=expected-$$
-
-exec 1> $actual
+exec 1> actual
# FIXME: This should be bigger: like more than 8k
contents=XYZ
@@ -153,7 +150,7 @@ done
test $fail = 1 &&
{ (exit 1); exit; }
-cat <<\EOF > $expected
+cat <<\EOF > expected
1 cp loc_reg rem_sl
[cp: `loc_reg' and `rem_sl' are the same file]
(loc_reg) (rem_sl -> dir/loc_reg)
@@ -259,6 +256,6 @@ cat <<\EOF > $expected
EOF
# Redirect to stderr, since stdout is already taken.
-compare $expected $actual 1>&2 || fail=1
+compare expected actual 1>&2 || fail=1
Exit $fail
diff --git a/tests/mv/to-symlink b/tests/mv/to-symlink
index ffc291c..600fde3 100755
--- a/tests/mv/to-symlink
+++ b/tests/mv/to-symlink
@@ -24,10 +24,8 @@ cleanup_() { rm -rf "$other_partition_tmpdir"; }
rem_file="$other_partition_tmpdir/file"
rem_symlink="$other_partition_tmpdir/symlink"
-file=to-sym-$$
+file=to-sym
-
-rm -f $file || framework_failure
echo local > $file || framework_failure
echo remote > $rem_file || framework_failure
ln -s $rem_file $rem_symlink || framework_failure
diff --git a/tests/touch/fail-diag b/tests/touch/fail-diag
index a4c81c6..a2613fe 100755
--- a/tests/touch/fail-diag
+++ b/tests/touch/fail-diag
@@ -20,15 +20,11 @@
print_ver_ touch
skip_if_root_
-d1=no-$$
-dir=/$d1/such-dir
-# Ensure that $d1 doesn't already exist.
-ls -d $d1 2> /dev/null && framework_failure
+file=/no-such-dir/file
-
-touch $dir > out 2>&1 && fail=1
+touch $file > out 2>&1 && fail=1
cat <<EOF > exp
-touch: cannot touch \`$dir': No such file or directory
+touch: cannot touch \`$file': No such file or directory
EOF
compare out exp || fail=1
--
1.7.3.5.44.g960a
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [coreutils] [PATCH] tests: remove obsolete uses of "$$" in temporary file names,
Jim Meyering <=