Skip to content

Commit

Permalink
Merge 75732eb into babaa0e
Browse files Browse the repository at this point in the history
  • Loading branch information
mohawk2 committed Apr 11, 2015
2 parents babaa0e + 75732eb commit f1a300e
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 91 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Expand Up @@ -7,6 +7,8 @@ matrix:
env: COVERAGE=1
- perl: "5.20"
env: EUMM_BLEAD=1
- perl: "5.20"
env: TEST_INSTALLED=1 # test not from blib but after installing
- perl: "5.10"
- perl: "5.12"
- perl: "5.14"
Expand Down Expand Up @@ -57,14 +59,15 @@ before_install:
- cd $BUILD_DIR # $BUILD_DIR is set by the build-dist command
install:
- cpan-install --deps # installs prereqs, including recommends
- cpan-install --coverage # installs converage prereqs, if enabled
- cpan-install --coverage # installs coverage prereqs, if enabled
- prove t/00-report-prereqs.t t/01-checkmanifest.t
# SYSTEM_CORES set by travis-perl-helpers
- if [ "$SERIAL_BUILD" == 1 ]; then make; else make -j$(( $SYSTEM_CORES * 2 )); fi
before_script:
- coverage-setup
script:
- if [ "$SERIAL_TESTING" == 1 ]; then prove -b -v $(test-files); else prove --formatter TAP::Formatter::File -j$(test-jobs) -b -v $(test-files); fi
- export PROVE_FLAG=""; if [ "$TEST_INSTALLED" == 1 ]; then make install clean; mv Basic Basic.x; mv ../Basic ../Basic.x; else PROVE_FLAG="-b -v"; fi # clean is to ensure no blib, mv to ensure doesn't think is in repo!
- if [ "$SERIAL_TESTING" == 1 ]; then prove $PROVE_FLAG $(test-files); else prove --formatter TAP::Formatter::File -j$(test-jobs) $PROVE_FLAG $(test-files); fi
after_script:
- perl -Iblib/lib -MPDL::Config -MData::Dumper -e 'print Dumper \%PDL::Config'
after_success:
Expand Down
51 changes: 23 additions & 28 deletions t/inline-comment-test.t
Expand Up @@ -5,9 +5,8 @@
# -- DCM, April 16, 2012

use strict;
use warnings;
use Test::More;
use blib; # otherwise possible error on virgin systems not finding PDL::Core

use PDL::LiteF;

# First some Inline administivia.
Expand Down Expand Up @@ -41,33 +40,9 @@ BEGIN {
plan tests => 3;
}

SKIP: {
# use Inline 'INFO'; # use to generate lots of info
use Inline 'Pdlpp';

print "Inline Version: $Inline::VERSION\n";
ok(1, 'Everything seems to have compiled');

$a = sequence(3,3);

$b = $a->testinc;

ok(all ($b == $a+1), 'Sanity check runs correctly');

# Test the inability to comment-out a threadloop. This is documented on the
# 11th page of the PDL::PP chapter of the PDL book. If somebody ever fixes this
# wart, this test will fail, in which case the book's text should be updated.
$b = $a->testinc2;
TODO: {
# Note: This test appears to fail on Cygwin and some flavors of Linux.
local $TODO = 'This test inexplicably passes on some machines';
ok(not (all $b == $a + 1), 'WART: commenting out a threadloop does not work')
or diag("\$a is $a and \$b is $b");
}

__DATA__
__Pdlpp__
eval { Inline->bind(Pdlpp => <<'EOF') };
# simple PP definition with user irritation tests :-)
pp_def('testinc',
Expand Down Expand Up @@ -108,3 +83,23 @@ pp_def('testinc2',
},
);
EOF
is $@, '', 'compiled' or skip 'bind failed', 2;

$a = sequence(3,3);

$b = $a->testinc;

ok(all ($b == $a+1), 'Sanity check runs correctly');

# Test the inability to comment-out a threadloop. This is documented on the
# 11th page of the PDL::PP chapter of the PDL book. If somebody ever fixes this
# wart, this test will fail, in which case the book's text should be updated.
$b = $a->testinc2;
TODO: {
# Note: This test appears to fail on Cygwin and some flavors of Linux.
local $TODO = 'This test inexplicably passes on some machines';
ok(not (all $b == $a + 1), 'WART: commenting out a threadloop does not work')
or diag("\$a is $a and \$b is $b");
}
}
39 changes: 18 additions & 21 deletions t/inline-with.t
Expand Up @@ -2,9 +2,8 @@
# Also that the XS code in PDL::API works.

