From 0f7c6f3211dc45fe944d2c5900ed9a1fb1216e22 Mon Sep 17 00:00:00 2001 From: David Dick Date: Sat, 4 Jan 2025 07:51:19 +1100 Subject: [PATCH] Fixing a case where tests fail when the module is installed. Thanks to ppisar for GH#9 --- .github/workflows/ci.yml | 14 ++++++++------ t/core_partial_read.t | 5 +++-- t/core_read.t | 4 +++- t/core_sysopen.t | 4 +++- t/pp.t | 12 +++++++++++- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82b6d25..86842fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,23 +34,25 @@ jobs: cpanm --installdeps . cpanm Test::CheckManifest - # RELEASE_TESTING is not enabled as some of the tests take way too long (more than 30 minutes) - name: Run tests under gmake (on windows) if: ${{ startsWith(matrix.runner, 'windows-') }} + env: + RELEASE_TESTING: 1 run: | perl Makefile.PL gmake gmake test + gmake install + gmake test - name: Run tests under make (not windows) if: ${{ ! startsWith(matrix.runner, 'windows-') }} + env: + RELEASE_TESTING: 1 run: | perl Makefile.PL make make test + make install + make test - - name: Run release tests - env: - RELEASE_TESTING: 1 - run: | - prove t/manifest.t diff --git a/t/core_partial_read.t b/t/core_partial_read.t index a247c44..697c788 100644 --- a/t/core_partial_read.t +++ b/t/core_partial_read.t @@ -8,6 +8,7 @@ use Carp(); use English qw( -no_match_vars ); use Exporter(); use XSLoader(); +use constant; SKIP: { if ($^O eq 'MSWin32') { @@ -17,9 +18,9 @@ SKIP: { *CORE::GLOBAL::read = sub { return 0 }; *CORE::GLOBAL::sysread = sub { return 0 }; use warnings; - require POSIX; my $required_error_message = quotemeta "Only read 0 bytes from"; - @INC = grep !/blib\/arch/, @INC; # making sure we're testing pure perl version + require FileHandle; + @INC = qw(blib/lib); # making sure we're testing pure perl version require Crypt::URandom; my $generated = 0; eval { diff --git a/t/core_read.t b/t/core_read.t index 0797629..3ab5174 100644 --- a/t/core_read.t +++ b/t/core_read.t @@ -8,6 +8,7 @@ use Carp(); use English qw( -no_match_vars ); use Exporter(); use XSLoader(); +use constant; BEGIN { if ($^O eq 'MSWin32') { require Win32; @@ -37,7 +38,8 @@ SKIP: { use warnings; require POSIX; my $required_error_message = q[(?:] . (quotemeta POSIX::strerror(POSIX::EACCES())) . q[|Permission[ ]denied)]; - @INC = grep !/blib\/arch/, @INC; # making sure we're testing pure perl version + require FileHandle; + @INC = qw(blib/lib); # making sure we're testing pure perl version require Crypt::URandom; my $generated = 0; eval { diff --git a/t/core_sysopen.t b/t/core_sysopen.t index 032d6d7..468c489 100644 --- a/t/core_sysopen.t +++ b/t/core_sysopen.t @@ -8,6 +8,7 @@ use Carp(); use English qw( -no_match_vars ); use Exporter(); use XSLoader(); +use constant; SKIP: { if ($^O eq 'MSWin32') { @@ -18,7 +19,8 @@ SKIP: { use warnings; require POSIX; my $required_error_message = q[(?:] . (quotemeta POSIX::strerror(POSIX::EACCES())) . q[|Permission[ ]denied)]; - @INC = grep !/blib\/arch/, @INC; # making sure we're testing pure perl version + require FileHandle; + @INC = qw(blib/lib); # making sure we're testing pure perl version require Crypt::URandom; my $generated = 0; eval { diff --git a/t/pp.t b/t/pp.t index e4fd71d..fc323f3 100644 --- a/t/pp.t +++ b/t/pp.t @@ -5,7 +5,17 @@ use Carp(); use English qw( -no_match_vars ); use Exporter(); use XSLoader(); -@INC = grep !/blib\/arch/, @INC; # making sure we're testing pure perl version +use constant; +BEGIN { + if ($^O eq 'MSWin32') { + require Win32; + require Win32::API; + require Win32::API::Type; + } else { + require FileHandle; + } +} +@INC = qw(blib/lib); # making sure we're testing pure perl version require Crypt::URandom; foreach my $correct (qw(500000 500 50)) {