libqb/tests/ipc_sock.test
Chrissie Caulfield 44a4cb2989
tests: Make ipc test more portable (#466)
fix a couple of errors reported by covscan

1. /usr/lib64/libqb/tests/resources.test:8:34: warning[SC2039]: In POSIX sh, UID is undefined.
1. /usr/lib64/libqb/tests/resources.test:8:30: warning[SC2166]: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
1. /usr/lib64/libqb/tests/ipc_sock.test:10:34: warning[SC2039]: In POSIX sh, UID is undefined.
1. /usr/lib64/libqb/tests/ipc_sock.test:10:30: warning[SC2166]: Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
2022-06-08 09:51:49 +01:00

22 lines
535 B
Bash
Executable File

#!/bin/sh
#
# Run the IPC tests under the stat wrapper,
# this simulates /etc/libqb/use-filesystem-sockets existing
# so we can test both options without breaking other things
# that might be running on this system.
#
# This creates sockets in /var/run so needs to be root
#
if [ "$(uname -s)" = "Linux" ] && [ "`id -u`" = "0" ]
then
if [ -f "$(pwd)/.libs/libstat_wrapper.so" ]
then
export "LD_PRELOAD=$(pwd)/.libs/libstat_wrapper.so"
else
export "LD_PRELOAD=$(pwd)/libstat_wrapper.so"
fi
./ipc.test
else
exit 0
fi