|
| 1 | +# Chipyard Tests |
| 2 | + |
| 3 | +To build the tests, we do the following procedure. |
| 4 | + |
| 5 | +## Clean the previous build |
| 6 | + |
| 7 | +First, we clean the previous build. This step is recommended when any changes are made to the CMake build flow. This is equivalent to running `make clean` to the CMake build system. |
| 8 | + |
| 9 | +```bash |
| 10 | +cd $chipyard/tests/ |
| 11 | +rm -rf ./build/ |
| 12 | +``` |
| 13 | + |
| 14 | + |
| 15 | +## Configure the CMake build system |
| 16 | + |
| 17 | +Then, we configure the cmake to build with the following settings. This step only needs to be done once when the build directory is not created. |
| 18 | + |
| 19 | +```bash |
| 20 | +cmake -S ./ -B ./build/ -D CMAKE_BUILD_TYPE=Debug |
| 21 | +``` |
| 22 | + |
| 23 | +`-S` specifies the source directory, which is the current directory. |
| 24 | + |
| 25 | +`-B` specifies the build directory, which is `./build/`. |
| 26 | + |
| 27 | +`-D CMAKE_BUILD_TYPE=Debug` specifies the build type, which is debug. |
| 28 | + |
| 29 | + |
| 30 | +## Build the tests |
| 31 | + |
| 32 | +Then, we build the tests with the following command. |
| 33 | + |
| 34 | +By default, the target is `all`, which builds all the tests. |
| 35 | + |
| 36 | +```bash |
| 37 | +cmake --build ./build/ --target all |
| 38 | +``` |
| 39 | + |
| 40 | +If only specific tests are needed, we can specify the tests by adding the test name after `--target`. |
| 41 | + |
| 42 | +For example, to build the `hello` test, we can run the following command. |
| 43 | + |
| 44 | +```bash |
| 45 | +cmake --build ./build/ --target hello |
| 46 | +``` |
| 47 | + |
| 48 | + |
| 49 | +## Generating disassembly of the tests |
| 50 | + |
| 51 | +To dump the disassembly of the tests, we can run the following command. |
| 52 | + |
| 53 | +```bash |
| 54 | +cmake --build ./build/ --target dump |
| 55 | +``` |
| 56 | + |
| 57 | +To dump the disassembly of the `hello` test, we can run the following command. |
| 58 | + |
| 59 | +```bash |
| 60 | +cmake --build ./build/ --target hello_dump |
| 61 | +``` |
| 62 | + |
| 63 | +## Clean the previous build |
| 64 | + |
| 65 | +To clean the previous build, we can run the following command. |
| 66 | + |
| 67 | +```bash |
| 68 | +cmake --build ./build/ --target clean |
| 69 | +``` |
0 commit comments