Skip to content

Testing the Checked C compiler

Mandeep Singh Grang edited this page Jul 29, 2019 · 1 revision

Checked C LIT Testing

There are a lot of unit tests under the checkedc/tests directory. These tests can be run using LLVM's lit infrastructure as follows:

cd <BUILD_DIR>/llvm

bin/llvm-lit -v <SRC_DIR>/projects/checkedc-wrapper/checkedc/tests

By default, this would compile and run these tests for the native X86 target. You can also run these tests for other targets like ARM as follows:

1. Configure the compiler

Specify these two CMake options when configuring the compiler:

-DCHECKEDC_ARM_RUNUNDER=<device> Specify the device to run the arm lit tests on. For example, specify this as qemu-arm in order to run the tests on the ARM QEMU.

NOTE: If you want to run the tests on the QEMU, make sure that the QEMU is installed on the host machine.

-DCHECKEDC_ARM_SYSROOT=<sysroot> Specify the path to the top of an ARM sysroot which contains the ARM-specific headers and runtime libs.

2. Run lit

Once you have built the Checked C compiler, this is how you would invoke lit for ARM testing:

bin/llvm-lit -v <SRC_DIR>/projects/checkedc-wrapper/checkedc/tests -DCHECKEDC_TARGET=ARM