Skip to content

Commit

Permalink
test: Fix 'make distcheck' (#303)
Browse files Browse the repository at this point in the history
Miscellaneous fixes and cleanups to get 'make distcheck' to work on most
platforms.

Signed-off-by: Christine Caulfield <[email protected]>
  • Loading branch information
chrissie-c committed Mar 27, 2018
1 parent 153956c commit 3730644
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 5 deletions.
3 changes: 3 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure depcomp \

ACLOCAL_AMFLAGS = -I m4

# For test suite
export SOCKETDIR

dist_doc_DATA = COPYING INSTALL README.markdown

SUBDIRS = include lib docs tools tests examples
Expand Down
2 changes: 2 additions & 0 deletions lib/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ install-exec-hook: qblog_script.ld
sed -i -- "s/libqb.so.<digit>/$${so_ver}/" \
"$(DESTDIR)$(libdir)/libqb.so-t" "$(DESTDIR)$(pkgconfigexecdir)/libqb.pc"
mv -f "$(DESTDIR)$(libdir)/libqb.so-t" "$(DESTDIR)$(libdir)/libqb.so"
rm -f "$(DESTDIR)$(pkgconfigexecdir)/libqb.pc--"
rm -f "$(DESTDIR)$(libdir)/libqb.so-t--"
endif

if HAVE_SPLINT
Expand Down
3 changes: 2 additions & 1 deletion tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ check: check-headers
.PHONY: check-headers
check-headers: $(auto_c_files:.c=.o)

distclean-compile:
distclean-local:
rm -rf auto_*.c
rm -rf .deps

if HAVE_DICT_WORDS
if HAVE_SLOW_TESTS
Expand Down
7 changes: 5 additions & 2 deletions tests/check_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "os_base.h"
#include <sys/wait.h>
#include <sys/un.h>
#include <signal.h>

#include "check_common.h"
Expand Down Expand Up @@ -132,7 +133,6 @@ set_ipc_name(const char *prefix)
if (f) {
fgets(process_name, sizeof(process_name), f);
fclose(f);
fprintf(stderr, "CC: using stored SHM name %s\n", process_name);
snprintf(ipc_name, sizeof(ipc_name), "%s%s", prefix, process_name);
} else {
/* This is the old code, use only as a fallback */
Expand All @@ -145,7 +145,6 @@ set_ipc_name(const char *prefix)

snprintf(ipc_name, sizeof(ipc_name), "%s%s%lX%.4x", prefix, t_sec,
(unsigned long)getpid(), (unsigned) ((long) time(NULL) % (0x10000)));
fprintf(stderr, "CC: using calculated SHM name %s\n", ipc_name);
}
}

Expand Down Expand Up @@ -1436,11 +1435,15 @@ END_TEST
START_TEST(test_ipcc_truncate_when_unlink_fails_shm)
{
char sock_file[PATH_MAX];
struct sockaddr_un socka;

qb_enter();
ipc_type = QB_IPC_SHM;
set_ipc_name(__func__);

sprintf(sock_file, "%s/%s", SOCKETDIR, ipc_name);
sock_file[sizeof(socka.sun_path)] = '\0';

/* If there's an old socket left from a previous run this test will fail
unexpectedly, so try to remove it first */
unlink(sock_file);
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ distclean maintainer-clean:
# includes, which are swiped when processing one subdir and then
# missing, as a hard error, for the other)
@$(MAKE) -C log_external $@
@mkdir .deps
@mkdir -p .deps
@touch .deps/log_client.Po .deps/log_interlib.Plo .deps/log_interlib_client.Po
@$(MAKE) -C log_internal $@
@$(MAKE) -f Makefile $@ SUBDIRS=
Expand Down
5 changes: 4 additions & 1 deletion tests/resources.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
RETURN=0

IPC_NAME=`cat ipc-test-name 2>/dev/null`
for d in /dev/shm /var/run; do
for d in /dev/shm /var/run $SOCKETDIR; do
leftovers=$(find $d -name qb-test*${IPC_NAME}* -size +0c 2>/dev/null | wc -l)
if [ "${leftovers}" -gt 0 ]; then
echo
Expand Down Expand Up @@ -30,4 +30,7 @@ if [ $? -eq 0 ]; then
RETURN=1
fi

# Keep it tidy - distcheck checks we have not left a mess
rm -f ipc-test-name
rm -f crash_test_dummy.core
exit $RETURN
1 change: 1 addition & 0 deletions tests/start.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
#
NAME="$$-`date +%N`"
echo -n "$NAME" > ipc-test-name
mkdir -p $SOCKETDIR

0 comments on commit 3730644

Please sign in to comment.