on master help sign in
Make tests work with sandboxes
commit3078c0bc4711c98cec72e39e36686d8b0be47e8b authorMattias Lundell <capitrane@gmail.com> dateSun 30 Nov 2014, 00:49 (12 years ago) parent9d3ce13
1 file changed+17−1
test/runtest.pl+17−1
test/runtest.pl+17−1
@@ -2,17 +2,32 @@
22
33use strict;
44use Cwd;
5+use Cwd 'abs_path';
6+use Env;
57
68my $exitstatus = 0;
79my @idrOpts = ();
810
11+sub sandbox_path {
12+ my ($test_dir,) = @_;
13+ my $sandbox = abs_path("$test_dir/../../.cabal-sandbox/bin");
14+
15+ if ( -d $sandbox ) {
16+ return "PATH=$sandbox:$PATH";
17+ } else {
18+ return "";
19+ }
20+}
21+
922sub runtest {
1023 my ($test, $update) = @_;
1124
25+ my $sandbox = sandbox_path($test);
26+
1227 chdir($test);
1328
1429 print "Running $test...\n";
15− my $got = `./run @idrOpts`;
30+ my $got = `$sandbox ./run @idrOpts`;
1631 my $exp = `cat expected`;
1732
1833 open my $out, '>', 'output';
@@ -62,6 +77,7 @@ if ($#ARGV>=0) {
6277 }
6378 }
6479 @tests = sort @tests;
80+
6581 } elsif ($test eq "without") {
6682 @args = @ARGV;
6783 foreach my $file (@args) {