From: Thierry Parmentelat Date: Tue, 8 Apr 2008 17:24:18 +0000 (+0000) Subject: remove (some) dependencies on open fd's - give up using tee - make sure that runtest... X-Git-Tag: tests-4.2-4~71 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=e9cf9194773f6a09f8f9dbbf402464cbd73edeb5;p=tests.git remove (some) dependencies on open fd's - give up using tee - make sure that runtest returns --- diff --git a/system/TestPlc.py b/system/TestPlc.py index 195aa7d..71ff989 100644 --- a/system/TestPlc.py +++ b/system/TestPlc.py @@ -155,7 +155,7 @@ class TestPlc: # xxx quick n dirty def run_in_guest_piped (self,local,remote): - return utils.system(local+" | "+self.test_ssh.actual_command(self.host_to_guest(remote))) + return utils.system(local+" | "+self.test_ssh.actual_command(self.host_to_guest(remote),keep_stdin=True)) def auth_root (self): return {'Username':self.plc_spec['PLC_ROOT_USER'], diff --git a/system/TestSsh.py b/system/TestSsh.py index 9ddb52e..d392659 100644 --- a/system/TestSsh.py +++ b/system/TestSsh.py @@ -69,10 +69,12 @@ class TestSsh: return "%s@%s"%(self.username,self.hostname) # command gets run on the right box - def actual_command (self, command): + def actual_command (self, command,keep_stdin=False): if self.is_local(): return command ssh_command = "ssh " + if not keep_stdin: + ssh_command += "-n " ssh_command += TestSsh.std_options ssh_command += self.key_part() ssh_command += "%s %s" %(self.hostname_part(),TestSsh.backslash_shell_specials(command)) diff --git a/system/runtest b/system/runtest index 6c46786..13f5205 100755 --- a/system/runtest +++ b/system/runtest @@ -5,7 +5,8 @@ logfile=logs/runtest-$(date +%H-%M).log # figure if TestMain succeeds, as the retcod gets lost in the pipe rm -f logs/success -(python -u TestMain.py "$@" && touch logs/success) | tee $logfile +python -u TestMain.py "$@" &> $logfile && touch logs/success +cat $logfile if [ -f logs/success ] ; then exit 0 diff --git a/system/template-qemu/qemu-kill-node b/system/template-qemu/qemu-kill-node index 5d591f9..3b9626b 100755 --- a/system/template-qemu/qemu-kill-node +++ b/system/template-qemu/qemu-kill-node @@ -2,6 +2,7 @@ # $Id$ COMMAND=$(basename $0) cd $(dirname $0) +THISNODE=$(basename $(pwd -P) | sed -e s,qemu-,,) cd .. # somehow qemu-system-x86_64 show up in pgrep as qemu-system-x86 @@ -12,6 +13,8 @@ function usage () { echo " lists current qemu processes" echo "usage: $COMMAND hostname" echo " kill qemu instance for that node" + echo "usage: $COMMAND this" + echo " kill qemu instance that was started in this directory" echo "usage: $COMMAND" echo " kill all instances of [$COMMANDS_TO_KILL]" exit 1 @@ -21,6 +24,7 @@ function list_pids () { hostnames="$@" if [[ -n "$hostnames" ]] ; then for hostname in $hostnames; do + [ $hostname == this ] && hostname=$THISNODE nodedir=qemu-$hostname cat $nodedir/qemu.pid 2> /dev/null done @@ -47,6 +51,7 @@ function kill_pids () { hostnames="$@" if [[ -n "$hostnames" ]] ; then for hostname in $hostnames; do + [ $hostname == this ] && hostname=$THISNODE nodedir=qemu-$hostname kill_from_file $nodedir/qemu.pid done @@ -77,7 +82,6 @@ function main () { while getopts "lk" opt; do case $opt in l) OPT_LIST=true ;; - k) OPT_GREP=true ;; *) usage ;; esac done diff --git a/system/template-qemu/qemu-start-node b/system/template-qemu/qemu-start-node index a6610c0..0b4eab4 100755 --- a/system/template-qemu/qemu-start-node +++ b/system/template-qemu/qemu-start-node @@ -1,6 +1,7 @@ #!/bin/bash # cd in this command's directory +COMMAND=$(basename $0) cd $(dirname $0) ########## globals @@ -28,6 +29,9 @@ case $archs in x86_64+x86_64) QEMU=qemu-system-x86_64;; esac +echo "Running $COMMAND in $(pwd)" +echo "Starting at $(date)" + #Creating new HDA if needed only #using qcow2 disk image format which is essential to support VM snapshots if [ -f $HDA ] ; then