31 lines
541 B
Bash
Executable File
31 lines
541 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
set -x
|
|
|
|
TEST_SOURCE=mtest
|
|
|
|
C_TEST_TARGET="${TEST_SOURCE}.c"
|
|
|
|
C_BINARY="${TEST_SOURCE}-c"
|
|
|
|
CFLAGS="$(rpm --eval '%{build_cflags}')"
|
|
|
|
LDFLAGS="$(rpm --eval '%{build_ldflags}')"
|
|
|
|
LIBCFLAGS="$(pkg-config lmdb --libs --cflags)"
|
|
|
|
# build target using distribution-specific flags
|
|
gcc -std=c11 $CFLAGS $LDFLAGS -o $C_BINARY $C_TEST_TARGET $LIBCFLAGS
|
|
|
|
# test that target exists
|
|
test -f ./$C_BINARY
|
|
|
|
# test that target is executable
|
|
test -x ./$C_BINARY
|
|
|
|
mkdir testdb
|
|
# test that target runs successfully
|
|
./$C_BINARY
|
|
|
|
rm -rf testdb
|