perl5
perl5 copied to clipboard
Proposal for Test Updating Project: dist/IO/t/*.t
I'd like to propose a small project aimed at updating tests in the Perl core distribution. This proposal has two intended audiences:
-
Core committers and other veteran committers who might be able to tell us why we should not embark on this project.
-
First-time or new contributors who will actually execute the project as a series of pull requests to be reviewed by core committers.
The focus of the project will be the 8 test files found in dist/IO/t which do not use either Test::More or the core distribution's own t/test.pl to generate TAP output. These test files, which date from the earliest days of Perl 5 (or possibly earlier), each generate output by using manually coded print ok or print not ok statements.
$ ack -L '^use Test::More' ../dist/IO/t/*.t | xargs ack -L 'test\.pl' | xargs ls |sort
../dist/IO/t/io_const.t
../dist/IO/t/io_dup.t
../dist/IO/t/io_pipe.t
../dist/IO/t/io_poll.t
../dist/IO/t/io_sel.t
../dist/IO/t/io_sock.t
../dist/IO/t/io_tell.t
../dist/IO/t/io_unix.t
Since it is cumbersome to include test descriptions (alternatively called 'names' or 'labels') in that approach, 7 of these 8 files have no descriptions whatsoever and the eighth has only a handful. So when a particular unit test fails, all we get is a number.
This is particularly annoying when one of these tests fails during smoke-testing (as io_poll.t did for me within the past week).
A separate pull request should be prepared for each file (in part to encourage multiple participants in this project). The first commit in each p.r. should simply convert a given file to use Test::More without adding any new descriptions. The second commit should add the descriptions. In the course of preparing test descriptions participants will necessarily have to learn a lot about I/O operations whose fundamentals date back to the early days of Unix. (I myself have rarely written Perl code directly using these operations, much less testing them.)
Core Committers: Is there any reason we should not convert these files to Test::More? @toddr @atoomic @ilmari @tonycoz
Once we've handled any objections we'll make a more formal call for volunteers.
Sounds good to me
Some of the tests use fork(), eg. io_sock.t, io_unix.t, and may not be convertible to Test::More.
Test2 has fork support. I'm unclear how much of it is in core now?
@jkeenan I'm interested in helping if y'all move ahead with it
The whole Test2 core suite is core now, however note that updates to the IO dist could complicate its dual-life CPAN release (which works on many versions where the Test2 suite is not yet core). Though I don't see any reason not to add that dependency if it's useful. (And Test2::IPC, which seems to be the necessary component here, has been core for a decent while, but I don't know if it works with Test::More.)
Test2::IPC does work for Test::More.
I suggest using Test2::V0 over Test::More for debugging, and for performance. However if the deps are a problem Test2::IPC + Test::More will work and are supported on perl versions that include Test2::IPC but not Test2::V0.
@jkeenan -
I updated io_poll.t and io_const.t to Test2::V0 with minimal changes and no labels. Shall I create PRs for these two?
io_dup.t and io_tell.t should be similarly easy; the others are denser with many intriguing assertions to translate, e.g. print $sock "ok 3\n";)