Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 26cc472

Browse files
committed
Add information on using run-test.sh outside CI
1 parent cc19cac commit 26cc472

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Running XUnit tests cross platform
2+
3+
Unlike Windows, where we run tests as part of the build, we have a seperate
4+
explicit testing step on Linux and OSX. Over time, this special step will go
5+
away in favor of a similar "run tests during the build" model.
6+
7+
`run-test.sh` is the shell script used by Jenkins in order to run all the XUnit
8+
tests cross platform. It combines the cross platform CoreCLR and CoreFX builds
9+
together into a test layout and then runs each test project from CoreFX.
10+
11+
In order to run tests, you need to build a bunch of different projects. The
12+
instructions assume you are building for Linux, but are easily modifiable for OSX.
13+
14+
1. Release or debug CoreCLR. In Jenkins we use a release CoreCLR build instead
15+
of debug CoreCLR since it is much faster at actually running XUnit, but debug
16+
will work if you have the time.
17+
18+
From the root of your CoreCLR enlistment on Linux, run `./build.sh Release` in
19+
order to build.
20+
2. A coresponding version of mscorlib.dll, built on Windows but targeting
21+
Linux. This can be produced by running `build.cmd linuxmscorlib Release` from
22+
a CoreCLR enlistment on Windows. Remember that the runtime and mscorlib are
23+
tightly coupled with respect to object sizes and layout so you need to ensure
24+
you have either a release coreclr and release mscorlib or debug coreclr and
25+
debug mscorlib.
26+
3. A Linux build of CoreFX. On Windows, run `build.cmd /p:OSGroup=Linux`. It
27+
is okay to build a Debug version of CoreFX and run it on top of a release
28+
CoreCLR (which is exactly what we do in Jenkins).
29+
4. A Linux build of the native CoreFX components. On Linux, run ./build.sh from
30+
src/Native in your CoreFX enlistment.
31+
32+
After building all the projects, we need to copy the files we built on Windows
33+
over to our Linux machine. The easiest way to do this is to mount a windows
34+
share on linux. For example, I do:
35+
36+
```
37+
# sudo mount.cifs "//MATELL3/D\$" ~/mnt/matell3/d -o user=matell
38+
```
39+
40+
The copy the CoreFX binaries over to your local machine (I have my enlistements
41+
on Linux under ~/git).
42+
43+
```
44+
# rsync -v -r --exclude 'obj' --exclude 'packages' ~/mnt/matell3/d/git/corefx/bin/ ~/git/corefx/bin/
45+
# rsync -v -r ~/mnt/matell3/d/git/coreclr/bin/Product/ ~/git/coreclr/bin/Product/
46+
```
47+
48+
Then, run the tests. run-test.sh defaults to wanting to use Windows tests (for
49+
historical reasons), so we need to pass an explict path to the tests, as well as
50+
a path to the location of CoreCLR and mscorlib.dll.
51+
52+
```
53+
# ./run-test.sh --coreclr-bins ~/git/coreclr/bin/Product/Linux.x64.Release \
54+
--mscorlib-bins ~/git/coreclr/bin/Product/Linux.x64.Release \
55+
--corefx-tests ~/git/corefx/bin/tests/Linux.AnyCPU.Debug
56+
```
57+
58+
run-test.sh should now invoke all the managed tests.

0 commit comments

Comments
 (0)