fuel-plugin-ovs/ovs_build/dpdk_16.04/debian/tests/test-linkage

42 lines
1.3 KiB
Bash

#!/bin/bash
set -eu
basedir=$(dirname "$0")
. "${basedir}"/check-dpdk-supported-arch.sh
cat > testlinkage.c << EOF
#include <stdio.h>
#include "dpdk/rte_common.h"
int main()
{
printf("Hello rte_exit %p\n", rte_exit);
return 0;
}
EOF
# with broken linkage this will fail with undefined symbols
printf "\n\nChecking compile with link against DPDK\n"
gcc -v testlinkage.c -o testlinkage.bin -Wall -Werror -ldpdk
echo "OK"
printf "\n\nChecking for expected libraries\n"
# The binary should inherit dependencies from the .so
# check one of the libs that came in due to features
ldd testlinkage.bin | grep libpcap
# check one of the libs that came in due to basic dpdp linuxapp config
ldd testlinkage.bin | grep libm
# one that it uses implicitly
ldd testlinkage.bin | grep libpthread
echo "OK"
printf "\n\nChecking test execution\n"
# It doesn't do much, but it should work - so calling it is a minor extra test.
# It is known to fail without SSE3 in e.g. some adt environments, in that
# case check at least that we get the correct error message (this will trigger
# a test fail if it neither finds the success nor the expected error message)
(./testlinkage.bin 2>&1 || /bin/true ) | \
grep -E 'ERROR: This system does not support "SSSE3".|Hello rte_exit 0x'
echo "OK"