Skip to content

Commit

Permalink
[Test suite] rearranges processing of rerun-failed, handles options b…
Browse files Browse the repository at this point in the history
…etter
  • Loading branch information
jp-bennett committed May 30, 2016
1 parent b5db9c6 commit 8122e46
Showing 1 changed file with 86 additions and 89 deletions.
175 changes: 86 additions & 89 deletions test/test-fwknop.pl
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,92 @@

&usage() if $help;


our @last_logfile = ();

if ($rerun_failed_mode) {
unless (open (RE, "<", "test.log")) { # check for test.log
die "[*] Can't find test.log";
}
while (<RE>) {
push @last_logfile, $_;
}
close RE;
my $arg_line = "";
for my $line (@last_logfile) {
if ($line =~ /args:(.+)/) {
$arg_line = $1;
last;
}
}
unless ($arg_line) {
die "[*] Can't find arguments";
}
system("cp -f test.log test.log.bak");

my $ret = 0;
my $leftovers = "";
($ret, $leftovers) = GetOptionsFromString(
$arg_line,
'fwknop-path=s' => \$fwknopCmd,
'fwknopd-path=s' => \$fwknopdCmd,
'lib-dir=s' => \$lib_dir, ### for LD_LIBRARY_PATH
'loopback-intf=s' => \$loopback_intf,
'test-include=s' => \$test_include,
'include=s' => \$test_include, ### synonym
'test-exclude=s' => \$test_exclude,
'exclude=s' => \$test_exclude, ### synonym
'enable-perl-module-checks' => \$enable_perl_module_checks,
'enable-perl-module-pkt-generation' => \$enable_perl_module_fuzzing_spa_pkt_generation,
'enable-python-module-checks' => \$enable_python_module_checks,
'fuzzing-pkts-file=s' => \$fuzzing_pkts_file,
'fuzzing-pkts-append' => \$fuzzing_pkts_append,
'fuzzing-test-tag=s' => \$fuzzing_test_tag,
'fuzzing-class=s' => \$fuzzing_class,
'prefer-iptables' => \$prefer_iptables,
'enable-recompile-check' => \$enable_recompilation_warnings_check,
'enable-configure-args-checks' => \$enable_configure_args_checks,
'enable-profile-coverage-check' => \$enable_profile_coverage_check,
'enable-cores-pattern' => \$enable_cores_pattern_mode,
'enable-profile-coverage-init' => \$enable_profile_coverage_init,
'enable-ip-resolve' => \$enable_client_ip_resolve_test,
'enable-distcheck' => \$enable_make_distcheck,
'enable-dist-check' => \$enable_make_distcheck, ### synonym
'enable-openssl-checks' => \$enable_openssl_compatibility_tests,
'enable-cunit' => \$enable_cunit_tests,
'gdb-test=s' => \$gdb_test_file,
'List-mode' => \$list_mode,
'test-limit=i' => \$test_limit,
'enable-fault-injection' => \$enable_fault_injection,
'disable-fault-injection' => \$disable_fault_injection,
'enable-valgrind' => \$enable_valgrind,
'disable-valgrind' => \$disable_valgrind,
'valgrind-disable-suppressions' => \$valgrind_disable_suppressions,
'valgrind-disable-child-silent' => \$valgrind_disable_child_silent,
'enable-all' => \$enable_all,
'enable-complete' => \$enable_complete,
'enable-fuzzing-interfaces-tests' => \$enable_fuzzing_interfaces_tests,
'valgrind-path=s' => \$valgrind_path,
'valgrind-suppression-file' => \$valgrind_suppressions_file,
'enable-valgrind-gen-suppressions' => \$enable_valgrind_gen_suppressions,
### can set the following to "output.last/valgrind-coverage" if
### a full test suite run has already been executed with --enable-valgrind
'valgrind-prev-cov-dir=s' => \$previous_valgrind_coverage_dir,
'openssl-path=s' => \$openssl_path,
'fiu-run-path=s' => \$fiu_run_path,
'output-dir=s' => \$output_dir,
'cmd-verbose=s' => \$verbose_str,
'client-only-mode' => \$client_only_mode,
'server-only-mode' => \$server_only_mode,
'diff' => \$diff_mode,
'diff-dir1=s' => \$diff_dir1,
'diff-dir2=s' => \$diff_dir2
);

}



&os_fw_detect();

