1
0
Fork 0
mirror of https://github.com/VSadov/Satori.git synced 2025-06-09 17:44:48 +09:00
Satori/docs/workflow/testing/mono/testing.md
Fan Yang 60c6086aa7
Update testing.md (#46295)
The current framework relays on CoreCLR to create the Core_Root and then patch it with mono runtime. So building CoreCLR is required before building runtime tests for desktop Mono
2020-12-21 14:04:30 -05:00

108 lines
3.8 KiB
Markdown

# Running test suites using Mono
Before running tests, [build Mono](../../building/mono/README.md) using the desired configuration.
## Runtime Tests
### Desktop Mono:
To build the runtime tests for Mono JIT or interpreter, build CoreCLR and execute the following command from `$(REPO_ROOT)/src/tests`
```
./build.sh excludemonofailures <release|debug>
```
Run individual test:
```
cd ../mono/netcore
make run-tests-coreclr CoreClrTest="bash ../../artifacts/tests/coreclr/OSX.x64.Release/JIT/opt/InstructionCombining/DivToMul/DivToMul.sh"
```
Run all tests:
```
cd ../mono/netcore
make run-tests-coreclr-all
```
### WebAssembly:
Build the runtime tests for WebAssembly
```
$(REPO_ROOT)/src/tests/build.sh -excludemonofailures os Browser wasm <Release/Debug>
```
The last few lines of the build log should contain something like this:
```
--------------------------------------------------
Example run.sh command
src/tests/run.sh --coreOverlayDir=<repo_root>artifacts/tests/coreclr/Browser.wasm.Release/Tests/Core_Root --testNativeBinDir=<repo_root>/artifacts/obj/coreclr/Browser.wasm.Release/tests --testRootDir=<repo_root>/artifacts/tests/coreclr/Browser.wasm.Release --copyNativeTestBin Release
--------------------------------------------------
```
To run all tests, execute that command, adding `wasm` to the end.
### Android:
Build the runtime tests for Android x64
```
$(REPO_ROOT)/src/tests/build.sh -excludemonofailures os Android x64 <Release/Debug>
```
The last few lines of the build log should contain something like this:
```
--------------------------------------------------
Example run.sh command
src/tests/run.sh --coreOverlayDir=<repo_root>artifacts/tests/coreclr/Android.x64.Release/Tests/Core_Root --testNativeBinDir=<repo_root>/artifacts/obj/coreclr/Android.x64.Release/tests --testRootDir=<repo_root>/artifacts/tests/coreclr/Android.x64.Release --copyNativeTestBin Release
--------------------------------------------------
```
To run all tests, execute that command, adding `Android` at the end.
### Additional Documents
For more details about internals of the runtime tests, please refer to the [CoreCLR testing documents](../coreclr)
## Libraries tests
### Desktop Mono
Build and run library tests against Mono JIT or interpreter
```
$(REPO_ROOT)/dotnet.sh build /t:Test /p:RuntimeFlavor=mono /p:Configuration=<Release/Debug> $(REPO_ROOT)/src/libraries/<library>/tests
```
Alternatively, you could execute the following command from `$(REPO_ROOT)/src/mono/netcore`
```
make run-tests-corefx-<library>
```
For example, the following command is for running System.Runtime tests:
```
make run-tests-corefx-System.Runtime
```
### Mobile targets and WebAssembly
Build and run library tests against Webassembly, Android or iOS. See instructions located in [Library testing document folder](../libraries/)
# Running the Mono samples
There are a few convenient samples located in `$(REPO_ROOT)/src/mono/netcore/sample`, which could help you test your program easily with different flavors of Mono or do a sanity check on the build. The samples are set up to work with a specific configuration; please refer to the relevant Makefile for specifics. If you would like to work with a different configuration, you can edit the Makefile.
## Desktop Mono
To run the desktop Mono sample, cd to `HelloWorld` and execute:
```
make run
```
Note that the default configuration of this sample is LLVM JIT.
## WebAssembly
To run the WebAssembly sample, cd to `wasm`. There are two sub-folders `browser` and `console`. One is set up to run the progam in browser, the other is set up to run the program in console. Enter the desirable sub-folder and execute
```
make build && make run
```
## Android
To run the Android sample, cd to `Android` and execute
```
make run
```
## iOS
To run the iOS sample, cd to `iOS` and execute
```
make run
```