Subject: | Passing the '--live-tests' option to 'perl Makefile.PL' does not DWIM |
It appears that passing the '--live-tests' option to Net-HTTP's 'perl Makefile.PL' does not, in and of itself, cause live tests to be run. You have to manually create a 't/LIVE_TESTS' file for options to be run -- and if you do so the '--live-tests' switch is irrelevant.
I started by cloning the github repository. (I'll omit output that's not relevant.)
[gitwork] 503 $ git clone git@github.com:libwww-perl/Net-HTTP.git
Cloning into 'Net-HTTP'...
...
[gitwork] 505 $ cd Net-HTTP/
[Net-HTTP] 506 $ perl Makefile.PL && make && make test
...
PERL_DL_NONLAZY=1 "/home/jkeenan/perl5/perlbrew/perls/perl-5.24.1/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/http-nb.t ..... ok
t/http.t ........ ok
t/live-https.t .. skipped: Live tests disabled; pass --live-tests to Makefile.PL to enable
t/live.t ........ skipped: Live tests disabled; pass --live-tests to Makefile.PL to enable
t/rt-112313.t ... skipped: Live tests disabled; pass --live-tests to Makefile.PL to enable
All tests successful.
Files=5, Tests=51, 1 wallclock secs ( 0.03 usr 0.00 sys + 0.16 cusr 0.01 csys = 0.20 CPU)
Result: PASS
#####
Oops! Let me clean and rerun Makefile.PL with that switch.
#####
[Net-HTTP] 507 $ make clean
...
[Net-HTTP] 508 $ perl Makefile.PL --live-tests
...
[Net-HTTP] 509 $ make
...
[Net-HTTP] 510 $ make test
PERL_DL_NONLAZY=1 "/home/jkeenan/perl5/perlbrew/perls/perl-5.24.1/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/http-nb.t ..... ok
t/http.t ........ ok
t/live-https.t .. skipped: Live tests disabled; pass --live-tests to Makefile.PL to enable
t/live.t ........ skipped: Live tests disabled; pass --live-tests to Makefile.PL to enable
t/rt-112313.t ... skipped: Live tests disabled; pass --live-tests to Makefile.PL to enable
All tests successful.
Files=5, Tests=51, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.14 cusr 0.02 csys = 0.19 CPU)
Result: PASS
#####
What? Still no live tests. So I peer into the failing tests.
#####
$ ack -C2 'live-tests' t
t/live-https.t
1-BEGIN {
2- unless ( -f "t/LIVE_TESTS" || -f "LIVE_TESTS" ) {
3: print "1..0 # SKIP Live tests disabled; pass --live-tests to Makefile.PL to enable\n";
4- exit;
5- }
t/rt-112313.t
18-unless (-f "t/LIVE_TESTS" || -f "LIVE_TESTS")
19-{
20: print "1..0 # SKIP Live tests disabled; pass --live-tests to Makefile.PL to enable\n";
21- exit;
22-}
t/live.t
1-BEGIN {
2- unless ( -f "t/LIVE_TESTS" || -f "LIVE_TESTS" ) {
3: print "1..0 # SKIP Live tests disabled; pass --live-tests to Makefile.PL to enable\n";
4- exit;
5- }
#####
Does LIVE_TESTS exist? No!
#####
[Net-HTTP] 519 $ find . -type f -name 'LIVE_TESTS'
[Net-HTTP] 520 $
#####
But, if I *manually* touch t/LIVE_TESTS and repeat the other steps, I *do* get live tests.
#####
[Net-HTTP] 528 $ touch t/LIVE_TESTS
# Note absence of '--live-tests' in command below:
[Net-HTTP] 529 $ perl Makefile.PL && make && make test
...
PERL_DL_NONLAZY=1 "/home/jkeenan/perl5/perlbrew/perls/perl-5.24.1/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/http-nb.t ..... ok
t/http.t ........ ok
t/live-https.t .. ok
t/live.t ........ ok
t/rt-112313.t ... ok
All tests successful.
Files=5, Tests=103, 26 wallclock secs ( 0.04 usr 0.00 sys + 0.42 cusr 0.03 csys = 0.49 CPU)
Result: PASS
[Net-HTTP] 530 $ prove -vb t/live.t
t/live.t ..
1..6
# ----------------------------
# 200 OK
# Accept-Ranges: none
# Cache-Control: private, max-age=0
# Content-Type: text/html; charset=UTF-8
# Date: Tue, 28 Mar 2017 19:16:45 GMT
# Expires: -1
# P3P: CP="This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info."
# Server: gws
# Set-Cookie: NID=100=Xz5ZEZXMBO9yQx5gCcFHsQZCR6J4lraXP6iBS83-YeyBlSyM0Z9uEwMftpumzUyKz75v4bEex6CY3OW8-lWyfWZKrUBeW1W_ZWDqRyAx9BR_Bqh8TFhBdRHNL9dAQyBZYdhbNaKGQI6BQYFP; expires=Wed, 27-Sep-2017 19:16:45 GMT; path=/; domain=.google.com; HttpOnly
# Transfer-Encoding: chunked
# Vary: Accept-Encoding
# X-Frame-Options: SAMEORIGIN
# X-XSS-Protection: 1; mode=block
#
ok 1
ok 2
ok 3
# ----------------------------
# 200 OK
# Accept-Ranges: none
# Cache-Control: private, max-age=0
# Content-Type: text/html; charset=UTF-8
# Date: Tue, 28 Mar 2017 19:16:45 GMT
# Expires: -1
# P3P: CP="This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info."
# Server: gws
# Set-Cookie: NID=100=YP0B1nfutl7Hs9nRzx3mMyyOLWalljomO_dwBkYRHFDJI2oEfiGtPM4NaktLoWC9NmANW3MPMygtj69gNYZrhCxsi_mkq_EJfMmcykBjZ4bzH-BMS_Vh4BZwxaUdtWzUKP4TUopbAmKv3WUM; expires=Wed, 27-Sep-2017 19:16:46 GMT; path=/; domain=.google.com; HttpOnly
# Transfer-Encoding: chunked
# Vary: Accept-Encoding
# X-Frame-Options: SAMEORIGIN
# X-XSS-Protection: 1; mode=block
#
ok 4
ok 5
ok 6
ok
All tests successful.
Files=1, Tests=6, 1 wallclock secs ( 0.01 usr 0.01 sys + 0.07 cusr 0.01 csys = 0.10 CPU)
Result: PASS
#####
Hence, there is a defect in Makefile.PL.
Thank you very much.
Jim Keenan