diff options
-rw-r--r-- | Makefile.in | 4 | ||||
-rw-r--r-- | lib/kernel/test/inet_res_SUITE.erl | 7 | ||||
-rwxr-xr-x | lib/kernel/test/inet_res_SUITE_data/run-named | 33 | ||||
-rw-r--r-- | make/target.mk | 36 | ||||
-rwxr-xr-x | otp_build | 12 |
5 files changed, 66 insertions, 26 deletions
diff --git a/Makefile.in b/Makefile.in index 9ac516ca33..902c21fb52 100644 --- a/Makefile.in +++ b/Makefile.in @@ -158,7 +158,9 @@ ERLANG_LIBDIR = $(DESTDIR)$(ERLANG_INST_LIBDIR) MAKE = @MAKE_PROG@ # This should be set to the target "arch-vendor-os" -export TARGET = @TARGET@ +TARGET := @TARGET@ +include $(ERL_TOP)/make/target.mk +export TARGET BOOTSTRAP_ONLY = @BOOTSTRAP_ONLY@ diff --git a/lib/kernel/test/inet_res_SUITE.erl b/lib/kernel/test/inet_res_SUITE.erl index 8a3d220e46..15b0ed5718 100644 --- a/lib/kernel/test/inet_res_SUITE.erl +++ b/lib/kernel/test/inet_res_SUITE.erl @@ -136,21 +136,22 @@ ns_init(ZoneDir, PrivDir, DataDir) -> atom_to_list(ZoneDir)]}, stderr_to_stdout, eof]), - ns_start(ZoneDir, NS, P); + ns_start(ZoneDir, PrivDir, NS, P); _ -> throw("Only run on Unix") end. -ns_start(ZoneDir, NS, P) -> +ns_start(ZoneDir, PrivDir, NS, P) -> case ns_collect(P) of eof -> erlang:error(eof); "Running: "++_ -> {ZoneDir,NS,P}; "Error: "++Error -> + ns_printlog(filename:join([PrivDir,ZoneDir,"named.log"])), throw(Error); _ -> - ns_start(ZoneDir, NS, P) + ns_start(ZoneDir, PrivDir, NS, P) end. ns_end(undefined, _PrivDir) -> undefined; diff --git a/lib/kernel/test/inet_res_SUITE_data/run-named b/lib/kernel/test/inet_res_SUITE_data/run-named index 7caa3756ef..39e7b1d5aa 100755 --- a/lib/kernel/test/inet_res_SUITE_data/run-named +++ b/lib/kernel/test/inet_res_SUITE_data/run-named @@ -47,6 +47,7 @@ CONF_FILE=named.conf INC_FILE=named_inc.conf PID_FILE=named.pid LOG_FILE=named.log +EXIT_FILE=named.exit error () { r=$? @@ -71,10 +72,14 @@ test -d "$SRCDIR" || \ test -f "$SRCDIR/$INC_FILE" || \ error "Missing file: $SRCDIR/$INC_FILE !" -# Locate named and check version +# Locate named and check version. +# The bind-named name is used for tricking Apparmor and such +# by copying/hardlinking the real named to that name. NAMED=named -for n in /usr/sbin/named /usr/sbin/in.named; do - test -x "$n" && NAMED="$n" +for n in /usr/local/bin/bind-named /usr/local/bin/named \ + /usr/sbin/bind-named /usr/sbin/named /usr/sbin/in.named +do + test -x "$n" && NAMED="$n" && break done NAMED_VER="`"$NAMED" -v 2>&1`" || \ error "Name server not found!" @@ -145,19 +150,27 @@ cat >>"$CONF_FILE" <<-CONF_FILE ( cd "$SRCDIR" && ls -1 ) | while read f; do cp -fp "$SRCDIR/$f" . done +rm -f "$EXIT_FILE" # Start nameserver echo "Cwd: `pwd`" echo "Nameserver: $NAMED_VER" echo "Port: $2" echo "ZoneDir: $3" -$NAMED $NAMED_FG -c "$CONF_FILE" >"$LOG_FILE" 2>&1 </dev/null & -NAMED=$! -trap "kill -TERM $NAMED >/dev/null 2>&1; wait $NAMED >/dev/null 2>&1" \ +echo "Command: $NAMED $NAMED_FG -c $CONF_FILE" +($NAMED $NAMED_FG -c "$CONF_FILE" >"$LOG_FILE" 2>&1 </dev/null; \ + echo "$?" >"$EXIT_FILE")& +NAMED_PID=$! +trap "kill -TERM $NAMED_PID >/dev/null 2>&1; wait $NAMED_PID >/dev/null 2>&1" \ 0 1 2 3 15 sleep 2 # Give name server time to load its zone files -echo "Running: Enter \`\`quit'' to terminate nameserver[$NAMED]..." -while read LINE; do - test :"$LINE" = :'quit' && break -done +if [ -f "$EXIT_FILE" ]; then + ERROR="`cat "$EXIT_FILE"`" + (exit "$ERROR")& error "$NAMED returned $ERROR on start" +else + echo "Running: Enter \`\`quit'' to terminate nameserver[$NAMED_PID]..." + while read LINE; do + test :"$LINE" = :'quit' && break + done +fi echo "Closing: Terminating nameserver..." diff --git a/make/target.mk b/make/target.mk index 06e895df90..a6493e09a5 100644 --- a/make/target.mk +++ b/make/target.mk @@ -1,3 +1,24 @@ +# +# %CopyrightBegin% +# +# Copyright Ericsson AB 1998-2011. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% + +# Ensure that the make variable TARGET is set +# + ifeq ($(OVERRIDE_TARGET),) ifeq ($(TARGET),) @@ -31,3 +52,18 @@ endif endif +ifneq ($(TARGET),) +ifneq ($(TARGET),win32) +ifneq ($(TARGET),vxworks) +override TARGET := $(shell $(ERL_TOP)/erts/autoconf/config.sub $(TARGET)) +else +endif +else +endif +else +endif + +ifeq ($(TARGET),) +$(error Neither TARGET nor OVERRIDE_TARGET can be determined!) +else +endif @@ -324,16 +324,6 @@ do_autoconf () fi } -mk_targetdir () -{ - if [ ! -d $ERL_TOP/$TARGET ]; then - echo "creating $ERL_TOP/$TARGET" - mkdir $ERL_TOP/$TARGET - else - echo "existing $ERL_TOP/$TARGET is used" - fi -} - run_configure () { cdir="$ERL_TOP" @@ -499,7 +489,6 @@ maybe_copy_static_cache () do_configure () { setup_make - mk_targetdir # Get `erl_build_tool_vars' . "$ERL_TOP/erl-build-tool-vars.sh" || exit 1 @@ -513,7 +502,6 @@ do_configure () hide_vars OVERRIDE_TARGET TARGET TARGET=$BUILDSYS export TARGET - mk_targetdir set_config_flags "$@" run_configure "$@" restore_vars OVERRIDE_TARGET TARGET;; |