use strict;
use warnings;
use Test::More;
use blib; # otherwise possible error on virgin systems not finding PDL::Core

use PDL::LiteF;

my $inline_test_dir;
Expand Down Expand Up @@ -37,27 +36,12 @@ END {
}
}
}
# rmtree $inline_test_dir if -d $inline_test_dir;
}

#use Inline 'INFO'; # use to generate lots of info
use Inline with => 'PDL';
use Inline 'C';

note "Inline Version: $Inline::VERSION\n";
ok 1, 'compiled';

my $pdl = myfloatseq();
note $pdl->info,"\n";

is $pdl->dims, 3, 'dims correct';

done_testing;

__DATA__
__C__
SKIP: {
#use Inline 'INFO'; # use to generate lots of info
use_ok 'Inline', with => 'PDL' or skip 'with PDL failed', 3;
eval { Inline->bind(C => <<'EOF') };
static pdl* new_pdl(int datatype, PDL_Indx dims[], int ndims)
{
pdl *p = PDL->pdlnew();
Expand All @@ -79,3 +63,16 @@ pdl* myfloatseq()
dataf[i] = i; /* the data must be initialized ! */
return p;
}
EOF
is $@, '', 'bind no error' or skip 'Inline C failed', 2;

note "Inline Version: $Inline::VERSION\n";
ok 1, 'compiled';

my $pdl = myfloatseq();
note $pdl->info,"\n";

is $pdl->dims, 3, 'dims correct';
}

done_testing;
61 changes: 21 additions & 40 deletions t/inlinepdlpp.t
@@ -1,46 +1,18 @@
use strict;
use Test::More;
use blib; # otherwise possible error on virgin systems not finding PDL::Core

use warnings;
use Test::More tests => 5;
use PDL::LiteF;

BEGIN {
# clean out the _Inline directory on every test
# (may be OTT but ensures that we're always testing the latest code)
#
# require File::Path;
# File::Path::rmtree (["_Inline", ".Inline"], 0, 0);

# Test for Inline and set options
my $inline_test_dir = './.inlinepdlpp';
mkdir $inline_test_dir unless -d $inline_test_dir;
eval 'use Inline (Config => DIRECTORY => $inline_test_dir , FORCE_BUILD => 1)';
plan skip_all => "Skipped: Inline not installed" if $@;
diag "Inline Version: $Inline::VERSION\n";
eval 'use Inline 0.43';
plan skip_all => "Skipped: not got Inline >= 0.43" if $@;
plan tests => 3;
}

sub myshape { join ',', $_[0]->dims }

# use Inline 'INFO'; # use to generate lots of info
use Inline 'Pdlpp';

ok(1); # ok, we made it so far

$a = sequence(3,3);

$b = $a->testinc;

ok(myshape($a) eq myshape($b));

ok(all $b == $a+1);

__DATA__
__Pdlpp__
my $inline_test_dir = './.inlinepdlpp';
mkdir $inline_test_dir unless -d $inline_test_dir;
SKIP: {
use_ok('Inline', Config => DIRECTORY => $inline_test_dir, FORCE_BUILD => 1)
|| skip "Skipped: Inline not installed", 4;
note "Inline Version: $Inline::VERSION\n";
eval { Inline->VERSION(0.43) };
is $@, '', 'at least 0.43' or skip "Skipped: not got Inline >= 0.43", 3;
# use Inline 'INFO'; # use to generate lots of info
eval { Inline->bind(Pdlpp => <<'EOF') };
# simple PP definition
pp_def('testinc',
Expand All @@ -49,3 +21,12 @@ pp_def('testinc',
);
# this tests the bug with a trailing comment and *no* newline
EOF
is $@, '', 'bind no error' or skip "bind failed", 2;
my $x = sequence(3,3);
my $y = $x->testinc;
is myshape($x), myshape($y), 'myshape eq';
ok(all $y == $x+1, '==');
}

sub myshape { join ',', $_[0]->dims }

0 comments on commit f1a300e

Please sign in to comment.