Debian Codegraph @

debian/tests/testsuite

raw
1 #!/bin/sh
2 # Copyright 2016 Ghislain Antony Vaillant <[email protected]>
3 #
4 # This file is part of the autopkgtest testsuite for the libjsoncpp
5 # source package.
6
7 set -e
8
9 # Presence of $AUTOPKGTEST_TMP implies that someone will handle cleanup for us, so we
10 # can avoid duplicating the effort (signal handling, etc.) here.
11 if [ -z "$AUTOPKGTEST_TMP" ]
12 then
13 echo "Required envvar \"$AUTOPKGTEST_TMP\"is not set" >&2
14 exit 1
15 fi
16
17 # Copy testsuite source code.
18 cp -a ./src/test_lib_json/* "$AUTOPKGTEST_TMP"
19 cd "$AUTOPKGTEST_TMP"
20
21 if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
22 cat <<EOF > "$AUTOPKGTEST_TMP/toolchain.cmake"
23 set(CMAKE_C_COMPILER $DEB_HOST_GNU_TYPE-gcc)
24 set(CMAKE_CXX_COMPILER $DEB_HOST_GNU_TYPE-g++)
25 set(PKG_CONFIG_EXECUTABLE $DEB_HOST_GNU_TYPE-pkg-config)
26 EOF
27 CCFILE=-DCMAKE_TOOLCHAIN_FILE="$AUTOPKGTEST_TMP/toolchain.cmake"
28 else
29 CCFILE=
30 fi
31
32 cat <<EOF > CMakeLists.txt
33 cmake_minimum_required(VERSION 3.18)
34 project(jsoncpp_test)
35
36 find_package(jsoncpp REQUIRED)
37 add_executable(jsoncpp_test main.cpp jsontest.cpp jsontest.h fuzz.cpp fuzz.h)
38 target_link_libraries(jsoncpp_test PRIVATE JsonCpp::JsonCpp)
39
40 EOF
41
42 # Configure, build and execute.
43 mkdir build && cd build
44 cmake $CCFILE ..
45 make VERBOSE=1 -j$(nproc)
46 ./jsoncpp_test