Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix distcheck #303

Merged
merged 1 commit into from
Mar 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took me some moments to realize the issue -- there's an ambiguity
across systems as to whether -- should be considered as an argument
to -i option or whether this option should be considered orphan (not
accompanied with any argument as it's optional, anyway), followed with
delimiter indicating the end of options:
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html#tag_12_02

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a better answer to this other than just removing the junk files? That chunk of shell code is extremely opaque (I remember commenting on that at the time.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me include the fix for that into #288 I am going to overhaul a bit
(incl. a solution for backdated OpenBSD per #299). We need to get
rid of sed -i as it's not POSIX :-/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, don't get me started ... spent way too much time yesterday trying to come up with a portable function to replace sed -i and gave up -- it's not impossible, but far uglier than this simple workaround:

sed ... "$INFILE" > "${INFILE}.$$"
mv -- "${INFILE}.$$" "$INFILE"

It obviously only works on one input file at a time. If you need to preserve permissions, you have to do this first:

cp -p "$INFILE" > "${INFILE}.$$"

(A portable way to preserve permissions without copying the entire file is also too ugly for words.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you had suspicion what triggered this response of mine, you were right,
I came by that pacemaker commit, thanks for insights.


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