remove (some) dependencies on open fd's - give up using tee - make sure that runtest...
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 8 Apr 2008 17:24:18 +0000 (17:24 +0000)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 8 Apr 2008 17:24:18 +0000 (17:24 +0000)
system/TestPlc.py
system/TestSsh.py
system/runtest
system/template-qemu/qemu-kill-node
system/template-qemu/qemu-start-node

index 195aa7d..71ff989 100644 (file)
@@ -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'],
index 9ddb52e..d392659 100644 (file)
@@ -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))
index 6c46786..13f5205 100755 (executable)
@@ -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
index 5d591f9..3b9626b 100755 (executable)
@@ -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
index a6610c0..0b4eab4 100755 (executable)
@@ -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