From 3fe6392f383463a05531b535107442f66c9814e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= Date: Fri, 19 Feb 2021 12:56:57 -0300 Subject: [PATCH] common/build-style: fix do_check for cmake. make was accidentally left hardcoded to query if a test target was available, which meant tests wouldn't be run for most of the applications, since they were now using ninja. --- common/build-style/cmake.sh | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/common/build-style/cmake.sh b/common/build-style/cmake.sh index 26d55f527e3..00ef3ff37e5 100644 --- a/common/build-style/cmake.sh +++ b/common/build-style/cmake.sh @@ -79,20 +79,34 @@ do_build() { } do_check() { + : ${make_cmd:=ninja} + cd ${cmake_builddir:=build} - if [ -z "$make_cmd" ] && [ -z "$make_check_target" ]; then - if make -q test 2>/dev/null; then - : - else - if [ $? -eq 2 ]; then - msg_warn 'No target to "make test".\n' - return 0 - fi - fi + if [ -z "$make_check_target" ]; then + case $make_cmd in + make) + if make -q test 2>/dev/null; then + : + else + if [ $? -eq 2 ]; then + msg_warn 'No target to "make test".\n' + return 0 + fi + fi + ;; + ninja) + if ! ninja -t query test >/dev/null 2>&1; then + msg_warn 'No target to "ninja test".\n' + return 0 + fi + ;; + *) + msg_warn "Can't run tests with '$make_cmd', define do_check.\n" + ;; + esac fi - : ${make_cmd:=ninja} : ${make_check_target:=test} CTEST_OUTPUT_ON_FAILURE=TRUE ${make_cmd} ${make_check_args} ${make_check_target}