Skip to content

Commit

Permalink
tests: Attempt to fix make distcheck
Browse files Browse the repository at this point in the history
Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
  • Loading branch information
chrissie-c committed Mar 19, 2018
1 parent 67e739e commit 85f7479
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Makefile.am
Expand Up @@ -37,6 +37,10 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure depcomp \

ACLOCAL_AMFLAGS = -I m4

DISTCHECK_CONFIGURE_FLAGS = --with-socket-dir=/tmp/libqb-$(VERSION)-$(shell echo $$$$)

export SOCKETDIR

dist_doc_DATA = COPYING INSTALL README.markdown

SUBDIRS = include lib docs tools tests examples
Expand Down
7 changes: 5 additions & 2 deletions tests/check_ipc.c
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/resources.test
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
1 change: 1 addition & 0 deletions tests/start.test
Expand Up @@ -8,3 +8,4 @@
#
NAME="$$-`date +%N`"
echo -n "$NAME" > ipc-test-name
mkdir -p $SOCKETDIR

0 comments on commit 85f7479

Please sign in to comment.