Closed jkeenan closed 3 years ago
(Note that I have rebased the lib-warnings-20201216
branch on the updated alpha-dev-03-warnings
branch.)
Most of this looked fine, but not all of the files appear to be passing, although I'm not sure all of them are tests. lib/perl5db.t
I'm not getting any failures or warnings for this file.
$ cd t; ./perl harness -v ../lib/perl5db.t 2>../err 1>../out; cd -
/usr/home/jkeenan/gitwork/perl-atoomic-2
$ wc -l err
0 err
$ tail out
ok 129 - check for reasonable result
ok 130 - [perl \#124203] the thread ran
ok 131 - [perl \#124203] debugger didn't deadlock
ok 132 - [perl \#124203] the thread ran (lvalue)
ok 133 - [perl \#124203] debugger didn't deadlock (lvalue)
1..133
ok
All tests successful.
Files=1, Tests=133, 8 wallclock secs ( 0.03 usr 0.01 sys + 7.71 cusr 0.71 csys = 8.46 CPU)
Result: PASS
Can you re-try?
t/lib/feature/indirect t/lib/strict/refs t/lib/strict/subs t/lib/strict/vars
These 4 files, among others, are best thought of as sets of code snippets that, in a normal Perl program, would be found beneath the __DATA__
tag. The operative test files for these 4 data files would be lib/feature.t
and lib/strict.t
. Let's look at the first of these:
$ cat lib/feature.t
#!./perl
chdir 't' if -d 't';
@INC = '../lib';
require "../t/lib/common.pl";
That's all, she wrote! Opening up `t/lib/common.pl' we find:
# This code is used by lib/charnames.t, t/lib/croak.t, lib/feature.t,
# lib/subs.t, lib/strict.t and lib/warnings.t
t/lib/common.pl
parses the name of the test file that is calling it and locates the corresponding data file. Then, using t/test.pl
's function setup_multiple_progs()
, it creates in memory the text of a Perl program for each code snippet found within the data file.
Next, using t/test.pl
's function run_multiple_progs()
, it runs each of these programs via t/test.pl
's runperl()
function. It is each of these instances of calling runperl()
that have to run warnings-free once warnings-by-default are turned on. Each such instance was originally written on the assumption that warnings were not turned on by default. We now have to re-approach each such instance with the premise that warnings are now turned on by default.
The advantage of using these data files in our test suite is that they cram an enormous number of test cases into a small space by moving all the boilerplate to functions ultimately found in t/test.pl
.
The disadvantage of using these data files is that they don't look anything like normal Perl programs, including the test programs found elsewhere in our test suite. You have to dig deep into the testing architecture to grok what's going on. I myself spent 8 years avoiding that grokking, and it's only this project that has forced me to cease that avoidance.
utils/h2ph.PL
Throughout the core distribution you will find files whose names end in upper-case .PL
. These are source files which generate other files during the build process. Generally, the generated files are either Makefiles or are executables which ship with the core distribution and get installed in the same directory specified by the user for perl
itself. The latter is the case here. During make
, utils/h2ph.PL
is used to write utils/h2ph
.
During make test
we run lib/h2ph.t
. If that file throws a warning, the warning will point to a line number in lib/h2ph.t
. But since that is merely a generated file, we can't fix the warning in that file. The correct place to fix the warning is in utils/h2ph.PL
.
HTH!
This pull request should get all tests under
lib/
to pass and run warnings-free exceptlib/B/Deparse-core.t
andlib/warnings.t
. Hence, this p.r. partially satisifies the ask in https://github.com/atoomic/perl/issues/306. Please review.