Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated mono testing doc #44360

Merged
merged 23 commits into from
Nov 20, 2020
Merged
Changes from 14 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
51241f1
Update testing.md
fanyang-mono Nov 6, 2020
5afb1da
Create testing-mono.md
fanyang-mono Nov 6, 2020
6a6d421
Update mono testing doc
fanyang-mono Nov 6, 2020
5ebf8af
Update docs/workflow/testing/mono/testing.md
fanyang-mono Nov 11, 2020
8f38660
Update docs/workflow/testing/mono/testing.md
fanyang-mono Nov 11, 2020
4dcfce5
Update docs/workflow/testing/mono/testing.md
fanyang-mono Nov 11, 2020
94d1c90
Update docs/workflow/testing/mono/testing.md
fanyang-mono Nov 11, 2020
5d0fd91
Update docs/workflow/testing/mono/testing.md
fanyang-mono Nov 11, 2020
0c664e8
Update docs/workflow/testing/mono/testing.md
fanyang-mono Nov 11, 2020
031a857
Update docs/workflow/testing/mono/testing.md
fanyang-mono Nov 11, 2020
4309c23
Update docs/workflow/testing/mono/testing.md
fanyang-mono Nov 11, 2020
ae3b8bb
Update docs/workflow/testing/mono/testing.md
fanyang-mono Nov 11, 2020
c538bd2
PR feedback
fanyang-mono Nov 11, 2020
bdf7016
Fix format
fanyang-mono Nov 13, 2020
e5a377e
Update docs/workflow/testing/mono/testing.md
fanyang-mono Nov 17, 2020
270a938
Update docs/workflow/testing/mono/testing.md
fanyang-mono Nov 17, 2020
cecd564
Update docs/workflow/testing/mono/testing.md
fanyang-mono Nov 17, 2020
3b24c94
Update docs/workflow/testing/mono/testing.md
fanyang-mono Nov 17, 2020
121e5c3
PR feedback
fanyang-mono Nov 17, 2020
bb6844e
Update docs/workflow/testing/mono/testing.md
fanyang-mono Nov 20, 2020
0bc668a
Update docs/workflow/testing/mono/testing.md
fanyang-mono Nov 20, 2020
3c6e23f
Replace bullet points with sub-headers
fanyang-mono Nov 20, 2020
6d1918c
Update sub-headers to remove the duplicated part
fanyang-mono Nov 20, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 87 additions & 27 deletions docs/workflow/testing/mono/testing.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,114 @@
# Running Tests using Mono Runtime
# Running test suites using Mono

## Running Runtime Tests
We currently only support running tests against coreclr. There are additional mono runtime tests in mono/mono, but they
have not been moved over yet. Simply run the following command:
Before running tests, [build Mono](../../building/mono/README.md) using the desired configuration.

## Runtime Tests
### Testing against Mono JIT:
fanyang-mono marked this conversation as resolved.
Show resolved Hide resolved

* Build runtime tests by executing the follwiing command from `$(REPO_ROOT)/src/tests`
fanyang-mono marked this conversation as resolved.
Show resolved Hide resolved
```
./build.sh excludemonofailures <release|debug>
```

* Running a single test:
fanyang-mono marked this conversation as resolved.
Show resolved Hide resolved
```
cd ../mono/netcore
fanyang-mono marked this conversation as resolved.
Show resolved Hide resolved
make run-tests-coreclr CoreClrTest="bash ../../artifacts/tests/coreclr/OSX.x64.Release/JIT/opt/InstructionCombining/DivToMul/DivToMul.sh"
fanyang-mono marked this conversation as resolved.
Show resolved Hide resolved
```

* Running all runtime tests:
```
cd ../mono/netcore
make run-tests-coreclr-all
```

### Testing on WebAssembly:
```
$(REPO_ROOT)/src/tests/build.sh -skipstressdependencies -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
--------------------------------------------------
```
dotnet build /t:RunCoreClrTests $(REPO_ROOT)/src/mono/mono.proj

Run that command, adding `wasm` to the end.

### Testing on Android x64:
```
$(REPO_ROOT)/src/tests/build.sh -skipstressdependencies -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
--------------------------------------------------
```
Run that command, adding `Android` at the end.

For more details about internals of the runtime tests, please refer to the [CoreCLR testing documents](../coreclr)

If you want to run individual tests, execute this command:
## Libraries tests
* Build and run library tests against Mono JIT:
fanyang-mono marked this conversation as resolved.
Show resolved Hide resolved
* cd into the test library of your choice (`cd $(REPO_ROOT)/src/libraries/<library>/tests`)
* Run the tests

```
dotnet build /t:RunCoreClrTest /p:CoreClrTest="<TestName>" $(REPO_ROOT)/src/mono/mono.proj
$(REPO_ROOT)/dotnet.sh build /t:Test /p:RuntimeFlavor=mono /p:Configuration=<Release/Debug>
fanyang-mono marked this conversation as resolved.
Show resolved Hide resolved
```

## Running Library Tests
Running library tests against Mono is straightforward regardless of configuration. Simply run the following commands:
* Build and run library tests against Webassembly, Android or iOS. See instructions located in [Library testing document folder](../libraries/)

1. Build and set the RuntimeFlavor
# Running the Mono samples
fanyang-mono marked this conversation as resolved.
Show resolved Hide resolved
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.

## Sample for desktop Mono
It lives in `HelloWorld` folder.
fanyang-mono marked this conversation as resolved.
Show resolved Hide resolved

To run that program, you could simply cd to that directory and execute
fanyang-mono marked this conversation as resolved.
Show resolved Hide resolved

```bash
./build.sh /p:RuntimeFlavor=mono
```
or on Windows
```bat
build.cmd /p:RuntimeFlavor=mono
make run
```

2. cd into the test library of your choice (`cd src/libraries/<library>/tests`)
Note that, it is configured with run with `Release` and `LLVM` mode by default. If you would like to work with other mode, you could edit the Makefile.

3. Run the tests
## Sample for WebAssembly
It lives in `wasm` folder. There are two sub-folders `browser` and `console`. One is set up to run the program in browser, the other is set up to run the program in console.

To run that program, you could simply cd to the desirable sub-folder and execute

```
dotnet build /t:Test /p:RuntimeFlavor=mono
make build && make run
```

# Patching Local dotnet (.dotnet-mono)
Another way to test mono out is by 'patching' a local dotnet with our runtime bits. This is a good way to write simple
test programs and get a glimpse of how mono will work with the dotnet tooling.
Note that, it is configured with run with `Release` mode by default. If you would like to work with other mode, you could edit the Makefile.

## Sample for Android
It lives in `Android` folder.

To generate a local .dotnet-mono, execute this command:
To run that program, you could simply cd to that directory and execute

```
dotnet build /t:PatchLocalMonoDotnet $(REPO_ROOT)/src/mono/mono.proj
make run
```

You can then, for example, run our HelloWorld sample via:
Note that, it is configured with run with `x64` architecture and `Release` mode by default. If you would like to work with other configurations, you could edit the Makefile.

## Sample for iOS
It lives in `Android` folder.

To run that program, you could simply cd to that directory and execute

```
dotnet build -c Release $(REPO_ROOT)/src/mono/netcore/sample/HelloWorld
MONO_ENV_OPTIONS="" COMPlus_DebugWriteToStdErr=1 \
$(REPO_ROOT)/.dotnet-mono/dotnet $(REPO_ROOT)/src/mono/netcore/sample/HelloWorld/bin/HelloWorld.dll
make run
```

Note that, it is configured with run with `x64` architecture and `Debug` mode by default. If you would like to work with other configurations, you could edit the Makefile.