run-tests: follow-up on the test-case format
ClosedPublic

Authored by lothiraldan on Jun 7 2018, 3:19 PM.

Details

Summary

It turns out the original regex doesn't support real test cases names like the
one Mercurial is using. Update the regex to being able to precisely select
them on the command line.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
lothiraldan created this revision.Jun 7 2018, 3:19 PM
indygreg accepted this revision.Jun 7 2018, 7:44 PM
This revision is now accepted and ready to land.Jun 7 2018, 7:44 PM
This revision was automatically updated to reflect the committed changes.
mharbison72 added inline comments.
tests/test-run-tests.t
1669

Windows can't create the test directory with all of the reserved characters here. Are these necessary?

yuja added a subscriber: yuja.Jun 8 2018, 10:20 PM

> test-run-tests.t:1669
> + --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
> + +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.casewith!@#$%^&*()chars.err
> + @@ -1,3 +1,3 @@

Windows can't create the test directory with all of the reserved characters here. Are these necessary?

Maybe no? I think alphanumerics + '-' should be enough, and allowing shell
meta characters is potentially unsafe.

lothiraldan added a comment.EditedJun 12 2018, 4:45 PM
In D3699#58174, @yuja wrote:

> test-run-tests.t:1669
> + --- $TESTTMP/anothertests/cases/test-cases-advanced-cases.t
> + +++ $TESTTMP/anothertests/cases/test-cases-advanced-cases.t.casewith!@#$%^&*()chars.err
> + @@ -1,3 +1,3 @@

Windows can't create the test directory with all of the reserved characters here. Are these necessary?

Maybe no? I think alphanumerics + '-' should be enough, and allowing shell
meta characters is potentially unsafe.

I checked core test files and some extensions test files. Alphanumerics + '-" would works for most of them. Some tests in the hg-experimental repository have a . in their test case name. I would also add _ for allowing all naming cases. Does that sounds good?

@mharbison72 I was not aware that this patch had been merged, is it breaking the windows build right now?

I have sends https://phab.mercurial-scm.org/D3721 to restrict the characters allowed in test-cases, we might want to add a warning or an error when such invalid names are used so the user won't get confused that he cannot select them