File: testsuite

package info (click to toggle)
libjsoncpp 1.9.6-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,852 kB
  • sloc: cpp: 9,483; python: 1,118; ansic: 215; makefile: 44; sh: 30; perl: 5
file content (46 lines) | stat: -rw-r--r-- 1,252 bytes parent folder | download | duplicates (2)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# Copyright 2016 Ghislain Antony Vaillant <ghisvail@gmail.com>
#
# This file is part of the autopkgtest testsuite for the libjsoncpp
# source package.

set -e

# Presence of $AUTOPKGTEST_TMP implies that someone will handle cleanup for us, so we
# can avoid duplicating the effort (signal handling, etc.) here.
if [ -z "$AUTOPKGTEST_TMP" ]
then
        echo "Required envvar \"$AUTOPKGTEST_TMP\"is not set" >&2
        exit 1
fi

# Copy testsuite source code.
cp -a ./src/test_lib_json/* "$AUTOPKGTEST_TMP"
cd "$AUTOPKGTEST_TMP"

if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
    cat <<EOF > "$AUTOPKGTEST_TMP/toolchain.cmake"
set(CMAKE_C_COMPILER $DEB_HOST_GNU_TYPE-gcc)
set(CMAKE_CXX_COMPILER $DEB_HOST_GNU_TYPE-g++)
set(PKG_CONFIG_EXECUTABLE $DEB_HOST_GNU_TYPE-pkg-config)
EOF
    CCFILE=-DCMAKE_TOOLCHAIN_FILE="$AUTOPKGTEST_TMP/toolchain.cmake"
else
    CCFILE=
fi

cat <<EOF > CMakeLists.txt
cmake_minimum_required(VERSION 3.18)
project(jsoncpp_test)

find_package(jsoncpp REQUIRED)
add_executable(jsoncpp_test main.cpp jsontest.cpp jsontest.h fuzz.cpp fuzz.h)
target_link_libraries(jsoncpp_test PRIVATE JsonCpp::JsonCpp)

EOF

# Configure, build and execute.
mkdir build && cd build
cmake $CCFILE ..
make VERBOSE=1 -j$(nproc)
./jsoncpp_test