-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
compiletest: ./x test <filter>
is a substring match
#134341
Comments
I have not investigated if this is true for run-make tests only, or if this is a generic compiletetst behavior. |
This behavior is indeed applicable generally, it seems like. E.g. necessary and sufficient condition to reproduce:
A folder must exists that shares the same "prefix" name, e.g. There's a bootstrap check that asserts the filter must correspond to an existing directory or file, but that's actually kind of misleading... |
./x test tests/run-make/exp/
for example is a substring match for a dir name that contains exp
./x test <filter>
is a substring match
Note that the combined effect of compiletest handling + underlying libtest means that |
I investigated this problem and got some findings:
tests/
ui/
unknown/
sample.rs # <- This is executed as expected
dir1/
dir2/
unknown/
sample.rs # <- This is also executed unexpectedly
We can fix this problem by modifying the run() function's behaviour slightly. If it modifies the original filter just removing the leading dot |
I'm a bit wary of fixing it like that, because that doesn't account for platform path separator differences nor UNC paths, right? Also relative paths but from different directories? I'm inclined to say that the actual problem (or rather, the deeper problem) is that compiletest doesn't properly normalize out the test path name during test discovery and collection before sending it off to libtest. This is further complicated because as far as I can recall bootstrap has another layer of filtering logic before handing the filter string to compiletest. |
Thanks.
I lacked of this point of view, I should investigate more.
Currently compiletest use a relative path to the test file as the test name, but do you mean that there is a better way than that? |
I'm not too sure. Because I think what compiletest does currently is that it uses the test path as a test name, and that test name is passed to libtest. However libtest does funny things like, using the test name verbatim, as a test filter. compiletest may need to properly handle the filtering during test discovery and not rely on libtest's filtering behavior, which is not easy to implement. |
Thanks! the discussion is very interesting. |
This is very non-intuitive...
I tried on native
x86_64-pc-windows-msvc
:This showed me 8 tests were ignored (incl. a local
tests/run-make/exp/
test I added for testing) even though I would've expected an exact match for only the local test I added:I almost never want this substring match behavior, at least not unless I explicitly write some kind of
--test-name="exp"
, for example.I suspect this is some behavior related to the test name constructed by compiletest, which is fed to libtest which probably handles the test filtering... Ah, it might be the test name constructed from the test path...
The text was updated successfully, but these errors were encountered: