make sure test message strings are unique across all tests

This commit is contained in:
Michael Rash 2013-01-31 21:20:04 -05:00
parent c31c924a45
commit 6d233a9427

View File

@ -1802,7 +1802,7 @@ my @tests = (
{
'category' => 'Rijndael SPA',
'subcategory' => 'client+server',
'detail' => 'replay detection (Rijndael prefix)',
'detail' => 'detect replay #1 (Rijndael prefix)',
'err_msg' => 'could not detect replay attack',
'function' => \&replay_detection,
'pkt_prefix' => 'U2FsdGVkX1',
@ -2234,7 +2234,7 @@ my @tests = (
{
'category' => 'Rijndael SPA',
'subcategory' => 'client+server',
'detail' => 'replay detection (Rijndael prefix)',
'detail' => 'detect replay #2 (Rijndael prefix)',
'err_msg' => 'could not detect replay attack',
'function' => \&replay_detection,
'pkt_prefix' => 'U2FsdGVkX1',
@ -2647,7 +2647,7 @@ my @tests = (
{
'category' => 'GPG (no pw) SPA',
'subcategory' => 'client+server',
'detail' => 'replay detection (GnuPG prefix)',
'detail' => 'detect replay #1 (GnuPG prefix)',
'err_msg' => 'could not detect replay attack',
'function' => \&replay_detection,
'pkt_prefix' => 'hQ',
@ -2866,7 +2866,7 @@ my @tests = (
{
'category' => 'GnuPG (GPG) SPA',
'subcategory' => 'client+server',
'detail' => 'replay detection (GnuPG prefix)',
'detail' => 'detect replay #2 (GnuPG prefix)',
'err_msg' => 'could not detect replay attack',
'function' => \&replay_detection,
'pkt_prefix' => 'hQ',
@ -2879,7 +2879,7 @@ my @tests = (
{
'category' => 'GnuPG (GPG) SPA',
'subcategory' => 'client+server',
'detail' => 'replay detection (GnuPG prefix)',
'detail' => 'detect replay #3 (GnuPG prefix)',
'err_msg' => 'could not detect replay attack',
'function' => \&replay_detection,
'pkt_prefix' => 'hQ',
@ -6509,6 +6509,19 @@ sub init() {
}
}
### make sure test message strings are unique across all tests
my %uniq_test_msgs = ();
for my $test_hr (@tests) {
my $msg = "[$test_hr->{'category'}]";
$msg .= " [$test_hr->{'subcategory'}]" if $test_hr->{'subcategory'};
$msg .= " $test_hr->{'detail'}";
if (defined $uniq_test_msgs{$msg}) {
die "[*] Duplicate test message: $msg\n";
} else {
$uniq_test_msgs{$msg} = '';
}
}
### make sure no fwknopd instance is currently running
die "[*] Please stop the running fwknopd instance."
if &is_fwknopd_running();