1nickt has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to use prove --state=failed,save. But it seems to not work as documented.
The first thing that is unclear is whether "test" in the doc refers to individual tests, or to test files. So I tried it both ways.
At the urging of Bishop toolic I am posting here my test files and results.
With multiple tests in a single file:
As you can see all four tests were run the second time as well as the first time. There also does not seem to be anything in the .prove file that records the outcome of the individual tests.
With multiple test files:
$ rm .prove $ cat t/test1.t use Test::More tests => 1; ok 1 == 1, 'A'; $ cat t/test2.t use Test::More tests => 1; ok 1 == 2, 'B'; $ cat t/test3.t use Test::More tests => 1; ok 1 == 1, 'C'; $ cat t/test4.t use Test::More tests => 1; ok 1 == 2, 'D'; $ prove -v --state=save t t/test1.t .. 1..1 ok 1 - A ok t/test2.t .. 1..1 not ok 1 - B # Failed test 'B' # at t/test2.t line 2. # Looks like you failed 1 test of 1. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/1 subtests t/test3.t .. 1..1 ok 1 - C ok t/test4.t .. 1..1 not ok 1 - D # Failed test 'D' # at t/test4.t line 2. # Looks like you failed 1 test of 1. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/1 subtests Test Summary Report ------------------- t/test2.t (Wstat: 256 Tests: 1 Failed: 1) Failed test: 1 Non-zero exit status: 1 t/test4.t (Wstat: 256 Tests: 1 Failed: 1) Failed test: 1 Non-zero exit status: 1 Files=4, Tests=4, 0 wallclock secs ( 0.03 usr 0.02 sys + 0.12 cusr + 0.02 csys = 0.19 CPU) Result: FAIL $ cat .prove --- generation: 1 last_run_time: 1519584062.28557 tests: t/test1.t: elapsed: 0.0381917953491211 gen: 1 last_pass_time: 1519584062.14733 last_result: 0 last_run_time: 1519584062.14733 last_todo: 0 seq: 1 total_passes: 1 t/test2.t: elapsed: 0.0359680652618408 gen: 1 last_fail_time: 1519584062.1927 last_result: 2 last_run_time: 1519584062.1927 last_todo: 0 seq: 2 total_failures: 1 t/test3.t: elapsed: 0.0373549461364746 gen: 1 last_pass_time: 1519584062.23968 last_result: 0 last_run_time: 1519584062.23968 last_todo: 0 seq: 3 total_passes: 1 t/test4.t: elapsed: 0.0356581211090088 gen: 1 last_fail_time: 1519584062.28471 last_result: 2 last_run_time: 1519584062.28471 last_todo: 0 seq: 4 total_failures: 1 version: 1 ... $ prove -v --state=failed,save t t/test2.t .. 1..1 not ok 1 - B # Failed test 'B' # at t/test2.t line 2. # Looks like you failed 1 test of 1. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/1 subtests t/test4.t .. 1..1 not ok 1 - D # Failed test 'D' # at t/test4.t line 2. # Looks like you failed 1 test of 1. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/1 subtests t/test1.t .. 1..1 ok 1 - A ok t/test3.t .. 1..1 ok 1 - C ok Test Summary Report ------------------- t/test2.t (Wstat: 256 Tests: 1 Failed: 1) Failed test: 1 Non-zero exit status: 1 t/test4.t (Wstat: 256 Tests: 1 Failed: 1) Failed test: 1 Non-zero exit status: 1 Files=4, Tests=4, 0 wallclock secs ( 0.02 usr 0.01 sys + 0.12 cusr + 0.02 csys = 0.17 CPU) Result: FAIL $ cat .prove --- generation: 2 last_run_time: 1519584153.98762 tests: t/test1.t: elapsed: 0.0381758213043213 gen: 2 last_pass_time: 1519584153.94307 last_result: 0 last_run_time: 1519584153.94307 last_todo: 0 mtime: 1519583913 seq: 7 total_passes: 2 t/test2.t: elapsed: 0.0387568473815918 gen: 2 last_fail_time: 1519584153.84872 last_result: 2 last_run_time: 1519584153.84872 last_todo: 0 mtime: 1519583940 seq: 5 total_failures: 2 t/test3.t: elapsed: 0.0351169109344482 gen: 2 last_pass_time: 1519584153.98684 last_result: 0 last_run_time: 1519584153.98684 last_todo: 0 mtime: 1519583962 seq: 8 total_passes: 2 t/test4.t: elapsed: 0.0388789176940918 gen: 2 last_fail_time: 1519584153.89626 last_result: 2 last_run_time: 1519584153.89626 last_todo: 0 mtime: 1519583950 seq: 6 total_failures: 2 version: 1 ...
As you can see, again all four test files were run the second time as well as the first time. The only difference is that on the second run the failing test files were run first, and then the ones that had succeeded on the first run. Again, this is not the behaviour the documentation describes.
Any clues gratefully accepted, especially if you are using this feature yourself with success.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: prove --state=failed,save
by choroba (Cardinal) on Feb 25, 2018 at 20:27 UTC | |
by 1nickt (Canon) on Feb 25, 2018 at 23:35 UTC |