Skip to content

Commit

Permalink
[test suite] bug fix - the current test file has an absolute path
Browse files Browse the repository at this point in the history
  • Loading branch information
mrash committed Jun 11, 2023
1 parent b34e9d8 commit 3600552
Showing 1 changed file with 22 additions and 25 deletions.
47 changes: 22 additions & 25 deletions test/test-fwknop.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,6 @@
die "[*] Please stop the running fwknopd instance."
if &global_fwknopd_pgrep_check();


if ($rerun_failed_mode) {
my $test_num = 0;
my $test_category = "";
Expand Down Expand Up @@ -1180,8 +1179,7 @@
&logr($line);
}
}

exit 0;
exit 0;
}

### now that we're ready to run, preserve any previous test
Expand Down Expand Up @@ -1657,30 +1655,30 @@ ()
for my $file ('Makefile-m32', 'Makefile') {
$rv = 1;
unless (&run_cmd("make -f $file clean", "../$cmd_out_tmp",
"../$curr_test_file")) {
$curr_test_file)) {
$rv = 0;
next;
}
if ($sudo_path) {
unless (&run_cmd("$sudo_path -u $username make -f $file",
"../$cmd_out_tmp", "../$curr_test_file")) {
"../$cmd_out_tmp", $curr_test_file)) {
unless (&run_cmd("make -f $file", "../$cmd_out_tmp",
"../$curr_test_file")) {
$curr_test_file)) {
$rv = 0;
next;
}
}
} else {
unless (&run_cmd("make -f $file", "../$cmd_out_tmp",
"../$curr_test_file")) {
$curr_test_file)) {
$rv = 0;
next;
}
}
if ($rv) {
&run_cmd('./a.out', "../$cmd_out_tmp", "../$curr_test_file");
&run_cmd('./a.out', "../$cmd_out_tmp", $curr_test_file);
chdir '..' or die $!;
if (&is_sanitizer_crash($curr_test_file)) {
chdir $asan_dir or die $!;
Expand All @@ -1707,7 +1705,7 @@ ()
### look for compilation warnings - something like:
### warning: ‘test’ is used uninitialized in this function
if (&file_find_regex([qr/\swarning:\s/i, qr/gcc\:.*\sunused/],
$MATCH_ANY, $APPEND_RESULTS, "test/$curr_test_file")) {
$MATCH_ANY, $APPEND_RESULTS, $curr_test_file)) {
chdir $curr_pwd or die $!;
return 0;
}
Expand Down Expand Up @@ -1916,14 +1914,14 @@ ()
for (my $i=0; $i < $iterations; $i++) {
&run_cmd("$lib_path $fiu_run_path -x " .
"-c '$test_hr->{'fiu_injection_style'}' $test_hr->{'wrapper_binary'}",
"../$cmd_out_tmp", "../$curr_test_file");
"../$cmd_out_tmp", $curr_test_file);
}
} else {
&run_cmd("./$test_hr->{'wrapper_script'} $test_hr->{'wrapper_binary'}",
"../$cmd_out_tmp", "../$curr_test_file");
"../$cmd_out_tmp", $curr_test_file);
if ($test_hr->{'wrapper_script'} =~ /valgrind/) {
$rv = 0 unless &valgrind_results("../$curr_test_file");
$rv = 0 unless &valgrind_results($curr_test_file);
}
}
Expand Down Expand Up @@ -2083,21 +2081,21 @@ ()
my $rv = 1;
&run_cmd('make clean', $cmd_out_tmp, "test/$curr_test_file");
&run_cmd('make clean', $cmd_out_tmp, $curr_test_file);
if ($config_cmd) {
&run_cmd($config_cmd, $cmd_out_tmp, "test/$curr_test_file");
&run_cmd($config_cmd, $cmd_out_tmp, $curr_test_file);
}
if ($sudo_path) {
unless (&run_cmd("$sudo_path -u $username make",
$cmd_out_tmp, "test/$curr_test_file")) {
$cmd_out_tmp, $curr_test_file)) {
$rv = 0 unless &run_cmd('make', $cmd_out_tmp,
"test/$curr_test_file");
$curr_test_file);
}
} else {
$rv = 0 unless &run_cmd('make', $cmd_out_tmp,
"test/$curr_test_file");
$curr_test_file);
}
unless ($rv) {
Expand All @@ -2121,7 +2119,7 @@ ()
unless (&config_recompile($orig_config_args)) {
&write_test_file("[-] configure/recompile failure.\n",
"test/$curr_test_file");
$curr_test_file);
chdir $curr_pwd or die $!;
$rv = 0;
}
Expand All @@ -2140,7 +2138,7 @@ ()
unless (&config_recompile('./extras/apparmor/configure_args.sh --disable-execvp')) {
&write_test_file("[-] configure/recompile failure.\n",
"test/$curr_test_file");
$curr_test_file);
chdir $curr_pwd or die $!;
$rv = 0;
}
Expand All @@ -2159,7 +2157,7 @@ ()
unless (&config_recompile('./extras/apparmor/configure_args.sh --enable-udp-server')) {
&write_test_file("[-] configure/recompile failure.\n",
"test/$curr_test_file");
$curr_test_file);
$rv = 0;
}
Expand Down Expand Up @@ -8085,8 +8083,7 @@ ()
chdir $fko_wrapper_dir or die $!;

### 'make clean' as root
unless (&run_cmd('make clean', "../$cmd_out_tmp",
"../$curr_test_file")) {
unless (&run_cmd('make clean', $cmd_out_tmp, $curr_test_file)) {
chdir '..' or die $!;
return 0;
}
Expand All @@ -8096,9 +8093,9 @@ ()

if ($sudo_path) {
unless (&run_cmd("$sudo_path -u $username $make_str",
"../$cmd_out_tmp", "../$curr_test_file")) {
"../$cmd_out_tmp", $curr_test_file)) {
unless (&run_cmd($make_str, "../$cmd_out_tmp",
"../$curr_test_file")) {
$curr_test_file)) {
chdir '..' or die $!;
return 0;
}
Expand All @@ -8107,7 +8104,7 @@ ()
} else {

unless (&run_cmd($make_str, "../$cmd_out_tmp",
"../$curr_test_file")) {
$curr_test_file)) {
chdir '..' or die $!;
return 0;
}
Expand Down

0 comments on commit 3600552

Please sign in to comment.