File: SelfTest

package info (click to toggle)
catch2 3.7.1-0.6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,296 kB
  • sloc: cpp: 50,696; python: 1,525; sh: 79; makefile: 18
file content (28 lines) | stat: -rwxr-xr-x 862 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/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