From 71a53b5cc09481eb3c35b36d65dce6fabedeb4bf Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 11 Sep 2024 13:21:50 +0200 Subject: [PATCH] Fix test suites invoked in the wrong directory Running test suites from another directory only works when the auto-chdir code in host_test.function is enabled, which is platform-dependent and configuration-dependent. Signed-off-by: Gilles Peskine --- tests/scripts/run-test-suites.pl | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/scripts/run-test-suites.pl b/tests/scripts/run-test-suites.pl index 8274210e6f..7f20ae00ee 100755 --- a/tests/scripts/run-test-suites.pl +++ b/tests/scripts/run-test-suites.pl @@ -85,8 +85,11 @@ sub pad_print_center { for my $suite_path (@suites) { - my $suite = $suite_path; - $suite =~ s!.*/!!; + my ($dir, $suite) = ('.', $suite_path); + if ($suite =~ m!(.*)/([^/]*)!) { + $dir = $1; + $suite = $2; + } print "$suite ", "." x ( 72 - length($suite) - 2 - 4 ), " "; if( $suite =~ /$skip_re/o ) { print "SKIP\n"; @@ -94,7 +97,7 @@ for my $suite_path (@suites) next; } - my $command = "$prefix$suite_path"; + my $command = "cd $dir && $prefix$suite"; if( $verbose ) { $command .= ' -v'; }