Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
tor-browser-bundle-testsuite
Commits
d6115624
Unverified
Commit
d6115624
authored
Aug 27, 2014
by
boklm
Browse files
Add report_dir and report_path functions
This replace the report-dir option.
parent
16841e7b
Changes
3
Hide whitespace changes
Inline
Side-by-side
TBBTestSuite/Reports.pm
View file @
d6115624
...
...
@@ -19,7 +19,7 @@ our (@ISA, @EXPORT_OK);
BEGIN
{
require
Exporter
;
@ISA
=
qw(Exporter)
;
@EXPORT_OK
=
qw(load_report)
;
@EXPORT_OK
=
qw(load_report
report_dir report_path
)
;
}
my
%template_functions
=
(
...
...
@@ -29,21 +29,26 @@ my %template_functions = (
test_by_name
=>
\
&
TBBTestSuite::Tests::
test_by_name
,
);
sub
set_
report_dir
{
sub
report_dir
{
my
(
$report
)
=
@_
;
my
$rdir
=
$report
->
{
options
}{'
reports-dir
'}
.
'
/r
';
my
$rdir
=
$options
->
{'
reports-dir
'}
.
'
/r
';
make_path
(
$rdir
)
unless
-
d
$rdir
;
if
(
$report
->
{
options
}{
name
})
{
$report
->
{
options
}{'
report-
dir
'}
=
"
$rdir
/
$report
->{options}{name}
";
make_path
(
$
options
->
{'
report
-
dir
'})
;
return
;
my
$reportdir
=
"
$rdir
/
$report
->{options}{name}
";
make_path
(
$
reportdir
)
unless
-
d
$
reportdir
;
return
$reportdir
;
}
make_path
(
$rdir
);
$report
->
{
options
}{'
report-dir
'}
=
File::Temp::
newdir
(
my
$reportdir
=
File::Temp::
newdir
(
'
XXXXXX
',
DIR
=>
$rdir
,
CLEANUP
=>
0
)
->
dirname
;
(
undef
,
undef
,
$report
->
{
options
}{
name
})
=
File::
Spec
->
splitpath
(
$report
->
{
options
}{'
report-dir
'});
=
File::
Spec
->
splitpath
(
$reportdir
);
return
$reportdir
;
}
sub
report_path
{
report_dir
(
$_
[
0
])
.
'
/
'
.
$_
[
1
];
}
sub
copy_static
{
...
...
@@ -61,8 +66,8 @@ sub make_report {
copy_static
;
my
$template
=
Template
->
new
(
ENCODING
=>
'
utf8
',
INCLUDE_PATH
=>
"
$FindBin
::Bin/tmpl:
$
report
->{options}{'report-dir'}
"
,
OUTPUT_PATH
=>
$
report
->
{
options
}{'
report-dir
'}
,
INCLUDE_PATH
=>
"
$FindBin
::Bin/tmpl:
"
.
report
_dir
(
$report
)
,
OUTPUT_PATH
=>
report
_dir
(
$report
)
,
);
foreach
my
$tbbfile
(
keys
%
{
$report
->
{
tbbfiles
}})
{
my
$type
=
$report
->
{
tbbfiles
}{
$tbbfile
}{
type
};
...
...
TBBTestSuite/Tests.pm
View file @
d6115624
...
...
@@ -10,6 +10,7 @@ use File::Temp;
use
File::
Slurp
;
use
LWP::
UserAgent
;
use
YAML
;
use
TBBTestSuite::
Reports
;
use
TBBTestSuite::
Common
qw(exit_error)
;
use
TBBTestSuite::
Options
qw($options)
;
use
TBBTestSuite::
BrowserBundleTests
qw(tbb_filename_infos)
;
...
...
@@ -155,7 +156,8 @@ sub test_start {
$tbbinfos
->
{
tmpdir
}
=
$tmpdir
->
dirname
;
$tbbinfos
->
{
tests
}
//
=
[
map
{
{
%
$_
}
}
@
TBBTestSuite::BrowserBundleTests::
tests
];
$tbbinfos
->
{'
results-dir
'}
=
"
$options
->{'report-dir'}/results-
$tbbinfos
->{filename}
";
TBBTestSuite::Reports::
report_path
(
$report
,
"
results-
$tbbinfos
->{filename}
");
mkdir
$tbbinfos
->
{'
results-dir
'};
my
$testsuite
=
$testsuite_types
{
$tbbinfos
->
{
type
}};
$testsuite
->
{
pre_tests
}(
$tbbinfos
);
...
...
tbb-testsuite
View file @
d6115624
...
...
@@ -7,7 +7,7 @@ use File::Path qw(make_path);
use
YAML
;
use
TBBTestSuite::
Common
qw(exit_error run_alone rm_pidfile)
;
use
TBBTestSuite::
Options
qw($options)
;
use
TBBTestSuite::
Reports
;
use
TBBTestSuite::
Reports
qw(report_dir report_path)
;
use
TBBTestSuite::Reports::
Receive
;
use
TBBTestSuite::Reports::
Send
;
use
TBBTestSuite::
Tests
;
...
...
@@ -44,15 +44,14 @@ sub run_tests {
system_infos
=>
TBBTestSuite::Common::
system_infos
,
report_format
=>
'
1
',
};
TBBTestSuite::Reports::
set_report_dir
(
$report
);
foreach
my
$tbbfile
(
@
{
$options
->
{
args
}})
{
my
$tbbinfos
=
ref
$tbbfile
eq
'
HASH
'
?
$tbbfile
:
tbb_filename_infos
(
$tbbfile
);
TBBTestSuite::Tests::
test_start
(
$report
,
$tbbinfos
);
}
set_report_success
(
$report
);
print
"
Report directory:
$options
->{'
report
-
dir
'}
\n
";
YAML::
DumpFile
(
"
$options
->{'report-dir'}/
report.yml
"
,
$report
);
print
'
Report directory:
',
report
_
dir
(
$report
),
"
\n
";
YAML::
DumpFile
(
report_path
(
$report
,
'
report.yml
')
,
$report
);
TBBTestSuite::Reports::
make_report
(
$report
);
TBBTestSuite::Reports::
make_reports_index
;
TBBTestSuite::Reports::Send::
send_report
if
$options
->
{'
upload-to
'};
...
...
@@ -61,8 +60,7 @@ sub run_tests {
sub
load_report_from_file
{
exit_error
"
--name is not set
"
unless
$options
->
{
name
};
my
$report
=
{
options
=>
$options
};
TBBTestSuite::Reports::
set_report_dir
(
$report
);
$report
=
YAML::
LoadFile
("
$options
->{'report-dir'}/report.yml
");
$report
=
YAML::
LoadFile
(
report_path
(
$report
,
'
report.yml
'));
$report
->
{
options
}
=
{
%
{
$report
->
{
options
}},
%$options
};
return
$report
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment