2023-03-10 12:19:11 -05:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
2023-08-12 00:04:38 -04:00
|
|
|
use strict;
|
2023-03-10 12:19:11 -05:00
|
|
|
|
2023-08-12 00:04:38 -04:00
|
|
|
unlink("negent-test.log");
|
2023-03-10 12:19:11 -05:00
|
|
|
|
|
|
|
|
|
2023-09-02 04:49:54 -04:00
|
|
|
my $langs = shift // 'cpp,js';
|
2023-09-15 00:00:21 -04:00
|
|
|
my @langs = split /,/, $langs;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Compat tests (verify langs are compatible with eachother)
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
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',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
foreach my $lang1 (@langs) {
|
|
|
|
|
foreach my $lang2 (@langs) {
|
|
|
|
|
foreach my $opts (@$allOpts) {
|
|
|
|
|
note("------ INTEROP $lang1 / $lang2 : $opts ------");
|
|
|
|
|
run("$opts perl fuzz.pl $lang1 $lang2");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Delta tests (ensure output from all langs are byte-for-byte identical)
|
2023-03-10 12:19:11 -05:00
|
|
|
|
2023-09-15 00:00:21 -04:00
|
|
|
if (@langs >= 2) {
|
|
|
|
|
my @otherLangs = @langs;
|
|
|
|
|
my $firstLang = shift @otherLangs;
|
2023-06-11 14:37:51 -04:00
|
|
|
|
2023-09-15 00:00:21 -04:00
|
|
|
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',
|
2023-03-10 12:19:11 -05:00
|
|
|
|
2023-09-15 00:00:21 -04:00
|
|
|
'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',
|
|
|
|
|
];
|
2023-09-02 04:49:54 -04:00
|
|
|
|
2023-09-15 00:00:21 -04:00
|
|
|
foreach my $opts (@$allOpts) {
|
|
|
|
|
foreach my $lang (@otherLangs) {
|
|
|
|
|
note("------- DELTA $firstLang / $lang : $opts ------");
|
2023-09-02 04:49:54 -04:00
|
|
|
|
2023-09-15 00:00:21 -04:00
|
|
|
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)},
|
|
|
|
|
);
|
2023-09-02 04:49:54 -04:00
|
|
|
|
2023-09-15 00:00:21 -04:00
|
|
|
die "Difference detected between $firstLang / $lang" if $res;
|
|
|
|
|
}
|
2023-09-02 06:41:17 -04:00
|
|
|
}
|
2023-09-02 04:49:54 -04:00
|
|
|
}
|
2023-03-10 12:19:11 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-16 22:51:22 -04:00
|
|
|
## Protocol upgrade tests
|
|
|
|
|
|
|
|
|
|
foreach my $lang (@langs) {
|
|
|
|
|
note("------- PROTO UPGRADE $lang -------");
|
|
|
|
|
run("perl protoversion.pl $lang");
|
|
|
|
|
}
|
|
|
|
|
|
2023-03-10 12:19:11 -05:00
|
|
|
|
|
|
|
|
|
2023-08-12 00:04:38 -04:00
|
|
|
########
|
2023-03-10 12:19:11 -05:00
|
|
|
|
2023-08-12 00:04:38 -04:00
|
|
|
sub run {
|
|
|
|
|
my $cmd = shift;
|
2023-03-10 12:19:11 -05:00
|
|
|
|
2023-08-12 00:04:38 -04:00
|
|
|
print "RUN: $cmd\n";
|
2023-03-10 12:19:11 -05:00
|
|
|
|
2023-08-12 00:04:38 -04:00
|
|
|
system("echo 'RUN: $cmd' >>negent-test.log");
|
|
|
|
|
system("$cmd >>negent-test.log 2>&1") && die "test failure";
|
|
|
|
|
system("echo '----------' >>negent-test.log");
|
2023-03-10 12:19:11 -05:00
|
|
|
}
|
|
|
|
|
|
2023-08-12 00:04:38 -04:00
|
|
|
sub note {
|
|
|
|
|
my $note = shift;
|
|
|
|
|
|
|
|
|
|
print "NOTE: $note\n";
|
2023-03-10 12:19:11 -05:00
|
|
|
|
2023-08-12 00:04:38 -04:00
|
|
|
system("echo 'NOTE: $note' >>negent-test.log");
|
2023-03-10 12:19:11 -05:00
|
|
|
}
|