summaryrefslogtreecommitdiff
path: root/test/run
diff options
context:
space:
mode:
Diffstat (limited to 'test/run')
-rwxr-xr-xtest/run15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/run b/test/run
index 562d2c4..4b1f8d0 100755
--- a/test/run
+++ b/test/run
@@ -70,8 +70,10 @@ if (isatty(fileno(STDOUT))) {
$FAILED = "\033[31m\033[1m" . $FAILED . "\033[m";
}
+# Export this dir to tests so they can access data files if needed.
+$ENV{"TESTDIR"} = abs_path(dirname($0));
# Add the current dir to PATH so we can find sort-getfattr-output and such.
-$ENV{"PATH"} = abs_path(dirname($0)) . ":$ENV{PATH}";
+$ENV{"PATH"} = $ENV{"TESTDIR"} . ":$ENV{PATH}";
# Add the parent dir to PATH so we can find the compiled tools.
$ENV{"PATH"} = dirname(abs_path(dirname($0))) . ":$ENV{PATH}";
$ENV{"TUSER"} = getpwuid($>);
@@ -87,6 +89,7 @@ if (!mkdir($tmpdir)) {
rmtree($tmpdir);
mkdir($tmpdir) or die "could not create $tmpdir";
}
+my $pretmpdir = getcwd();
chdir($tmpdir) or die "could not enter $tmpdir";
sub exec_test($$);
@@ -141,7 +144,7 @@ if (isatty(fileno(STDOUT))) {
print $status, "\n";
# Now clean up the testdir.
-chdir("..");
+chdir($pretmpdir);
rmtree($tmpdir);
exit $failed ? 1 : 0;
@@ -279,6 +282,14 @@ sub exec_test($$) {
return su($prog->[1]);
} elsif ($prog->[0] eq "sg") {
return sg($prog->[1]);
+ } elsif ($prog->[0] eq "require_root") {
+ my $ret = su("root");
+ if ($! != 0) {
+ print $ret->[0];
+ warn "required root failed; skipping test";
+ exit 77;
+ }
+ return [];
} elsif ($prog->[0] eq "export") {
my ($name, $value) = split /=/, $prog->[1];
# FIXME: need to evaluate $value, so that things like this will work: