Unverified Commit 0a5385ae authored by boklm's avatar boklm
Browse files

Move the command test type to its own file

parent df6af6db
......@@ -11,11 +11,11 @@ use File::Type;
use File::Copy;
use JSON;
use Digest::SHA qw(sha256_hex);
use IO::CaptureOutput qw(capture_exec);
use LWP::UserAgent;
use TBBTestSuite::Common qw(exit_error winpath get_var);
use TBBTestSuite::Common qw(exit_error winpath);
use TBBTestSuite::Options qw($options);
use TBBTestSuite::Tests::VirusTotal qw(virustotal_run);
use TBBTestSuite::Tests::Command qw(command_run);
use TBBTestSuite::Tests::TorBootstrap;
our (@ISA, @EXPORT_OK);
......@@ -449,24 +449,6 @@ sub selenium_run {
check_modified_files($tbbinfos, $test);
}
sub command_run {
my ($tbbinfos, $test) = @_;
$test->{results}{success} = 1;
my $files = get_var($test->{files}, $tbbinfos, $test);
for my $file (@$files) {
my ($out, $err, $success) = capture_exec(@{$test->{command}}, $file);
if ($success && $test->{check_output}) {
$success = $test->{check_output}($out);
}
if (!$success) {
$test->{results}{success} = 0;
$file =~ s/^$tbbinfos->{tbbdir}\///;
push @{$test->{results}{failed}}, $file;
next;
}
}
}
sub set_tbbpaths {
my ($tbbinfos) = @_;
if ($options->{newlayout}) {
......
package TBBTestSuite::Tests::Command;
use strict;
use IO::CaptureOutput qw(capture_exec);
use TBBTestSuite::Common qw(get_var);
our (@ISA, @EXPORT_OK);
BEGIN {
require Exporter;
@ISA = qw(Exporter);
@EXPORT_OK = qw(command_run);
}
sub command_run {
my ($tbbinfos, $test) = @_;
$test->{results}{success} = 1;
my $files = get_var($test->{files}, $tbbinfos, $test);
for my $file (@$files) {
my ($out, $err, $success) = capture_exec(@{$test->{command}}, $file);
if ($success && $test->{check_output}) {
$success = $test->{check_output}($out);
}
if (!$success) {
$test->{results}{success} = 0;
$file =~ s/^$tbbinfos->{tbbdir}\///;
push @{$test->{results}{failed}}, $file;
next;
}
}
}
1;
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