xref: /aosp_15_r20/external/swiftshader/docs/dEQP.md (revision 03ce13f70fcc45d86ee91b7ee4cab1936a95046e)
1dEQP
2====
3
4These steps are specifically for testing SwiftShader's Vulkan implementation using dEQP on Windows (steps for Linux below the Windows instructions).
5
6Prerequisites
7-------------
8
91. Install the latest [Python 3](https://www.python.org/downloads/)
102. Install [Visual Studio](https://visualstudio.microsoft.com/vs/community/)
113. Install [CMake](https://cmake.org/download/)
124. Install [Go](https://golang.org/doc/install)
135. Install [MinGW-W64](http://mingw-w64.org/doku.php/download)
14  * Select 'x86_64' as Architecture during setup
156. Install [Git](https://git-scm.com/download/win)
167. Set environment variables: Config Panel -> System and Security -> System -> Advanced system settigns -> Environment Variables
17  * Add `<path to python>` to your PATH environment variable
18  * Add `<path to MinGW-W64>\bin` to your PATH environment variable
19
208. (Optional) Install [TortoiseGit](https://tortoisegit.org/)
21
22Getting the Code
23----------------
24
2512. Get dEQP (either in 'cmd' or by using TortoiseGit):
26
27    `git clone https://github.com/KhronosGroup/VK-GL-CTS`
28
29    You may wish to check out a stable vulkan-cts-* branch.
30
3113. Get dEQP's dependencies. In your dEQP root directory, open 'cmd' and run:
32
33    `python3 external\fetch_sources.py`
34
3514. Get Cherry (either in 'cmd' or by using TortoiseGit):
36
37    `git clone https://android.googlesource.com/platform/external/cherry`
38
3915. Set environment variable (see point 9):
40
41    Add new variable GOPATH='`<path to cherry>`'
42
43Building the code
44-----------------
45
4616. Build dEQP's Visual Studio files using the CMake GUI, or, in the dEQP root dir, run:
47    ```
48    mkdir build
49    cd build
50    cmake ..
51    ```
52    Note: don't call 'cmake .' directly in the root directory. It will make things fails later on. If you do, simply erase the files created by CMake and follow the steps above.
53
5417. Build dEQP:
55
56    Open `<path to dEQP>\build\dEQP-Core-default.sln` in Visual Studio and Build Solution
57
58    Note: Choose a 'Debug' build.
59
6018. Generate test cases:
61    ```
62    mkdir <path to cherry>\data
63    cd <path to dEQP>
64    python3 scripts\build_caselists.py <path to cherry>\data
65    ```
66
67    Note: you need to run `python3 scripts\build_caselists.py <path to cherry>\data` every time you update dEQP.
68
69Preparing the server
70--------------------
71
7219. Edit `<path to cherry>\cherry\data.go`
73* Search for `../candy-build/deqp-wgl` and replace that by `<path to deqp>/build`
74* Just above, add an option to CommandLine: `--deqp-gl-context-type=egl`
75* Remove `--deqp-watchdog=enable` to avoid timeouts during debugging.
76
77  Note: If you chose a Release build at step 17, modify the BinaryPath from 'Debug' to 'Release'.
78
79Testing Vulkan
80--------------
81
8220. Assuming you already built SwiftShader, copy and rename this file:
83
84    `<path to SwiftShader>\build\Release_x64\vk_swiftshader.dll` or\
85    `<path to SwiftShader>\build\Debug_x64\vk_swiftshader.dll`
86
87    To:
88
89    `<path to dEQP>\build\external\vulkancts\modules\vulkan\Debug\vulkan-1.dll`
90
91    This will cause dEQP to load SwiftShader's Vulkan implementatin directly, without going through a system-provided [loader](https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/LoaderAndLayerInterface.md#the-loader) library or any layers.
92
93     This step can also be automated by setting the `SWIFTSHADER_VULKAN_API_LIBRARY_INSTALL_PATH` environment variable to a path where we'd like the drop-in API library to be installed. For example `<path to dEQP>/build/external/vulkancts/modules/vulkan/Debug/`.
94
95    To use SwiftShader as an [Installable Client Driver](https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/LoaderAndLayerInterface.md#installable-client-drivers) (ICD) instead:
96    * Edit environment variables:
97      * Define VK_ICD_FILENAMES to `<path to SwiftShader>\src\Vulkan\vk_swiftshader_icd.json`
98    * If the location of `vk_swiftshader.dll` you're using is different than the one specified in `src\Vulkan\vk_swiftshader_icd.json`, modify it to point to the `vk_swiftshader.dll` file you want to use.
99
100Running the tests
101-----------------
102
10321. Start the test server. Go to `<path to cherry>` and run:
104
105    `go run server.go`
106
10722. Open your favorite browser and navigate to `localhost:8080`
108
109    Get Started -> Choose Device 'localhost' -> Select Tests 'dEQP-VK' -> Execute tests!
110
111Mustpass sets
112-------------
113
114dEQP contains more tests than what is expected to pass by a conformant implementation (e.g. some tests are considered too strict, or assume certain undefined behavior). The [android/cts/master/vk-master.txt](https://android.googlesource.com/platform/external/deqp/+/master/android/cts/master/vk-master.txt) text file which can be loaded in Cherry's 'Test sets' tab to only run the latest tests expected to pass by certified Android devices.
115
116Linux
117-----
118
119The Linux process is similar to Windows. However it doesn't use Release or Debug variants, paths use forward slashes, and it uses shared object files instead of DLLs.
120
1211. Install the latest [Python 3](https://www.python.org/downloads/)
1222. Install GCC and Make. In a terminal, run:
123
124    `sudo apt-get install gcc make`
125
1263. Install [CMake](https://cmake.org/download/)
1274. Install [Go](https://golang.org/doc/install)
1285. Install Git. In a terminal, run:
129
130    `sudo apt-get install git`
131
1326. Download the [Vulkan SDK](https://vulkan.lunarg.com/) and unpack it into a location you like.
133
134Getting the Code
135----------------
136
1377. Get Swiftshader. In a terminal, go to the location you want to keep Swiftshader, and run:
138
139    ```
140    git clone https://swiftshader.googlesource.com/SwiftShader && (cd SwiftShader && curl -Lo `git rev-parse --git-dir`/hooks/commit-msg https://gerrit-review.googlesource.com/tools/hooks/commit-msg ; chmod +x `git rev-parse --git-dir`/hooks/commit-msg)
141    ```
142
143    This will also install the commit hooks you need for committing to SwiftShader.
144
1458. Get dEQP:
146
147   `git clone https://github.com/KhronosGroup/VK-GL-CTS`
148
1499. Get dEQP's dependencies. In your dEQP root directory, run:
150
151    `python3 external/fetch_sources.py`
152
15310. Get Cherry, similar to step 8:
154
155    `git clone https://android.googlesource.com/platform/external/cherry`
156
15711. Set environment variable. Open ~/.bashrc in your preferred editor and add the following line:
158
159    GOPATH='`<path to cherry>`'
160
161Building the code
162-----------------
163
16412. Build Swiftshader. In the Swiftshader root dir, run:
165    ```
166    cd build
167    cmake ..
168    make --jobs=$(nproc)
169    ```
170
17113. Set your environment variables. In the terminal in which you'll be building dEQP, run the following commands:
172
173    ```
174    export LD_LIBRARY_PATH="<Vulkan SDK location>/x86_64/lib:$LD_LIBRARY_PATH"
175    export LD_LIBRARY_PATH="<Swiftshader location>/build:$LD_LIBRARY_PATH"
176    ```
177
17814. Build dEQP. In the dEQP root dir, run:
179    ```
180    mkdir build
181    cd build
182    cmake ..
183    make --jobs=$(nproc)
184    ```
185
186    Also: don't call 'cmake .' directly in the root directory. It will make things fails later on. If you do, simply erase the files created by CMake and follow the steps above.
187
18815. Generate test cases:
189    ```
190    mkdir <path to cherry>/data
191    cd <path to dEQP>
192    python3 scripts/build_caselists.py <path to cherry>/data
193    ```
194
195    Note: you need to run `python3 scripts/build_caselists.py <path to cherry>/data` every time you update dEQP.
196
197Preparing the server
198--------------------
199
20016. Edit `<path to cherry>/cherry/data.go`
201* Search for ".exe" and remove all instances.
202* Search for `../candy-build/deqp-wgl/execserver/Release` and replace that by `<path to deqp>/build/execserver/execserver`
203* Just above, add an option to CommandLine: `--deqp-gl-context-type=egl`
204* Just below, remove 'Debug/' from the BinaryPath.
205* Just one more line below, replace `../candy-build/deqp-wgl/` with `<path to deqp>/build/modules/${TestPackageDir}`.
206* Remove `--deqp-watchdog=enable` to avoid timeouts during debugging.
207
208Testing Vulkan
209--------------
210
21117. Use SwiftShader as an [Installable Client Driver](https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/LoaderAndLayerInterface.md#installable-client-drivers) (ICD). Add the following line to your `~/.bashrc`:
212
213      `export VK_ICD_FILENAMES="<path to SwiftShader>/build/Linux/vk_swiftshader_icd.json"`
214
215    Then run `source ~/.bashrc` in the terminal(s) you'll be running tests from.
216
217
218Running the tests
219-----------------
220
22118. Start the test server. Go to `<path to cherry>` and run:
222
223    `go run server.go`
224
22519. Open your favorite browser and navigate to `localhost:8080`
226
227    Get Started -> Choose Device 'localhost' -> Select Tests 'dEQP-VK' -> Execute tests!
228
22920. To make sure that you're running SwiftShader's drivers, select only the dEQP-VK->info->device test. In the next window, click on these tests in the left pane. If you see SwiftShader in the deviceName field, then you've set your suite up properly.
230
23121. If you want to run Vulkan tests in the command line, go to the build directory in dEQP root. Then run the following command:
232
233    `external/vulkanacts/modules/vulkan/deqp-vk`
234
235    You can also run individual tests with:
236
237    `external/vulkanacts/modules/vulkan/deqp-vk --deqp-case=<test name>`
238
239    And you can find a list of the test names in `<Swiftshader root>/tests/regres/testlists/vk-master.txt` However, deqp-vk will cease upon the first failure. It's recommended that you use cherry for your testing needs unless you know what you're doing.
240
24122. To check that you're running SwiftShader in cherry, start the server
242
243Mustpass sets
244-------------
245
246dEQP contains more tests than what is expected to pass by a conformant implementation (e.g. some tests are considered too strict, or assume certain undefined behavior). The [android/cts/master/vk-master.txt](https://android.googlesource.com/platform/external/deqp/+/master/android/cts/master/vk-master.txt) text file which can be loaded in Cherry's 'Test sets' tab to only run the latest tests expected to pass by certified Android devices.
247