llvm-lit module for first-class utest.h unit test support
Project description
llvm-lit module for first-class utest.h unit test support
This module allows you to run a utest testsuite as part of a larger lit testsuite. This is useful when you want to mix API unit tests with functional testing of your driver programs.
Installation
pip install lit-utest
Requirements
lit is required. Your tests should be utest.h-based or behave like it.
Usage
In each of your main utest test files, set the build command:
// UTEST: cc %s -o %utest_bin
This works just like the built-in ShTest RUN: line, but introduces the special UTEST keyword to lit. The runner executes this command and the runs the resultant %utest_bin output file. All lit substitutions are available for use as usual.
Once your build commands have been added to your unit tests, configure lit with the UTestRunner in lit.local.cfg:
import lit_utest config.test_format = lit_utest.UTestRunner()
lit will now expect all discovered tests in the subdirectory to behave as utest tests, and ignore those without a UTEST: build command. It runs each unit test separately using utest’s --filter switch, and collects the results and prints them in the way you’d expect lit to do:
-- Testing: 3 tests, 3 threads -- XFAIL: lit_utest :: shell_tests/runline.xfail.test (1 of 3) PASS: lit_utest :: shell_tests/runline.test (2 of 3) PASS: lit_utest :: utest_tests/test.c (3 of 3) *** MICRO-TEST: lit_utest :: utest_tests/test.c[MyTestF.c2] -> PASS *** MICRO-TEST: lit_utest :: utest_tests/test.c[MyTestF.c] -> PASS *** MICRO-TEST: lit_utest :: utest_tests/test.c[MyTestI.c/0] -> PASS *** MICRO-TEST: lit_utest :: utest_tests/test.c[MyTestI.c/1] -> PASS *** MICRO-TEST: lit_utest :: utest_tests/test.c[MyTestI.c2/0] -> PASS [...]
For examples, see the test directory, where we eat our own dogfood.
Compatibility
This module should work in all places upstream lit is supported, but I will make no extra effort to support python < 2.7
Unlicence
utest.h is Public Domain, llvm is either NCSA or Apache-2 license depending on the version, so it makes sense to dedicate this work to the PUBLIC DOMAIN.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file lit_utest-0.1.1.tar.gz
.
File metadata
- Download URL: lit_utest-0.1.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.9.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f7a65522b4550ebbaabc1b83a60de47cfcead4fd21129b5ae2ac47989803a1f |
|
MD5 | d90d167fd0d8f830a50b471feebf7816 |
|
BLAKE2b-256 | a8bc6c998922f20b25ba74729433d7a12efe97fa243febea530a2dc35c7a2fa3 |