Subject: | [Win32] Enable running of t/plplot_library_tests.t |
Attached patch to t/plplot_library_tests.t allows the script to run on
Windows.
Cheers,
Rob
Subject: | tests-diff.txt |
--- t/plplot_library_tests.t_orig Sat Sep 3 15:10:20 2011
+++ t/plplot_library_tests.t Sat Sep 3 15:17:14 2011
@@ -10,6 +10,7 @@
use PDL::Config;
use PDL::Graphics::PLplot;
use Test::More;
+use File::Spec;
######################### End of black magic.
@@ -42,15 +43,27 @@
# Compile C version
unlink ("a.out");
+ if($^O =~ /MSWin32/i) {
+ my $cmd = $plversion->{'C_COMPILE'};
+ my $cc = $Config::Config{'cc'};
+ $cmd =~ s/\\/\//g; # Convert all backslashes to forward slashes
+ $cmd =~ s/\Q$cc\E/\Q$cc $c_code\E/; # Insert source file into the command
+ $cmd =~ s/\\//g; # Remove all backskashes
+ system("$cmd -o a.out");
+ }
+ else {
system "LD_RUN_PATH=\"$plversion->{'PLPLOT_LIB'}\" $plversion->{'C_COMPILE'} $c_code -o a.out";
+ }
ok ((($? == 0) && -s "a.out"), "$c_code compiled successfully");
# Run C version
- system "a.out -dev svg -o x${num}c.svg -fam > /dev/null 2>&1";
+ my $devnull = File::Spec->devnull();
+ system "a.out -dev svg -o x${num}c.svg -fam > $devnull 2>&1";
ok ($? == 0, "C code $c_code ran successfully");
# Run perl version
- system "$plplot_test_script -dev svg -o x${num}p.svg -fam > /dev/null 2>&1";
+ my $perlrun = $^O =~ /MSWin32/i ? 'perl -Mblib' : '';
+ system "$perlrun $plplot_test_script -dev svg -o x${num}p.svg -fam > $devnull 2>&1";
ok ($? == 0, "Script $plplot_test_script ran successfully");
my @output = glob ("x${num}p.svg*");
foreach my $outfile (@output) {