summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2013-06-14 20:52:09 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2013-06-14 20:52:09 +0000
commit257d8eba3e90c40c070f0e589930d0169b6bcf49 (patch)
treee66eb752f8016eadcdea4a5518ccd0e7e0372bcb
parent940dd845d50e19c3b8045b4bde0ca5f6f94e6437 (diff)
Add -T option to set the temp dir.
-rw-r--r--bin/ksh/tests/th27
1 files changed, 15 insertions, 12 deletions
diff --git a/bin/ksh/tests/th b/bin/ksh/tests/th
index 9fb3ef33b11..80318ca30d4 100644
--- a/bin/ksh/tests/th
+++ b/bin/ksh/tests/th
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $OpenBSD: th,v 1.15 2013/06/14 20:31:56 millert Exp $
+# $OpenBSD: th,v 1.16 2013/06/14 20:52:08 millert Exp $
#
@@ -146,6 +146,7 @@ Usage: $prog [-s test-set] [-C category] [-p prog] [-v] [-e e=v] test-name ...
-s s Read tests from file s; if s is a directory, it is recursively
scaned for test files (which end in .t).
-t t Use t as default time limit for tests (default is unlimited)
+ -T dir Use dir instead of /tmp to hold temporary files
-P program (-p) string has multiple words, and the program is in
the path (kludge option)
-v Verbose mode: print reason test failed.
@@ -191,16 +192,6 @@ EOF
"os:$os", '1'
);
-($fh, $temps) = mkstemp("/tmp/rts.XXXXXXXX");
-close($fh);
-($fh, $tempi) = mkstemp("/tmp/rti.XXXXXXXX");
-close($fh);
-($fh, $tempo) = mkstemp("/tmp/rto.XXXXXXXX");
-close($fh);
-($fh, $tempe) = mkstemp("/tmp/rte.XXXXXXXX");
-close($fh);
-$tempdir = mkdtemp("/tmp/rtd.XXXXXXXX");
-
$nfailed = 0;
$nxfailed = 0;
$npassed = 0;
@@ -208,7 +199,7 @@ $nxpassed = 0;
%known_tests = ();
-if (!getopts('C:p:Ps:t:ve:')) {
+if (!getopts('C:p:Ps:t:T:ve:')) {
print STDERR $Usage;
exit 1;
}
@@ -218,6 +209,7 @@ die "$prog: no test set specified (use -s)\n" if !defined $opt_s;
$test_prog = $opt_p;
$verbose = defined $opt_v && $opt_v;
$test_set = $opt_s;
+$temp_dir = $opt_T || "/tmp";
if (defined $opt_t) {
die "$prog: bad -t argument (should be number > 0): $opt_t\n"
if $opt_t !~ /^\d+$/ || $opt_t <= 0;
@@ -278,6 +270,17 @@ $SIG{'ALRM'} = 'catch_sigalrm';
$| = 1;
+# Create temp files
+($fh, $temps) = mkstemp("${temp_dir}/rts.XXXXXXXX");
+close($fh);
+($fh, $tempi) = mkstemp("${temp_dir}/rti.XXXXXXXX");
+close($fh);
+($fh, $tempo) = mkstemp("${temp_dir}/rto.XXXXXXXX");
+close($fh);
+($fh, $tempe) = mkstemp("${temp_dir}/rte.XXXXXXXX");
+close($fh);
+$tempdir = mkdtemp("${temp_dir}/rtd.XXXXXXXX");
+
if (-d $test_set) {
$file_prefix_skip = length($test_set) + 1;
$ret = &process_test_dir($test_set);