summaryrefslogtreecommitdiffstats
path: root/regression-gp.pl
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2018-09-23 19:56:22 -0400
committerSolomon Peachy <pizza@shaftnet.org>2018-09-26 09:37:36 -0400
commit1d5b82b5914be3df396a53ad36725cc08829cb89 (patch)
tree1010483978fc6c5923600afaf77f32da89a8324f /regression-gp.pl
parent0234fffd7e5e595a623ccd7421dbe5b6149ca019 (diff)
downloadselphy_print-1d5b82b5914be3df396a53ad36725cc08829cb89.tar.gz
selphy_print-1d5b82b5914be3df396a53ad36725cc08829cb89.tar.bz2
selphy_print-1d5b82b5914be3df396a53ad36725cc08829cb89.zip
regression: support passing stuff through gutenprint
Diffstat (limited to 'regression-gp.pl')
-rwxr-xr-xregression-gp.pl76
1 files changed, 76 insertions, 0 deletions
diff --git a/regression-gp.pl b/regression-gp.pl
new file mode 100755
index 0000000..ae383ca
--- /dev/null
+++ b/regression-gp.pl
@@ -0,0 +1,76 @@
+#!/usr/bin/perl
+use strict;
+use IPC::Run qw( run );
+
+my $retval = 0;
+
+my $id = 123;
+my $user = "tester";
+my $title = "image_test";
+my $copies = 1;
+my $input_image = "testjobs/s3s-59.png";
+
+$ENV{"STP_SUPPRESS_VERBOSE_MESSAGES"} = 1;
+$ENV{"OMP_NUM_THREADS"} = 1;
+$ENV{"TEST_MODE"} = "2";
+
+while (<STDIN>) {
+ chomp;
+ next if /^#/;
+ s/(.+)#.*/$1/;
+
+ if (defined($ARGV[0])) {
+ next if (index($_,$ARGV[0]) == -1);
+ };
+
+ my @row = split(/,/);
+
+ my $gp_name = $row[0];
+ $ENV{"BACKEND"} = $row[1];
+ $ENV{"EXTRA_VID"} = $row[2];
+ $ENV{"EXTRA_PID"} = $row[3];
+
+ if (length($row[4])) {
+ $ENV{"MEDIA_CODE"} = $row[4];
+ } else {
+ undef($ENV{"MEDIA_CODE"});
+ }
+
+ my $options = "";
+
+ my @gp_options = split(/;/,$row[5]);
+ # generate options list
+ foreach my $x (@gp_options) {
+ $options .= "$x ";
+ }
+
+ print "***** $row[0] $row[1] $row[2] $row[3] $row[4] '$row[5]'\n";
+
+ my @args;
+
+ # Generate PPD
+ my $ppd_fname = "/tmp/stp-$gp_name.5.3.ppd";
+
+ $ENV{"PPD"} = $ppd_fname;
+ $ENV{"DEVICE_URI"} = "gutenprint53+usb://$row[1]/12345678";
+
+ run ["/usr/sbin/cups-genppd.5.3", "-p", "/tmp", "-Z", $gp_name] or die("FAIL genppd $?: $row[0] $row[1] $row[2] $row[3] $row[4] $row[5]\n");
+
+ # Generate raster from $image
+ @args = ("/usr/lib/cups/filter/imagetoraster", $id, $user, $title, $copies, $options, $input_image);
+ print join(":", @args) . "\n";
+ run \@args, ">", "/tmp/${gp_name}.raster" or die ("FAIL: imagetoraster $?: $row[0] $row[1] $row[2] $row[3] $row[4] $row[5]\n");
+
+ # Call raster2gutenprint
+ @args = ("valgrind", "/usr/lib/cups/filter/rastertogutenprint.5.3", $id, $user, $title, $copies, $options);
+ print join(":", @args) . "\n";
+ run \@args, "<", "/tmp/${gp_name}.raster", ">", "/tmp/${gp_name}.raw" or die("FAIL: rastertogutenorint $?: $row[0] $row[1] $row[2] $row[3] $row[4] $row[5]\n");
+
+ # Call backend using CUPS methodologies, using STDIN.
+ @args = ("./dyesub_backend", $id, $user, $title, $copies, $options);
+ print join(":", @args) . "\n";
+ run \@args, "<", "/tmp/${gp_name}.raw" or die("FAIL: backend $?: $row[0] $row[1] $row[2] $row[3] $row[4] $row[5]\n");
+
+ print "***** PASS\n";
+}
+exit($retval);