Test-More / Test2-Harness

Alternative to Test::Harness
Other
23 stars 26 forks source link

Some rel_file tests in t/unit/Test2/Harness/TestFile.t fail when running under /tmp #234

Closed ppisar closed 3 years ago

ppisar commented 3 years ago

If I execute tests under /tmp, t/unit/Test2/Harness/TestFile.t fails like this:

$ yath -D test --qvf t/unit/Test2/Harness/TestFile.t
[...]
[  PASS  ]  job  1  +~conflicts
[  PASS  ]  job  1    + 1 conflict line is reflected as an array
[  PASS  ]  job  1    + 1 conflict line with 2 conflict categories
[  PASS  ]  job  1    + 2 conflict lines with some comments on one of them
[  PASS  ]  job  1    + Duplicate conflict lines only lead to 2 conflict items.
[  PLAN  ]  job  1    | Expected assertions: 4
            job  1    ^
[  FAIL  ]  job  1  +~binary
[  PASS  ]  job  1    + File is binary
[  PASS  ]  job  1    + File must be executable
[  PASS  ]  job  1    + No SHBANG switches
[  PASS  ]  job  1    + No shbang
[  FAIL  ]  job  1    + Got queue item data
[  DEBUG ]  job  1    | t/unit/Test2/Harness/TestFile.t line 505
(  DIAG  )  job  1    | +------------+------------------------+----+------------------------+-----+
(  DIAG  )  job  1    | | PATH       | GOT                    | OP | CHECK                  | LNs |
(  DIAG  )  job  1    | +------------+------------------------+----+------------------------+-----+
(  DIAG  )  job  1    | | {rel_file} | ../yath-46667-SQtwyt/t | =~ | (?^:\/tmp\/yath\-46667 | 505 |
(  DIAG  )  job  1    | |            | mp/GY0EEe/ZOzcbbwBDu/b |    | \-SQtwyt\/tmp\/GY0EEe\ |     |
(  DIAG  )  job  1    | |            | inary                  |    | /ZOzcbbwBDu\/binary$)  |     |
(  DIAG  )  job  1    | +------------+------------------------+----+------------------------+-----+
[  PLAN  ]  job  1    | Expected assertions: 5
            job  1    ^
(  DIAG  )  job  1    Failed test 'binary'
(  DIAG  )  job  1    at t/unit/Test2/Harness/TestFile.t line 531.
[  FAIL  ]  job  1  +~not_perl
[  PASS  ]  job  1    + File must be executable
[  PASS  ]  job  1    + No SHBANG switches
[  PASS  ]  job  1    + Non-perl shbang
[  FAIL  ]  job  1    + Got queue item data
[  DEBUG ]  job  1    | t/unit/Test2/Harness/TestFile.t line 553
(  DIAG  )  job  1    | +------------+------------------------+----+------------------------+-----+
(  DIAG  )  job  1    | | PATH       | GOT                    | OP | CHECK                  | LNs |
(  DIAG  )  job  1    | +------------+------------------------+----+------------------------+-----+
(  DIAG  )  job  1    | | {rel_file} | ../yath-46667-SQtwyt/t | =~ | (?^:\/tmp\/yath\-46667 | 553 |
(  DIAG  )  job  1    | |            | mp/GY0EEe/ZOzcbbwBDu/n |    | \-SQtwyt\/tmp\/GY0EEe\ |     |
(  DIAG  )  job  1    | |            | ot_perl                |    | /ZOzcbbwBDu\/not_perl$ |     |
(  DIAG  )  job  1    | |            |                        |    | )                      |     |
(  DIAG  )  job  1    | +------------+------------------------+----+------------------------+-----+
[  PLAN  ]  job  1    | Expected assertions: 4
            job  1    ^
(  DIAG  )  job  1    Failed test 'not_perl'
(  DIAG  )  job  1    at t/unit/Test2/Harness/TestFile.t line 579.
[  FAIL  ]  job  1  +~not_env_perl
[  PASS  ]  job  1    + File must be executable
[  PASS  ]  job  1    + No SHBANG switches
[  PASS  ]  job  1    + Non-perl shbang
[  FAIL  ]  job  1    + Got queue item data
[  DEBUG ]  job  1    | t/unit/Test2/Harness/TestFile.t line 602
(  DIAG  )  job  1    | +------------+------------------------+----+------------------------+-----+
(  DIAG  )  job  1    | | PATH       | GOT                    | OP | CHECK                  | LNs |
(  DIAG  )  job  1    | +------------+------------------------+----+------------------------+-----+
(  DIAG  )  job  1    | | {rel_file} | ../yath-46667-SQtwyt/t | =~ | (?^:\/tmp\/yath\-46667 | 602 |
(  DIAG  )  job  1    | |            | mp/GY0EEe/ZOzcbbwBDu/n |    | \-SQtwyt\/tmp\/GY0EEe\ |     |
(  DIAG  )  job  1    | |            | ot_env_perl            |    | /ZOzcbbwBDu\/not_env_p |     |
(  DIAG  )  job  1    | |            |                        |    | erl$)                  |     |
(  DIAG  )  job  1    | +------------+------------------------+----+------------------------+-----+
[  PLAN  ]  job  1    | Expected assertions: 4
            job  1    ^
(  DIAG  )  job  1    Failed test 'not_env_perl'
(  DIAG  )  job  1    at t/unit/Test2/Harness/TestFile.t line 628.
[  FAIL  ]  job  1  +~smoke
[  PASS  ]  job  1    + Turned smoke on
[  FAIL  ]  job  1    + Got queue item data
[  DEBUG ]  job  1    | t/unit/Test2/Harness/TestFile.t line 634
(  DIAG  )  job  1    | +------------+------------------------+----+------------------------+-----+
(  DIAG  )  job  1    | | PATH       | GOT                    | OP | CHECK                  | LNs |
(  DIAG  )  job  1    | +------------+------------------------+----+------------------------+-----+
(  DIAG  )  job  1    | | {rel_file} | ../yath-46667-SQtwyt/t | =~ | (?^:\/tmp\/yath\-46667 | 634 |
(  DIAG  )  job  1    | |            | mp/GY0EEe/ZOzcbbwBDu/s |    | \-SQtwyt\/tmp\/GY0EEe\ |     |
(  DIAG  )  job  1    | |            | moke1                  |    | /ZOzcbbwBDu\/smoke1$)  |     |
(  DIAG  )  job  1    | +------------+------------------------+----+------------------------+-----+
[  PASS  ]  job  1    + Turned smoke on
[  PLAN  ]  job  1    | Expected assertions: 3
            job  1    ^
(  DIAG  )  job  1    Failed test 'smoke'
(  DIAG  )  job  1    at t/unit/Test2/Harness/TestFile.t line 663.
[  PASS  ]  job  1  +~smoke

Those are the subtests which place a file under $tmp which by an accident is also located under /tmp. Then the paths have a common parent directory and a relative path is articulated instead of an absolute one.

A possible fix is change rel_file to be always relative.

ppisar commented 3 years ago

I confirm this is fixed in 1.000079.