[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gimp-print-devel
Subject:    [Gimp-print-devel] [PATCH] run-testpattern-2 print md5sum
From:       Sascha Sommer <saschasommer () freenet ! de>
Date:       2006-08-11 16:08:29
Message-ID: 200608111808.29829.saschasommer () freenet ! de
[Download RAW message or body]

Hi,

this patch adds a -m option to run-testpattern-2 which would output the 
generated printjobs to out.prn and print the md5sum of this file.
Do you think something like this could be usefull for gutenprint?

Comments? I'm not really an expert when it comes to perl.
Note that the return value of testpattern gets lost because it now gets 
executed multiple times.

Regards

Sascha

["run-testpattern-2_md5sum.patch" (text/x-diff)]

--- run-testpattern-2.mod	2006-08-07 18:45:12.000000000 +0200
+++ run-testpattern-2	2006-08-11 17:57:04.000000000 +0200
@@ -8,8 +8,10 @@
 my $valgrind = 0;
 my $cachegrind = 0;
 my $gdb_attach = 0;
+my $calc_md5 = 0;
 my $dontrun = 0;
 my $retval = 0;
+my $testpattern_command;
 my @printer_list = ();
 
 my @extras = ();
@@ -24,7 +26,8 @@
 	   "c"   => \$cachegrind,
 	   "g"   => \$gdb_attach,
 	   "n"   => \$dontrun,
-	   "s!"  => \$skip_duplicate_printers);
+	   "s!"  => \$skip_duplicate_printers,
+	   "m"   => \$calc_md5);
 
 my $pwd = `pwd`;
 chomp $pwd;
@@ -129,8 +132,21 @@
     close PIPE;
 }
 
-sub do_printer($$) {
-    my ($printer, $fh) = @_;
+sub do_print{
+    my $output = @_[0];
+    if($dontrun){
+	print $output;
+    }else{
+	open TESTPATTERN, "|$testpattern_command" or
+		die "Can't run $testpattern_command: $!\n";
+	print TESTPATTERN $output;
+	close TESTPATTERN;
+    }
+}
+
+
+sub do_printer {
+    my $printer = @_[0];
     my $tmp = $stpdata{$printer}{'Resolution'};
     my $min_res_name;
     my $min_res_value = 0;
@@ -173,7 +189,7 @@
 	    set_opt("ColorCorrection", "Raw");
 	    set_message("    ${pmode}+${resolution}");
 	    my $output = print_one_testpattern($printer);
-	    print $fh $output;
+	    do_print( $output );
 	}
 	if ($#ink_types >= 1) {
 	    foreach $ink_type (@ink_types) {
@@ -190,7 +206,7 @@
 		set_opt("ColorCorrection", "Raw");
 		set_message("    ${ink_type}+${pmode}+${min_res_name}");
 		my $output = print_one_testpattern($printer);
-		print $fh $output;
+		do_print( $output );
 	    }
 	}
     }
@@ -200,7 +216,6 @@
     map { do_printer($_, \*STDOUT) } @printer_list;
     exit 0;
 } else {
-    my $testpattern_command;
     my $valgrind_command;
     my $valopts;
     if ($cachegrind) {
@@ -222,15 +237,13 @@
 	$valgrind_command = "valgrind $valopts";
     }
 
-    $testpattern_command = "$valgrind_command ./testpattern -n";
-	
-    open TESTPATTERN, "|$testpattern_command" or
-	die "Can't run $testpattern_command: $!\n";
-    map { do_printer($_, \*TESTPATTERN) } @printer_list;
-    my $status = close TESTPATTERN;
-    if ($status) {
-	exit 0;
-    } else {
-	exit 1;
+    if ($calc_md5) {
+	$testpattern_command = "./testpattern > out.prn ; md5sum out.prn";
+    }else {
+	$testpattern_command = "$valgrind_command ./testpattern -n";
     }
+
+    map { do_printer($_) } @printer_list;
+
+    exit 0;
 }


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
Gimp-print-devel mailing list
Gimp-print-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gimp-print-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic