summaryrefslogtreecommitdiff
path: root/src/testpattern
diff options
context:
space:
mode:
authorDidier Raboud <odyx@debian.org>2017-01-22 10:36:11 +0100
committerDidier Raboud <odyx@debian.org>2017-01-22 10:36:11 +0100
commit7bd83d89975d166521a0b326b64b4cad80117750 (patch)
treed303f82c5651a20c507e69d9a8bb37a845492feb /src/testpattern
parent54a135b87201e48d4da4894a61b81a8c6fe46d26 (diff)
New upstream version 5.2.12
Diffstat (limited to 'src/testpattern')
-rw-r--r--src/testpattern/Makefile.am9
-rw-r--r--src/testpattern/Makefile.in4
-rw-r--r--src/testpattern/run-testpattern-2.in85
3 files changed, 72 insertions, 26 deletions
diff --git a/src/testpattern/Makefile.am b/src/testpattern/Makefile.am
index 8e3089d..0482a05 100644
--- a/src/testpattern/Makefile.am
+++ b/src/testpattern/Makefile.am
@@ -25,12 +25,12 @@ include $(top_srcdir)/scripts/global.mk
pkgdatadir = $(datadir)/$(PACKAGE)/samples
-TESTS = run-testpattern-1 run-testpattern-2
-
-
## Programs
if BUILD_TESTPATTERN
+
+TESTS = run-testpattern-1 run-testpattern-2
+
bin_PROGRAMS = testpattern
noinst_PROGRAMS = printers printer_options
noinst_SCRIPTS = run-testpattern-2 compare-checksums compress-checksums uncompress-checksums
@@ -58,9 +58,10 @@ endif
## Generate checksums
if BUILD_TESTPATTERN
+
checksums: testpattern run-testpattern-2 ./compress-checksums
$(MKDIR_P) Checksums
- ./run-testpattern-2 -q -M Checksums/sums.@GUTENPRINT_VERSION@.in
+ ./run-testpattern-2 -q -M Checksums/sums.$(SPREFIX)@GUTENPRINT_VERSION@.in
./compress-checksums < Checksums/sums.@GUTENPRINT_VERSION@.in |$(BZIP2) -c > Checksums/sums.@GUTENPRINT_VERSION@.bz2
rm -f Checksums/sums.@GUTENPRINT_VERSION@.in
endif
diff --git a/src/testpattern/Makefile.in b/src/testpattern/Makefile.in
index 9b44a91..feec3ce 100644
--- a/src/testpattern/Makefile.in
+++ b/src/testpattern/Makefile.in
@@ -633,7 +633,7 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include $(LOCAL_CPPFLAGS) $(GNUCFLAGS)
GUTENPRINTUI_LIBS = $(top_builddir)/src/gutenprintui/libgutenprintui.la
-TESTS = run-testpattern-1 run-testpattern-2
+@BUILD_TESTPATTERN_TRUE@TESTS = run-testpattern-1 run-testpattern-2
@BUILD_TESTPATTERN_TRUE@noinst_SCRIPTS = run-testpattern-2 compare-checksums compress-checksums uncompress-checksums
AM_LFLAGS = -i
AM_YFLAGS = -d
@@ -1243,7 +1243,7 @@ testpattern.o: testpatterny.o
@BUILD_TESTPATTERN_TRUE@checksums: testpattern run-testpattern-2 ./compress-checksums
@BUILD_TESTPATTERN_TRUE@ $(MKDIR_P) Checksums
-@BUILD_TESTPATTERN_TRUE@ ./run-testpattern-2 -q -M Checksums/sums.@GUTENPRINT_VERSION@.in
+@BUILD_TESTPATTERN_TRUE@ ./run-testpattern-2 -q -M Checksums/sums.$(SPREFIX)@GUTENPRINT_VERSION@.in
@BUILD_TESTPATTERN_TRUE@ ./compress-checksums < Checksums/sums.@GUTENPRINT_VERSION@.in |$(BZIP2) -c > Checksums/sums.@GUTENPRINT_VERSION@.bz2
@BUILD_TESTPATTERN_TRUE@ rm -f Checksums/sums.@GUTENPRINT_VERSION@.in
diff --git a/src/testpattern/run-testpattern-2.in b/src/testpattern/run-testpattern-2.in
index 8df73b8..00608ff 100644
--- a/src/testpattern/run-testpattern-2.in
+++ b/src/testpattern/run-testpattern-2.in
@@ -4,6 +4,7 @@ use Getopt::Long;
Getopt::Long::Configure("bundling", "no_ignore_case", "pass_through");
use strict;
+use POSIX ":sys_wait_h";
my $valgrind = 0;
my $callgrind = 0;
@@ -66,6 +67,7 @@ my $list_printers = 0;
my $list_options = 0;
my $verbose = 0;
my $use_unused_options = 0;
+my $proc_count = 1;
my @default_options = ();
my %base_settings = ("DitherAlgorithm" => "Fast");
@@ -77,6 +79,13 @@ my %stp_float_values;
my %stp_int_values;
my %rerun_cases;
+if (defined $ENV{"STP_PARALLEL"}) {
+ $proc_count = $ENV{"STP_PARALLEL"};
+ if ($proc_count > 1) {
+ $quiet = 1;
+ }
+}
+
GetOptions("C=s" => \$csum_type,
"G=s" => \$geometry,
"H!" => \$halt_on_error,
@@ -106,7 +115,8 @@ GetOptions("C=s" => \$csum_type,
"N!" => \$use_unused_options,
"v+" => \$valgrind,
"x=s" => \@exclude_list,
- "y=s" => \@exclude_patterns);
+ "y=s" => \@exclude_patterns,
+ "t:i" => \$proc_count);
sub print_help_and_exit() {
my $options = join("\n ", sort @standard_options);
@@ -831,6 +841,9 @@ if ($list_options) {
} else {
my $valgrind_command;
my $valopts;
+ if ($gdb_attach) {
+ $proc_count = 1;
+ }
if ($callgrind) {
$valopts = '--tool=callgrind --dump-instr=yes --trace-jump=yes';
$valgrind = 4;
@@ -871,27 +884,58 @@ if ($list_options) {
}
my ($qopt) = $quiet ? "-q" : "";
my ($Hopt) = $halt_on_error ? "-H" : "";
- $testpattern_command = "$valgrind_command ./testpattern -y $suppress $qopt $Hopt";
- if ($single > 1) {
- $SIG{TERM} = sub() { stopit() };
- $SIG{HUP} = sub() { stopit() };
- $SIG{INT} = sub() { stopit() };
- foreach my $printer (@printer_list) {
- do_printer($printer, undef);
+ my (@children);
+ my ($child_no);
+ my ($kid);
+ if ($proc_count > 1) {
+ for ($child_no = 0; $child_no < $proc_count; $child_no++) {
+ $kid = fork();
+ if ($kid == 0) {
+ last;
+ } else {
+ push @children, $kid;
+ }
}
- } elsif ($single) {
- $SIG{PIPE} = sub() { restart_testpattern() };
- foreach my $printer (@printer_list) {
- restart_testpattern(1);
- do_printer($printer, $global_fh);
- $status |= close $global_fh;
- $status |= ($? & 255);
+ if ($kid == 0) {
+ my (@xprinter_list);
+ foreach my $i (0..$#printer_list) {
+ if ($i % $proc_count == $child_no) {
+ push @xprinter_list, $printer_list[$i];
+ }
+ }
+ @printer_list = @xprinter_list;
+ }
+ }
+ if ($proc_count > 1 && $kid > 0) {
+ while ($proc_count > 0 && $kid > 0) {
+ $kid = waitpid(-1, 0);
+ if ($kid > 0 && $? > 0) {
+ $error++;
+ }
}
} else {
- $SIG{PIPE} = sub() { restart_testpattern() };
- restart_testpattern(1);
- map { do_printer($_, $global_fh) } @printer_list;
- $status = close $global_fh;
+ $testpattern_command = "$valgrind_command ./testpattern -y $suppress $qopt $Hopt";
+ if ($single > 1) {
+ $SIG{TERM} = sub() { stopit() };
+ $SIG{HUP} = sub() { stopit() };
+ $SIG{INT} = sub() { stopit() };
+ foreach my $printer (@printer_list) {
+ do_printer($printer, undef);
+ }
+ } elsif ($single) {
+ $SIG{PIPE} = sub() { restart_testpattern() };
+ foreach my $printer (@printer_list) {
+ restart_testpattern(1);
+ do_printer($printer, $global_fh);
+ $status |= close $global_fh;
+ $status |= ($? & 255);
+ }
+ } else {
+ $SIG{PIPE} = sub() { restart_testpattern() };
+ restart_testpattern(1);
+ map { do_printer($_, $global_fh) } @printer_list;
+ $status = close $global_fh;
+ }
}
if ($quiet == 2) {
print STDERR "\n";
@@ -903,7 +947,8 @@ if ($list_options) {
if ($single > 1) {
print STDERR "$error cases failed\n";
} else {
- print STDERR "*** $error CRASHES NOTED***\n";
+ my ($plural) = ($error > 1 ? "ES" : "");
+ print STDERR "*** $error CRASH${plural} NOTED***\n";
}
}
exit 1;