Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | #!/usr/bin/env perl |
michael@0 | 2 | ########################################################################### |
michael@0 | 3 | ## Intent: |
michael@0 | 4 | ## Test::Harness is a testing wrapper that will process output |
michael@0 | 5 | ## from Test.pm module tests. Sumarize results, report stats |
michael@0 | 6 | ## and exit with overall status for the testing suites. |
michael@0 | 7 | ## |
michael@0 | 8 | ## Run testing suite: |
michael@0 | 9 | ## % make clean test |
michael@0 | 10 | ## % perl runtest |
michael@0 | 11 | ## |
michael@0 | 12 | ## Run Individual tests |
michael@0 | 13 | ## % perl tUtils0 |
michael@0 | 14 | ########################################################################### |
michael@0 | 15 | |
michael@0 | 16 | ##----------------------------## |
michael@0 | 17 | ##---] CORE/CPAN INCLUDES [---## |
michael@0 | 18 | ##----------------------------## |
michael@0 | 19 | use strict; |
michael@0 | 20 | use warnings; |
michael@0 | 21 | use Getopt::Long; |
michael@0 | 22 | |
michael@0 | 23 | use Test::Harness; |
michael@0 | 24 | |
michael@0 | 25 | ##-------------------## |
michael@0 | 26 | ##---] EXPORTS [---## |
michael@0 | 27 | ##-------------------## |
michael@0 | 28 | our $VERSION = qw(1.0); |
michael@0 | 29 | use FindBin; |
michael@0 | 30 | |
michael@0 | 31 | ##-------------------## |
michael@0 | 32 | ##---] GLOBALS [---## |
michael@0 | 33 | ##-------------------## |
michael@0 | 34 | my %argv; |
michael@0 | 35 | |
michael@0 | 36 | ##----------------## |
michael@0 | 37 | ##---] MAIN [---## |
michael@0 | 38 | ##----------------## |
michael@0 | 39 | unless(GetOptions(\%argv, |
michael@0 | 40 | qw(debug|d) |
michael@0 | 41 | )) |
michael@0 | 42 | { |
michael@0 | 43 | print "Usage: $0\n"; |
michael@0 | 44 | print " --debug Enable debug mode\n"; |
michael@0 | 45 | exit 1; |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | if (2 > $Test::Harness::VERSION) |
michael@0 | 49 | { |
michael@0 | 50 | print "Unit tests will not be run, Test::Harness is too old\n" |
michael@0 | 51 | if ($argv{debug}); |
michael@0 | 52 | exit 0; |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | |
michael@0 | 56 | my @tests; |
michael@0 | 57 | |
michael@0 | 58 | ######################################## |
michael@0 | 59 | ## Gather a list of tests if none passed |
michael@0 | 60 | ######################################## |
michael@0 | 61 | unless (@tests = @ARGV) |
michael@0 | 62 | { |
michael@0 | 63 | local *D; |
michael@0 | 64 | opendir(D, '.'); |
michael@0 | 65 | while($_ = readdir(D)) { |
michael@0 | 66 | next unless /.t\S+$/; |
michael@0 | 67 | next if (/\.ts$/); |
michael@0 | 68 | push(@tests, $_); |
michael@0 | 69 | } |
michael@0 | 70 | closedir(D); |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | ############################################### |
michael@0 | 74 | ## Glob a list of tests when directories passed |
michael@0 | 75 | ############################################### |
michael@0 | 76 | my @tmp; |
michael@0 | 77 | foreach (@tests) |
michael@0 | 78 | { |
michael@0 | 79 | local *D; |
michael@0 | 80 | if (-d $_ && (my $dir = $_)) |
michael@0 | 81 | { |
michael@0 | 82 | opendir(D, $_) || die "opendir(D) failed: $!"; |
michael@0 | 83 | my @tests = grep(/\.t[^\.\s]+/o, readdir(D)); |
michael@0 | 84 | closedir(D); |
michael@0 | 85 | push(@tmp, map{ join('/', $dir, $_); } @tests); |
michael@0 | 86 | } else { |
michael@0 | 87 | push(@tmp, $_); |
michael@0 | 88 | } |
michael@0 | 89 | } |
michael@0 | 90 | @tests = @tmp; |
michael@0 | 91 | |
michael@0 | 92 | print "$0: @ARGV\n" if ($argv{debug}); |
michael@0 | 93 | runtests(@tests); |
michael@0 | 94 | |
michael@0 | 95 | # EOF |