Skip to content

Commit

Permalink
test: Include ipc_sock.test in the libqb-tests rpm (#463)
Browse files Browse the repository at this point in the history
...but don't run it unless we are root
  • Loading branch information
chrissie-c authored Mar 23, 2022
1 parent ccdaada commit 758044b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
11 changes: 7 additions & 4 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,12 @@ endif

bench_log_SOURCES = bench-log.c
bench_log_LDADD = $(top_builddir)/lib/libqb.la
libdir= $(TESTDIR)

lib_LTLIBRARIES = libstat_wrapper.la
if HAVE_CHECK
libstat_wrapper_la_SOURCES = libstat_wrapper.c
libstat_wrapper_la_LIBADD = -ldl
libdir= $(TESTDIR)

if HAVE_CHECK
EXTRA_DIST += start.test resources.test ipc_sock.test
EXTRA_DIST += blackbox-segfault.sh

Expand All @@ -128,11 +127,12 @@ TESTS_ENVIRONMENT = export PATH=.:../tools:$$PATH;

resources.log: rb.log log.log ipc.log

check_LTLIBRARIES =
check_PROGRAMS = array.test ipc.test list.test log.test loop.test \
map.test rb.test util.test tlist.test \
crash_test_dummy file_change_bytes
dist_check_SCRIPTS = start.test resources.test blackbox-segfault.sh ipc_sock.test
#lib_LTLIBRARIES = libstat_wrapper.la
check_LTLIBRARIES =

if HAVE_SLOW_TESTS
TESTS += util.test
Expand All @@ -143,6 +143,9 @@ if INSTALL_TESTS
testsuitedir = $(TESTDIR)
testsuite_PROGRAMS = $(check_PROGRAMS)
testsuite_SCRIPTS = $(dist_check_SCRIPTS) test.conf
lib_LTLIBRARIES = libstat_wrapper.la
else
noinst_LTLIBRARIES = libstat_wrapper.la
endif

file_change_bytes_SOURCES = file_change_bytes.c
Expand Down
6 changes: 4 additions & 2 deletions tests/ipc_sock.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
# 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
# that might be running on this system.
#
if [ "$(uname -s)" = "Linux" ]
# This creates sockets in /var/run so needs to be root
#
if [ "$(uname -s)" = "Linux" -a "$UID" = "0" ]
then
if [ -f "$(pwd)/.libs/libstat_wrapper.so" ]
then
Expand Down
2 changes: 1 addition & 1 deletion tests/resources.test
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ EXPECTED_DLOCK=6
EXPECTED_LEFTOVER=2

# Linux also runs filesystem socket tests
if [ "$(uname -s)" = "Linux" ]
if [ "$(uname -s)" = "Linux" -a "$UID" = "0" ]
then
EXPECTED_DLOCK=12
EXPECTED_LEFTOVER=4
Expand Down

0 comments on commit 758044b

Please sign in to comment.