[pkg-kolab] r1455 - pkg-kolab_testsuite

Mathieu Parent sathieu at alioth.debian.org
Sun Nov 29 22:39:22 UTC 2009


Author: sathieu
Date: 2009-11-29 22:39:22 +0000 (Sun, 29 Nov 2009)
New Revision: 1455

Modified:
   pkg-kolab_testsuite/testsuite
Log:
- exit script on most errors
- some ASCII art ;)
- correct slave domain names

Modified: pkg-kolab_testsuite/testsuite
===================================================================
--- pkg-kolab_testsuite/testsuite	2009-11-29 14:53:46 UTC (rev 1454)
+++ pkg-kolab_testsuite/testsuite	2009-11-29 22:39:22 UTC (rev 1455)
@@ -144,9 +144,12 @@
 sub local_command
 {
     my $command = shift;
+    my $no_die_on_error = shift || 0;
+    
     local $SIG{CHLD} = 'DEFAULT';
     my $ret = system($command);
     print "\nReturn value: $ret\nCommand was: $command\n" if($ret);
+    die "Fatal error\n" if($ret != 0 and !$no_die_on_error);
     return $ret;
 }
 #-------------------------------------------------------
@@ -154,6 +157,8 @@
 {
     my $domip = shift;
     my $command = shift || undef;
+    my $no_die_on_error = shift || 0;
+    
     my $ret;
     if(defined($command)) {
         $ret = system('ssh',
@@ -167,6 +172,7 @@
             "root\@$domip");
     }
     print "\nReturn value: $ret\nRemote command was: $command\n" if($ret);
+    die "Fatal error\n" if($ret != 0 and !$no_die_on_error);
     return $ret;
 }
 
@@ -197,7 +203,7 @@
 {
     my $domid = shift;
     return $platform."_master" if $domid == 0;
-    return $platform."_test$domid";
+    return $platform."_slave$domid";
 }
 
 sub domain_ip
@@ -434,8 +440,8 @@
     print "* Preparing:\n";
     if(conf('virt_type') eq 'vbox') {
         #release
-        local_command("VBoxManage unregistervm '$domname' --delete");
-        local_command("VBoxManage closemedium disk '$storagepooldir/domains/$domname/disk.vmdk'");
+        local_command("VBoxManage unregistervm '$domname' --delete", 1);
+        local_command("VBoxManage closemedium disk '$storagepooldir/domains/$domname/disk.vmdk'", 1);
         local_command("sudo rm -f '$storagepooldir/domains/$domname/disk.vmdk'");
         #volume
         my $loopdev = `sudo losetup --find --show '$storagepooldir/domains/$domname/disk.img'`;
@@ -1001,7 +1007,10 @@
     #Main loop
     for(my $domid = 0; $domid<=conf('slave_count'); $domid++) {
         my $domname = domain_name($domid);
-        print "Action $action for domain $domname:\n";
+        print "\n";
+        print "/=======================================\n";
+        print "| Action $action for domain $domname:\n";
+        print "\=======================================\n";
         my $domip = domain_ip($domid, $domname);
         if ($action eq 'bootstrap') {
             #Cleaning:




More information about the pkg-kolab-devel mailing list