Unverified Commit 21ec7452 authored by boklm's avatar boklm
Browse files

Get infos about bundle (os, version, language) from filename

parent b4884975
......@@ -19,13 +19,33 @@ sub exit_error {
}
sub get_options {
my @options = qw(os=s language=s mozmill! selenium!);
my @options = qw(mozmill! selenium!);
my %res = %default_options;
Getopt::Long::GetOptionsFromArray(\@_, \%res, @options) || exit 1;
$res{files} = \@_;
return \%res;
}
sub tbb_filename_infos {
my ($tbbfile) = @_;
my (undef, undef, $file) = File::Spec->splitpath($tbbfile);
my %res;
if ($file =~ m/^tor-browser-linux(..)-([^_]+)_(.+)\.tar\.xz$/) {
@res{qw(type os version language)} = ('tbbfile', 'Linux', $2, $3);
$res{arch} = $1 eq '64' ? 'x86_64' : 'x86';
} elsif ($file =~ m/^torbrowser-install-([^_]+)_(.+)\.exe$/) {
@res{qw(type os arch version language)} =
('tbbfile', 'Windows', 'x86', $1, $2);
} elsif ($file =~ m/^TorBrowserBundle-(.+)-osx32_(.+)\.zip$/) {
@res{qw(type os arch version language)} =
('tbbfile', 'MacOSX', 'x86', $1, $2);
} elsif ($file eq 'sha256sums.txt') {
$res{type} = 'sha256sum';
} else {
$res{type} = 'Unknown';
}
return \%res;
}
sub extract_tbb {
my ($tbbfile) = @_;
......@@ -35,7 +55,7 @@ sub extract_tbb {
my $tmpdir = File::Temp::newdir('tbbXXXXX', CLEANUP => 0);
chdir $tmpdir;
system('tar', 'xf', $tbbfile);
return "$tmpdir/tor-browser_$options->{language}";
return "$tmpdir/tor-browser_$options->{tbbinfos}{language}";
}
sub setup_tbb {
......@@ -74,6 +94,7 @@ sub selenium_tests {
sub test_tbb {
my ($tbbfile) = @_;
my $oldcwd = getcwd;
$options->{tbbinfos} = tbb_filename_infos($tbbfile);
$options->{tbbdir} = extract_tbb($tbbfile);
chdir $options->{tbbdir} || exit_error "Can't enter directory $options->{tbbdir}";
setup_tbb;
......
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