Re: [Xen-devel] [PATCH 23/27] ts-bench-hostcmp-host-reset: new script

2014-12-11 Thread Dario Faggioli
On Wed, 2014-12-10 at 19:12 +0100, Dario Faggioli wrote:
 From: Dario Faggioli raist...@linux.it
 
Somehow, this patch lacks a changelog! :-O

Sorry about this too, I'll write one for next version.

Regards,
Dario

 Signed-off-by: Dario Faggioli dario.faggi...@citrix.com
 Cc: Wei Liu wei.l...@citrix.com
 Cc: Ian Campbell ian.campb...@citrix.com
 Cc: Ian Jackson ian.jack...@eu.citrix.com
 ---
  Osstest/Debian.pm  |   32 +---
  Osstest/TestSupport.pm |   46 +-
  ts-bench-hostcmp-post  |   39 +++
  ts-xen-install |   38 ++
  4 files changed, 103 insertions(+), 52 deletions(-)
  create mode 100755 ts-bench-hostcmp-post
 
 diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
 index 418d9f2..447d2d2 100644
 --- a/Osstest/Debian.pm
 +++ b/Osstest/Debian.pm
 @@ -87,25 +87,27 @@ sub debian_boot_setup (;$) {
  my $kern= $bootloader-{GetBootKern}();
  logm(dom0 kernel is $kern);
  
 -system tar zvtf $distpath-{kern} boot/$kern;
 -$? and die $distpath-{kern} boot/$kern $?;
 -
 -my $kernver= $kern;
 -$kernver =~ s,^/?(?:boot/)?(?:vmlinu[xz]-)?,, or die $kernver ?;
 -my $kernpath= $kern;
 -$kernpath =~ s,^(?:boot/)?,/boot/,;
 -
 -target_cmd_root($ho,
 -update-initramfs -k $kernver -c ||.
 - update-initramfs -k $kernver -u,
 -200);
 +if (defined $distpath) {
 +system tar zvtf $distpath-{kern} boot/$kern;
 +$? and die $distpath-{kern} boot/$kern $?;
 +
 +my $kernver= $kern;
 +$kernver =~ s,^/?(?:boot/)?(?:vmlinu[xz]-)?,, or die $kernver ?;
 +my $kernpath= $kern;
 +$kernpath =~ s,^(?:boot/)?,/boot/,;
 +
 +target_cmd_root($ho,
 +update-initramfs -k $kernver -c ||.
 + update-initramfs -k $kernver -u,
 +200);
 +
 +store_runvar(target_var_prefix($ho).'xen_kernel_path',$kernpath);
 +store_runvar(target_var_prefix($ho).'xen_kernel_ver',$kernver);
 +}
  
  $bootloader-{PreFinalUpdate}();
  
  $bootloader-{UpdateConfig}($ho);
 -
 -store_runvar(target_var_prefix($ho).'xen_kernel_path',$kernpath);
 -store_runvar(target_var_prefix($ho).'xen_kernel_ver',$kernver);
  }
  
  sub bl_getmenu_open ($$$) {
 diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
 index 251668a..c967e4f 100644
 --- a/Osstest/TestSupport.pm
 +++ b/Osstest/TestSupport.pm
 @@ -99,7 +99,7 @@ BEGIN {
guest_vncsnapshot_begin guest_vncsnapshot_stash
 guest_check_remus_ok guest_editconfig
host_involves_pcipassthrough 
 host_get_pcipassthrough_devs
 -  toolstack guest_create
 +  toolstack guest_create host_bootxen_setup
  
await_webspace_fetch_byleaf create_webfile
file_link_contents get_timeout
 @@ -1012,6 +1012,50 @@ sub get_host_memory ($) {
  return $mem;
  }
  
 +#-- bootloader and booting --
 +#
 +sub host_bootxen_setup ($) {
 +my ($ho)= @_;
 +
 +my $xenhopt= conswitch=x watchdog;
 +
 +my $cons= get_host_property($ho, 'XenSerialConsole', 'com1');
 +
 +if ( $cons eq com1 ) {
 +$xenhopt .=  com1=$c{Baud},8n1 console=com1,vga gdb=com1;
 +} elsif ( $cons eq dtuart ) {
 +$xenhopt .=  console=dtuart;
 +my $dtuart= get_host_property($ho, 'XenDTUARTPath', undef);
 +$xenhopt .=  dtuart=$dtuart if $dtuart;
 +} else {
 +logm(No Xen console device defined for host);
 +}
 +if (toolstack()-{Dom0MemFixed}) {
 +$xenhopt .=  dom0_mem=512M,max:512M;
 +}
 +my $append= $r{xen_boot_append};
 +$xenhopt .=  $append if defined $append;
 +$append = get_host_property($ho, 'xen-commandline-append', undef);
 +$xenhopt .=  $append if defined $append;
 +
 +my @hooks;
 +
 +if (host_involves_pcipassthrough($ho)) {
 +push @hooks, {
 +EditBootOptions = sub {
 +my ($ho,$hopt,$kopt) = @_;
 +$$hopt .= ' iommu=on';
 +my $hide= ' xen-pciback.hide='. join '',map { ($_-{Bdf}) }
 +host_get_pcipassthrough_devs($ho);
 +logm(pci passthrough: hiding in dom0: $hide);
 +$$kopt .= $hide;
 +}
 +};
 +}
 +
 +return ($xenhopt,@hooks);
 +}
 +
  #-- stashed files --
  
  sub open_unique_stashfile ($) {
 diff --git a/ts-bench-hostcmp-post b/ts-bench-hostcmp-post
 new file mode 100755
 index 000..26a67f4
 --- /dev/null
 +++ b/ts-bench-hostcmp-post
 @@ -0,0 +1,39 @@
 +#!/usr/bin/perl -w
 +# This is part of osstest, an automated testing framework for Xen.
 +# Copyright (C) 2009-2014 Citrix Inc.
 +#
 +# This program is free software: you can redistribute it 

[Xen-devel] [PATCH 23/27] ts-bench-hostcmp-host-reset: new script

2014-12-10 Thread Dario Faggioli
From: Dario Faggioli raist...@linux.it

Signed-off-by: Dario Faggioli dario.faggi...@citrix.com
Cc: Wei Liu wei.l...@citrix.com
Cc: Ian Campbell ian.campb...@citrix.com
Cc: Ian Jackson ian.jack...@eu.citrix.com
---
 Osstest/Debian.pm  |   32 +---
 Osstest/TestSupport.pm |   46 +-
 ts-bench-hostcmp-post  |   39 +++
 ts-xen-install |   38 ++
 4 files changed, 103 insertions(+), 52 deletions(-)
 create mode 100755 ts-bench-hostcmp-post

diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index 418d9f2..447d2d2 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -87,25 +87,27 @@ sub debian_boot_setup (;$) {
 my $kern= $bootloader-{GetBootKern}();
 logm(dom0 kernel is $kern);
 
-system tar zvtf $distpath-{kern} boot/$kern;
-$? and die $distpath-{kern} boot/$kern $?;
-
-my $kernver= $kern;
-$kernver =~ s,^/?(?:boot/)?(?:vmlinu[xz]-)?,, or die $kernver ?;
-my $kernpath= $kern;
-$kernpath =~ s,^(?:boot/)?,/boot/,;
-
-target_cmd_root($ho,
-update-initramfs -k $kernver -c ||.
- update-initramfs -k $kernver -u,
-200);
+if (defined $distpath) {
+system tar zvtf $distpath-{kern} boot/$kern;
+$? and die $distpath-{kern} boot/$kern $?;
+
+my $kernver= $kern;
+$kernver =~ s,^/?(?:boot/)?(?:vmlinu[xz]-)?,, or die $kernver ?;
+my $kernpath= $kern;
+$kernpath =~ s,^(?:boot/)?,/boot/,;
+
+target_cmd_root($ho,
+update-initramfs -k $kernver -c ||.
+ update-initramfs -k $kernver -u,
+200);
+
+store_runvar(target_var_prefix($ho).'xen_kernel_path',$kernpath);
+store_runvar(target_var_prefix($ho).'xen_kernel_ver',$kernver);
+}
 
 $bootloader-{PreFinalUpdate}();
 
 $bootloader-{UpdateConfig}($ho);
-
-store_runvar(target_var_prefix($ho).'xen_kernel_path',$kernpath);
-store_runvar(target_var_prefix($ho).'xen_kernel_ver',$kernver);
 }
 
 sub bl_getmenu_open ($$$) {
diff --git a/Osstest/TestSupport.pm b/Osstest/TestSupport.pm
index 251668a..c967e4f 100644
--- a/Osstest/TestSupport.pm
+++ b/Osstest/TestSupport.pm
@@ -99,7 +99,7 @@ BEGIN {
   guest_vncsnapshot_begin guest_vncsnapshot_stash
  guest_check_remus_ok guest_editconfig
   host_involves_pcipassthrough host_get_pcipassthrough_devs
-  toolstack guest_create
+  toolstack guest_create host_bootxen_setup
 
   await_webspace_fetch_byleaf create_webfile
   file_link_contents get_timeout
@@ -1012,6 +1012,50 @@ sub get_host_memory ($) {
 return $mem;
 }
 
+#-- bootloader and booting --
+#
+sub host_bootxen_setup ($) {
+my ($ho)= @_;
+
+my $xenhopt= conswitch=x watchdog;
+
+my $cons= get_host_property($ho, 'XenSerialConsole', 'com1');
+
+if ( $cons eq com1 ) {
+$xenhopt .=  com1=$c{Baud},8n1 console=com1,vga gdb=com1;
+} elsif ( $cons eq dtuart ) {
+$xenhopt .=  console=dtuart;
+my $dtuart= get_host_property($ho, 'XenDTUARTPath', undef);
+$xenhopt .=  dtuart=$dtuart if $dtuart;
+} else {
+logm(No Xen console device defined for host);
+}
+if (toolstack()-{Dom0MemFixed}) {
+$xenhopt .=  dom0_mem=512M,max:512M;
+}
+my $append= $r{xen_boot_append};
+$xenhopt .=  $append if defined $append;
+$append = get_host_property($ho, 'xen-commandline-append', undef);
+$xenhopt .=  $append if defined $append;
+
+my @hooks;
+
+if (host_involves_pcipassthrough($ho)) {
+push @hooks, {
+EditBootOptions = sub {
+my ($ho,$hopt,$kopt) = @_;
+$$hopt .= ' iommu=on';
+my $hide= ' xen-pciback.hide='. join '',map { ($_-{Bdf}) }
+host_get_pcipassthrough_devs($ho);
+logm(pci passthrough: hiding in dom0: $hide);
+$$kopt .= $hide;
+}
+};
+}
+
+return ($xenhopt,@hooks);
+}
+
 #-- stashed files --
 
 sub open_unique_stashfile ($) {
diff --git a/ts-bench-hostcmp-post b/ts-bench-hostcmp-post
new file mode 100755
index 000..26a67f4
--- /dev/null
+++ b/ts-bench-hostcmp-post
@@ -0,0 +1,39 @@
+#!/usr/bin/perl -w
+# This is part of osstest, an automated testing framework for Xen.
+# Copyright (C) 2009-2014 Citrix Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without