diff options
author | Micael Karlberg <[email protected]> | 2011-11-15 12:10:42 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2011-11-15 12:10:42 +0100 |
commit | ba8a4e80193d3b1e20b5d43f6176ed439ad1c4ae (patch) | |
tree | 9b6a70d0cf7afae5b5668930f32bc1877133ba6a /lib | |
parent | 451f76fca7a777ea1ffeb4da84bbb397a9743174 (diff) | |
parent | e95b8b3fa7f9afac4c91eb41017ef094add43124 (diff) | |
download | otp-ba8a4e80193d3b1e20b5d43f6176ed439ad1c4ae.tar.gz otp-ba8a4e80193d3b1e20b5d43f6176ed439ad1c4ae.tar.bz2 otp-ba8a4e80193d3b1e20b5d43f6176ed439ad1c4ae.zip |
Merge branch 'master' of super:otp
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kernel/test/inet_res_SUITE.erl | 7 | ||||
-rwxr-xr-x | lib/kernel/test/inet_res_SUITE_data/run-named | 33 |
2 files changed, 27 insertions, 13 deletions
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..." |