Open xFrednet opened 12 months ago
The order of filters may be important. You can specify the backslash filter again at the end.
Are you overriding the default filters by any chance?
We do have https://github.com/oli-obk/ui_test/blob/5898e04e5b0d5213e223bea93dbb5ac06f7bf391/src/lib.rs#L56, which we could use to cover your situation, too, once we know what the issue is.
It doesn't pick it up because of the mixed slashes in the path
FAILED TEST: tests/ui\almost_complete_range.rs
Rust paths have this incredibly annoying property on windows where they don't correct the slashes, you can hack around that by changing https://docs.rs/marker_uitest/latest/src/marker_uitest/lib.rs.html#41 to something like PathBuf::from_iter(Path::new($ui_dir))
p.s. this $ui_dir
isn't used https://docs.rs/marker_uitest/latest/src/marker_uitest/lib.rs.html#33
🤔 wait no, it should be picking it up https://regex101.com/r/fnT6rV/1
I've tried your suggestion and it seems to work, at least i have a green CI now
Are you overriding the default filters by any chance?
AFAIK, I've only added new filters.
p.s. this $ui_dir isn't used docs.rs/marker_uitest/latest/src/marker_uitest/lib.rs.html#33
Ohhh, yeah, thank you!
I appreciate the help, everything seems to work now :D
@oli-obk Should I close this issue, since it was a misconfiguration, or do you think this path normalization should also be in ui_test?
Yea I think I also have added workarounds for this issue. We could just normalize the PathBufs that end up getting printed (or used in filters) before doing so.
I don't actually see why this is failing, https://github.com/rust-marker/marker-example-lints/blob/959fdbc6298e57bc4f16cfeee9983e9e36911ef8/tests/uitest.rs passes the test successfully for me on a windows machine. Also passes if I remove the two filters
If I change it to verbose the path is there with the mixed slashes in:
tests/ui\almost_complete_range.rs ... ok
That's weird, the windows CI of that branch failed though :thinking: Here is a link to the job:
https://github.com/rust-marker/marker-example-lints/actions/runs/6417999196/job/17424884765
The logs weirdly don't show the actual diff, I just guessed that it was a related problem.
I've also tried to test if it was a problem with different line endings or something, but couldn't identify the error :thinking:
That diff looks weird. Maybe this is line ending nonsense in git?
https://github.com/oli-obk/ui_test/blob/main/.gitattributes was necessary in this crate due to dogfooding, but it seems to be an issue in general, even with compiletest... time to add it to the readme
There are default filters to remove the \r
, so it shouldn't matter if it uses CRLF
There are default filters to remove the
\r
, so it shouldn't matter if it uses CRLF
It does, because the .stderr file will end up having them without the gitattributes file
I've added a .gitattributes
file in the PR as well, that could have been the fix. That's still weird. I tried printing invisible characters with cat after blessing and didn't see any CLRF, but that could have been after the .gitattributes
file :thinking:
.stderr file will end up having them without the gitattributes file
Aha, yeah that's it. unix2dos
ing the .stderr
files give the same output
Yea, when changing git attributes like that you need to refresh the worktree (I just did something like rm -r * && git checkout HEAD --hard
)
I tried adding stderr filters before, which works, until you bless and get no \r
, as then git shows the files to differ even if they don't.
I can probably work around that, too somehow, but the git attributes seemed easier.
I can add something that detects if the only difference is a \r
and emit a suggestion to add a gitattributes file
I can add something that detects if the only difference is a \r and emit a suggestion to add a gitattributes file
That would be perfect. If users see that and don't use git, they can still manually add a filter, that replaces the line feeds with just a \n
.
For testing, it could also be cool, to have an option to print invisible characters as well. Not sure, how easy this would be though and the use cases might be very limited as well :)
Yea I tried this before, but it's a bit annoying for this crate's dogfooding
Marker uses ui_test in the CI and runs them on Ubuntu, MacOS, and windows. The
$DIR
value replacement for paths works very well for unix-based systems with/
but struggles on windows. The default setup withui_test::Config::rustc(ui_dir)
, doesn't seem to replace windows paths.In the main Marker repo, it was sufficient to add the following filters:
However, the same filters don't seem to work on another lint crate, when ran on windows. This is the error output I get even with the filters:
I assume that this is just a configuration error somewhere on my end. However, it would be nice if the path replacement could be improved to handle windows better.
Replacing all
\\
with something else, is also not ideal, as it was pointed out in https://github.com/oli-obk/ui_test/issues/89