Author: dagolden
Date: Sun Jun 28 11:19:09 2009
New Revision: 12959
Modified:
ExtUtils-ParseXS/trunk/Build.PL
ExtUtils-ParseXS/trunk/Changes
ExtUtils-ParseXS/trunk/Makefile.PL
ExtUtils-ParseXS/trunk/t/basic.t
ExtUtils-ParseXS/trunk/t/usage.t
Log:
change to Test::More; skip tests if no compiler/no dynamic loading
Modified: ExtUtils-ParseXS/trunk/Build.PL
==============================================================================
--- ExtUtils-ParseXS/trunk/Build.PL (original)
+++ ExtUtils-ParseXS/trunk/Build.PL Sun Jun 28 11:19:09 2009
@@ -8,18 +8,22 @@
installdirs => 'core',
auto_configure_requires => 0,
requires => {
- 'Cwd' => 0,
- 'Config' => 0,
- 'File::Basename' => 0,
- 'File::Spec' => 0,
- 'Exporter' => 0,
- },
+ 'Cwd' => 0,
+ 'Exporter' => 0,
+ 'File::Basename' => 0,
+ 'File::Spec' => 0,
+ 'Symbol' => 0,
+ },
build_requires => {
- 'ExtUtils::CBuilder' => 0,
- },
+ 'Carp' => 0,
+ 'DynaLoader' => 0,
+ 'ExtUtils::CBuilder' => 0,
+ 'Test::More' => 0.47,
+ },
add_to_cleanup => ["t/XSTest.c", "t/XSTest$Config{obj_ext}", "t/XSTest.$Config{dlext}"],
create_makefile_pl => 'traditional',
create_readme => 1,
);
$build->create_build_script;
+
Modified: ExtUtils-ParseXS/trunk/Changes
==============================================================================
--- ExtUtils-ParseXS/trunk/Changes (original)
+++ ExtUtils-ParseXS/trunk/Changes Sun Jun 28 11:19:09 2009
@@ -2,6 +2,10 @@
2.19_04 -
+ - Changed tests to use Test::More and added it to prereqs
+
+ - Some tests skip if no compiler or if no dynamic loading
+
2.19_03 - Sat Jun 27 22:51:18 EDT 2009
- Released to see updated results from smoke testers
Modified: ExtUtils-ParseXS/trunk/Makefile.PL
==============================================================================
--- ExtUtils-ParseXS/trunk/Makefile.PL (original)
+++ ExtUtils-ParseXS/trunk/Makefile.PL Sun Jun 28 11:19:09 2009
@@ -9,9 +9,12 @@
'VERSION_FROM' => 'lib/ExtUtils/ParseXS.pm',
'PREREQ_PM' => {
'File::Spec' => 0,
- 'File::Basename' => 0,
+ 'Symbol' => 0,
'Exporter' => 0,
- 'Config' => 0,
+ 'Carp' => 0,
+ 'Test::More' => '0.47',
+ 'File::Basename' => 0,
+ 'DynaLoader' => 0,
'ExtUtils::CBuilder' => 0,
'Cwd' => 0
}
Modified: ExtUtils-ParseXS/trunk/t/basic.t
==============================================================================
--- ExtUtils-ParseXS/trunk/t/basic.t (original)
+++ ExtUtils-ParseXS/trunk/t/basic.t Sun Jun 28 11:19:09 2009
@@ -9,12 +9,17 @@
}
}
use strict;
-use Test;
-BEGIN { plan tests => 10 };
+use Test::More;
+use Config;
use DynaLoader;
-use ExtUtils::ParseXS qw(process_file);
use ExtUtils::CBuilder;
-ok(1); # If we made it this far, we're loaded.
+
+plan tests => 10;
+
+my ($source_file, $obj_file, $lib_file);
+
+require_ok( 'ExtUtils::ParseXS' );
+ExtUtils::ParseXS->import('process_file');
chdir 't' or die "Can't chdir to t/, $!";
@@ -25,32 +30,35 @@
# Try sending to filehandle
tie *FH, 'Foo';
process_file( filename => 'XSTest.xs', output => \*FH, prototypes => 1 );
-ok tied(*FH)->content, '/is_even/', "Test that output contains some text";
+like tied(*FH)->content, '/is_even/', "Test that output contains some text";
-my $source_file = 'XSTest.c';
+$source_file = 'XSTest.c';
# Try sending to file
process_file(filename => 'XSTest.xs', output => $source_file, prototypes => 0);
-ok -e $source_file, 1, "Create an output file";
+ok -e $source_file, "Create an output file";
-# TEST doesn't like extraneous output
my $quiet = $ENV{PERL_CORE} && !$ENV{HARNESS_ACTIVE};
-
-# Try to compile the file! Don't get too fancy, though.
my $b = ExtUtils::CBuilder->new(quiet => $quiet);
-if ($b->have_compiler) {
- my $module = 'XSTest';
- my $obj_file = $b->compile( source => $source_file );
+SKIP: {
+ skip "no compiler available", 2
+ if ! $b->have_compiler;
+ $obj_file = $b->compile( source => $source_file );
ok $obj_file;
- ok -e $obj_file, 1, "Make sure $obj_file exists";
+ ok -e $obj_file, "Make sure $obj_file exists";
+}
- my $lib_file = $b->link( objects => $obj_file, module_name => $module );
+SKIP: {
+ skip "no dynamic loading", 5
+ if !$b->have_compiler || !$Config{usedl};
+ my $module = 'XSTest';
+ $lib_file = $b->link( objects => $obj_file, module_name => $module );
ok $lib_file;
- ok -e $lib_file, 1, "Make sure $lib_file exists";
+ ok -e $lib_file, "Make sure $lib_file exists";
eval {require XSTest};
- ok $@, '';
+ is $@, '';
ok XSTest::is_even(8);
ok !XSTest::is_even(9);
@@ -64,16 +72,13 @@
}
}
}
- unless ($ENV{PERL_NO_CLEANUP}) {
- 1 while unlink $obj_file;
- 1 while unlink $lib_file;
- }
-} else {
- skip "Skipped can't find a C compiler & linker", 1 for 1..7;
}
unless ($ENV{PERL_NO_CLEANUP}) {
- 1 while unlink $source_file;
+ for ( $obj_file, $lib_file, $source_file) {
+ next unless defined $_;
+ 1 while unlink $_;
+ }
}
#####################################################################
Modified: ExtUtils-ParseXS/trunk/t/usage.t
==============================================================================
--- ExtUtils-ParseXS/trunk/t/usage.t (original)
+++ ExtUtils-ParseXS/trunk/t/usage.t Sun Jun 28 11:19:09 2009
@@ -9,12 +9,17 @@
}
}
use strict;
-use Test;
-BEGIN { plan tests => 24 };
+use Test::More;
+use Config;
use DynaLoader;
-use ExtUtils::ParseXS qw(process_file);
use ExtUtils::CBuilder;
-ok(1); # If we made it this far, we're loaded.
+
+plan tests => 24;
+
+my ($source_file, $obj_file, $lib_file, $module);
+
+require_ok( 'ExtUtils::ParseXS' );
+ExtUtils::ParseXS->import('process_file');
chdir 't' or die "Can't chdir to t/, $!";
@@ -22,30 +27,37 @@
#########################
-my $source_file = 'XSUsage.c';
+$source_file = 'XSUsage.c';
# Try sending to file
process_file(filename => 'XSUsage.xs', output => $source_file);
-ok -e $source_file, 1, "Create an output file";
+ok -e $source_file, "Create an output file";
# TEST doesn't like extraneous output
my $quiet = $ENV{PERL_CORE} && !$ENV{HARNESS_ACTIVE};
# Try to compile the file! Don't get too fancy, though.
my $b = ExtUtils::CBuilder->new(quiet => $quiet);
-if ($b->have_compiler) {
- my $module = 'XSUsage';
- my $obj_file = $b->compile( source => $source_file );
+SKIP: {
+ skip "no compiler available", 2
+ if ! $b->have_compiler;
+ $module = 'XSUsage';
+
+ $obj_file = $b->compile( source => $source_file );
ok $obj_file;
- ok -e $obj_file, 1, "Make sure $obj_file exists";
+ ok -e $obj_file, "Make sure $obj_file exists";
+}
+SKIP: {
+ skip "no dynamic loading", 20
+ if !$b->have_compiler || !$Config{usedl};
- my $lib_file = $b->link( objects => $obj_file, module_name => $module );
+ $lib_file = $b->link( objects => $obj_file, module_name => $module );
ok $lib_file;
- ok -e $lib_file, 1, "Make sure $lib_file exists";
+ ok -e $lib_file, "Make sure $lib_file exists";
eval {require XSUsage};
- ok $@, '';
+ is $@, '';
# The real tests here - for each way of calling the functions, call with the
# wrong number of arguments and check the Usage line is what we expect
@@ -97,10 +109,12 @@
}
}
}
- 1 while unlink $obj_file;
- 1 while unlink $lib_file;
-} else {
- skip "Skipped can't find a C compiler & linker", 1 for 3 .. 24;
}
-1 while unlink $source_file;
+unless ($ENV{PERL_NO_CLEANUP}) {
+ for ( $obj_file, $lib_file, $source_file) {
+ next unless defined $_;
+ 1 while unlink $_;
+ }
+}
+
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.