[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser-bundle-testsuite][main] Bug 40122: Remove TBBTestSuite::TestSuite::BrowserUnitTests



Title: GitLab

boklm pushed to branch main at The Tor Project / Applications / tor-browser-bundle-testsuite

Commits:

  • b8c0aa67
    by Nicolas Vigier at 2026-10-09T15:43:21+02:00
    Bug 40122: Remove TBBTestSuite::TestSuite::BrowserUnitTests
    

16 changed files:

Changes:

  • TBBTestSuite/BrowserGit.pm deleted
    1
    -package TBBTestSuite::BrowserGit;
    
    2
    -
    
    3
    -use strict;
    
    4
    -use FindBin;
    
    5
    -use TBBTestSuite::Common qw(exit_error);
    
    6
    -use Cwd qw(getcwd);
    
    7
    -use IO::CaptureOutput qw(capture_exec);
    
    8
    -
    
    9
    -# TODO: We should merge this into GitRepo.pm
    
    10
    -
    
    11
    -our (@ISA, @EXPORT_OK);
    
    12
    -BEGIN {
    
    13
    -    require Exporter;
    
    14
    -    @ISA       = qw(Exporter);
    
    15
    -    @EXPORT_OK = qw(git_clone_fetch get_commits_by_branch parent_commit
    
    16
    -                    git_cmd git_cmd_ch);
    
    17
    -}
    
    18
    -
    
    19
    -my $torbrowsergit = 'https://git.torproject.org/tor-browser.git';
    
    20
    -my $geckodevgit = 'https://github.com/mozilla/gecko-dev';
    
    21
    -our $clone_dir = "$FindBin::Bin/clones/tor-browser";
    
    22
    -
    
    23
    -sub git_cmd {
    
    24
    -    my $oldcwd = getcwd;
    
    25
    -    chdir $clone_dir || exit_error "Error entering directory $clone_dir";
    
    26
    -    my @res = capture_exec(@_);
    
    27
    -    chdir $oldcwd;
    
    28
    -    if (!$res[2]) {
    
    29
    -        exit_error 'Error running ' . join(' ', @_) . ":\n" . $res[1];
    
    30
    -    }
    
    31
    -    return @res;
    
    32
    -}
    
    33
    -
    
    34
    -sub git_cmd_ch {
    
    35
    -    my (@res) = git_cmd(@_);
    
    36
    -    chomp @res;
    
    37
    -    chomp @res;
    
    38
    -    return @res;
    
    39
    -}
    
    40
    -
    
    41
    -sub git_clone_fetch {
    
    42
    -    mkdir "$FindBin::Bin/clones" unless -d "$FindBin::Bin/clones";
    
    43
    -    if (!-d $clone_dir) {
    
    44
    -        system('git', 'clone', $torbrowsergit, $clone_dir) == 0
    
    45
    -                || exit_error "Error cloning $torbrowsergit";
    
    46
    -    }
    
    47
    -    git_cmd('git', 'checkout', '--detach', '-f');
    
    48
    -    git_cmd('git', 'fetch', 'origin', '+refs/heads/*:refs/heads/*');
    
    49
    -    my ($r) = git_cmd('git', 'remote');
    
    50
    -    git_cmd('git', 'remote', 'add', 'gecko-dev', $geckodevgit)
    
    51
    -        unless $r =~ m/^gecko-dev$/m;
    
    52
    -    git_cmd('git', 'fetch', 'gecko-dev');
    
    53
    -}
    
    54
    -
    
    55
    -sub merge_base {
    
    56
    -    my ($commit_a, $commit_b) = @_;
    
    57
    -    my ($out) = git_cmd_ch('git', 'merge-base', $commit_a, $commit_b);
    
    58
    -    return $out;
    
    59
    -}
    
    60
    -
    
    61
    -sub parent_commits {
    
    62
    -    my ($c) = @_;
    
    63
    -    my ($out) = git_cmd_ch('git', 'show', '-s', '--abbrev=20', '--format=%p', $c);
    
    64
    -    return split(' ', $out);
    
    65
    -}
    
    66
    -
    
    67
    -sub get_commits {
    
    68
    -    my ($commit, $commit_stop) = @_;
    
    69
    -    my ($out) = git_cmd_ch('git', 'rev-list', '--topo-order',
    
    70
    -                           "$commit_stop^..$commit");
    
    71
    -    return split "\n", $out;
    
    72
    -}
    
    73
    -
    
    74
    -sub get_commits_by_branch {
    
    75
    -    my ($tb_branch, $esr_branch) = @_;
    
    76
    -    my $base = merge_base($tb_branch, "gecko-dev/$esr_branch");
    
    77
    -    my ($commit) = git_cmd_ch('git', 'show', '-s', '--format=%H',
    
    78
    -                              "$tb_branch^{commit}");
    
    79
    -    return get_commits($commit, $base);
    
    80
    -}
    
    81
    -
    
    82
    -1;

  • TBBTestSuite/TestSuite/BrowserUnitTests.pm deleted
    1
    -package TBBTestSuite::TestSuite::BrowserUnitTests;
    
    2
    -
    
    3
    -use strict;
    
    4
    -
    
    5
    -use parent 'TBBTestSuite::TestSuite';
    
    6
    -
    
    7
    -use FindBin;
    
    8
    -use IO::CaptureOutput qw(capture_exec);
    
    9
    -use File::Spec;
    
    10
    -use File::Find;
    
    11
    -use File::Copy;
    
    12
    -use File::Slurp;
    
    13
    -use XML::LibXML '1.70';
    
    14
    -use JSON;
    
    15
    -use TBBTestSuite::Common qw(exit_error get_nbcpu run_to_file);
    
    16
    -use TBBTestSuite::Reports qw(load_report);
    
    17
    -use TBBTestSuite::Options qw($options);
    
    18
    -use TBBTestSuite::XServer qw(start_X stop_X set_Xmode);
    
    19
    -use TBBTestSuite::GitRepo;
    
    20
    -
    
    21
    -sub test_types {
    
    22
    -    return {
    
    23
    -        xpcshell => \&xpcshell_test,
    
    24
    -        mochitest_plain => sub { mochitest_test('mochitest-plain', @_) },
    
    25
    -        mochitest_chrome => sub { mochitest_test('mochitest-chrome', @_) },
    
    26
    -        mochitest_browser => sub { mochitest_test('mochitest-browser', @_) },
    
    27
    -        mochitest_a11y => sub { mochitest_test('mochitest-a11y', @_) },
    
    28
    -        build_firefox => \&build_firefox,
    
    29
    -    };
    
    30
    -}
    
    31
    -
    
    32
    -sub description {
    
    33
    -    'Tor Browser unit tests';
    
    34
    -}
    
    35
    -
    
    36
    -sub type {
    
    37
    -    'browserunit';
    
    38
    -}
    
    39
    -
    
    40
    -sub new {
    
    41
    -    my ($ts, $infos) = @_;
    
    42
    -    return undef unless $infos->{commit};
    
    43
    -    my $tbbinfos = {
    
    44
    -        git_url => 'https://git.torproject.org/tor-browser.git',
    
    45
    -        %$infos,
    
    46
    -        type => $ts->type(),
    
    47
    -        filename => "browser-$infos->{commit}",
    
    48
    -        tests => [
    
    49
    -            {
    
    50
    -                name => 'build_firefox',
    
    51
    -                type => 'build_firefox',
    
    52
    -                fail_type => 'fatal',
    
    53
    -                descr => 'Build Firefox',
    
    54
    -            },
    
    55
    -        ],
    
    56
    -    };
    
    57
    -    bless $tbbinfos, $ts;
    
    58
    -    $tbbinfos->{gitrepo} = TBBTestSuite::GitRepo->new({
    
    59
    -            name => 'tor-browser',
    
    60
    -            git_url => $tbbinfos->{git_url},
    
    61
    -        });
    
    62
    -    $tbbinfos->{gitrepo}->clone_fetch;
    
    63
    -    chdir $tbbinfos->{gitrepo}->clone_dir;
    
    64
    -    my ($commit, $err, $success) = capture_exec('git', 'show', '-s',
    
    65
    -        '--abbrev=20', '--format=%h', $tbbinfos->{commit});
    
    66
    -    return undef unless $success;
    
    67
    -    while (chomp $commit) {};
    
    68
    -    $tbbinfos->{commit} = $commit;
    
    69
    -    $tbbinfos->{filename} = $tbbinfos->name;
    
    70
    -    return $tbbinfos;
    
    71
    -}
    
    72
    -
    
    73
    -sub name {
    
    74
    -    my ($testsuite) = @_;
    
    75
    -    return $testsuite->{name} // "browser-$testsuite->{commit}";
    
    76
    -}
    
    77
    -
    
    78
    -sub pre_tests {
    
    79
    -    my ($tbbinfos) = @_;
    
    80
    -    chdir $tbbinfos->{gitrepo}->clone_dir;
    
    81
    -    if ($options->{clean_browserdir}) {
    
    82
    -        system('git', 'clean', '-fxd');
    
    83
    -        system('git', 'reset', '--hard');
    
    84
    -    }
    
    85
    -    system('git', 'checkout', $tbbinfos->{commit}) == 0
    
    86
    -        or exit_error "Error checking out $tbbinfos->{commit}";
    
    87
    -    my ($out, $err, $success) = capture_exec('git', 'show', '-s',
    
    88
    -        '--abbrev=20', '--format=%p', $tbbinfos->{commit});
    
    89
    -    exit_error "Error checking parents of $tbbinfos->{commit}" unless $success;
    
    90
    -    $tbbinfos->{parent_commits} = [ split(' ', $out) ];
    
    91
    -    ($out, $err, $success) = capture_exec('git', 'show', '-s',
    
    92
    -        '--format=%s', $tbbinfos->{commit});
    
    93
    -    exit_error "Error getting commit subject" unless $success;
    
    94
    -    $tbbinfos->{commit_subject} = $out;
    
    95
    -    ($out, $err, $success) = capture_exec('git', 'show', '-s',
    
    96
    -        '--format=%an', $tbbinfos->{commit});
    
    97
    -    exit_error "Error getting commit author" unless $success;
    
    98
    -    $tbbinfos->{commit_author} = $out;
    
    99
    -    $tbbinfos->find_xpcshell_tests;
    
    100
    -    $tbbinfos->find_mochitest_tests;
    
    101
    -    my ($config_guess) = capture_exec('./build/autoconf/config.guess');
    
    102
    -    chomp $config_guess;
    
    103
    -    $tbbinfos->{topobjdir} = "obj-$config_guess";
    
    104
    -    if ($options->{xdummy}) {
    
    105
    -        $tbbinfos->{Xdisplay} = start_X("$tbbinfos->{'results-dir'}/xorg.log");
    
    106
    -    }
    
    107
    -}
    
    108
    -
    
    109
    -sub post_tests {
    
    110
    -    my ($tbbinfos) = @_;
    
    111
    -    stop_X($tbbinfos->{Xdisplay}) if $options->{xdummy};
    
    112
    -}
    
    113
    -
    
    114
    -sub tests_by_name {
    
    115
    -    my ($tests) = @_;
    
    116
    -    my %res = map { $_->{name} => $_ } @$tests;
    
    117
    -    return \%res;
    
    118
    -}
    
    119
    -
    
    120
    -sub xpcshell_mochitest_subtests_diff {
    
    121
    -    my ($t1, $t2) = @_;
    
    122
    -    my (@fail, @fixed);
    
    123
    -    my %f1 = ref $t1->{results}{failed} eq 'HASH' ?
    
    124
    -                %{$t1->{results}{failed}}
    
    125
    -               : map { $_ => 1 } @{$t1->{results}{failed}};
    
    126
    -    my %f2 = ref $t2->{results}{failed} eq 'HASH' ?
    
    127
    -                %{$t2->{results}{failed}}
    
    128
    -               : map { $_ => 1 } @{$t2->{results}{failed}};
    
    129
    -    my %f = ( %f1, %f2);
    
    130
    -    foreach my $t (keys %f) {
    
    131
    -        if ($f2{$t} && !$f1{$t}) {
    
    132
    -            push @fail, $t;
    
    133
    -        }
    
    134
    -        if (!$f2{$t} && $f1{$t}) {
    
    135
    -            push @fixed, $t;
    
    136
    -        }
    
    137
    -    }
    
    138
    -    if (@fail or @fixed) {
    
    139
    -        return { fail => \@fail, fixed => \@fixed };
    
    140
    -    }
    
    141
    -    return undef;
    
    142
    -}
    
    143
    -
    
    144
    -sub diff_results {
    
    145
    -    my ($r1, $r2) = @_;
    
    146
    -    my %res;
    
    147
    -    $res{run_time} = $r2->{run_time} - $r1->{run_time};
    
    148
    -    $res{fail_tests} = [];
    
    149
    -    $res{fixed_tests} = [];
    
    150
    -    $res{tests_time} = {};
    
    151
    -    $res{subtests} = {};
    
    152
    -    my $r1t = tests_by_name($r1->{tests});
    
    153
    -    my $r2t = tests_by_name($r2->{tests});
    
    154
    -    foreach my $test (keys %$r2t) {
    
    155
    -        my ($t1, $t2) = ($r1t->{$test}, $r2t->{$test});
    
    156
    -        if (defined $t2->{run_time} && defined $t1->{run_time}) {
    
    157
    -            $res{tests_time}->{$test} = $t2->{run_time} - $t1->{run_time};
    
    158
    -        }
    
    159
    -        next unless defined $t1->{results};
    
    160
    -        next unless defined $t2->{results};
    
    161
    -        if (!$t2->{results}{success} && $t1->{results}{success}) {
    
    162
    -            push @{$res{fail_tests}}, $test;
    
    163
    -        }
    
    164
    -        if ($t2->{results}{success} && !$t1->{results}{success}) {
    
    165
    -            push @{$res{fixed_tests}}, $test;
    
    166
    -        }
    
    167
    -        if ($t1->{type} eq 'xpcshell' || $t1->{type} =~ m/^mochitest_/) {
    
    168
    -            my $s = xpcshell_mochitest_subtests_diff($t1, $t2);
    
    169
    -            $res{subtests}{$test} = $s if $s;
    
    170
    -        }
    
    171
    -    }
    
    172
    -    return \%res;
    
    173
    -}
    
    174
    -
    
    175
    -sub pre_makereport {
    
    176
    -    my ($testsuite, $report, $r) = @_;
    
    177
    -    foreach my $test (@{$testsuite->{tests}}) {
    
    178
    -        mochitest_error_logs($test);
    
    179
    -    }
    
    180
    -    return unless $testsuite->{parent_results};
    
    181
    -    $r //= TBBTestSuite::Reports::load_report($testsuite->{parent_results}[0]);
    
    182
    -    return unless $r;
    
    183
    -    my $parent = $r->{tbbfiles}{$testsuite->{parent_results}[1]};
    
    184
    -    return unless $parent;
    
    185
    -    $testsuite->{parent_diff} = diff_results($parent, $testsuite);
    
    186
    -}
    
    187
    -
    
    188
    -sub pre_reports_index {
    
    189
    -    my ($testsuite, $reports, $report) = @_;
    
    190
    -    foreach my $tbbfile (keys %{$report->{tbbfiles}}) {
    
    191
    -        my $tbbinfos = $report->{tbbfiles}{$tbbfile};
    
    192
    -        $tbbinfos->pre_makereport($report,
    
    193
    -                       $reports->{$tbbinfos->{parent_results}[0]})
    
    194
    -                   if $tbbinfos->{parent_results};
    
    195
    -        foreach my $test (@{$report->{tbbfiles}{$tbbfile}{tests}}) {
    
    196
    -            mochitest_error_logs($test);
    
    197
    -        }
    
    198
    -    }
    
    199
    -}
    
    200
    -
    
    201
    -sub find_xpcshell_tests {
    
    202
    -    my ($tbbinfos) = @_;
    
    203
    -    my $browserdir = $tbbinfos->{gitrepo}->clone_dir;
    
    204
    -    my $wanted = sub {
    
    205
    -        return unless -f $File::Find::name;
    
    206
    -        my (undef, $dir, $file) = File::Spec->splitpath($File::Find::name);
    
    207
    -        return unless $file eq 'xpcshell.ini';
    
    208
    -        $dir =~ s{^$browserdir/}{};
    
    209
    -        $dir =~ s{/$}{};
    
    210
    -        return if $dir =~ m/^obj-/;
    
    211
    -        push @{$tbbinfos->{tests}}, {
    
    212
    -            name  => "xpcshell:$dir",
    
    213
    -            type  => 'xpcshell',
    
    214
    -            descr => "xpcshell test in directory $dir",
    
    215
    -            dir   => $dir,
    
    216
    -        };
    
    217
    -    };
    
    218
    -    find($wanted, $browserdir);
    
    219
    -}
    
    220
    -
    
    221
    -sub find_mochitest_tests {
    
    222
    -    my ($tbbinfos) = @_;
    
    223
    -    my $browserdir = $tbbinfos->{gitrepo}->clone_dir;
    
    224
    -    my $wanted = sub {
    
    225
    -        return unless -f $File::Find::name;
    
    226
    -        my (undef, $dir, $file) = File::Spec->splitpath($File::Find::name);
    
    227
    -        return unless $file eq 'Makefile.in';
    
    228
    -        $dir =~ s{^$browserdir/}{};
    
    229
    -        $dir =~ s{/$}{};
    
    230
    -        return if $dir =~ m/^obj-/;
    
    231
    -        my @makefile = read_file $File::Find::name;
    
    232
    -        my @types;
    
    233
    -        push @types, 'plain' if grep { m/MOCHITEST_FILES/ } @makefile;
    
    234
    -        push @types, 'chrome' if grep { m/MOCHITEST_CHROME_FILES/ } @makefile;
    
    235
    -        push @types, 'browser' if grep { m/MOCHITEST_BROWSER_FILES/ } @makefile;
    
    236
    -        push @types, 'a11y' if grep { m/MOCHITEST_A11Y_FILES/ } @makefile;
    
    237
    -        foreach my $type (@types) {
    
    238
    -            push @{$tbbinfos->{tests}}, {
    
    239
    -                name => "mochitest-$type:$dir",
    
    240
    -                type => "mochitest_$type",
    
    241
    -                descr => "$type mochitest in directory $dir",
    
    242
    -                dir => $dir,
    
    243
    -            };
    
    244
    -        }
    
    245
    -    };
    
    246
    -    find($wanted, $browserdir);
    
    247
    -}
    
    248
    -
    
    249
    -sub xpcshell_test {
    
    250
    -    my ($tbbinfos, $test) = @_;
    
    251
    -    my $xunit_file = "$tbbinfos->{topobjdir}/.mozbuild/xpchsell.xunit.xml";
    
    252
    -    unlink $xunit_file if -f $xunit_file;
    
    253
    -    my @xvfb = $options->{xvfb} ?
    
    254
    -        ('xvfb-run', '--server-args=-screen 0 1024x768x24') : ();
    
    255
    -    my ($out, $err, $success) =
    
    256
    -                capture_exec(@xvfb, './mach', 'xpcshell-test', $test->{dir});
    
    257
    -    return unless -f $xunit_file;
    
    258
    -    $test->{results}{out} = $out;
    
    259
    -    $test->{results}{failed} = {};
    
    260
    -    my $root = eval {
    
    261
    -        -f $xunit_file
    
    262
    -                && XML::LibXML->load_xml(location => $xunit_file)
    
    263
    -                              ->documentElement();
    
    264
    -    };
    
    265
    -    if (!$root) {
    
    266
    -        $test->{results}{success} = 0;
    
    267
    -        return;
    
    268
    -    }
    
    269
    -    $test->{results}{success} = ($root->getAttribute('failures') // 0)== 0;
    
    270
    -    foreach my $testcase (@{$root->getChildrenByLocalName('testcase')}) {
    
    271
    -        if ($testcase->getChildrenByLocalName('failure')) {
    
    272
    -            $test->{results}{failed}{$testcase->getAttribute('name')} =
    
    273
    -                            ($testcase->getChildrenByLocalName('failure'))[0]
    
    274
    -                                                    ->textContent;
    
    275
    -        }
    
    276
    -    }
    
    277
    -}
    
    278
    -
    
    279
    -sub mochitest_test {
    
    280
    -    my ($mach_command, $tbbinfos, $test) = @_;
    
    281
    -    my $failures_file = "$tbbinfos->{topobjdir}/.mozbuild/mochitest_failures.json";
    
    282
    -    unlink $failures_file if -f $failures_file;
    
    283
    -    my @xvfb = $options->{xvfb} ?
    
    284
    -        ('xvfb-run', '--server-args=-screen 0 1024x768x24') : ();
    
    285
    -    my ($out, $err, $success) =
    
    286
    -                capture_exec(@xvfb, './mach', $mach_command, $test->{dir});
    
    287
    -    return unless -f $failures_file;
    
    288
    -    $test->{results}{out} = $out;
    
    289
    -    my $failed = eval { -f $failures_file
    
    290
    -                && decode_json(scalar read_file($failures_file)) };
    
    291
    -    $test->{results}{failed} = $failed ? [ keys %$failed ] : [];
    
    292
    -    $test->{results}{success} = $failed && ! @{$test->{results}{failed}};
    
    293
    -}
    
    294
    -
    
    295
    -sub mochitest_error_logs {
    
    296
    -    my ($test) = @_;
    
    297
    -    return unless $test->{type} =~ m/^mochitest_/;
    
    298
    -    return unless exists $test->{results};
    
    299
    -    return unless $test->{results}{out};
    
    300
    -    return if exists $test->{results}{error_logs};
    
    301
    -    my @logs = split /^/, $test->{results}{out};
    
    302
    -    @logs = grep { m/^\s*[^\s]+\s[^\s]+\sERROR/ } @logs;
    
    303
    -    $test->{results}{error_logs} = join '', @logs;
    
    304
    -}
    
    305
    -
    
    306
    -sub build_firefox {
    
    307
    -    my ($tbbinfos, $test) = @_;
    
    308
    -    my $nbcpu = get_nbcpu;
    
    309
    -    $test->{results}{success} = 0;
    
    310
    -    copy("$FindBin::Bin/data/mozconfig", '.mozconfig');
    
    311
    -    my @l = read_file('.mozconfig');
    
    312
    -    foreach (@l) {
    
    313
    -        s/MOZ_MAKE_FLAGS="-j4"/MOZ_MAKE_FLAGS="-j$nbcpu"/;
    
    314
    -    }
    
    315
    -    write_file('.mozconfig', @l);
    
    316
    -    run_to_file("$tbbinfos->{'results-dir'}/$test->{name}.configure.txt",
    
    317
    -        'make', '-f', 'client.mk', 'configure') or return;
    
    318
    -    run_to_file("$tbbinfos->{'results-dir'}/$test->{name}.build.txt",
    
    319
    -        'make', "-j$nbcpu", '-f', 'client.mk', 'build') or return;
    
    320
    -    $test->{results}{success} = 1;
    
    321
    -}
    
    322
    -
    
    323
    -1;

  • TBBTestSuite/TestSuites.pm
    ... ... @@ -4,14 +4,13 @@ use strict;
    4 4
     
    
    5 5
     use TBBTestSuite::TestSuite::TestTestSuite;
    
    6 6
     use TBBTestSuite::TestSuite::BrowserBundleTests;
    
    7
    -use TBBTestSuite::TestSuite::BrowserUnitTests;
    
    8 7
     use TBBTestSuite::TestSuite::RBMBuild;
    
    9 8
     use TBBTestSuite::TestSuite::TorBrowserBuild;
    
    10 9
     use TBBTestSuite::TestSuite::TorBrowserBuildGitlabPipelines;
    
    11 10
     use TBBTestSuite::TestSuite::BrowserBundleHardening;
    
    12 11
     
    
    13 12
     my @testsuite_list = qw(TestTestSuite BrowserBundleTests
    
    14
    -                        BrowserUnitTests RBMBuild TorBrowserBuild
    
    13
    +                        RBMBuild TorBrowserBuild
    
    15 14
                             TorBrowserBuildGitlabPipelines BrowserBundleHardening);
    
    16 15
     my %testsuite_types;
    
    17 16
     sub testsuite_types {
    

  • TBBTestSuite/Tests.pm
    ... ... @@ -15,7 +15,6 @@ use TBBTestSuite::Common qw(exit_error);
    15 15
     use TBBTestSuite::Options qw($options);
    
    16 16
     use TBBTestSuite::TestSuites;
    
    17 17
     use TBBTestSuite::TestSuite::BrowserBundleTests;
    
    18
    -use TBBTestSuite::TestSuite::BrowserUnitTests;
    
    19 18
     use TBBTestSuite::XServer qw(set_Xmode);
    
    20 19
     
    
    21 20
     our (@ISA, @EXPORT_OK);
    

  • config/browser-unit deleted
    1
    -# vim: filetype=perl expandtab
    
    2
    -
    
    3
    -use strict;
    
    4
    -use FindBin;
    
    5
    -use TBBTestSuite::Common;
    
    6
    -use TBBTestSuite::TestSuite::BrowserUnitTests;
    
    7
    -use TBBTestSuite::BrowserGit qw(git_clone_fetch get_commits_by_branch
    
    8
    -                                parent_commit);
    
    9
    -
    
    10
    -my $torbrowser_branch = 'tor-browser-31.2.0esr-4.x-1';
    
    11
    -my $esr_branch = 'esr31';
    
    12
    -my $testsuite_version = '2';
    
    13
    -
    
    14
    -sub commit_to_name {
    
    15
    -    my ($commit) = @_;
    
    16
    -    $commit = substr $commit, 0, 20;
    
    17
    -    return ("browser-$testsuite_version-$commit", "browser-$commit");
    
    18
    -}
    
    19
    -
    
    20
    -git_clone_fetch;
    
    21
    -
    
    22
    -my @commits = get_commits_by_branch($torbrowser_branch, $esr_branch);
    
    23
    -
    
    24
    -my %res = (
    
    25
    -    args => [],
    
    26
    -    'reports-url' => 'http://tbb-test-reports.mars-attacks.org/reports/',
    
    27
    -    tags => [ "$torbrowser_branch-build2" ],
    
    28
    -    'disable-tests' => [
    
    29
    -        'mochitest-chrome:toolkit/content/tests/chrome',
    
    30
    -        'mochitest-chrome:toolkit/content/tests/widgets',
    
    31
    -        'mochitest-chrome:toolkit/identity/tests/chrome',
    
    32
    -    ],
    
    33
    -);
    
    34
    -my $previous;
    
    35
    -for my $commit (reverse @commits) {
    
    36
    -    my ($name, $fname) = commit_to_name($commit);
    
    37
    -    if (-d "$options->{'reports-dir'}/r/$name") {
    
    38
    -        $previous = [ $name, $fname ];
    
    39
    -        next;
    
    40
    -    }
    
    41
    -    $res{name} = $name;
    
    42
    -    my $tbbinfos = TBBTestSuite::TestSuite::BrowserUnitTests->new({
    
    43
    -            commit => substr($commit, 0, 20),
    
    44
    -            $previous ? (parent_results => $previous) : (),
    
    45
    -        });
    
    46
    -    $res{args} = [ $tbbinfos ],
    
    47
    -    return %res;
    
    48
    -}
    
    49
    -
    
    50
    -%res;

  • install-deps
    ... ... @@ -36,7 +36,7 @@ perlmodules='
    36 36
     Cwd Data::Dump Digest::SHA File::Path File::Slurp File::Spec File::Temp
    
    37 37
     FindBin Getopt::Long IO::CaptureOutput IO::Socket::INET Image::Magick
    
    38 38
     JSON LWP::UserAgent LWP::Protocol::https Template YAML::Syck DateTime
    
    39
    -Email::Simple Email::Sender File::Type IPC::Run XML::LibXML Storable
    
    39
    +Email::Simple Email::Sender File::Type IPC::Run Storable
    
    40 40
     '
    
    41 41
     
    
    42 42
     if [ -f /etc/debian_version ]
    
    ... ... @@ -58,7 +58,7 @@ then
    58 58
                 libwww-perl liblwp-protocol-https-perl libtemplate-perl \
    
    59 59
                 libyaml-syck-perl libdatetime-perl \
    
    60 60
                 libemail-sender-perl libemail-simple-perl libfile-type-perl \
    
    61
    -            libipc-run-perl libxml-libxml-perl
    
    61
    +            libipc-run-perl
    
    62 62
        apt-get install -y nmap curl
    
    63 63
     fi
    
    64 64
     
    

  • tmpl/details_build_firefox.html deleted
    1
    -<ul>
    
    2
    -    <li><a href="">"results-[% tbbfile %]/[% test.name %].configure.txt">configure logs</a></li>
    
    3
    -    <li><a href="">"results-[% tbbfile %]/[% test.name %].build.txt">build logs</a></li>
    
    4
    -</ul>

  • tmpl/details_mochitest.html deleted
    1
    -[% IF ! from_index %]
    
    2
    -[% IF test.results.failed.size %]
    
    3
    -Failed tests:
    
    4
    -<ul>
    
    5
    -[% FOREACH f IN test.results.failed %]
    
    6
    -<li>[% f %]</li>
    
    7
    -[% END %]
    
    8
    -</ul>
    
    9
    -[% END %]
    
    10
    -[% IF test.results.error_logs %]<a href="">"_javascript_:togglecontent('logs_[% test.name %]');">mochitest error logs</a>[% END %]
    
    11
    -[% END %]
    
    12
    -<pre [% IF ! from_index %]id="logs_[% report_name %][% test.name %]" style="display:none"[% END %]>[% FILTER html_entity %][% test.results.error_logs %][% END %]</pre>

  • tmpl/details_mochitest_a11y.html deleted
    1
    -details_mochitest.html
    \ No newline at end of file

  • tmpl/details_mochitest_browser.html deleted
    1
    -details_mochitest.html
    \ No newline at end of file

  • tmpl/details_mochitest_chrome.html deleted
    1
    -details_mochitest.html
    \ No newline at end of file

  • tmpl/details_mochitest_plain.html deleted
    1
    -details_mochitest.html
    \ No newline at end of file

  • tmpl/details_xpcshell.html deleted
    1
    -[% IF ! from_index %]
    
    2
    -[% IF test.results.failed.keys.size %]
    
    3
    -Failed tests:
    
    4
    -<ul>
    
    5
    -[% FOREACH f IN test.results.failed.keys %]
    
    6
    -<li><a href="">"_javascript_:togglecontent('logs_[% test.name %]_[% f %]');">[% f %]</a>
    
    7
    -<pre id="logs_[% test.name %]_[% f %]" style="display:none">[% test.results.failed.$f %]</pre>
    
    8
    -</li>
    
    9
    -[% END %]
    
    10
    -</ul>
    
    11
    -[% END %]
    
    12
    -<a href="">"_javascript_:togglecontent('logs_[% test.name %]');">xpcshell logs</a>
    
    13
    -[% END %]
    
    14
    -<pre [% IF ! from_index %]id="logs_[% report_name %][% test.name %]" style="display:none"[% END %]>[% FILTER html_entity %][% test.results.out %][% END %]</pre>

  • tmpl/report.html
    ... ... @@ -18,123 +18,13 @@
    18 18
             [% INCLUDE togglecontent.js %]
    
    19 19
         </head>
    
    20 20
         <body>
    
    21
    -        [% IF tbbfiles.$tbbfile.type == 'browserunit' %]
    
    22
    -        <h1>Browser infos</h1>
    
    23
    -        [% ELSIF tbbfiles.$tbbfile.type == 'browserbundle' %]
    
    21
    +        [% IF tbbfiles.$tbbfile.type == 'browserbundle' %]
    
    24 22
             <h1>Bundle infos</h1>
    
    25 23
             [% END %]
    
    26 24
             <ul>
    
    27
    -            [% IF tbbfiles.$tbbfile.type == 'browserunit' %]
    
    28
    -            <li><b>Commit:</b> <a href="">"https://gitweb.torproject.org/tor-browser.git/commit/[% tbbfiles.$tbbfile.commit %]">[% tbbfiles.$tbbfile.commit %]</a></li>
    
    29
    -            <li><b>Commit subject:</b> [% tbbfiles.$tbbfile.commit_subject %]</li>
    
    30
    -            [% ELSIF tbbfiles.$tbbfile.type == 'browserbundle' %]
    
    31
    -            <li><b>Filename:</b> [% tbbfiles.$tbbfile.filename %]</li>
    
    32
    -            <li><b>Version:</b> [% tbbfiles.$tbbfile.version %]</li>
    
    33
    -            <li><b>Language:</b> [% tbbfiles.$tbbfile.language %]</li>
    
    34
    -            <li><b>OS:</b> [% tbbfiles.$tbbfile.os %]</li>
    
    35
    -            <li><b>Architecture:</b> [% tbbfiles.$tbbfile.arch %]</li>
    
    36
    -            <li><b>sha256sum:</b> [% tbbfiles.$tbbfile.sha256sum %]</li>
    
    37
    -            [% END %]
    
    38 25
                 <li><b>Total run time:</b> [% tbbfiles.$tbbfile.run_time %] seconds</li>
    
    39 26
             </ul>
    
    40 27
     
    
    41
    -        [% IF tbbfiles.$tbbfile.type == 'browserunit' && tbbfiles.$tbbfile.parent_diff %]
    
    42
    -        [% SET diff = tbbfiles.$tbbfile.parent_diff %]
    
    43
    -        <h1>Diff with previous results</h1>
    
    44
    -        <ul>
    
    45
    -            [% SET parent_results = tbbfiles.$tbbfile.parent_results %]
    
    46
    -            <li>Previous results: <a href="">"../[% parent_results.0 %]/[% parent_results.1 %].html">[% parent_results.0 %]</a></li>
    
    47
    -            <li><a href="">"_javascript_:togglecontent('run_time_diff')"><b>Total run time diff:</b> [% diff.run_time %]</a>
    
    48
    -            <div id="run_time_diff" style="display:none">
    
    49
    -                <ul>
    
    50
    -                    [% FOREACH t IN diff.tests_time.nsort.reverse %]
    
    51
    -                    <li>[% t %]: [% diff.tests_time.$t %]</li>
    
    52
    -                    [% END %]
    
    53
    -                </ul>
    
    54
    -            </div>
    
    55
    -            </li>
    
    56
    -
    
    57
    -            [% IF ! diff.fail_tests.size %]
    
    58
    -            <li>No new failing tests</li>
    
    59
    -            [% ELSE %]
    
    60
    -            <li><a href="">"_javascript_:togglecontent('fail_tests_diff')"><b>[% diff.fail_tests.size %] new failing tests</b></a>
    
    61
    -            <div id="fail_tests_diff" style="display:none">
    
    62
    -                <ul>
    
    63
    -                    [% FOREACH t IN diff.fail_tests.sort %]
    
    64
    -                    <li>[% t %]</li>
    
    65
    -                    [% END %]
    
    66
    -                </ul>
    
    67
    -            </div>
    
    68
    -            </li>
    
    69
    -            [% END %]
    
    70
    -
    
    71
    -            [%
    
    72
    -            SET nb_js_fail = 0;
    
    73
    -            SET nb_js_fixed = 0;
    
    74
    -            FOREACH t IN diff.subtests.keys;
    
    75
    -              SET nb_js_fail = nb_js_fail + diff.subtests.$t.fail.size;
    
    76
    -              SET nb_js_fixed = nb_js_fixed + diff.subtests.$t.fixed.size;
    
    77
    -            END
    
    78
    -            %]
    
    79
    -
    
    80
    -            [% IF nb_js_fail %]
    
    81
    -            <li><a href="">"_javascript_:togglecontent('fail_js_diff')"><b>[% nb_js_fail %] new js files failing</b></a>
    
    82
    -            <div id="fail_js_diff" style="display:none">
    
    83
    -                <ul>
    
    84
    -                    [% FOREACH t IN diff.subtests.keys %]
    
    85
    -                    [% IF ! diff.subtests.$t.fail.size; NEXT; END %]
    
    86
    -                        <li>[% t %]:
    
    87
    -                           <ul>
    
    88
    -                               [% FOREACH js IN diff.subtests.$t.fail %]
    
    89
    -                               <li>[% js %]</li>
    
    90
    -                               [% END %]
    
    91
    -                           </ul>
    
    92
    -                        </li>
    
    93
    -                    [% END %]
    
    94
    -                </ul>
    
    95
    -            </div>
    
    96
    -            </li>
    
    97
    -            [% ELSE %]
    
    98
    -            <li>No new js files failing</li>
    
    99
    -            [% END %]
    
    100
    -
    
    101
    -            [% IF ! diff.fixed_tests.size %]
    
    102
    -            <li>No fixed tests</li>
    
    103
    -            [% ELSE %]
    
    104
    -            <li><a href="">"_javascript_:togglecontent('fixed_tests_diff')"><b>[% diff.fixed_tests.size %] fixed tests</b></a>
    
    105
    -            <div id="fixed_tests_diff" style="display:none">
    
    106
    -                <ul>
    
    107
    -                    [% FOREACH t IN diff.fixed_tests.sort %]
    
    108
    -                    <li>[% t %]</li>
    
    109
    -                    [% END %]
    
    110
    -                </ul>
    
    111
    -            </div>
    
    112
    -            </li>
    
    113
    -            [% END %]
    
    114
    -
    
    115
    -            [% IF nb_js_fixed %]
    
    116
    -            <li><a href="">"_javascript_:togglecontent('fixed_js_diff')"><b>[% nb_js_fixed %] new js files fixed</b></a>
    
    117
    -            <div id="fixed_js_diff" style="display:none">
    
    118
    -                <ul>
    
    119
    -                    [% FOREACH t IN diff.subtests.keys %]
    
    120
    -                    [% IF ! diff.subtests.$t.fixed.size; NEXT; END %]
    
    121
    -                        <li>[% t %]:
    
    122
    -                           <ul>
    
    123
    -                               [% FOREACH js IN diff.subtests.$t.fixed %]
    
    124
    -                               <li>[% js %]</li>
    
    125
    -                               [% END %]
    
    126
    -                           </ul>
    
    127
    -                        </li>
    
    128
    -                    [% END %]
    
    129
    -                </ul>
    
    130
    -            </div>
    
    131
    -            </li>
    
    132
    -            [% ELSE %]
    
    133
    -            <li>No js files fixed</li>
    
    134
    -            [% END %]
    
    135
    -        </ul>
    
    136
    -        [% END %]
    
    137
    -
    
    138 28
             <h1>Results</h1>
    
    139 29
             [% IF tbbfiles.$tbbfile.pre_tests_error %]
    
    140 30
               <h2>pre_tests error</h2>
    

  • tmpl/report_browserunit.txt deleted
    1
    -[% IF tbbfiles.$tbbfile.pre_tests_error -%]
    
    2
    -  pre_tests error:
    
    3
    -[% FILTER indent('   ') -%]
    
    4
    -[% tbbfiles.$tbbfile.pre_tests_error %]
    
    5
    -[% END %]
    
    6
    -[% END -%]
    
    7
    -[% FOREACH test IN tbbfiles.$tbbfile.tests -%]
    
    8
    -[% IF test.results -%]
    
    9
    -[% test.name %]: [% test.results.success ? 'ok' : 'failed (' _ test.fail_type _ ')' %]
    
    10
    -[% END -%]
    
    11
    -[% END %]

  • tmpl/reports_index_browserunit.html deleted
    1
    -[% USE date -%]
    
    2
    -<html>
    
    3
    -    <head>
    
    4
    -        <title>Tests reports</title>
    
    5
    -        <style type="text/css">
    
    6
    -            .test_ok {
    
    7
    -                color: #006600;
    
    8
    -                font-weight: bold;
    
    9
    -            }
    
    10
    -            .test_ok A {
    
    11
    -                color: #006600;
    
    12
    -                font-weight: bold;
    
    13
    -            }
    
    14
    -            .test_notok {
    
    15
    -                color: #FF0000;
    
    16
    -                font-weight: bold;
    
    17
    -            }
    
    18
    -            .test_notok A {
    
    19
    -                color: #FF0000;
    
    20
    -            }
    
    21
    -            .reportdate {
    
    22
    -                font-size: small;
    
    23
    -            }
    
    24
    -        </style>
    
    25
    -        [% INCLUDE togglecontent.js %]
    
    26
    -    </head>
    
    27
    -    <body>
    
    28
    -        <h1>Tor Browser Unit Test Reports: [% title %]</h1>
    
    29
    -        [% FOREACH report IN reports_list %]
    
    30
    -        [%
    
    31
    -          SET tbbfiles = reports.$report.tbbfiles;
    
    32
    -          SET tbbfile = reports.$report.tbbfiles.keys.0;
    
    33
    -          SET diff = tbbfiles.$tbbfile.parent_diff;
    
    34
    -        %]
    
    35
    -        <ul>
    
    36
    -            <li><b>Commit:</b> <a href="">"https://gitweb.torproject.org/tor-browser.git/commit/[% tbbfiles.$tbbfile.commit %]">[% tbbfiles.$tbbfile.commit %]</a></li>
    
    37
    -            <li><b>Subject:</b> [% tbbfiles.$tbbfile.commit_subject %]</li>
    
    38
    -            <li><b>Run time:</b> [% tbbfiles.$tbbfile.run_time %] seconds (diff: [% diff.run_time %])</li>
    
    39
    -
    
    40
    -            [%
    
    41
    -            SET nb_js_fail = 0;
    
    42
    -            SET nb_js_fixed = 0;
    
    43
    -            FOREACH t IN diff.subtests.keys;
    
    44
    -              SET nb_js_fail = nb_js_fail + diff.subtests.$t.fail.size;
    
    45
    -              SET nb_js_fixed = nb_js_fixed + diff.subtests.$t.fixed.size;
    
    46
    -            END
    
    47
    -            %]
    
    48
    -
    
    49
    -            [% IF diff.fail_tests.size %]
    
    50
    -            <li><b>[% diff.fail_tests.size %] new failing tests</b>
    
    51
    -                <ul>
    
    52
    -                    [% FOREACH t IN diff.fail_tests.sort %]
    
    53
    -                    <li><a href="">"_javascript_:togglecontent('fail_test_[% report %]_[% t %]');">[% t %]</a>
    
    54
    -                    <div id="fail_test_[% report %]_[% t %]" style="display:none">
    
    55
    -                        [% SET test = test_by_name(tbbfiles.$tbbfile.tests, t); %]
    
    56
    -                        [% SET type = test.type; INCLUDE "details_${type}.html" from_index=1 %]
    
    57
    -                    </div>
    
    58
    -                    </li>
    
    59
    -                    [% END %]
    
    60
    -                </ul>
    
    61
    -            </li>
    
    62
    -            [% END %]
    
    63
    -
    
    64
    -            [% IF nb_js_fail %]
    
    65
    -            <li><b>[% nb_js_fail %] new js files failing</b>
    
    66
    -                <ul>
    
    67
    -                    [% FOREACH t IN diff.subtests.keys %]
    
    68
    -                    [% IF ! diff.subtests.$t.fail.size; NEXT; END %]
    
    69
    -                        <li>[% t %]:
    
    70
    -                           <ul>
    
    71
    -                               [% FOREACH js IN diff.subtests.$t.fail %]
    
    72
    -                               <li>[% js %]</li>
    
    73
    -                               [% END %]
    
    74
    -                           </ul>
    
    75
    -                           <a href="">"_javascript_:togglecontent('js_fail_test_[% report %]_[% t %]');">logs</a>
    
    76
    -                           <div id="js_fail_test_[% report %]_[% t %]" style="display:none">
    
    77
    -                               [% SET test = test_by_name(tbbfiles.$tbbfile.tests, t); %]
    
    78
    -                               [% SET type = test.type; INCLUDE "details_${type}.html" from_index=1 %]
    
    79
    -                           </div>
    
    80
    -                        </li>
    
    81
    -                    [% END %]
    
    82
    -                </ul>
    
    83
    -            </li>
    
    84
    -            [% END %]
    
    85
    -
    
    86
    -            [% IF diff.fixed_tests.size %]
    
    87
    -            <li><b>[% diff.fixed_tests.size %] fixed tests</b>
    
    88
    -                <ul>
    
    89
    -                    [% FOREACH t IN diff.fixed_tests.sort %]
    
    90
    -                    <li>[% t %]</li>
    
    91
    -                    [% END %]
    
    92
    -                </ul>
    
    93
    -            </li>
    
    94
    -            [% END %]
    
    95
    -
    
    96
    -            [% IF nb_js_fixed %]
    
    97
    -            <li><b>[% nb_js_fixed %] new js files fixed</b>
    
    98
    -                <ul>
    
    99
    -                    [% FOREACH t IN diff.subtests.keys %]
    
    100
    -                    [% IF ! diff.subtests.$t.fixed.size; NEXT; END %]
    
    101
    -                        <li>[% t %]:
    
    102
    -                           <ul>
    
    103
    -                               [% FOREACH js IN diff.subtests.$t.fixed %]
    
    104
    -                               <li>[% js %]</li>
    
    105
    -                               [% END %]
    
    106
    -                           </ul>
    
    107
    -                        </li>
    
    108
    -                    [% END %]
    
    109
    -                </ul>
    
    110
    -            </li>
    
    111
    -            [% END %]
    
    112
    -
    
    113
    -            <li><a href="">"r/[% report %]/[% tbbfile %].html">Details</a></li>
    
    114
    -        </ul>
    
    115
    -        <hr />
    
    116
    -        [% END %]
    
    117
    -    </body>
    
    118
    -</html>

  • _______________________________________________
    tor-commits mailing list -- tor-commits@xxxxxxxxxxxxxxxxxxxx
    To unsubscribe send an email to tor-commits-leave@xxxxxxxxxxxxxxxxxxxx