Skip to content

Commit d0605a4

Browse files
committed
For -internal mode, if format has internal mask, test it
We do this by dropping last letter of wordlist and add -mask=?w?a See #23
1 parent dc70f20 commit d0605a4

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

jtrts.pl

+17-6
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
if (defined $opts{internal} && $opts{internal} > 0) { doInternalMode(); unlink_restore(); }
6969
if (defined $opts{restore} && $opts{restore} > 0) { doRestoreMode(); unlink_restore(); }
7070
filterPatterns();
71-
process(0);
71+
process(0, 0);
7272
cleanup();
7373
unlink_restore();
7474
displaySummary();
@@ -854,7 +854,7 @@ sub exit_cause {
854854
}
855855

856856
sub process {
857-
my $skip = shift(@_);
857+
my ($skip, $int_mask) = @_;
858858
my $pot = "tst-.pot";
859859
my $pot_opt = "";
860860
my $line_num = 0;
@@ -895,6 +895,9 @@ sub process {
895895
$dict_name = "--incremental=" . substr($ar[5],10);
896896
} else {
897897
$dict_name = "--wordlist=$ar[5].dic";
898+
if ($int_mask) {
899+
$dict_name .= " --mask=?w?a";
900+
}
898901
}
899902
my $cmd = "$cmd_head $ar[6]";
900903
unless (-e $ar[6]) { next LINE; }
@@ -1300,7 +1303,7 @@ sub is_hash_salted {
13001303
return $details[11] > 0;
13011304
}
13021305
sub build_self_test_files {
1303-
my $type = $_[0];
1306+
my ($type, $int_mask) = @_;
13041307
my $cnt = 0;
13051308
my $mangle = does_hash_split_unifies_case($type);
13061309
my $cmd = "$JOHN_EXE -format=$type -list=format-tests $show_pass_thru 2>/dev/null";
@@ -1319,7 +1322,13 @@ sub build_self_test_files {
13191322
if (scalar (@dtls) >= 3) {
13201323
if ($dtls[2] !~ m/:/) { $dtls[2] = "vec_" . $dtls[1] . ":" . $dtls[2]; }
13211324
print FILE1 $dtls[2]."\n";
1322-
if (defined $dtls[3]) { print FILE2 $dtls[3]; }
1325+
if (defined $dtls[3]) {
1326+
if ($int_mask) {
1327+
print FILE2 substr($dtls[3], 0, -1);
1328+
} else {
1329+
print FILE2 $dtls[3];
1330+
}
1331+
}
13231332
print FILE2 "\n";
13241333
if ($cnt < 3) {
13251334
print FILE2 "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234\n";
@@ -1404,8 +1413,10 @@ sub doInternalMode {
14041413
if (scalar(@match) == 0) { $doit = 0; }
14051414

14061415
if ($doit == 1) {
1416+
my $int_mask = `$JOHN_EXE --format=$type $show_pass_thru --list=format-all-details 2>/dev/null | grep "Internal mask generation"`;
1417+
$int_mask = (defined $int_mask && $int_mask =~ m/yes/i) ? 1 : 0;
14071418
# first, build our dictionary/input files
1408-
my $cnt = build_self_test_files($type);
1419+
my $cnt = build_self_test_files($type, $int_mask);
14091420
# build the @tstdata array with 1 element
14101421
if (does_hash_split_unifies_case($type)) {
14111422
my $cnt3 = $cnt*3;
@@ -1415,7 +1426,7 @@ sub doInternalMode {
14151426
}
14161427
ScreenOutV("Preparing to run internal for type: $type\n");
14171428
ScreenOutV("tstdata = @tstdata\n\n");
1418-
process(1);
1429+
process(1, $int_mask);
14191430
}
14201431
}
14211432

0 commit comments

Comments
 (0)