Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
This might be a dumb question, but in Windows you can use NUL instead of /dev/null. Instead of all this hackery around temp files, why don't we just replace /dev/null with NUL?
We should do that, but I consider it future work. It will require more testing. I have a feeling if you just say open("NUL", mode) you will create a file called "NUL" in the cwd. It's not something you can feed to generic filesystem APIs.
utils/lit/tests/unit/TestRunner.py | ||
---|---|---|
105 ↗ | (On Diff #139417) | This should match the 4 space indent. |
No, it won't create a file named NUL. The special file names are handled at a relatively low level in the Windows stack (below _open). You would have to use a namespace escape like \\?\ to avoid having Windows treat your special file name as a regular name. The special names are: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9.
I ran the tests, and the unit tests don't pass because the /dev/null replacement happens much later during test execution, not command parsing. Unit testing the text executor would require much more faking/mocking than is really worth it. I would be comfortable making this change include a revert of rL328157. That will exercise the new replacement enough.
Looks good after reverting the unit test that didn't work.
utils/lit/tests/Inputs/shtest-shell/dev-null.txt | ||
---|---|---|
1 ↗ | (On Diff #139728) | New test looks good, thanks! |
utils/lit/tests/unit/TestRunner.py | ||
108 ↗ | (On Diff #139728) | This test still fails because the parser doesn't do the replacement. You need to revert changes to this file and probably testrunner-custom-parsers/test.txt before committing or tests will fail on Windows. |