libseccomp/tests/devel-usability/runtest.sh
Zoltan Fridrich 81d3550e24 Fix devel-usability test
- turn off --as-needed linker flag so the libsecomp library does not get
  flagged as not needed (in which case the linking fails)
resolves: rhbz#2019887
2021-11-09 16:26:56 +01:00

23 lines
520 B
Bash
Executable File

#!/bin/bash
set -e
set -x
TEST_SOURCE=test.c
TEST_TARGET="${TEST_SOURCE/\.c/}"
CXXFLAGS="$(rpm --eval '%{build_cxxflags}')"
LDFLAGS="$(rpm --eval '%{build_ldflags}') -Wl,--no-as-needed"
PKGFLAGS="$(pkg-config libseccomp --cflags --libs)"
# build target using distribution-specific flags
gcc -Werror $CXXFLAGS $LDFLAGS $PKGFLAGS -o $TEST_TARGET $TEST_SOURCE
# test that target exists
test -f ./$TEST_TARGET
# test that target is executable
test -x ./$TEST_TARGET
# test that target runs successfully
./$TEST_TARGET