To build the tests, we do the following procedure.
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.
cd $chipyard/tests/
rm -rf ./build/
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.
cmake -S ./ -B ./build/ -D CMAKE_BUILD_TYPE=Debug
-S
specifies the source directory, which is the current directory.
-B
specifies the build directory, which is ./build/
.
-D CMAKE_BUILD_TYPE=Debug
specifies the build type, which is debug.
Then, we build the tests with the following command.
By default, the target is all
, which builds all the tests.
cmake --build ./build/ --target all
If only specific tests are needed, we can specify the tests by adding the test name after --target
.
For example, to build the hello
test, we can run the following command.
cmake --build ./build/ --target hello
To dump the disassembly of the tests, we can run the following command.
cmake --build ./build/ --target dump
To dump the disassembly of the hello
test, we can run the following command.
cmake --build ./build/ --target hello_dump
To clean the previous build, we can run the following command.
cmake --build ./build/ --target clean