This fixes a few issues in the C# unit test engine. It fixes tests sitting in subdirectories not being tested correctly (the location of both the test assembly and the results file would be wrong). It also fixes a very strange issue where xUnit.NET seems to not output the resulting XML file when it executes; in this case we just retry running the test until the XML file appears after completion (and eventually it works).
Details
- Reviewers
hach-que epriestley - Group Reviewers
Blessed Reviewers - Commits
- rARCbd191c2860e3: Fix issues in C# unit test engine
Ran arc unit --everything and arc unit --everything --no-coverage and verified that it's all reliably working.
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Is this writing to NFS or something? I don't love the:
while (true) { // check for ghosts }
...construction. When it fails to write, does it exit with an error code? Anything on stderr?
src/unit/engine/XUnitTestEngine.php | ||
---|---|---|
318 | If this is to avoid collisions, maybe this should have some Filesystem::readRandomCharacters() in it? | |
329โ332 | You can do this without the branch by using DIRECTORY_SEPARATOR. | |
381โ385 | uhhhhhhh |
src/unit/engine/XUnitTestEngine.php | ||
---|---|---|
318 | This was to ensure any previous .results files that didn't get cleaned up weren't impacting future tests. It was only really relevant while I was trying to diagnose the randomness of the files not appearing. |
I don't think I can reproduce this, although I'm not sure why the "Website" tests are failing.
See http://code.redpointsoftware.com.au/w/troubleshooting/mono/v10_dir_missing/. Mono doesn't seem to ship with the v10.0 directory set up correctly, even though .NET under Windows has it set up fine.
Also you won't be hitting the randomly failing section since it's not getting past the build.
I did some more investigation into this and it seems to be caused by a segmentation fault in Mono. After checking their bug list, it looks like it's fixed in a very new version of Mono (it's not available in the package repositories yet).
I'm going to install a later version of Mono and verify that the issue is fixed. If it is, I'll remove the do-while loop and restore the file_exists check to output a BROKEN status (with an additional message letting users know about the issues with the particular Mono version).
Not finished with these changes yet; just diffing it so I can access it later on a different machine.
One minor inline, feel free to send a followup if you want.
src/unit/engine/XUnitTestEngine.php | ||
---|---|---|
114 | This should probably be preg_quote(), this str_replace() looks ghetto. |
src/unit/engine/XUnitTestEngine.php | ||
---|---|---|
114 | Actually the input string is a regular expression, but in C# you don't place / around the regex, so / on it's own is fine in C#. Under PHP, it needs to be escaped because preg_* uses / to designate options. This is mainly to bring it inline with the linter discovery rules, where the linter discovery rules are passed straight into C#, which then does the discovery logic (as opposed to this unit test engine, where the discovery logic is implemented in PHP). |