Skip Menu |
 

This queue is for tickets about the Google-Ads-AdWords-Client CPAN distribution.

Report information
The Basics
Id: 120674
Status: new
Priority: 0/
Queue: Google-Ads-AdWords-Client

People
Owner: Nobody in particular
Requestors: KENTNL [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)

Attachments
0001-t-001_require.t-Force-a-relative-path-load-for-requi.patch
0002-t-020_GenerateOfflineCredentials.t-Force-relative-pa.patch



Subject: Fails tests when no "." in @INC

On 5.25.10 with -Ddefault_inc_excludes_dot ( 5.25.11 is like this by default )

prove -lr t/001_require.t |& head -n 10

#   Failed test 'require 'ComplexType.pm';'
#   at t/001_require.t line 41.
#     Tried to require ''ComplexType.pm''.
#     Error:  Can't locate ComplexType.pm in @INC (you may need to install the ComplexType module) (@INC contains: /home/kent/.cpanm/work/1490086039.18632/Google-Ads-AdWords-Client-4.13.0/lib /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/site_perl/5.25.10 /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10/x86_64-linux /home/kent/perl5/perlbrew/perls/5.25.10-nossp-sdbm-nopmc-nodot/lib/5.25.10 t/../lib) at (eval 47) line 2.

 

PERL_USE_UNSAFE_INC=1 prove -lr t/001_require.t |& head -n 10
t/001_require.t .. ok
All tests successful.
Files=1, Tests=3899,  2 wallclock secs ( 0.34 usr  0.04 sys +  1.99 cusr  0.18 csys =  2.55 CPU)
Result: PASS


And a bunch more:

Test Summary Report
-------------------
t/001_require.t                     (Wstat: 65024 Tests: 3899 Failed: 3898)
  Failed tests:  2-3899
  Non-zero exit status: 254
t/020_GenerateOfflineCredentials.t  (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 15 tests but ran 0.
t/022_ReportUtils.t                 (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 28 tests but ran 0.
t/024_BatchJobHandler.t             (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 14 tests but ran 0.
t/100_CodeExamples_v201702.ft       (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 67 tests but ran 0.
t/108_CodeExamples_v201607.ft       (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 60 tests but ran 0.
t/109_CodeExamples_v201609.ft       (Wstat: 65280 Tests: 0 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 58 tests but ran 0.
t/110_CampaignService.ft            (Wstat: 65280 Tests: 8 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 25 tests but ran 8.
t/120_AdGroupService.ft             (Wstat: 65280 Tests: 7 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 19 tests but ran 7.
t/130_AdGroupCriterionService.ft    (Wstat: 65280 Tests: 7 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 51 tests but ran 7.
t/140_AdGroupAdService.ft           (Wstat: 65280 Tests: 9 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 62 tests but ran 9.
t/170_CampaignCriterionService.ft   (Wstat: 65280 Tests: 6 Failed: 0)
  Non-zero exit status: 255
  Parse errors: Bad plan.  You planned 29 tests but ran 6.





--
- CPAN kentnl@cpan.org
- Gentoo Perl Maintainer kentnl@gentoo.org ( perl@gentoo.org )
 

Attached are 2 patches for this problem.

One is for the problem as reported, that the "require" test fails profusely.

And the other is for a second test failure that wasn't so obvious due to the first, but had a similar cause.

-- 
- CPAN kentnl@cpan.org
- Gentoo Perl Maintainer kentnl@gentoo.org ( perl@gentoo.org )
Subject: 0001-t-001_require.t-Force-a-relative-path-load-for-requi.patch
From a67324b5622088422b0b0c1a403c594312452d16 Mon Sep 17 00:00:00 2001 From: Kent Fredric <kentfredric@gmail.com> Date: Sun, 4 Jun 2017 07:35:25 +1200 Subject: [PATCH 1/3] t/001_require.t: Force a relative path load for require test require_ok("Foo") is implemented in terms of require "Foo" This means: require "Foo.pm" Only loads "Foo.pm" from "." if: - '.' is in @INC ( Not true by default in Perl >5.25.11 ) - Foo.pm is not installed in Perl5lib ( dangerous assumption ) This forces require to side-step @INC traversal by using an explicit prefix of "./", which is special-cased in require. This fixes RT#120674 Bug: https://rt.cpan.org/Ticket/Display.html?id=120674 --- t/001_require.t | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/001_require.t b/t/001_require.t index fe0d205..d70b2d2 100755 --- a/t/001_require.t +++ b/t/001_require.t @@ -24,7 +24,7 @@ use File::Spec; use Test::More qw(no_plan); # Set up @INC at runtime with an absolute path. -my $lib_path = File::Spec->catdir(dirname($0), "..", "lib"); +my $lib_path = File::Spec->rel2abs(File::Spec->catdir(dirname($0), "..", "lib")); push(@INC, $lib_path); require_ok 'Google::Ads::AdWords::Client'; @@ -38,6 +38,6 @@ sub test_require { local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ /redefine/; }; - require_ok($file_name); + require_ok("./$file_name"); } } -- 2.12.2
Subject: 0002-t-020_GenerateOfflineCredentials.t-Force-relative-pa.patch
From 76f5a421585b8c85b7e39b91adb0b257d1d83665 Mon Sep 17 00:00:00 2001 From: Kent Fredric <kentfredric@gmail.com> Date: Sun, 4 Jun 2017 07:40:01 +1200 Subject: [PATCH 2/3] t/020_GenerateOfflineCredentials.t: Force relative path for script require "some/path.pl" previously fell into worknig due to '.' being in @INC, as this still invokes @INC traversal This change simply forces a "./" so that Perl uses direct access via a special-cased path instead of relying on @INC traversal, which becomes unsafe to depend on since Perl 5.25.11 --- t/020_GenerateOfflineCredentials.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/020_GenerateOfflineCredentials.t b/t/020_GenerateOfflineCredentials.t index 0dcde9d..dfa8b50 100755 --- a/t/020_GenerateOfflineCredentials.t +++ b/t/020_GenerateOfflineCredentials.t @@ -51,7 +51,7 @@ my $stdout; open(STDOUT, ">", \$stdout); # Calling the offline credentials code -require qw(examples/oauth/generate_offline_credentials.pl); +require qw(./examples/oauth/generate_offline_credentials.pl); ok(generate_offline_credentials($client)); # Checking the auth mock was correctly called -- 2.12.2


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.