summaryrefslogtreecommitdiff
path: root/src/testpattern/run-testpattern-2.in
diff options
context:
space:
mode:
Diffstat (limited to 'src/testpattern/run-testpattern-2.in')
-rw-r--r--src/testpattern/run-testpattern-2.in397
1 files changed, 271 insertions, 126 deletions
diff --git a/src/testpattern/run-testpattern-2.in b/src/testpattern/run-testpattern-2.in
index 006da1c..ee8f5f4 100644
--- a/src/testpattern/run-testpattern-2.in
+++ b/src/testpattern/run-testpattern-2.in
@@ -16,8 +16,7 @@
# for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with this program. If not, see <https://www.gnu.org/licenses/>.
use Getopt::Long;
Getopt::Long::Configure("bundling", "no_ignore_case", "pass_through");
@@ -52,6 +51,7 @@ my @standard_options = ("InkType",
"MediaType",
"InputSlot",
"ColorCorrection",
+ "TPMode",
"ImageType",
"FullBleed",
"Quality",
@@ -62,9 +62,22 @@ my @standard_options = ("InkType",
"CyanDensity",
"Orientation",
"LabelSeparator");
+my @tp_modes = ("cmyk8",
+ "cmyk16",
+ "kcmy8",
+ "kcmy16",
+ "rgb8",
+ "rgb16",
+ "cmy8",
+ "cmy16",
+ "gray8",
+ "gray16",
+ "white8",
+ "white16");
my $global_status = 1;
my $run_installed = 0;
my $use_min_res = 0;
+my $use_min_pagesize = 0;
my $help = 0;
my $output = undef;
my $hsize = 0.1;
@@ -79,8 +92,6 @@ my $global_printer;
my $global_messages;
my $global_page;
my $global_case;
-my $enable_static = "@ENABLE_STATIC@";
-my $enable_shared = "@ENABLE_SHARED@";
my @extras = ();
my @job_extras = ();
@@ -88,6 +99,7 @@ my @messages = ();
my @global_messages = ();
my @families = ();
my %stpdata = ();
+my %resolutions = ();
my %models_found = ();
my %models;
my %families;
@@ -105,15 +117,22 @@ my $verbose = 0;
my $use_unused_options = 0;
my $proc_count = 1;
my $round = 0;
+my $print_family = 0;
+my $res_limit = 0;
+my $proc_rotor = 0;
+my $case_no = 0;
+my $vg = "libtool --mode=execute valgrind";
my @default_options = ();
my %base_settings = ("DitherAlgorithm" => "Fast");
my %param_types;
-my %param_classes;
-my %param_levels;
+my %stp_dimension_values;
my %stp_float_values;
my %stp_int_values;
+my %min_page_size;
+my %max_page_size;
+my %stp_bools;
my %rerun_cases;
if (defined $ENV{"STP_PARALLEL"}) {
@@ -123,7 +142,12 @@ if (defined $ENV{"STP_PARALLEL"}) {
}
}
+if (defined $ENV{"STP_TEST_FAMILY"}) {
+ @families = split(/ +/, $ENV{"STP_TEST_FAMILY"});
+}
+
GetOptions("C=s" => \$csum_type,
+ "F" => \$print_family,
"G=s" => \$geometry,
"H!" => \$halt_on_error,
"L" => \$list_options,
@@ -132,6 +156,7 @@ GetOptions("C=s" => \$csum_type,
"P:i" => \$duplex_pages,
"R+" => \$use_min_res,
"S+" => \$single,
+ "T:i" => \$res_limit,
"V+" => \$verbose,
"X" => \$rerun,
"Y=s" => \@include_patterns,
@@ -188,6 +213,8 @@ Usage: run-testpattern-2 [opts] [model ...]
-O out_dir Generate actual output and place it in the specified
directory, one file per run. Directory will be created
if necessary.
+ -F Report printer name as "family_modelno" rather than
+ model ID.
Control options:
-H Halt on any error.
@@ -205,7 +232,9 @@ Usage: run-testpattern-2 [opts] [model ...]
Test selection/control options:
-d option=value Test this option with only the specified (default) value,
- if available.
+ if available. For Resolution and PageSize the special
+ values MIN and MAX can be used to specify the
+ lowest/smallest and highest/largest respectively.
-G geometry Specify geometry (=(HxV)(+L+T), as fractions of page).
-o option Test this option. Multiple -o options may be specified.
option1,option2... tests all combinations of each
@@ -216,12 +245,15 @@ Usage: run-testpattern-2 [opts] [model ...]
Default:
$options
-o+ Any options specified with -o will be tested in addition
- to those specified.
+ to those specified (or omitted if -o -option is used)
-p page count Specify number of pages to print per printer. Default $std_pages.
-P page count Specify number of pages to print per printer when testing
duplex mode. Default $duplex_pages.
-R Use the minimum resolution (rather than the default)
to test other options. Equivalent to -dResolution=MIN.
+ -T maxres Limit the tested resolutions to a maximum of maxres in
+ both dimensions; use the lowest resolution available
+ if none meet the criterion.
-X Repeat specified cases listed on standard input.
-N Supply all requested options, even if unused.
-u Round all dimensions to the lower point (for
@@ -255,14 +287,15 @@ if ($use_min_res) {
if (@special_options) {
my (%options);
my ($optseq) = 1;
- if (scalar grep { /^\+$/ } @special_options) {
+ if ((scalar grep { /^\+$/ } @special_options) ||
+ (! scalar grep { /^[^-]/ } @special_options)) {
map { $options{$_} = $optseq++; } @standard_options;
}
if (scalar grep { /^\-$/ } @special_options) {
%options = ();
}
foreach my $opt (@special_options) {
- next if $_ eq '+';
+ next if $opt eq '+';
if ($opt =~ /^-/) {
$opt = substr($opt, 1);
delete $options{$opt};
@@ -307,13 +340,16 @@ my $srcdir = $ENV{"srcdir"};
my $sdir;
$geometry =~ s/^=*//;
-if ($geometry =~ /^(([01]?(\.[0-9]*)?)x([01]?(\.[0-9]*)?))?(\+([01]?(\.[0-9]*)?)\+([01]?(\.[0-9]*)?))?$/) {
+if ($geometry =~ /^(([01]?(\.[0-9]*)?)(x([01]?(\.[0-9]*)?))?)?(\+([01]?(\.[0-9]*)?)(\+([01]?(\.[0-9]*)?))?)?$/) {
my ($H) = $2;
- my ($V) = $4;
- my ($L) = $7;
- my ($T) = $9;
+ my ($V) = $5;
+ my ($L) = $8;
+ my ($T) = $11;
if ($H) {
$hsize = $H;
+ if (not $V) {
+ $V=$H;
+ }
if ($hsize > 1) {
$hsize = 1;
}
@@ -325,6 +361,9 @@ if ($geometry =~ /^(([01]?(\.[0-9]*)?)x([01]?(\.[0-9]*)?))?(\+([01]?(\.[0-9]*)?)
}
}
if ($L) {
+ if (not $T) {
+ $T=$L;
+ }
$left = $L;
}
if ($T) {
@@ -350,10 +389,6 @@ if (! $run_installed && ! defined $ENV{"STP_DATA_PATH"}) {
$ENV{"STP_DATA_PATH"} = "${sdir}/../xml";
}
-if ($valgrind && ! $run_installed && $enable_shared ne "no") {
- die "Valgrind is not compatible with --enable-shared in tree.\nPlease use autogen.sh --disable-shared.\n";
-}
-
if (! defined $ENV{"STP_MODULE_PATH"}) {
$ENV{"STP_MODULE_PATH"} = "${sdir}/../main:${sdir}/../main/.libs";
}
@@ -395,8 +430,8 @@ sub set_global_message($) {
push @global_messages, "message \"$message\";\n"
}
-sub print_one_testpattern($$;$) {
- my ($printer, $pages, $raw) = @_;
+sub print_one_testpattern($$$;$) {
+ my ($printer, $pages, $tp_mode, $raw) = @_;
my $stuff = join "", @global_messages;
$stuff .= join "", @job_extras;
$global_printer = $printer;
@@ -449,8 +484,9 @@ sub print_one_testpattern($$;$) {
$stuff .= ";\n";
$stuff .= "end;\n";
} else {
- $stuff .= << 'EOF';
-mode rgb 8;
+ $tp_mode =~ s/([81]+)/ $1/;
+ $stuff .= << "EOF";
+mode $tp_mode;
pattern 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 ;
pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0;
pattern 1.0 1.0 1.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0;
@@ -504,37 +540,84 @@ EOF
return $stuff;
}
-map { $exclude_list{$_} = 1; } @exclude_list;
-$include_pattern = join("|", map {"($_)"} @include_patterns);
-$exclude_pattern = join("|", map {"($_)"} @exclude_patterns);
-my $extra_arg = "";
-if ($#ARGV >= 0) {
- @printer_list = @ARGV;
- $extra_arg = join " ", @printer_list;
-} else {
+sub get_printers() {
+ map { $exclude_list{$_} = 1; } @exclude_list;
+ $include_pattern = join("|", map {"($_)"} @include_patterns);
+ $exclude_pattern = join("|", map {"($_)"} @exclude_patterns);
+ my (@nprinter_list);
+ my $extra_arg = "";
+ my (%families);
+ my (%model_families);
+ my (%printer_models);
+ map { $families{$_} = 1; } @families;
open PIPE, "./printers|" or die "Cannot run printers: $!\n";
+ my ($line_count);
while(<PIPE>) {
next if m!^#!;
chomp;
- next if $exclude_list{$_};
- next if $exclude_pattern ne '' && /$exclude_pattern/;
- next if $include_pattern ne '' && ! /$include_pattern/;
- push @printer_list, $_;
+ $line_count++;
+ my ($model, $family, $printer) = split;
+ my ($model_family) = "${model}_${family}";
+ $printer_models{$printer} = $model_family;
+ if (! defined $model_families{$model_family}) {
+ $model_families{$model_family} = $printer;
+ }
+ next if @families && ! defined $families{$family};
+ next if $exclude_list{$printer};
+ next if $exclude_pattern ne '' && $printer =~ /$exclude_pattern/;
+ next if $include_pattern ne '' && ! $printer =~ /$include_pattern/;
+ next if $skip_duplicate_printers && $model_families{$model_family} ne $printer;
+ push @nprinter_list, $printer;
}
close PIPE;
+ if ($#ARGV >= 0) {
+ my ($bad_printers_found) = 0;
+ @nprinter_list = grep { defined $_ } map {
+ if (defined $printer_models{$_}) {
+ $_;
+ } elsif (defined $model_families{$_}) {
+ $model_families{$_};
+ } else {
+ print STDERR "Unknown printer ${_}!\n";
+ $bad_printers_found = 1;
+ undef;
+ }
+ } @ARGV;
+ }
+ exit 1 if (! scalar @nprinter_list);
+ return @nprinter_list;
}
-if ($list_printers) {
- print join("\n", sort @printer_list), "\n";
- exit 0;
-}
+sub load_printer_data() {
+ my ($extra_arg) = join(" ", @printer_list);
+ open PIPE, "./printer_options $extra_arg|" or die "Cannot run printer_options: $!\n";
+ while(<PIPE>) {
+ next if m!^#!;
+ eval $_;
+ }
+ close PIPE or die "Cannot run printer_options: $!\n";
+ if ($rerun) {
+ while (<>) {
+ chomp;
+ s/^[^a-zA-Z]*//;
+ s/\..*//;
+ $rerun_cases{$_} = 1;
+ }
+ }
-open PIPE, "./printer_options $extra_arg|" or die "Cannot run printer_options: $!\n";
-while(<PIPE>) {
- next if m!^#!;
- eval $_;
+ my (@nprinter_list);
+ foreach my $printer (@printer_list) {
+ my $model_id = $models{$printer};
+ my $family_id = $families{$printer};
+ if (($skip_duplicate_printers && $models_found{$family_id}{$model_id}) ||
+ (@families && ! grep { $family_id eq $_ } @families)) {
+ } else {
+ $models_found{$family_id}{$model_id} = 1;
+ push @nprinter_list, $printer;
+ }
+ }
+ @printer_list = @nprinter_list;
}
-close PIPE or die "Cannot run printer_options: $!\n";
sub do_print($$) {
my ($output, $fh) = @_;
@@ -572,7 +655,9 @@ sub do_output($) {
my $outfile = "$output/$outbase";
if (defined $csum_file) {
$checksum_cmd = "${csum_type}sum -b | sed 's/-/$outbase/'";
- if ($csum_file ne '' && $csum_file ne '-') {
+ if ($csum_file =~ /^\:([0-9]+)$/) {
+ $checksum_cmd .= " 1>&$1";
+ } elsif ($csum_file ne '' && $csum_file ne '-') {
$checksum_cmd .= " >> '$csum_file'";
}
} elsif (defined $csum_dir) {
@@ -622,25 +707,48 @@ sub build_list($$$$) {
$_
}
} @tmp;
+ } elsif ($key eq 'PageSize') {
+ @tmp = map {
+ if ($_ eq 'MIN') {
+ $min_page_size{$printer}
+ } elsif ($_ eq 'MAX') {
+ $max_page_size{$printer}
+ } else {
+ $_
+ }
+ } @tmp;
}
} elsif ($param_types{$printer}{$key} == 3) {
- my ($minv) = $stp_float_values{$printer}{'MINVAL'}{$key};
- my ($defv) = $stp_float_values{$printer}{'DEFVAL'}{$key};
- my ($maxv) = $stp_float_values{$printer}{'MAXVAL'}{$key};
+ my (@vals) = @{$stp_float_values{$printer}{$key}};
+ my ($minv) = $vals[2];
+ my ($defv) = $vals[1];
+ my ($maxv) = $vals[3];
push @tmp, $minv;
push @tmp, ($minv + $defv) / 2.0;
push @tmp, $defv;
push @tmp, ($defv + $maxv) / 2.0;
push @tmp, $maxv;
} elsif ($param_types{$printer}{$key} == 1) {
- my ($minv) = $stp_int_values{$printer}{'MINVAL'}{$key};
- my ($maxv) = $stp_int_values{$printer}{'MAXVAL'}{$key};
+ my (@vals) = @{$stp_int_values{$printer}{$key}};
+ my ($minv) = $vals[2];
+ my ($maxv) = $vals[3];
push @tmp, ($minv..$maxv);
} elsif ($param_types{$printer}{$key} == 2) {
push @tmp, 0;
push @tmp, 1;
+ } elsif ($key eq "TPMode") {
+ push @tmp, @tp_modes;
+ } elsif ($key eq "Resolution") {
+ @tmp = sort keys %{$resolutions{$printer}};
+ if ($res_limit > 0) {
+ @tmp = grep { $resolutions{$printer}{$_}[0] <= $res_limit &&
+ $resolutions{$printer}{$_}[1] <= $res_limit} @tmp;
+ }
+ if (! @tmp) {
+ push @tmp, $min_res;
+ }
} elsif (defined($param_types{$printer}{$key})) {
- @tmp = keys %{$stpdata{$printer}{$key}};
+ @tmp = @{$stpdata{$printer}{$key}};
}
if (! @tmp) {
return @stuff;
@@ -661,27 +769,28 @@ sub build_list($$$$) {
sub build_key($$) {
my ($keys, $printer) = @_;
my (@keys) = split (/,/, $keys);
- my (@answer) = grep { defined $param_types{$printer}{$_} || /=/ } @keys;
+ my (@answer) = grep { $_ eq "TPMode" || defined $param_types{$printer}{$_} || /=/ } @keys;
return join ",", @answer;
}
sub get_min_max_res($) {
my ($printer) = @_;
- my (@resolutions) = grep {$_ ne 'None' } keys %{$stpdata{$printer}{'Resolution'}};
+ my (%reslist) = %{$resolutions{$printer}};
my $min_res_name;
- my $min_res_value = 0;
+ my $min_res_value = 5760*5760;
my $max_res_name;
my $max_res_value = 0;
- foreach my $res (sort @resolutions) {
- my $res_value = ($stpdata{$printer}{'x_resolution'}{$res} *
- $stpdata{$printer}{'y_resolution'}{$res});
- if ($min_res_value == 0 || $res_value < $min_res_value) {
+ # We want to get the same named resolution each time.
+ foreach my $resid (sort keys %reslist) {
+ my ($res) = $reslist{$resid};
+ my ($res_value) = $$res[0] * $$res[1];
+ if ($res_value < $min_res_value) {
$min_res_value = $res_value;
- $min_res_name = $res;
+ $min_res_name = $resid;
}
if ($res_value > $max_res_value) {
$max_res_value = $res_value;
- $max_res_name = $res;
+ $max_res_name = $resid;
}
}
return ($min_res_name, $max_res_name);
@@ -689,7 +798,7 @@ sub get_min_max_res($) {
sub get_printing_modes($) {
my ($printer) = @_;
- my (@printing_modes) = grep {$_ ne 'None' } keys %{$stpdata{$printer}{'PrintingMode'}};
+ my (@printing_modes) = grep {$_ ne 'None' } @{$stpdata{$printer}{'PrintingMode'}};
if ($base_settings{'PrintingMode'}) {
if ($base_settings{'PrintingMode'} eq 'Color' &&
grep { $_ eq 'Color' } @printing_modes) {
@@ -724,7 +833,41 @@ sub get_optvals($$$) {
return %opt_vals;
}
-# Resolution needs special handling because of MIN and MAX
+sub setup_printer_params($) {
+ my ($printer) = @_;
+ if ($stpdata{$printer}) {
+ foreach my $k (sort keys %{$stpdata{$printer}}) {
+ my ($vals) = $stpdata{$printer}{$k};
+ foreach my $v (0..@$vals) {
+ if (substr($$vals[$v], 0, 1) eq '+') {
+ $$vals[$v] = substr($$vals[$v], 1);
+ $defaults{$printer}{$k} = $$vals[$v];
+ last;
+ }
+ }
+ }
+ map { $param_types{$printer}{$_} = 0 } keys %{$stpdata{$printer}};
+ }
+ $param_types{$printer}{"Resolution"} = 0;
+ if ($stp_int_values{$printer}) {
+ map { $param_types{$printer}{$_} = 1 } keys %{$stp_int_values{$printer}};
+ }
+ if ($stp_bools{$printer}) {
+ map { $param_types{$printer}{$_} = 2 } keys %{$stp_bools{$printer}};
+ }
+ if ($stp_float_values{$printer}) {
+ map { $param_types{$printer}{$_} = 3 } keys %{$stp_float_values{$printer}};
+ }
+ if ($stp_dimension_values{$printer}) {
+ map { $param_types{$printer}{$_} = 8 } keys %{$stp_dimension_values{$printer}};
+ }
+ # curve = 4
+ # file = 5
+ # raw = 6
+ # array = 7
+}
+
+# Resolution and PageSize need special handling because of MIN and MAX
# Duplex needs special handling because of printing multiple pages, and
# need to set JobMode
# RawChannels needs special handling because it's handled specially by
@@ -734,6 +877,7 @@ sub do_printer($$) {
my $first_time = 1;
my %opt_vals = {};
+ setup_printer_params($printer);
my (@printing_modes) = get_printing_modes($printer);
return if (! @printing_modes);
my ($min_res, $max_res) = get_min_max_res($printer);
@@ -748,10 +892,22 @@ sub do_printer($$) {
map {$subkeys{$_} = 1} @subkeys;
my $opt;
foreach $opt (@opts) {
- @extras = ();
- @job_extras = ();
@messages = ();
@global_messages = ();
+ my ($pname) = $print_family ?
+ "${models{$printer}}-$families{$printer}" : $printer;
+ if ($first_time) {
+ if ($quiet < 2) {
+ set_global_message("$pname\n");
+ } elsif ($quiet == 2) {
+ set_global_message(".");
+ }
+ $first_time = 0;
+ }
+ next if (($case_no++ % $proc_count) != $proc_rotor);
+ my ($tp_mode) = "rgb8";
+ @extras = ();
+ @job_extras = ();
my (@ovals);
my $rawval;
my (@subopts) = split (/,/, $opt);
@@ -761,6 +917,8 @@ sub do_printer($$) {
next if ($k eq "RawChannels" && $v ne "None" && $pmode ne "Color");
if ($k eq "RawChannels") {
$rawval = $v;
+ } elsif ($k eq "TPMode") {
+ $tp_mode = $v;
} else {
set_opt($k, $v, $printer);
}
@@ -773,13 +931,18 @@ sub do_printer($$) {
$setting = $min_res;
} elsif ($_ eq "Resolution" && $setting eq "MAX") {
$setting = $max_res;
+ } elsif ($_ eq "PageSize" && $setting eq "MIN") {
+ $setting = $min_page_size{$printer};
+ } elsif ($_ eq "PageSize" && $setting eq "MAX") {
+ $setting = $max_page_size{$printer};
}
set_opt($_, $setting, $printer);
push @ovals, "${_}=$setting";
}
} grep { ! defined $subkeys{$_} &&
- ($use_unused_options ||
- defined $stpdata{$printer}{$_})} (keys %base_settings);
+ ($use_unused_options || $_ eq "Resolution" ||
+ $_ eq "TPMode" ||
+ defined $stpdata{$printer}{$_})} (sort keys %base_settings);
my $pages = $std_pages;
set_opt("PrintingMode", $pmode, $printer);
if ($key =~ /Duplex/) {
@@ -787,53 +950,27 @@ sub do_printer($$) {
$pages = $duplex_pages;
}
my $rawval;
- if ($first_time) {
- if ($quiet < 2) {
- set_global_message("$printer\n");
- } elsif ($quiet == 2) {
- set_global_message(".");
- }
- $first_time = 0;
- }
my ($mstring) = join "_", @ovals;
$mstring =~ s/=/_/g;
my ($ostring) = join "+", @ovals;
- my $case = "${printer}_PrintingMode_${pmode}_${mstring}";
+ my $case = "${pname}_PrintingMode_${pmode}_${mstring}";
$global_case = $case;
if (! $rerun || $rerun_cases{$case}) {
$global_messages = $case;
do_output($case);
set_message(" ${pmode}+${ostring}");
- my $output = print_one_testpattern($printer, $pages, $rawval);
+ my $output = print_one_testpattern($printer, $pages, $tp_mode, $rawval);
do_print($output, $global_fh);
}
}
}
}
+ # Increment the rotor here also, so that if the degree of parallelism is even
+ # and we're running with -o - (an easy way to run minimal cases) we won't wind
+ # up with half the workers running color and half running black and white.
+ $case_no++;
}
-if ($rerun) {
- while (<>) {
- chomp;
- s/^[^a-zA-Z]*//;
- s/\..*//;
- $rerun_cases{$_} = 1;
- }
-}
-
-my (@nprinter_list);
-foreach my $printer (@printer_list) {
- my $model_id = $models{$printer};
- my $family_id = $families{$printer};
- if (($skip_duplicate_printers && $models_found{$family_id}{$model_id}) ||
- (@families && ! grep { $family_id eq $_ } @families)) {
- } else {
- $models_found{$family_id}{$model_id} = 1;
- push @nprinter_list, $printer;
- }
-}
-@printer_list = @nprinter_list;
-
sub restart_testpattern {
my ($silent) = @_;
if (! $silent) {
@@ -868,23 +1005,32 @@ sub stopit {
}
}
+sub get_default($$) {
+ my ($printer, $opt) = @_;
+ if (defined $defaults{$printer}{$opt}) {
+ return $defaults{$printer}{$opt};
+ } else {
+ return $stpdata{$printer}{$opt}[0];
+ }
+}
+
sub list_options() {
if ($#printer_list > 0) {
die "-L must be used with one printer\n";
}
my ($printer) = $printer_list[0];
foreach my $opt (sort keys %{$stpdata{$printer}}) {
- next if $opt eq "x_resolution";
- next if $opt eq "y_resolution";
print "$opt\n";
if ($verbose) {
if ($param_types{$printer}{$opt} == 3) {
- print " $stp_float_values{$printer}{'MINVAL'}{$opt}\n";
- print " =>$stp_float_values{$printer}{'DEFVAL'}{$opt}\n";
- print " $stp_float_values{$printer}{'MAXVAL'}{$opt}\n";
+ my (@vals) = @{$stp_float_values{$printer}{$opt}};
+ print " $vals[2]\n";
+ print " =>$vals[1]\n";
+ print " $vals[3]\n";
} elsif ($param_types{$printer}{$opt} == 1) {
- print " $stp_int_values{$printer}{'MINVAL'}{$opt}\n";
- print " $stp_int_values{$printer}{'MAXVAL'}{$opt}\n";
+ my (@vals) = @{$stp_float_values{$printer}{$opt}};
+ print " $vals[2]\n";
+ print " $vals[3]\n";
} elsif ($param_types{$printer}{$opt} == 2) {
if ($defaults{$printer}{$opt}) {
print " 0\n";
@@ -894,8 +1040,9 @@ sub list_options() {
print " 1\n";
}
} else {
- foreach my $val (sort keys %{$stpdata{$printer}{$opt}}) {
- if ($val eq $defaults{$printer}{$opt}) {
+ my ($default) = get_default($printer, $opt);
+ foreach my $val (sort @{$stpdata{$printer}{$opt}}) {
+ if ($val eq $default) {
print " =>$val\n";
} else {
print " $val\n";
@@ -921,16 +1068,16 @@ sub runit() {
$valopts = '--tool=memcheck';
}
if ($gdb_attach) {
- $valopts .= ' --db-attach=yes';
+ $valopts .= ' --vgdb=yes';
}
if ($valgrind == 1) {
- $valgrind_command = "valgrind $valopts -q --num-callers=50 --error-limit=no --leak-check=yes";
+ $valgrind_command = "$vg $valopts -q --num-callers=50 --error-limit=no --leak-check=yes --error-exitcode=1";
} elsif ($valgrind == 2) {
- $valgrind_command = "valgrind $valopts --num-callers=50 --error-limit=no --leak-resolution=high --leak-check=yes";
+ $valgrind_command = "$vg $valopts --num-callers=50 --error-limit=no --leak-resolution=high --leak-check=yes --error-exitcode=1";
} elsif ($valgrind == 3) {
- $valgrind_command = "valgrind $valopts --error-limit=no --num-callers=50 --show-reachable=yes --leak-resolution=high --leak-check=yes";
+ $valgrind_command = "$vg $valopts --error-limit=no --num-callers=50 --show-reachable=yes --leak-resolution=high --leak-check=yes --error-exitcode=1";
} elsif ($valgrind == 4) {
- $valgrind_command = "valgrind $valopts";
+ $valgrind_command = "$vg $valopts --error-exitcode=1";
}
# O U T P U T #
@@ -942,7 +1089,7 @@ sub runit() {
mkdir $csum_dir || die "Can't create directory $csum_dir: $!\n";
}
- if (defined $csum_file) {
+ if (defined $csum_file && ! $csum_file =~ /^\:([0-9]+)$/) {
unlink $csum_file;
system "touch $csum_file";
}
@@ -956,6 +1103,10 @@ sub runit() {
my (@children);
my ($child_no);
my ($kid);
+ load_printer_data();
+ # Note that when testing duplex all pages of the duplex run are done by
+ # one process, but each page counts as a separate test. So the number
+ # of cases per process may not always be within 1.
if ($proc_count > 1) {
for ($child_no = 0; $child_no < $proc_count; $child_no++) {
$kid = fork();
@@ -963,19 +1114,9 @@ sub runit() {
last;
} else {
push @children, $kid;
+ $proc_rotor++;
}
}
-
- # Child: select the printers to print, round-robin.
- 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;
- }
}
my $status = 1;
@@ -1004,7 +1145,7 @@ sub runit() {
restart_testpattern(1);
do_printer($printer, $global_fh);
$status |= close $global_fh;
- $status |= ($? & 255);
+ $error += ($? != 0);
}
} else {
$SIG{PIPE} = sub() { restart_testpattern() };
@@ -1031,10 +1172,14 @@ sub runit() {
}
}
-
-if ($list_options) {
+@printer_list = get_printers();
+if ($list_printers) {
+ print join("\n", sort @printer_list), "\n";
+} elsif ($list_options) {
+ load_printer_data();
list_options();
} elsif ($dontrun) {
+ load_printer_data();
map { do_printer($_, \*STDOUT) } @printer_list;
} else {
exit(runit());