GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Unverified Commit 60b60b11 authored by boklm's avatar boklm

Add a --download-dir option

parent d992fed8
......@@ -73,6 +73,13 @@ Available options
Name of the keyring used to check the gpg signature of a
downloaded sha256sum.txt file.
--download-dir=<directory>
The directory where to store the files downloaded when a URL is
given rather than a local path. If the file already exists in
this directory, it is not downloaded again. If this option is
not given, the files are downloaded in a temporary directory
which is removed at the end of the tests.
--no-mozmill
Don't run mozmill tests.
......
......@@ -52,7 +52,7 @@ sub exit_error {
sub get_options {
my @options = qw(mozmill! selenium! starttor! tor-control-port=i
tor-socks-port=i reports-dir=s gpgcheck! keyring=s
virtualenv=s xvfb! name=s);
virtualenv=s xvfb! name=s download-dir=s);
my %res = %default_options;
Getopt::Long::GetOptionsFromArray(\@_, \%res, @options) || exit 1;
$res{files} = \@_;
......@@ -77,9 +77,11 @@ sub set_report_dir {
sub get_tbbfile {
my ($tbbinfos, $tbbfile) = @_;
if ($tbbfile =~ m/^https?:\/\//) {
print "Downloading $tbbfile\n";
my (undef, undef, $file) = File::Spec->splitpath($tbbfile);
my $output = "$tbbinfos->{tmpdir}/$file";
my $output = $options->{'download-dir'} ?
"$options->{'download-dir'}/$file" : "$tbbinfos->{tmpdir}/$file";
return $output if -f $output;
print "Downloading $tbbfile\n";
my $ua = LWP::UserAgent->new;
my $resp = $ua->get($tbbfile, ':content_file' => $output);
exit_error "Error downloading $tbbfile:\n" . $resp->status_line
......
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