From 6481e12595de1b95cf9f75ddad2ae9e7c27fd150 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Wed, 3 Jan 2018 15:11:48 +0000 Subject: [PATCH] Testsuite: Better platform portability by searching for Postgres server binaries --- .gitignore | 2 +- test/.gitignore | 2 +- test/Makefile.in | 41 +++++++++---------------------- test/bin/.gitignore | 2 ++ test/bin/locate.sh | 24 ++++++++++++++++++ test/scripts/2620-Postgresql/2620 | 4 +-- 6 files changed, 41 insertions(+), 34 deletions(-) create mode 100644 test/bin/.gitignore create mode 100755 test/bin/locate.sh diff --git a/.gitignore b/.gitignore index 63c37a289..8d30d0cda 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -exim-packaging-* +exim-* *~ *.bak .*.swp diff --git a/test/.gitignore b/test/.gitignore index e93f253ef..1752948fd 100644 --- a/test/.gitignore +++ b/test/.gitignore @@ -1,6 +1,6 @@ autom4te.cache/ aux-var/ -bin/ +bin.sys/ config.log config.status dnszones/ diff --git a/test/Makefile.in b/test/Makefile.in index 3d7810c8b..9d145ece3 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -16,15 +16,18 @@ SRC = @srcdir@/src ############################################################################## -# List of targets - -all: makebin bin/cf bin/client $(CLIENT_SSL) $(CLIENT_GNUTLS) \ +BINARIES = bin/cf bin/client $(CLIENT_SSL) $(CLIENT_GNUTLS) \ bin/checkaccess bin/fakens bin/fd bin/iefbr14 $(LOADED) \ bin/mtpscript bin/server bin/showids -# Ensure the bin directory exists +# List of targets + +all: binaries sysbinaries + +binaries: $(BINARIES) -makebin:; @if [ ! -e bin ] ; then mkdir bin 2>/dev/null; echo ""; fi +sysbinaries: FRC + bin/locate.sh initdb postgres # Compile and link the programs: # @@ -43,64 +46,42 @@ makebin:; @if [ ! -e bin ] ; then mkdir bin 2>/dev/null; echo ""; fi bin/cf: $(SRC)/cf.c Makefile $(CC) $(CFLAGS) $(LDFLAGS) -o bin/cf $(SRC)/cf.c - @echo ">>> bin/cf command build" - @echo " " bin/client: $(SRC)/client.c Makefile $(CC) $(CFLAGS) $(LDFLAGS) -o bin/client $(SRC)/client.c $(LIBS) - @echo ">>> bin/client command built" - @echo " " bin/client-gnutls: $(SRC)/client.c Makefile $(CC) $(CFLAGS) -DHAVE_GNUTLS $(LDFLAGS) -o bin/client-gnutls $(SRC)/client.c -lgnutls -lgcrypt $(LIBS) - @echo ">>> bin/client-gnutls command built" - @echo " " bin/client-ssl: $(SRC)/client.c Makefile $(CC) $(CFLAGS) -DHAVE_OPENSSL $(LDFLAGS) -o bin/client-ssl $(SRC)/client.c -lssl -lcrypto $(LIBS) - @echo ">>> bin/client-ssl command built" - @echo " " bin/checkaccess:$(SRC)/checkaccess.c Makefile $(CC) $(CFLAGS) -DNO_TLS $(LDFLAGS) -o bin/checkaccess $(SRC)/checkaccess.c - @echo ">>> bin/checkaccess command built" - @echo " " bin/fakens: $(SRC)/fakens.c Makefile $(CC) $(CFLAGS) $(LDFLAGS) -o bin/fakens $(SRC)/fakens.c $(LIBS) - @echo ">>> bin/fakens command built" - @echo " " bin/fd: $(SRC)/fd.c Makefile $(CC) $(CFLAGS) $(LDFLAGS) -o bin/fd $(SRC)/fd.c - @echo ">>> bin/fd command built" - @echo " " bin/iefbr14: $(SRC)/iefbr14.c Makefile $(CC) $(CFLAGS) $(LDFLAGS) -o bin/iefbr14 $(SRC)/iefbr14.c - @echo ">>> bin/iefbr14 command built" - @echo " " bin/loaded: $(SRC)/loaded.c Makefile $(CC) $(CFLAGS) $(LDFLAGS) $(LOADED_OPT) -o bin/loaded $(SRC)/loaded.c - @echo ">>> bin/loaded command built" - @echo " " bin/mtpscript: $(SRC)/mtpscript.c Makefile $(CC) $(CFLAGS) $(LDFLAGS) $(mtpscript_OPT) -o bin/mtpscript $(SRC)/mtpscript.c - @echo ">>> bin/mtpscript command built" - @echo " " bin/server: $(SRC)/server.c Makefile $(CC) $(CFLAGS) $(LDFLAGS) -o bin/server $(SRC)/server.c $(LIBS) - @echo ">>> bin/server command built" - @echo " " bin/showids: $(SRC)/showids.c Makefile $(CC) $(CFLAGS) $(LDFLAGS) -o bin/showids $(SRC)/showids.c - @echo ">>> bin/showids command built" - @echo " " -clean:; rm -rf bin/* +clean:; rm -rf $(BINARIES) bin.sys + +FRC: # End diff --git a/test/bin/.gitignore b/test/bin/.gitignore new file mode 100644 index 000000000..df0219e79 --- /dev/null +++ b/test/bin/.gitignore @@ -0,0 +1,2 @@ +* +!locate.sh diff --git a/test/bin/locate.sh b/test/bin/locate.sh new file mode 100755 index 000000000..dad0bd49f --- /dev/null +++ b/test/bin/locate.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +[ -e bin.sys ] || mkdir bin.sys +cd bin.sys + +while read d +do + if [ -x $d/$1 ] + then + while [ $# -gt 0 ] + do + rm -f ./$1 + ln -s $d/$1 . + shift + done + fi +done <<-HERE + /bin + /usr/bin + /usr/local/bin + /usr/lib/postgresql/10/bin + /usr/lib/postgresql/9/bin +HERE + diff --git a/test/scripts/2620-Postgresql/2620 b/test/scripts/2620-Postgresql/2620 index ae5dca130..d0dd00190 100644 --- a/test/scripts/2620-Postgresql/2620 +++ b/test/scripts/2620-Postgresql/2620 @@ -3,11 +3,11 @@ # first, populate a DB to test against sudo rm -fr DIR/pgsql perl -system 'initdb -D DIR/pgsql/data'; +system 'DIR/bin.sys/initdb -D DIR/pgsql/data'; **** sudo rm test-stdout background -/usr/bin/postgres -D DIR/pgsql/data -p PORT_N -k DIR/pgsql +DIR/bin.sys/postgres -D DIR/pgsql/data -p PORT_N -k DIR/pgsql **** sleep 1 perl -- 2.25.1