Unverified Commit 5f5ed018 authored by boklm's avatar boklm
Browse files

Add a test testsuite

This testsuite can be useful to check that the testsuite program is
still working, after making some changes.
parent 4e5cfe9a
package TBBTestSuite::TestTestSuite;
use strict;
my $test_types = {
test_test => \&test_test,
};
our %testsuite = (
description => 'Tor Browser test testsuite',
test_types => $test_types,
pre_tests => \&pre_tests,
post_tests => \&post_tests,
pre_makereport => \&pre_makereport,
pre_reports_index => \&pre_reports_index,
);
sub get_tbbinfos {
my ($infos) = @_;
my %tbbinfos = (
%$infos,
type => 'testtestsuite',
filename => 'testtestsuite',
tests => [
{
name => 'first_test',
type => 'test_test',
r => 1,
},
{
name => 'second_test',
type => 'test_test',
r => 0,
},
{
name => 'warn_test',
type => 'test_test',
r => 0,
fail_type => 'warning',
},
],
);
return \%tbbinfos;
}
sub pre_tests {
my ($tbbinfos) = @_;
print "Test TestSuite pre tests\n";
}
sub post_tests {
my ($tbbinfos) = @_;
print "Test TestSuite post tests\n";
}
sub pre_makereport {
print "Test TestSuite pre makereport\n";
}
sub pre_reports_index {
print "Test TestSuite pre reports index\n";
}
sub test_test {
my ($tbbinfos, $test) = @_;
print "running test $test->{name}\n";
$test->{results}{success} = $test->{r};
}
1;
......@@ -21,6 +21,7 @@ our %testsuite_types = (
browserrebase => \%TBBTestSuite::BrowserRebaseTests::testsuite,
browserbundle => \%TBBTestSuite::BrowserBundleTests::testsuite,
browserbundle_virustotal => \%TBBTestSuite::BrowserBundleTests::testsuite_virustotal,
testtestsuite => \%TBBTestSuite::TestTestSuite::testsuite,
);
sub run_tests {
......
# vim: filetype=perl expandtab
use strict;
use TBBTestSuite::TestTestSuite;
my $tbbinfos = TBBTestSuite::TestTestSuite::get_tbbinfos({});
my %res = (
args => [ $tbbinfos ],
);
%res;
[% USE date -%]
<html>
<head>
<title>Tests reports</title>
<style type="text/css">
.test_ok {
color: #006600;
font-weight: bold;
}
.test_ok A {
color: #006600;
font-weight: bold;
}
.test_notok {
color: #FF0000;
font-weight: bold;
}
.test_notok A {
color: #FF0000;
}
.reportdate {
font-size: small;
}
</style>
</head>
<body>
<h1>[% title %]</h1>
<table>
<tr>
<th>Name</th>
<th>Date</th>
<th>Version</th>
<th>OS</th>
<th>Arch</th>
<th>Result</th>
</tr>
[% FOREACH report IN reports_list %]
<tr>
<td valign="top"><a href="r/[% report %]/index.html">[% report %]</a></td>
<td valign="top">[% date.format(reports.$report.time, '%Y-%m-%d %H:%M') %]</td>
<td valign="top">[% IF reports.$report.options.tags %]
<a href="index-browserbundle-[% reports.$report.options.tags.0 %].html">[% reports.$report.options.tags.0 %]</a>
[% END %]
</td>
<td valign="top">[% reports.$report.system_infos.osname %]</td>
<td valign="top">[% reports.$report.system_infos.arch %]</td>
<td valign="top">
[% failed = 0 %]
[% FOREACH tbbfile IN reports.$report.tbbfiles.keys %]
[% IF ! reports.$report.tbbfiles.$tbbfile.success %]
<span class="test_notok">Failed: <a href="r/[% report %]/[% tbbfile %].html">[% tbbfile %]</a></span><br />
[% failed = 1 %]
[% END %]
[% END %]
[% IF failed == 0 %]
<span class="test_ok"><a href="r/[% report %]/index.html">OK</a></span>
[% END %]
</td>
</tr>
[% END %]
</table>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment