smc-tools/tests/sanity/test-smc-tools-help.sh
Ping Fang c46f31a62b Initial commit to enable RHEL-9 gating for smc-tools
Resolves: rhbz#1972137

Signed-off-by: Ping Fang <pifang@redhat.com>
2021-06-15 18:36:12 +08:00

44 lines
747 B
Bash

#!/usr/bin/env sh
#
# smc-tools gating
#
# verify that LD_PRELOAD works
#
TESTS+=(test_smc_tools_ld_preload)
DESCRIPTION_test_smc_tools_ld_preload=(
"Verify that smc-tools's libsmc-preload.so can be LD_PRELOAD-ed."
)
function test_smc_tools_ld_preload()
{
local stdout_log="$1"
local stderr_log="$2"
shift 2
echo > $stdout_log
echo > $stderr_log
echo "# Calling LD_PRELOAD=\"$PLD_LD\" ping -4 google.com -c 1" \
>> $stdout_log
LD_PRELOAD="$PLD_LD" ping -4 google.com -c 1 >> $stdout_log 2>> $stderr_log
if test $? -gt 0
then
echo
echo "ERROR: Failed with non-zero return code." >&2
echo "STDOUT {"
cat $stdout_log
echo "}"
echo "STDERR {"
cat $stderr_log
echo "}"
return 1
fi
}