[wasm][tests] Exit the script if WasmTestRunner build fails#46048
[wasm][tests] Exit the script if WasmTestRunner build fails#46048radical merged 4 commits intodotnet:masterfrom
WasmTestRunner build fails#46048Conversation
If building the `WasmTestRunner.proj` on helix fails, then the error
gets ignored, and script execution continues. And that results in the
failure to be shown as:
```
/home/helixbot/work/9CE408BA/w/BF5C0A02/e/JIT/Methodical/eh/interactions/throw1dimarray_d/throw1dimarray_d.sh: line 136: cd: WasmApp: No such file or directory
/home/helixbot/work/9CE408BA/w/BF5C0A02/e/JIT/Methodical/eh/interactions/throw1dimarray_d/throw1dimarray_d.sh: line 137: ./run-v8.sh: No such file or directory
```
.. which is misleading. Looking at the execution log shows that the real error was:
```
Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
AppDir: /home/helixbot/work/9CE408BA/w/BF5C0A02/e/JIT/Methodical/eh/interactions/throw1dimarray_d/WasmApp/
TestBinDir: /home/helixbot/work/9CE408BA/w/BF5C0A02/e/JIT/Methodical/eh/interactions/throw1dimarray_d
ArtifactsBinDir:
/home/helixbot/work/9CE408BA/p/build/WasmApp.targets(11,5): error : Failed to load assembly reference 'System.Windows.Forms, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' for 'Except, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null': Could not find assembly 'System.Windows.Forms, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Either explicitly load this assembly using a method such as LoadFromAssemblyPath() or use a MetadataAssemblyResolver that returns a valid assembly. [/home/helixbot/work/9CE408BA/p/wasm-test-runner/WasmTestRunner.proj]
```
So, exit the script if the build fails.
- And:
```diff
-cd WasmApp
-./run-v8.sh
+cd WasmApp && ./run-v8.sh
```
Just makes it a single error, if that directory/script doesn't exist.
|
Tagging subscribers to this area: @directhex Issue DetailsIf building the .. which is misleading. Looking at the execution log shows that the real error was: So, exit the script if the build fails.
|
lewing
left a comment
There was a problem hiding this comment.
The changes make sense, one question about setting CLRTestExitCode when we haven't actually run the test.
Some test projects have `<CLRTestKind>RunOnly</CLRTestKind>`, eg.
`GitHub_26491_SingleReturnSynchronized`. In this particular project, it
doesn't have it own code/assembly, and just runs another assembly.
But the default script generated for the test adds the build command for
`WasmTestRunner.proj`, which fails here because there is no assembly to
bundle!
This manifested for
`JIT/Regression/JitBlue/GitHub_26491/GitHub_26491_SingleReturnSynchronized/GitHub_26491_SingleReturnSynchronized.sh` as:
```
BEGIN EXECUTION
Microsoft (R) Build Engine version 16.8.0+126527ff1 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
AppDir: /home/helixbot/work/AA96097C/w/9CC508B9/e/JIT/Regression/JitBlue/GitHub_26491/GitHub_26491_SingleReturnSynchronized/WasmApp/
TestBinDir: /home/helixbot/work/AA96097C/w/9CC508B9/e/JIT/Regression/JitBlue/GitHub_26491/GitHub_26491_SingleReturnSynchronized
ArtifactsBinDir:
/home/helixbot/work/AA96097C/p/build/WasmApp.targets(11,5): error : Could not find assembly '/home/helixbot/work/AA96097C/w/9CC508B9/e/JIT/Regression/JitBlue/GitHub_26491/GitHub_26491_SingleReturnSynchronized/GitHub_26491_SingleReturnSynchronized.dll' [/home/helixbot/work/AA96097C/p/wasm-test-runner/WasmTestRunner.proj]
Test Harness Exitcode is : 1
```
This *test* wasn't failing earlier, because the build command would
fail, but the script continued execution. And the subsequent shell
script worked as expected. But now we exit if the build command fails,
causing the whole test to fail!
Solution: Honor `$(CLRTestKind) == RunOnly`, and don't emit the build
command in that case.
|
This caused a test failure: f662177 @naricc Does the fix look correct? And/or should something be done with https://github.com/dotnet/runtime/blob/master/src/tests/JIT/Regression/JitBlue/GitHub_26491/GitHub_26491_SingleReturnSynchronized.ilproj#L7 ? |
Yes, I think it is the correct fix. I am not sure about why the android one was excluded that way; if it is for the same reason we should probably use the same/similar fix there. @fanyang-mono any insight? |
The reason why I excluded this test from Android, because the comment that I left there "Generated shell script has no corresponding assembly". When creating Android apps for runtime tests, I used shell script names to find the corresponding assembly. Then include that assembly to the APK. WASM doesn't have such logic. If this test used to pass when running with WASM, we should keep it that way. |
| fi | ||
|
|
||
| $__Command msbuild $CORE_ROOT/wasm-test-runner/WasmTestRunner.proj /p:NetCoreAppCurrent=$(NetCoreAppCurrent) /p:TestAssembly=`pwd`/$(MsBuildProjectName).dll /p:TestBinDir=`pwd` | ||
| $__Command msbuild $CORE_ROOT/wasm-test-runner/WasmTestRunner.proj /p:NetCoreAppCurrent=$(NetCoreAppCurrent) /p:TestAssembly=`pwd`/$(MsBuildProjectName).dll /p:TestBinDir=`pwd` || exit $? |
There was a problem hiding this comment.
This is how I handled the error of this script. I think it is better this way, because it covers the whole script.
https://github.com/dotnet/runtime/blob/master/src/tests/Common/CLRTest.Execute.Bash.targets#L409-L413
You could add the WASM condition there.
There was a problem hiding this comment.
True, that would be better, but I wasn't sure what that might break lol. @naricc thoughts?
There was a problem hiding this comment.
We can maybe merge this one, and then explore the set -e in a separate PR
There was a problem hiding this comment.
I think using set -e works for android because the tests use the xharness runner which is returning 0 if the test succeeds. Wasm is using the return code the test assemblies themselves produce, which is 100 on success, but looks like an error to bash.
However, putting it as the first part of an || statement like in your PR would keep bash from seeing is as an error that requires termination with set -e.
So, regardless of whether or not we use set -e, we need this change.
There was a problem hiding this comment.
Then set -e would cause it to exit early. We probably shouldn't use it for WASM.
Talked to Ankit offline, it seems that WASM ran into a similar issue as Android. From Ankit |
Why do we want to exclude (disable?) the test? The fix for the failure that I ran into, is to simply not build |
You are right. |
|
Just to give this more context:
|
If building the
WasmTestRunner.projon helix fails, then the errorgets ignored, and script execution continues. And that results in the
failure to be shown as:
.. which is misleading. Looking at the execution log shows that the real error was:
So, exit the script if the build fails.