From 758044bed5f615c90818aa5431d00303288888e5 Mon Sep 17 00:00:00 2001 From: Chrissie Caulfield Date: Wed, 23 Mar 2022 09:54:07 +0000 Subject: [PATCH] test: Include ipc_sock.test in the libqb-tests rpm (#463) ...but don't run it unless we are root --- tests/Makefile.am | 11 +++++++---- tests/ipc_sock.test | 6 ++++-- tests/resources.test | 2 +- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 093bd1e5..91b582a4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -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 @@ -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 @@ -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 diff --git a/tests/ipc_sock.test b/tests/ipc_sock.test index 0bcebe25..5806c507 100755 --- a/tests/ipc_sock.test +++ b/tests/ipc_sock.test @@ -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 diff --git a/tests/resources.test b/tests/resources.test index d3f8e0f1..5398d15b 100755 --- a/tests/resources.test +++ b/tests/resources.test @@ -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