|
1 #!/usr/bin/perl |
|
2 |
|
3 # xyzimage_test.pl |
|
4 # This file is part of the testsuite of the Radiance csh2perl project. |
|
5 # You may copy and modify this file as basis for other tests. |
|
6 # |
|
7 # (c) Axel Jacobs, 28 June 2011 |
|
8 |
|
9 use strict; |
|
10 use warnings; |
|
11 |
|
12 my $script = "xyzimage"; |
|
13 my $csh = "../orig/$script.csh"; |
|
14 my $perl = "../bin/$script.perl"; |
|
15 print "script: $script\n"; |
|
16 |
|
17 my $img = "data/images/street-xyze_rle_400x400.hdr"; |
|
18 |
|
19 # Options are arrays of [STDIN, command-line options]. |
|
20 # Please include the pipe symbol as part of STDIN. |
|
21 # Put a leading space in front of STDIN to line up the output. |
|
22 my @options = ( |
|
23 ["", "$img"], |
|
24 ["", "-g 1.0 $img"], |
|
25 ["", "-p 0.65 0.25 0.15 0.75 0.15 0.2 0.4 0.35 $img"], |
|
26 ["", "-p 0.5 0.25 0.15 0.75 0.15 0.2 0.4 0.35 $img"], |
|
27 ); |
|
28 |
|
29 # Run old CSH and new Perl script with different options, |
|
30 # compare the resulting images. |
|
31 my $total = 0; |
|
32 my $fail = 0; |
|
33 my $index = 0; |
|
34 my $opts; |
|
35 foreach $opts (@options) { |
|
36 # Hmm, not sure how to compare old and new automatically without screen-shooting. |
|
37 my $stdin = @$opts[0]; |
|
38 my $args = @$opts[1]; |
|
39 $total++; |
|
40 |
|
41 my $cshcmd = "$script.csh $args"; |
|
42 print " $stdin $cshcmd\n"; |
|
43 system "$stdin csh ../orig/$cshcmd >/dev/null &"; |
|
44 |
|
45 my $perlcmd = "$script.pl $args"; |
|
46 print " $stdin $perlcmd\n"; |
|
47 system "$stdin perl ../bin/$perlcmd >/dev/null &"; |
|
48 |
|
49 print " Please compare the two rvu displays. Are they identical [y/N]? "; |
|
50 my $identical = <>; |
|
51 chomp $identical; |
|
52 if( lc( $identical ) eq 'y' ) { |
|
53 print " Ok: Output appears to be identical.\n"; |
|
54 } else { |
|
55 print " Error: Output appears to be different.\n"; |
|
56 $fail++; |
|
57 } |
|
58 } |
|
59 |
|
60 print "$fail of $total tests failed.\n"; |
|
61 |
|
62 #EOF |