3 # Run each of the shell tests, capturing the output, and reporting passed
9 # Place to put test output to avoid cluttering test/
10 mkdir 'test_output', 0750;
12 # Override the users default .darcs settings
15 system 'echo ALL --ignore-times >> .darcs/defaults';
16 # Used for finding darcs, but may not be defined by the shell
19 # Put the right darcs first in PATH
20 my $darcspath="$ENV{HOME}/..";
22 # User has asked for a particular darcs...
23 my $actualdarcs=`which $ENV{DARCS}`;
24 my $darcspath=`dirname "$actualdarcs"`;
26 $ENV{PATH
} = "$darcspath:$ENV{PATH}";
28 # Some environment variables can act as defaults that we don't want
29 $ENV{EMAIL
} = $ENV{DARCS_EMAIL
} = 'tester';
31 # These two environment variables will turn off darcs' "Christmas mode".
32 # It will make the tests run a tad faster, and make darcs' output
33 # independent of the testing systems locale and environment.
34 $ENV{DARCS_DONT_COLOR
} = 1;
35 $ENV{DARCS_DONT_ESCAPE_ANYTHING
} = 1;
43 die "You need bash to run the shell tests!"
46 for my $test (@ARGV) {
47 my $test_out = "test_output/$test.out";
49 printf "Running %-40s", "$test ...";
51 my $output = `bash $test 2>&1`;
59 push @Failures, $test;
62 print "Output from failed $test:\n$output";
64 # give ourselves write permissions to every file in a tmp dir
65 # (in case a script sets permissions and fails to clean up
67 my @tmpdirs = glob("tmp* temp*");
69 find
(sub { chmod 0755, $_; }, @tmpdirs);
74 if ($CWD =~ /bugs/ && $#Passes >= 0) {
75 print "Some tests passed:\n";
76 print "\t$_\n" for @Passes;
79 print "All tests successful!\n";
82 print "TESTS FAILED!\n";
83 print "\t$_\n" for @Failures;
86 # Exit with non-zero if anything failed.