This defaults to tests/tmp, but we set it in autotest to a
test-specific value. We are going to use make to do parallel test
running, so they all need their own logfile.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
set testfile [lindex $argv 0]
-set tt tests/tmp
+switch -glob -- $testfile {
+ tests/*.at {
+ regsub {^tests/} $testfile {tests/tmp/} tt
+ regsub {\.at$} $tt {} tt
+ }
+ * {
+ set tt tests/tmp/[info pid]
+ }
+}
exec rm -rf $tt
-exec mkdir $tt
+file mkdir tests/tmp $tt
set pwd [pwd]
set env(HOME) $tt
set env(CAFTEST_CAF) $pwd
+set env(CAFTEST_TMP) $pwd/$tt
set env(TERM) vt100
set env(CAFTEST_NOSRCDUMP) 1
set env(LC_ALL) en_GB.utf-8
#use Carp::Always;
$SIG{__DIE__} = sub { Carp::confess(@_) };
-my $dump = "$ENV{'CAFTEST_CAF'}/tests/tmp";
+my $dump = $ENV{'CAFTEST_TMP'} // 'tests/tmp';
my $q = CGI->new;
#!/bin/sh
set -e
cd "$CAFTEST_CAF"
-exec 2>>tests/tmp/wrap.log
-export HTTP_COOKIE=$(cat "tests/tmp/cookie")
+: ${CAFTEST_TMP:=tests/tmp}
+export CAFTEST_TMP
+exec 2>>$CAFTEST_TMP/wrap.log
+export HTTP_COOKIE=$(cat "$CAFTEST_TMP/cookie")
export CAFTEST_URLBASE=file:///
tests/cgi "$@" | perl -pe '
next if m/^$/..0;
next unless m/Set-Cookie: (\w+=[^; ]+)/;
- my $cf = "tests/tmp/cookie";
+ my $cf = "$ENV{CAFTEST_TMP}/cookie";
open C, ">", "$cf.new" or die "$cf $!";
print C $1 or die $!;
close C or die $!;