#!/bin/sh # # This test builds and runs the SelfTest tool that is shipped in the source # package. # set -eu SRCDIR="$AUTOPKGTEST_TMP"/source BLDDIR="$AUTOPKGTEST_TMP"/build mkdir -p "$SRCDIR" cat >"$SRCDIR"/CMakeLists.txt <<-EOF cmake_minimum_required(VERSION 3.10) project(SelfTest CXX) set(TEST_SRCDIR $(pwd)/tests/SelfTest) file(GLOB_RECURSE TEST_SOURCES \${TEST_SRCDIR}/*.cpp) add_executable(SelfTest \${TEST_SOURCES}) find_package(PkgConfig REQUIRED) pkg_check_modules(CATCH2 REQUIRED catch2-with-main) target_compile_options(SelfTest PUBLIC \${CATCH2_CFLAGS_OTHERS}) target_include_directories(SelfTest PUBLIC \${CATCH2_INCLUDE_DIRS}) target_include_directories(SelfTest PRIVATE \${TEST_SRCDIR}) target_link_libraries(SelfTest \${CATCH2_LIBRARIES}) EOF cmake -S "$SRCDIR" -B "$BLDDIR" make -C "$BLDDIR" -j "$(nproc)" exec "$BLDDIR"/SelfTest