implementation delta-testing, test suite refactor

This commit is contained in:
Doug Hoyte 2023-09-15 00:00:21 -04:00
parent c3466fc040
commit 22354e0f84
2 changed files with 50 additions and 12 deletions

View File

@ -101,6 +101,7 @@ my $totalDown = 0;
while (1) {
my $msg = <$outfile1>;
chomp $msg;
print "[1]: $msg\n" if $ENV{DEBUG};
if ($msg =~ /^(have|need),(\w+)/) {
@ -115,8 +116,9 @@ while (1) {
}
next;
} elsif ($msg =~ /^msg,(\w+)/) {
} elsif ($msg =~ /^msg,(\w*)/) {
my $data = $1;
print "DELTATRACE1 $data\n" if $ENV{DELTATRACE};
print $infile2 "msg,$data\n";
my $bytes = length($data) / 2;
@ -133,6 +135,7 @@ while (1) {
if ($msg =~ /^msg,(\w*)/) {
my $data = $1;
print "DELTATRACE2 $data\n" if $ENV{DELTATRACE};
print $infile1 "msg,$data\n";
my $bytes = length($data) / 2;

View File

@ -6,23 +6,58 @@ unlink("negent-test.log");
my $langs = shift // 'cpp,js';
my @langs = split /,/, $langs;
foreach my $lang1 (split /,/, $langs) {
foreach my $lang2 (split /,/, $langs) {
note("------LANG $lang1 / $lang2 ------");
## Compat tests (verify langs are compatible with eachother)
note("Full upload");
run("RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=1 P2=0 P3=0 perl fuzz.pl $lang1 $lang2");
{
my $allOpts = [
'RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=1 P2=0 P3=0',
'RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=0 P2=1 P3=0',
'RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=0 P2=0 P3=1',
'RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=1 P2=1 P3=5',
];
note("Full download");
run("RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=0 P2=1 P3=0 perl fuzz.pl $lang1 $lang2");
foreach my $lang1 (@langs) {
foreach my $lang2 (@langs) {
foreach my $opts (@$allOpts) {
note("------ INTEROP $lang1 / $lang2 : $opts ------");
run("$opts perl fuzz.pl $lang1 $lang2");
}
}
}
}
note("Identical DBs");
run("RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=0 P2=0 P3=1 perl fuzz.pl $lang1 $lang2");
note("Mixed");
run("RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=1 P2=1 P3=5 perl fuzz.pl $lang1 $lang2");
## Delta tests (ensure output from all langs are byte-for-byte identical)
if (@langs >= 2) {
my @otherLangs = @langs;
my $firstLang = shift @otherLangs;
my $allOpts = [
'RECS=10000 P1=1 P2=0 P3=0',
'RECS=10000 P1=0 P2=1 P3=0',
'RECS=10000 P1=0 P2=0 P3=1',
'RECS=10000 P1=1 P2=1 P3=10',
'RECS=100000 FRAMESIZELIMIT1=60000 FRAMESIZELIMIT2=500000 P1=1 P2=1 P3=10',
'RECS=200000 FRAMESIZELIMIT1=30000 FRAMESIZELIMIT2=200000 P1=1 P2=1 P3=10',
];
foreach my $opts (@$allOpts) {
foreach my $lang (@otherLangs) {
note("------- DELTA $firstLang / $lang : $opts ------");
my $res = system(
"/bin/bash",
"-c",
qq{diff -u <(DELTATRACE=1 $opts perl fuzz.pl $firstLang $firstLang | grep DELTATRACE) <(DELTATRACE=1 $opts perl fuzz.pl $lang $lang | grep DELTATRACE)},
);
die "Difference detected between $firstLang / $lang" if $res;
}
}
}