diff options
author | John Levon <john.levon@nutanix.com> | 2020-11-25 17:33:25 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-25 17:33:25 +0000 |
commit | 76fb4e20298c7c41efb20a8a53ae81d2ce716303 (patch) | |
tree | 2055c804d241b4dd366d5c5ae1ee5be98761389c | |
parent | 48c55b26a05ab8d4bf7afdfed98bd8a71142848f (diff) | |
download | libvfio-user-76fb4e20298c7c41efb20a8a53ae81d2ce716303.zip libvfio-user-76fb4e20298c7c41efb20a8a53ae81d2ce716303.tar.gz libvfio-user-76fb4e20298c7c41efb20a8a53ae81d2ce716303.tar.bz2 |
add "make test"; run it in pre-commit (#127)
Also rename test.c to reflect it should cover unit tests.
Reviewed-by: Swapnil Ingle <swapnil.ingle@nutanix.com>
Signed-off-by: John Levon <john.levon@nutanix.com>
-rw-r--r-- | .travis.yml | 1 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | test/CMakeLists.txt | 7 | ||||
-rw-r--r-- | test/unit-tests.c (renamed from test/test.c) | 0 |
4 files changed, 9 insertions, 2 deletions
diff --git a/.travis.yml b/.travis.yml index 6f267b2..a75abce 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,3 +6,4 @@ before_install: script: - make - make BUILD_TYPE=rel + - make test @@ -53,6 +53,9 @@ PHONY_TARGETS := all realclean buildclean force_cmake export install-export tags all $(filter-out $(PHONY_TARGETS), $(MAKECMDGOALS)): $(BUILD_DIR)/Makefile +$(MAKE) -C $(BUILD_DIR) $@ +test: all + cd $(BUILD_DIR)/test; ctest --verbose + realclean: rm -rf $(BUILD_DIR_BASE) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e5fc7a0..a04e0f1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -26,5 +26,8 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # -add_executable(test test.c ) -target_link_libraries(test cmocka json-c muser) +add_executable(unit-tests unit-tests.c) +target_link_libraries(unit-tests cmocka json-c muser) + +enable_testing() +add_test(NAME unit-tests COMMAND unit-tests) diff --git a/test/test.c b/test/unit-tests.c index 6ad4e3b..6ad4e3b 100644 --- a/test/test.c +++ b/test/unit-tests.c |