### main configuration file paths
Expand Down Expand Up @@ -632,95 +718,6 @@

our $lib_view_str = "LD_LIBRARY_PATH=$lib_dir";
our $libfko_bin = "$lib_dir/libfko.so"; ### this is usually a link
our @last_logfile = ();

if ($rerun_failed_mode) {
unless (open (RE, "<", "test.log")) { # check for test.log
die "[*] Can't find test.log";
}
while (<RE>) {
push @last_logfile, $_;
}
close RE;
my $arg_line = "";
for my $line (@last_logfile) {
if ($line =~ /args:(.+)/) {
$arg_line = $1;
last;
}
}
unless ($arg_line) {
die "[*] Can't find arguments";
}
system("cp -f test.log test.log.bak");

my $ret = 0;
my $leftovers = "";
($ret, $leftovers) = GetOptionsFromString(
$arg_line,
'fwknop-path=s' => \$fwknopCmd,
'fwknopd-path=s' => \$fwknopdCmd,
'lib-dir=s' => \$lib_dir, ### for LD_LIBRARY_PATH
'loopback-intf=s' => \$loopback_intf,
'test-include=s' => \$test_include,
'include=s' => \$test_include, ### synonym
'test-exclude=s' => \$test_exclude,
'exclude=s' => \$test_exclude, ### synonym
'enable-perl-module-checks' => \$enable_perl_module_checks,
'enable-perl-module-pkt-generation' => \$enable_perl_module_fuzzing_spa_pkt_generation,
'enable-python-module-checks' => \$enable_python_module_checks,
'fuzzing-pkts-file=s' => \$fuzzing_pkts_file,
'fuzzing-pkts-append' => \$fuzzing_pkts_append,
'fuzzing-test-tag=s' => \$fuzzing_test_tag,
'fuzzing-class=s' => \$fuzzing_class,
'prefer-iptables' => \$prefer_iptables,
'enable-recompile-check' => \$enable_recompilation_warnings_check,
'enable-configure-args-checks' => \$enable_configure_args_checks,
'enable-profile-coverage-check' => \$enable_profile_coverage_check,
'enable-cores-pattern' => \$enable_cores_pattern_mode,
'enable-profile-coverage-init' => \$enable_profile_coverage_init,
'enable-ip-resolve' => \$enable_client_ip_resolve_test,
'enable-distcheck' => \$enable_make_distcheck,
'enable-dist-check' => \$enable_make_distcheck, ### synonym
'enable-openssl-checks' => \$enable_openssl_compatibility_tests,
'enable-cunit' => \$enable_cunit_tests,
'gdb-test=s' => \$gdb_test_file,
'List-mode' => \$list_mode,
'test-limit=i' => \$test_limit,
'enable-fault-injection' => \$enable_fault_injection,
'disable-fault-injection' => \$disable_fault_injection,
'enable-valgrind' => \$enable_valgrind,
'disable-valgrind' => \$disable_valgrind,
'valgrind-disable-suppressions' => \$valgrind_disable_suppressions,
'valgrind-disable-child-silent' => \$valgrind_disable_child_silent,
'enable-all' => \$enable_all,
'enable-complete' => \$enable_complete,
'enable-fuzzing-interfaces-tests' => \$enable_fuzzing_interfaces_tests,
'valgrind-path=s' => \$valgrind_path,
'valgrind-suppression-file' => \$valgrind_suppressions_file,
'enable-valgrind-gen-suppressions' => \$enable_valgrind_gen_suppressions,
### can set the following to "output.last/valgrind-coverage" if
### a full test suite run has already been executed with --enable-valgrind
'valgrind-prev-cov-dir=s' => \$previous_valgrind_coverage_dir,
'openssl-path=s' => \$openssl_path,
'fiu-run-path=s' => \$fiu_run_path,
'output-dir=s' => \$output_dir,
'cmd-verbose=s' => \$verbose_str,
'client-only-mode' => \$client_only_mode,
'server-only-mode' => \$server_only_mode,
'diff' => \$diff_mode,
'diff-dir1=s' => \$diff_dir1,
'diff-dir2=s' => \$diff_dir2
);




# grab args:, split the args: off, use GetOptionsFromString()
# at this point, process as normal
#
}

if ($enable_all or $enable_complete) {
$enable_valgrind = 1;
$enable_recompilation_warnings_check = 1;
Expand Down

0 comments on commit 8122e46

Please sign in to comment.