All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] tools/tests: More cleanup for automation improvements
@ 2021-06-15 16:19 Andrew Cooper
  2021-06-15 16:19 ` [PATCH 1/5] tools/tests: Drop obsolete mce-test infrastructure Andrew Cooper
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Andrew Cooper @ 2021-06-15 16:19 UTC (permalink / raw)
  To: Xen-devel
  Cc: Andrew Cooper, Ian Jackson, Wei Liu, Jan Beulich,
	Roger Pau Monné,
	Juergen Gross

This series takes us one step closer towards the "autotests" plan for
simplifying the running of unit and low level system tests.

With this series in place, all the tests which need running in dom0 have
working install/uninstall targets, so they can be packaged suitably.

Some questions, concerning future changes.

Ian: Presuambly OSSTest is going to complain if I stick a test- prefix on
depriv-fd-checker?  I've left that test alone for now, as it was the only
preexisting test with working install runes.

Jan/Roger: x86_emulator and vpci use $(HOSTCC) not $(CC).  While they are unit
tests, we still potentially want to run them in dom0 rather than the build
environment - particularly for x86_emulator which is heavily CPUID based and
wants to run on a wide set of hardware.  Any issues moving them off $(HOSTCC)?

Roger: vhpet isn't even wired into the build system, and seems non-trivial to
run in the first place.  How should "success" be judged?

Andrew Cooper (5):
  tools/tests: Drop obsolete mce-test infrastructure
  tools/tests: Drop run runes
  tests/resource: Rework Makefile
  tests/cpu-policy: Rework Makefile
  tests/xenstore: Rework Makefile

 .gitignore                                         |   2 -
 tools/misc/.gitignore                              |   1 +
 tools/misc/Makefile                                |   4 +
 tools/{tests/mce-test/tools => misc}/xen-mceinj.c  |  32 +--
 tools/tests/Makefile                               |   1 -
 tools/tests/cpu-policy/Makefile                    |  33 +--
 tools/tests/mce-test/Makefile                      |  12 -
 tools/tests/mce-test/README                        |  75 ------
 tools/tests/mce-test/cases/srao_llc/dom0/cases.sh  |  73 ------
 tools/tests/mce-test/cases/srao_llc/guest/cases.sh |  94 --------
 tools/tests/mce-test/cases/srao_llc/xen/cases.sh   |  69 ------
 tools/tests/mce-test/cases/srao_mem/dom0/cases.sh  |  73 ------
 tools/tests/mce-test/cases/srao_mem/guest/cases.sh |  94 --------
 tools/tests/mce-test/cases/srao_mem/xen/cases.sh   |  69 ------
 tools/tests/mce-test/cases/ucna_llc/dom0/cases.sh  |  72 ------
 tools/tests/mce-test/cases/ucna_llc/guest/cases.sh |  92 --------
 tools/tests/mce-test/cases/ucna_llc/xen/cases.sh   |  68 ------
 tools/tests/mce-test/config/setup.conf             |  24 --
 tools/tests/mce-test/lib/xen-mceinj-tool.sh        | 260 ---------------------
 tools/tests/mce-test/tools/Makefile                |  24 --
 tools/tests/mce-test/tools/README                  |  24 --
 tools/tests/resource/Makefile                      |  11 +-
 tools/tests/vpci/Makefile                          |   4 -
 tools/tests/x86_emulator/Makefile                  |   4 -
 tools/tests/xenstore/.gitignore                    |   1 +
 tools/tests/xenstore/Makefile                      |  31 ++-
 .../tests/xenstore/{xs-test.c => test-xenstore.c}  |   0
 27 files changed, 71 insertions(+), 1176 deletions(-)
 rename tools/{tests/mce-test/tools => misc}/xen-mceinj.c (97%)
 delete mode 100644 tools/tests/mce-test/Makefile
 delete mode 100644 tools/tests/mce-test/README
 delete mode 100644 tools/tests/mce-test/cases/srao_llc/dom0/cases.sh
 delete mode 100644 tools/tests/mce-test/cases/srao_llc/guest/cases.sh
 delete mode 100644 tools/tests/mce-test/cases/srao_llc/xen/cases.sh
 delete mode 100644 tools/tests/mce-test/cases/srao_mem/dom0/cases.sh
 delete mode 100644 tools/tests/mce-test/cases/srao_mem/guest/cases.sh
 delete mode 100644 tools/tests/mce-test/cases/srao_mem/xen/cases.sh
 delete mode 100644 tools/tests/mce-test/cases/ucna_llc/dom0/cases.sh
 delete mode 100644 tools/tests/mce-test/cases/ucna_llc/guest/cases.sh
 delete mode 100644 tools/tests/mce-test/cases/ucna_llc/xen/cases.sh
 delete mode 100644 tools/tests/mce-test/config/setup.conf
 delete mode 100644 tools/tests/mce-test/lib/xen-mceinj-tool.sh
 delete mode 100644 tools/tests/mce-test/tools/Makefile
 delete mode 100644 tools/tests/mce-test/tools/README
 create mode 100644 tools/tests/xenstore/.gitignore
 rename tools/tests/xenstore/{xs-test.c => test-xenstore.c} (100%)

-- 
2.11.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 1/5] tools/tests: Drop obsolete mce-test infrastructure
  2021-06-15 16:19 [PATCH 0/5] tools/tests: More cleanup for automation improvements Andrew Cooper
@ 2021-06-15 16:19 ` Andrew Cooper
  2021-06-16  6:46   ` Jan Beulich
  2021-06-15 16:19 ` [PATCH 2/5] tools/tests: Drop run runes Andrew Cooper
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Andrew Cooper @ 2021-06-15 16:19 UTC (permalink / raw)
  To: Xen-devel
  Cc: Andrew Cooper, Ian Jackson, Wei Liu, Jan Beulich,
	Roger Pau Monné,
	Juergen Gross

mce-test has a test suite, but it depends on xend, needs to run in-tree, and
requires manual setup of at least one guest, and manual parameters to pass
into cases.  Drop the test infrasturcture.

Move the one useful remaining item, xen-mceinj, into misc/, fixing some minor
style issues as it goes.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Jackson <iwj@xenproject.org>
CC: Wei Liu <wl@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Juergen Gross <jgross@suse.com>
---
 .gitignore                                         |   1 -
 tools/misc/.gitignore                              |   1 +
 tools/misc/Makefile                                |   4 +
 tools/{tests/mce-test/tools => misc}/xen-mceinj.c  |  32 +--
 tools/tests/Makefile                               |   1 -
 tools/tests/mce-test/Makefile                      |  12 -
 tools/tests/mce-test/README                        |  75 ------
 tools/tests/mce-test/cases/srao_llc/dom0/cases.sh  |  73 ------
 tools/tests/mce-test/cases/srao_llc/guest/cases.sh |  94 --------
 tools/tests/mce-test/cases/srao_llc/xen/cases.sh   |  69 ------
 tools/tests/mce-test/cases/srao_mem/dom0/cases.sh  |  73 ------
 tools/tests/mce-test/cases/srao_mem/guest/cases.sh |  94 --------
 tools/tests/mce-test/cases/srao_mem/xen/cases.sh   |  69 ------
 tools/tests/mce-test/cases/ucna_llc/dom0/cases.sh  |  72 ------
 tools/tests/mce-test/cases/ucna_llc/guest/cases.sh |  92 --------
 tools/tests/mce-test/cases/ucna_llc/xen/cases.sh   |  68 ------
 tools/tests/mce-test/config/setup.conf             |  24 --
 tools/tests/mce-test/lib/xen-mceinj-tool.sh        | 260 ---------------------
 tools/tests/mce-test/tools/Makefile                |  24 --
 tools/tests/mce-test/tools/README                  |  24 --
 20 files changed, 24 insertions(+), 1138 deletions(-)
 rename tools/{tests/mce-test/tools => misc}/xen-mceinj.c (97%)
 delete mode 100644 tools/tests/mce-test/Makefile
 delete mode 100644 tools/tests/mce-test/README
 delete mode 100644 tools/tests/mce-test/cases/srao_llc/dom0/cases.sh
 delete mode 100644 tools/tests/mce-test/cases/srao_llc/guest/cases.sh
 delete mode 100644 tools/tests/mce-test/cases/srao_llc/xen/cases.sh
 delete mode 100644 tools/tests/mce-test/cases/srao_mem/dom0/cases.sh
 delete mode 100644 tools/tests/mce-test/cases/srao_mem/guest/cases.sh
 delete mode 100644 tools/tests/mce-test/cases/srao_mem/xen/cases.sh
 delete mode 100644 tools/tests/mce-test/cases/ucna_llc/dom0/cases.sh
 delete mode 100644 tools/tests/mce-test/cases/ucna_llc/guest/cases.sh
 delete mode 100644 tools/tests/mce-test/cases/ucna_llc/xen/cases.sh
 delete mode 100644 tools/tests/mce-test/config/setup.conf
 delete mode 100644 tools/tests/mce-test/lib/xen-mceinj-tool.sh
 delete mode 100644 tools/tests/mce-test/tools/Makefile
 delete mode 100644 tools/tests/mce-test/tools/README

diff --git a/.gitignore b/.gitignore
index 38a085e398..d4b90303b2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -276,7 +276,6 @@ tools/tests/x86_emulator/test_x86_emulator
 tools/tests/x86_emulator/x86_emulate
 tools/tests/x86_emulator/xop*.[ch]
 tools/tests/xenstore/xs-test
-tools/tests/mce-test/tools/xen-mceinj
 tools/tests/vpci/list.h
 tools/tests/vpci/vpci.[hc]
 tools/tests/vpci/test_vpci
diff --git a/tools/misc/.gitignore b/tools/misc/.gitignore
index ce6f937d0c..73ce95e6d7 100644
--- a/tools/misc/.gitignore
+++ b/tools/misc/.gitignore
@@ -1,4 +1,5 @@
 xen-access
+xen-mceinj
 xen-memshare
 xen-ucode
 xen-vmtrace
diff --git a/tools/misc/Makefile b/tools/misc/Makefile
index 2b683819d4..1a07191d83 100644
--- a/tools/misc/Makefile
+++ b/tools/misc/Makefile
@@ -22,6 +22,7 @@ INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool
 INSTALL_SBIN-$(CONFIG_X86)     += xen-hvmcrash
 INSTALL_SBIN-$(CONFIG_X86)     += xen-hvmctx
 INSTALL_SBIN-$(CONFIG_X86)     += xen-lowmemd
+INSTALL_SBIN-$(CONFIG_X86)     += xen-mceinj
 INSTALL_SBIN-$(CONFIG_X86)     += xen-memshare
 INSTALL_SBIN-$(CONFIG_X86)     += xen-mfndump
 INSTALL_SBIN-$(CONFIG_X86)     += xen-ucode
@@ -97,6 +98,9 @@ xen-memshare: xen-memshare.o
 xen-vmtrace: xen-vmtrace.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenforeignmemory) $(APPEND_LDFLAGS)
 
+xen-mceinj: xen-mceinj.o
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(APPEND_LDFLAGS)
+
 xenperf: xenperf.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
diff --git a/tools/tests/mce-test/tools/xen-mceinj.c b/tools/misc/xen-mceinj.c
similarity index 97%
rename from tools/tests/mce-test/tools/xen-mceinj.c
rename to tools/misc/xen-mceinj.c
index 1187d01e5f..df55eefbac 100644
--- a/tools/tests/mce-test/tools/xen-mceinj.c
+++ b/tools/misc/xen-mceinj.c
@@ -137,7 +137,7 @@ static void err(xc_interface *xc_handle, const char *fmt, ...)
     va_list args;
 
     va_start(args, fmt);
-    if (vasprintf(&buf, fmt, args) < 0)
+    if ( vasprintf(&buf, fmt, args) < 0 )
         abort();
     perror(buf);
     va_end(args);
@@ -173,7 +173,7 @@ static unsigned int mca_cpuinfo(xc_interface *xc_handle)
     mc.cmd = XEN_MC_physcpuinfo;
     mc.interface_version = XEN_MCA_INTERFACE_VERSION;
 
-    if (!xc_mca_op(xc_handle, &mc))
+    if ( !xc_mca_op(xc_handle, &mc) )
         return mc.u.mc_physcpuinfo.ncpus;
     else
         return 0;
@@ -187,9 +187,9 @@ static int inject_cmci(xc_interface *xc_handle, unsigned int cpu_nr)
     memset(&mc, 0, sizeof(struct xen_mc));
 
     nr_cpus = mca_cpuinfo(xc_handle);
-    if (!nr_cpus)
+    if ( !nr_cpus )
         err(xc_handle, "Failed to get mca_cpuinfo");
-    if (cpu_nr >= nr_cpus)
+    if ( cpu_nr >= nr_cpus )
         err(xc_handle, "-c %u is larger than %u", cpu_nr, nr_cpus - 1);
 
     mc.cmd = XEN_MC_inject_v2;
@@ -284,7 +284,7 @@ static int add_msr_intpose(xc_interface *xc_handle,
         flush_msr_inj(xc_handle);
         init_msr_inj();
     }
-    count= msr_inj.mcinj_count;
+    count = msr_inj.mcinj_count;
 
     if ( !count )
     {
@@ -422,7 +422,7 @@ static long xs_get_dom_mem(int domid)
     if (!memstr || !plen)
         return -1;
 
-    mem = atoll(memstr)*1024;
+    mem = atoll(memstr) * 1024;
     free(memstr);
 
     return mem;
@@ -474,17 +474,20 @@ int main(int argc, char *argv[])
     cpu_nr = 0;
 
     init_msr_inj();
-    xc_handle = xc_interface_open(0, 0, 0);
-    if ( !xc_handle ) {
+    xc_handle = xc_interface_open(NULL, NULL, 0);
+    if ( !xc_handle )
+    {
         Lprintf("Failed to get xc interface");
         exit(EXIT_FAILURE);
     }
 
-    while ( 1 ) {
+    while ( 1 )
+    {
         c = getopt_long(argc, argv, "c:Dd:t:hp:l", opts, &opt_index);
         if ( c == -1 )
             break;
-        switch ( c ) {
+        switch ( c )
+        {
         case 'D':
             dump=1;
             break;
@@ -516,7 +519,8 @@ int main(int argc, char *argv[])
         }
     }
 
-    if ( domid != DOMID_XEN ) {
+    if ( domid != DOMID_XEN )
+    {
         max_gpa = xs_get_dom_mem(domid);
         Lprintf("get domain %d max gpa is: 0x%lx", domid, max_gpa);
         if ( gaddr >= max_gpa )
@@ -524,7 +528,8 @@ int main(int argc, char *argv[])
     }
     Lprintf("get gaddr of error inject is: 0x%lx", gaddr);
 
-    if ( dump ) {
+    if ( dump )
+    {
         if ( domid == DOMID_XEN )
             Lprintf("Xen: gaddr=0x%lx", gaddr);
         else
@@ -532,7 +537,8 @@ int main(int argc, char *argv[])
         goto out;
     }
 
-    if ( type < 0 || type >= MCE_TABLE_SIZE ) {
+    if ( type < 0 || type >= MCE_TABLE_SIZE )
+    {
         err(xc_handle, "Unsupported error type");
         goto out;
     }
diff --git a/tools/tests/Makefile b/tools/tests/Makefile
index 8746aabe6b..f76feb0b3a 100644
--- a/tools/tests/Makefile
+++ b/tools/tests/Makefile
@@ -4,7 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 SUBDIRS-y :=
 SUBDIRS-y += resource
 SUBDIRS-$(CONFIG_X86) += cpu-policy
-SUBDIRS-$(CONFIG_X86) += mce-test
 ifneq ($(clang),y)
 SUBDIRS-$(CONFIG_X86) += x86_emulator
 endif
diff --git a/tools/tests/mce-test/Makefile b/tools/tests/mce-test/Makefile
deleted file mode 100644
index 1395df38ac..0000000000
--- a/tools/tests/mce-test/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
-.PHONY: all clean distclean
-
-all: 
-	$(MAKE) -C tools
-
-clean:
-	$(MAKE) -C tools clean
-
-distclean:
-	$(MAKE) -C tools distclean
-
-install uninstall:
diff --git a/tools/tests/mce-test/README b/tools/tests/mce-test/README
deleted file mode 100644
index 65e6d1b045..0000000000
--- a/tools/tests/mce-test/README
+++ /dev/null
@@ -1,75 +0,0 @@
-Xen MCE test suite
----------------
-
-The Xen MCE test suite is a collection of tools and test scripts for
-testing the Xen MCE processing features. The goal is to cover
-most Xen MCE processing code paths and features with automation tests.
-
-
-In the Package
---------------
-
-Here is a short description of what is included in the package
-
-README
-	This is document
-
-Makefile
-	For compile
-
-cases/*
-	Contains all test cases, which may be organized in sub-directories, 
-	the interface of test case is a shell script under cases/, such as:
-	   -- cases/srao_mem/dom0/cases.sh
-
-config/*
-	Contains test configuration files, which specifies the parameters 
-	for test cases, etc.
-
-lib/*
-	Contains some shell scripts, in which some common shell
-	functions and variable definitions are defined to be used by
-	test cases.
-
-tools/*
-	Tools used by MCE test suites, now only xen-mceinj tool.
-
-results/
-	When test is done, the test result will be placed in this
-	directory, test results	of various cases may be in corresponding 
-	directory. 
-	For example, files in
-	    results/srao_mem_dom0/result
-	is the result for test case cases/srao_mem/dom0/cases.sh, there will
-	be 3 result conditions: PASSED/FAILED/NORESULT.
-		results/<test_case>/testlog   #the test log during testing
-		results/<test_case>/mcelog    #mcelog output during testing
-		results/<test_case>/xenlog    #Xen log during testing
-		results/<test_case>/gklog     #VM guest kernel log during testing
-		results/<test_case>/guest_config   #config file used to create guest
-
-
-Test Instruction
-----------------
-
-1.	make sure you have a dom0 with mce support
-	CONFIG_X86_MCE=y
-	CONFIG_X86_MCE_INTEL=y
-	CONFIG_X86_MCE_AMD=y
-	CONFIG_X86_MCE_THRESHOLD=y
-	CONFIG_X86_MCE_INJECT=y
-
-2.	run system at xen and start xend. A installed guest image is
-	necessary when do guest MCE error injection.
-3.	compile tools that used to test. in mce-test, $make.
-	Note: make sure compile xen/tools before do this step
-4.	run test cases that you want.
-	e.g. $sh cases/srao_mem/dom0/cases.sh -d 0 -p 0x0200 -c 2 -t 1
-5.	get test result in results directory
-
-
-Notes
-----------------
-All test cases fake a error and inject this error in 0x180020, For Xen
-test cases(e.g. cases/srao_mem/xen/cases.sh), error happen on every page 
-may cause a Xen panic. 
diff --git a/tools/tests/mce-test/cases/srao_llc/dom0/cases.sh b/tools/tests/mce-test/cases/srao_llc/dom0/cases.sh
deleted file mode 100644
index c540f64998..0000000000
--- a/tools/tests/mce-test/cases/srao_llc/dom0/cases.sh
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2010, Intel Corporation
-# 
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version
-# 2 as published by the Free Software Foundation.
-# 
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Xudong Hao <xudong.hao@intel.com>
-#
-
-sd=$(dirname $0)
-export ROOT=`(cd $sd/../../../; pwd)`
-export this_case=srao_llc_dom0
-
-. $ROOT/lib/xen-mceinj-tool.sh
-
-usage()
-{
-    echo "Usage: ./cases.sh [-options] [arguments]"
-    echo "================Below are the optional options================"
-    echo -e "\t-d domainID\t: 0"
-    echo -e "\t-c injcpu\t: which cpu to inject error"
-    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
-    echo -e "\t\t\tBy default, the GPA is 0x180020"
-    echo -e "\t-h help"
-    exit 0
-}
-
-while getopts ":c:d:p:h" option
-do
-    case "$option" in
-    c) injcpu=$OPTARG;;
-    d) domid=$OPTARG;;
-    p) pageaddr=$OPTARG;;
-    h) usage;;
-    *) echo "invalid option!"; usage;;
-    esac
-done
-
-[ -z $domid ] && domid=0
-
-inject()
-{
-    mce_inject_trigger $MCE_SRAO_LLC -d $domid -u $injcpu -p $pageaddr 
-    if [ $? -eq 0 ]; then
-        show "  Passed: Successfully to fake and inject a MCE error"
-    else
-        show "  Failed: Fake error and inject fail !!"
-        return 1
-    fi
-    return 0
-}
-
-do_main()
-{
-    ret_val=0
-    clean_env
-    inject || ret_val=1
-    xen_verify || ret_val=1
-    mcelog_verify $MCE_SRAO_LLC || ret_val=1
-    gen_result $ret_val
-}
-
-do_main "$@"
diff --git a/tools/tests/mce-test/cases/srao_llc/guest/cases.sh b/tools/tests/mce-test/cases/srao_llc/guest/cases.sh
deleted file mode 100644
index 47a7ee4ab9..0000000000
--- a/tools/tests/mce-test/cases/srao_llc/guest/cases.sh
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2010, Intel Corporation
-# 
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version
-# 2 as published by the Free Software Foundation.
-# 
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Xudong Hao <xudong.hao@intel.com>
-#
-
-sd=$(dirname $0)
-export ROOT=`(cd $sd/../../../; pwd)`
-export this_case=srao_llc_guest
-
-. $ROOT/lib/xen-mceinj-tool.sh
-
-usage()
-{
-    echo "Usage: ./cases.sh [-options] [arguments]"
-    echo "================Below are the must have options==============="
-    echo -e "\t-i image\t: guest image"
-    echo -e "\t-m memory\t: set guest virtual memory"
-    echo "========                                              ========"
-    echo "================Below are the optional options================"
-    echo -e "\t-u vcpus\t: set guest virtual cpus number"
-    echo -e "\t-c injcpu\t: which cpu to inject error"
-    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
-    echo -e "\t\t\tBy default, the GPA is 0x180020"
-    echo -e "\t-h help"
-    exit 0
-}
-
-[ $# -lt 1 ] && usage
-
-while getopts ":i:u:m:c:p:hl:" option
-do
-    case "$option" in
-    i) image=$OPTARG; offset=`kpartx -l $image | awk '{print $NF*512}'`;;
-    u) vcpus=$OPTARG;;
-    m) memory=$OPTARG;;
-    c) injcpu=$OPTARG;;
-    p) pageaddr=$OPTARG;;
-    l) early_kill="0";;
-    h) usage;;
-    *) echo "invalid option!"; usage;;
-    esac
-done
-
-
-start_guest()
-{
-    create_hvm_guest $image -u $vcpus -m $memory
-    if [ $? -ne 0 ]; then
-        echo "  Create guest fail!"
-        return 1
-    fi
-    return 0
-}
-
-inject()
-{
-    mce_inject_trigger $MCE_SRAO_LLC -u $injcpu -p $pageaddr 
-    if [ $? -eq 0 ]; then
-        show "  Passed: Successfully to fake and inject a MCE error"
-    else
-        show "  Failed: Fake error and inject fail !!"
-        return 1
-    fi
-    return 0
-}
-
-do_main()
-{
-    ret_val=0
-    clean_env
-    start_guest || ret_val=1
-    inject || ret_val=1
-    xen_verify || ret_val=1
-    guest_verify || ret_val=1
-    mcelog_verify $MCE_SRAO_LLC || ret_val=1
-    des_guest
-    gen_result $ret_val
-}
-
-do_main "$@"
diff --git a/tools/tests/mce-test/cases/srao_llc/xen/cases.sh b/tools/tests/mce-test/cases/srao_llc/xen/cases.sh
deleted file mode 100644
index 1d8e02ff65..0000000000
--- a/tools/tests/mce-test/cases/srao_llc/xen/cases.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2010, Intel Corporation
-# 
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version
-# 2 as published by the Free Software Foundation.
-# 
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Xudong Hao <xudong.hao@intel.com>
-#
-
-sd=$(dirname $0)
-export ROOT=`(cd $sd/../../../; pwd)`
-export this_case=srao_llc_xen
-
-. $ROOT/lib/xen-mceinj-tool.sh
-
-usage()
-{
-    echo "Usage: ./cases.sh [-options] [arguments]"
-    echo "================Below are the optional options================"
-    echo -e "\t-c injcpu\t: which cpu to inject error"
-    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
-    echo -e "\t\t\tBy default, the GPA is 0x180020"
-    echo -e "\t-h help"
-    exit 0
-}
-
-while getopts ":c:p:h" option
-do
-    case "$option" in
-    c) injcpu=$OPTARG;;
-    p) pageaddr=$OPTARG;;
-    h) usage;;
-    *) echo "invalid option!"; usage;;
-    esac
-done
-
-inject()
-{
-    mce_inject_trigger $MCE_SRAO_LLC -u $injcpu -p $pageaddr 
-    if [ $? -eq 0 ]; then
-        show "  Passed: Successfully to fake and inject a MCE error"
-    else
-        show "  Failed: Fake error and inject fail !!"
-        return 1
-    fi
-    return 0
-}
-
-do_main()
-{
-    ret_val=0
-    clean_env
-    inject || ret_val=1
-    xen_verify || ret_val=1
-    mcelog_verify $MCE_SRAO_LLC || ret_val=1
-    gen_result $ret_val
-}
-
-do_main "$@"
diff --git a/tools/tests/mce-test/cases/srao_mem/dom0/cases.sh b/tools/tests/mce-test/cases/srao_mem/dom0/cases.sh
deleted file mode 100644
index 22d4a00960..0000000000
--- a/tools/tests/mce-test/cases/srao_mem/dom0/cases.sh
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2010, Intel Corporation
-# 
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version
-# 2 as published by the Free Software Foundation.
-# 
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Xudong Hao <xudong.hao@intel.com>
-#
-
-sd=$(dirname $0)
-export ROOT=`(cd $sd/../../../; pwd)`
-export this_case=srao_mem_dom0
-
-. $ROOT/lib/xen-mceinj-tool.sh
-
-usage()
-{
-    echo "Usage: ./cases.sh [-options] [arguments]"
-    echo "================Below are the optional options================"
-    echo -e "\t-d domainID\t: 0"
-    echo -e "\t-c injcpu\t: which cpu to inject error"
-    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
-    echo -e "\t\t\tBy default, the GPA is 0x180020"
-    echo -e "\t-h help"
-    exit 0
-}
-
-while getopts ":c:d:p:h" option
-do
-    case "$option" in
-    c) injcpu=$OPTARG;;
-    d) domid=$OPTARG;;
-    p) pageaddr=$OPTARG;;
-    h) usage;;
-    *) echo "invalid option!"; usage;;
-    esac
-done
-
-[ -z $domid ] && domid=0
-
-inject()
-{
-    mce_inject_trigger $MCE_SRAO_MEM -d $domid -u $injcpu -p $pageaddr 
-    if [ $? -eq 0 ]; then
-        show "  Passed: Successfully to fake and inject a MCE error"
-    else
-        show "  Failed: Fake error and inject fail !!"
-        return 1
-    fi
-    return 0
-}
-
-do_main()
-{
-    ret_val=0
-    clean_env
-    inject || ret_val=1
-    xen_verify || ret_val=1
-    mcelog_verify $MCE_SRAO_MEM || ret_val=1
-    gen_result $ret_val
-}
-
-do_main "$@"
diff --git a/tools/tests/mce-test/cases/srao_mem/guest/cases.sh b/tools/tests/mce-test/cases/srao_mem/guest/cases.sh
deleted file mode 100644
index 7ab4523096..0000000000
--- a/tools/tests/mce-test/cases/srao_mem/guest/cases.sh
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2010, Intel Corporation
-# 
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version
-# 2 as published by the Free Software Foundation.
-# 
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Xudong Hao <xudong.hao@intel.com>
-#
-
-sd=$(dirname $0)
-export ROOT=`(cd $sd/../../../; pwd)`
-export this_case=srao_mem_guest
-
-. $ROOT/lib/xen-mceinj-tool.sh
-
-usage()
-{
-    echo "Usage: ./cases.sh [-options] [arguments]"
-    echo "================Below are the must have options==============="
-    echo -e "\t-i image\t: guest image"
-    echo -e "\t-m memory\t: set guest virtual memory"
-    echo "========                                              ========"
-    echo "================Below are the optional options================"
-    echo -e "\t-u vcpus\t: set guest virtual cpus number"
-    echo -e "\t-c injcpu\t: which cpu to inject error"
-    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
-    echo -e "\t\t\tBy default, the GPA is 0x180020"
-    echo -e "\t-h help"
-    exit 0
-}
-
-[ $# -lt 1 ] && usage
-
-while getopts ":i:u:m:c:p:hl:" option
-do
-    case "$option" in
-    i) image=$OPTARG; offset=`kpartx -l $image | awk '{print $NF*512}'`;;
-    u) vcpus=$OPTARG;;
-    m) memory=$OPTARG;;
-    c) injcpu=$OPTARG;;
-    p) pageaddr=$OPTARG;;
-    l) early_kill="0";;
-    h) usage;;
-    *) echo "invalid option!"; usage;;
-    esac
-done
-
-
-start_guest()
-{
-    create_hvm_guest $image -u $vcpus -m $memory
-    if [ $? -ne 0 ]; then
-        echo "  Create guest fail!"
-        return 1
-    fi
-    return 0
-}
-
-inject()
-{
-    mce_inject_trigger $MCE_SRAO_MEM -u $injcpu -p $pageaddr 
-    if [ $? -eq 0 ]; then
-        show "  Passed: Successfully to fake and inject a MCE error"
-    else
-        show "  Failed: Fake error and inject fail !!"
-        return 1
-    fi
-    return 0
-}
-
-do_main()
-{
-    ret_val=0
-    clean_env
-    start_guest || ret_val=1
-    inject || ret_val=1
-    xen_verify || ret_val=1
-    guest_verify || ret_val=1
-    mcelog_verify $MCE_SRAO_MEM || ret_val=1
-    des_guest
-    gen_result $ret_val
-}
-
-do_main "$@"
diff --git a/tools/tests/mce-test/cases/srao_mem/xen/cases.sh b/tools/tests/mce-test/cases/srao_mem/xen/cases.sh
deleted file mode 100644
index 7ae49a82ac..0000000000
--- a/tools/tests/mce-test/cases/srao_mem/xen/cases.sh
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2010, Intel Corporation
-# 
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version
-# 2 as published by the Free Software Foundation.
-# 
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Xudong Hao <xudong.hao@intel.com>
-#
-
-sd=$(dirname $0)
-export ROOT=`(cd $sd/../../../; pwd)`
-export this_case=srao_mem_xen
-
-. $ROOT/lib/xen-mceinj-tool.sh
-
-usage()
-{
-    echo "Usage: ./cases.sh [-options] [arguments]"
-    echo "================Below are the optional options================"
-    echo -e "\t-c injcpu\t: which cpu to inject error"
-    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
-    echo -e "\t\t\tBy default, the GPA is 0x180020"
-    echo -e "\t-h help"
-    exit 0
-}
-
-while getopts ":c:p:h" option
-do
-    case "$option" in
-    c) injcpu=$OPTARG;;
-    p) pageaddr=$OPTARG;;
-    h) usage;;
-    *) echo "invalid option!"; usage;;
-    esac
-done
-
-inject()
-{
-    mce_inject_trigger $MCE_SRAO_MEM -u $injcpu -p $pageaddr 
-    if [ $? -eq 0 ]; then
-        show "  Passed: Successfully to fake and inject a MCE error"
-    else
-        show "  Failed: Fake error and inject fail !!"
-        return 1
-    fi
-    return 0
-}
-
-do_main()
-{
-    ret_val=0
-    clean_env
-    inject || ret_val=1
-    xen_verify || ret_val=1
-    mcelog_verify $MCE_SRAO_MEM || ret_val=1
-    gen_result $ret_val
-}
-
-do_main "$@"
diff --git a/tools/tests/mce-test/cases/ucna_llc/dom0/cases.sh b/tools/tests/mce-test/cases/ucna_llc/dom0/cases.sh
deleted file mode 100644
index 808f007708..0000000000
--- a/tools/tests/mce-test/cases/ucna_llc/dom0/cases.sh
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2010, Intel Corporation
-# 
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version
-# 2 as published by the Free Software Foundation.
-# 
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Xudong Hao <xudong.hao@intel.com>
-#
-
-sd=$(dirname $0)
-export ROOT=`(cd $sd/../../../; pwd)`
-export this_case=ucna_llc_dom0
-
-. $ROOT/lib/xen-mceinj-tool.sh
-
-usage()
-{
-    echo "Usage: ./cases.sh [-options] [arguments]"
-    echo "================Below are the optional options================"
-    echo -e "\t-d domainID\t: 0"
-    echo -e "\t-c injcpu\t: which cpu to inject error"
-    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
-    echo -e "\t\t\tBy default, the GPA is 0x180020"
-    echo -e "\t-h help"
-    exit 0
-}
-
-while getopts ":c:d:p:h" option
-do
-    case "$option" in
-    c) injcpu=$OPTARG;;
-    d) domid=$OPTARG;;
-    p) pageaddr=$OPTARG;;
-    h) usage;;
-    *) echo "invalid option!"; usage;;
-    esac
-done
-
-[ -z $domid ] && domid=0
-
-inject()
-{
-    mce_inject_trigger $CMCI_UCNA_LLC -d $domid -u $injcpu -p $pageaddr 
-    if [ $? -eq 0 ]; then
-        show "  Passed: Successfully to fake and inject a MCE error"
-    else
-        show "  Failed: Fake error and inject fail !!"
-        return 1
-    fi
-    return 0
-}
-
-do_main()
-{
-    ret_val=0
-    clean_env
-    inject || ret_val=1
-    mcelog_verify $CMCI_UCNA_LLC || ret_val=1
-    gen_result $ret_val
-}
-
-do_main "$@"
diff --git a/tools/tests/mce-test/cases/ucna_llc/guest/cases.sh b/tools/tests/mce-test/cases/ucna_llc/guest/cases.sh
deleted file mode 100644
index 0ca4e2c961..0000000000
--- a/tools/tests/mce-test/cases/ucna_llc/guest/cases.sh
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2010, Intel Corporation
-# 
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version
-# 2 as published by the Free Software Foundation.
-# 
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Xudong Hao <xudong.hao@intel.com>
-#
-
-sd=$(dirname $0)
-export ROOT=`(cd $sd/../../../; pwd)`
-export this_case=ucna_llc_guest
-
-. $ROOT/lib/xen-mceinj-tool.sh
-
-usage()
-{
-    echo "Usage: ./cases.sh [-options] [arguments]"
-    echo "================Below are the must have options==============="
-    echo -e "\t-i image\t: guest image"
-    echo -e "\t-m memory\t: set guest virtual memory"
-    echo "========                                              ========"
-    echo "================Below are the optional options================"
-    echo -e "\t-u vcpus\t: set guest virtual cpus number"
-    echo -e "\t-c injcpu\t: which cpu to inject error"
-    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
-    echo -e "\t\t\tBy default, the GPA is 0x180020"
-    echo -e "\t-h help"
-    exit 0
-}
-
-[ $# -lt 1 ] && usage
-
-while getopts ":i:u:m:c:p:hl:" option
-do
-    case "$option" in
-    i) image=$OPTARG; offset=`kpartx -l $image | awk '{print $NF*512}'`;;
-    u) vcpus=$OPTARG;;
-    m) memory=$OPTARG;;
-    c) injcpu=$OPTARG;;
-    p) pageaddr=$OPTARG;;
-    l) early_kill="0";;
-    h) usage;;
-    *) echo "invalid option!"; usage;;
-    esac
-done
-
-
-start_guest()
-{
-    create_hvm_guest $image -u $vcpus -m $memory
-    if [ $? -ne 0 ]; then
-        echo "  Create guest fail!"
-        return 1
-    fi
-    return 0
-}
-
-inject()
-{
-    mce_inject_trigger $CMCI_UCNA_LLC -u $injcpu -p $pageaddr 
-    if [ $? -eq 0 ]; then
-        show "  Passed: Successfully to fake and inject a MCE error"
-    else
-        show "  Failed: Fake error and inject fail !!"
-        return 1
-    fi
-    return 0
-}
-
-do_main()
-{
-    ret_val=0
-    clean_env
-    start_guest || ret_val=1
-    inject || ret_val=1
-    mcelog_verify $CMCI_UCNA_LLC || ret_val=1
-    des_guest
-    gen_result $ret_val
-}
-
-do_main "$@"
diff --git a/tools/tests/mce-test/cases/ucna_llc/xen/cases.sh b/tools/tests/mce-test/cases/ucna_llc/xen/cases.sh
deleted file mode 100644
index c73a2f6c16..0000000000
--- a/tools/tests/mce-test/cases/ucna_llc/xen/cases.sh
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/bin/bash
-#
-# Copyright (c) 2010, Intel Corporation
-# 
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version
-# 2 as published by the Free Software Foundation.
-# 
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Xudong Hao <xudong.hao@intel.com>
-#
-
-sd=$(dirname $0)
-export ROOT=`(cd $sd/../../../; pwd)`
-export this_case=ucna_llc_xen
-
-. $ROOT/lib/xen-mceinj-tool.sh
-
-usage()
-{
-    echo "Usage: ./cases.sh [-options] [arguments]"
-    echo "================Below are the optional options================"
-    echo -e "\t-c injcpu\t: which cpu to inject error"
-    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
-    echo -e "\t\t\tBy default, the GPA is 0x180020"
-    echo -e "\t-h help"
-    exit 0
-}
-
-while getopts ":c:p:h" option
-do
-    case "$option" in
-    c) injcpu=$OPTARG;;
-    p) pageaddr=$OPTARG;;
-    h) usage;;
-    *) echo "invalid option!"; usage;;
-    esac
-done
-
-inject()
-{
-    mce_inject_trigger $CMCI_UCNA_LLC -u $injcpu -p $pageaddr 
-    if [ $? -eq 0 ]; then
-        show "  Passed: Successfully to fake and inject a MCE error"
-    else
-        show "  Failed: Fake error and inject fail !!"
-        return 1
-    fi
-    return 0
-}
-
-do_main()
-{
-    ret_val=0
-    clean_env
-    inject || ret_val=1
-    mcelog_verify $CMCI_UCNA_LLC || ret_val=1
-    gen_result $ret_val
-}
-
-do_main "$@"
diff --git a/tools/tests/mce-test/config/setup.conf b/tools/tests/mce-test/config/setup.conf
deleted file mode 100644
index 05f754dfd6..0000000000
--- a/tools/tests/mce-test/config/setup.conf
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash
-#
-# Software injection based test cases: test cases are triggered via
-# mce-inject tool.
-# Copyright (c) 2010, Intel Corporation
-# 
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version
-# 2 as published by the Free Software Foundation.
-# 
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Xudong Hao <xudong.hao@intel.com>
-#
-
-export MCE_SRAO_MEM=0
-export MCE_SRAO_LLC=1
-export CMCI_UCNA_LLC=2
diff --git a/tools/tests/mce-test/lib/xen-mceinj-tool.sh b/tools/tests/mce-test/lib/xen-mceinj-tool.sh
deleted file mode 100644
index c0a3b293c5..0000000000
--- a/tools/tests/mce-test/lib/xen-mceinj-tool.sh
+++ /dev/null
@@ -1,260 +0,0 @@
-#!/bin/bash
-#
-# Software injection based test cases: test cases are triggered via
-# mce-inject tool.
-# Copyright (c) 2010, Intel Corporation
-# 
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version
-# 2 as published by the Free Software Foundation.
-# 
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-# 
-# You should have received a copy of the GNU General Public License
-# along with this program; If not, see <http://www.gnu.org/licenses/>.
-#
-# Author: Xudong Hao <xudong.hao@intel.com>
-#
-
-. $ROOT/config/setup.conf
-
-#Guest Image Preparation
-hvm_image_prepare()
-{
-    local image=$1
-    local tmpdir=`mktemp -d`
-    local tmpfile=`mktemp`
-    local offset=`kpartx -l $image | awk '{print $NF*512}'`
-    mount -oloop,offset=$offset $image $tmpdir && echo "mount image to $tmpdir"
-    local g_grub=$tmpdir/boot/grub/grub.conf
-    if [ $? -ne 0 ]; then
-        show "  Mount image failed!"
-        return 1
-    fi
-
-    if ! grep FLAG_CONSOLE $g_grub; then
-        sed -e '/kernel/s/$/ console=ttyS0,115200,8n1 console=tty0/g' \
-            $g_grub > $tmpfile
-        mv -f $tmpfile $g_grub
-        rm -f $tmpfile
-        echo "
-#### FLAG_CONSOLE #### " >> $g_grub
-    fi
-    umount $tmpdir
-    rm -fr $tmpdir
-
-    return 0
-}
-
-create_hvm_guest()
-{
-    local image=$1
-    local originconfig="/etc/xen/xmexample.hvm"
-    local TF=`mktemp`
-    local case_dir=$ROOT/results/$this_case
-    local config=$case_dir/guest_config
-    [ -d $case_dir ] || mkdir $case_dir
-    [ -f $logfile ] || touch $logfile
-    local File=`echo $image|sed "s/\//\\\\\\\\\\//g"`
-    local g_name="`basename $image`_`date +%H%M%S`"
-
-    hvm_image_prepare $image
-
-    while getopts ":u:m:" Option
-    do
-        case $Option in
-            u ) vcpus=$OPTARG;;
-            m ) memory=$OPTARG;;
-            e ) bridge_name=$OPTARG;;
-            * ) ;;
-        esac
-    done
-
-    cp $originconfig $config -f
-
-    if [ -z $image ]; then
-        show "Image file $image does not exist, Please input one valid file"
-        return 1
-    fi
-
-    sed -e "/^disk/s/file:.*,\(hda\)/file:${File},\1/" $config \
-          | sed -e "/^disk/s/phy:.*,\(hda\)/file:${File},\1/" >$TF
-    mv -f $TF $config
-
-    [ -z $memory ] || sed -i "/^memory/s/^.*$/memory = $memory/" $config
-    [ -z $vcpus ] || sed -i "1,/^#vcpus/s/^#vcpus.*$/vcpus=$vcpus/;1d" $config
-    sed -i "/^vif/s/vif/#vif/" $config
-    sed -i "/^name/s/^.*$/name = \"$g_name\"/" $config
-
-    string1=$(ls /dev/pts | sort)
-    xm cr $config
-    [ $? -eq 0 ] && domid=`xm list $g_name | tail -n1 | awk '{print $2}'`
-    if [ -z $domid ]; then
-        show "  Guest can not boot up"
-        return 1
-    fi
-    
-    sleep 10
-
-    string2=$(ls /dev/pts | sort)
-
-    get_guest_klog
-    sleep 40
-
-    return 0
-}
-
-get_guest_klog()
-{
-    local case_dir=$ROOT/results/$this_case
-    gklog=$case_dir/gklog
-    [ -d $case_dir ] || mkdir $case_dir
-    [ -f $gklog ] || touch $gklog
-    for fo in $string2; do
-        echo $string1 | grep $fo -wq
-        [ $? -eq 1 ] && num=$fo
-    done
-    cat /dev/pts/$num > $gklog &
-}
-
-mce_inject_trigger()
-{
-    local errtype=$1
-    local append=""
-    while getopts ":d:u:p:" Option
-    do
-        case $Option in
-            d ) domid=$OPTARG;;
-            u ) cpu=$OPTARG;;
-            p ) pageaddr=$OPTARG;;
-            * ) ;;
-        esac
-    done
-
-    [ -z $domid ] || append=$append" -d $domid"
-    [ -z $cpu ] || append=$append" -c $cpu"
-    [ -z $pageaddr ] || append=$append" -p $pageaddr"
-
-    [ -f $ROOT/tools/xen-mceinj ]
-    if [ $? -eq 0 ]; then
-        xm dmesg -c
-        $ROOT/tools/xen-mceinj -t $errtype $append
-        if [ $? -ne 0 ]; then
-            show "  Failed: Maybe the memory addr is out of range. \
-                      Please check whether used xen-mceinj tool correctlly"
-            return 1
-        fi
-    else
-        show "  Failed: please compile xen-mce inject tool firstly"
-        return 1
-    fi
-    return 0
-}
-
-xen_verify()
-{
-    local case_dir=$ROOT/results/$this_case
-    local xenlog=$case_dir/xenlog
-    [ -d $case_dir ] || mkdir $case_dir
-    [ -f $xenlog ] || touch $xenlog
-    xm dmesg > $xenlog
-    grep "Error is successfully recovered" $xenlog > /dev/null
-    if [ $? -eq 0 ]; then
-        show "  Passed: Xen handle this MCE error successfully"
-    else
-        show "  Failed: Xen does not handle MCE error correctly !!"
-        return 1
-    fi
-    return 0
-}
-
-guest_verify()
-{
-    grep "kernel page recovery" $gklog > /dev/null
-    if [ $? -eq 0 ]; then
-        show "  Passed: Guest recive MCE error and solved correctly"
-    else
-        show "  Failed: Guest fail to solve MCE error"
-        return 1
-    fi
-    return 0
-}
-
-mcelog_verify()
-{
-    local err_type=$1
-    local ret=0
-    local case_dir=$ROOT/results/$this_case
-    local mcelog=$case_dir/mcelog
-    [ -d $case_dir ] || mkdir $case_dir
-    [ -f $mcelog ] || touch $mcelog
-    mcelog > $mcelog
-    if [ -z $mcelog ]; then
-        show "  Failed: MCELOG does not catch anything"
-        return 1
-    else
-        if [ $err_type -eq 0 ]; then
-            grep "MEMORY CONTROLLER MS_CHANNELunspecified_ERR" $mcelog \
-                > /dev/null
-            ret=$?
-        elif [ $err_type -eq 1 ]; then
-            grep "Generic CACHE Level-2 Eviction Error" $mcelog > /dev/null
-            ret=$?
-        elif [ $err_type -eq 2 ]; then
-            grep "Data CACHE Level-2 Data-Read Error" $mcelog > /dev/null
-            ret=$?
-        fi
-
-        if [ $ret -eq 0 ]; then
-            show "  Passed: MCElog catch a correct error"
-        else 
-            show "  Failed: MCE log catch a incorrect error !!"
-            return 1
-        fi
-    fi
-
-    return 0
-}
-
-function des_guest()
-{
-    xm des $domid    
-}
-
-function clean_env()
-{
-    [ -d $ROOT/results ] || mkdir $ROOT/results
-    # clean logs and results of last test for this case
-    rm -fr $ROOT/results/$this_case/*
-}
-
-function show()
-{
-    local case_dir=$ROOT/results/$this_case
-    local logfile=$case_dir/testlog
-    [ -d $case_dir ] || mkdir $case_dir
-    [ -f $logfile ] || touch $logfile
-    echo -e $* | tee -a $logfile > /dev/null
-}
-
-function gen_result()
-{
-    local ret=$1
-    local case_dir=$ROOT/results/$this_case
-    local result=$case_dir/result
-    [ -d $case_dir ] || mkdir $case_dir
-    [ -f $result ] || touch $result
-    
-    if [ $ret -eq 0 ]; then
-        echo "PASSED" > $result
-    elif [ $ret -eq 1 ]; then
-        echo "FAILED" > $result
-        echo "   Please check testlog for details!!! " >> $result
-    else
-        echo "NORESULT" > $result
-        echo "   Please check testlog for details!!! " >> $result
-    fi
-}
diff --git a/tools/tests/mce-test/tools/Makefile b/tools/tests/mce-test/tools/Makefile
deleted file mode 100644
index 0e92ac2977..0000000000
--- a/tools/tests/mce-test/tools/Makefile
+++ /dev/null
@@ -1,24 +0,0 @@
-XEN_ROOT=$(CURDIR)/../../../..
-include $(XEN_ROOT)/tools/Rules.mk
-
-CFLAGS += -Werror
-CFLAGS += $(CFLAGS_libxenctrl)
-CFLAGS += $(CFLAGS_libxenguest)
-CFLAGS += $(CFLAGS_libxenstore)
-CFLAGS += $(CFLAGS_xeninclude)
-
-.PHONY: all
-all: xen-mceinj
-
-install: xen-mceinj
-	$(INSTALL_PROG) xen-mceinj $(DESTDIR)$(sbindir)
-
-.PHONY: clean
-clean:
-	$(RM) *.o xen-mceinj
-
-.PHONY: distclean
-distclean: clean
-
-xen-mceinj: xen-mceinj.o Makefile
-	$(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore)
diff --git a/tools/tests/mce-test/tools/README b/tools/tests/mce-test/tools/README
deleted file mode 100644
index bd0d442bae..0000000000
--- a/tools/tests/mce-test/tools/README
+++ /dev/null
@@ -1,24 +0,0 @@
-Xen Machine Check Exception(MCE) error inject tool
-----------------------------------------------
-
-xen-mceinj is a software MCE injection tool, which is based on Xen 
-MCE injection mechanism. It allows to inject machine check errors on the
-software level into a running Xen/dom0/VM. This is intended for
-validation of the Xen machine check handler.
-
-With the help of the Makefile, it is possible to compile a binary file 
-named "xen-mceinj".
-
-Usage
------
-$make (make install) --Note: make sure compile xen/tools before do this step
-$./xen-mceinj [OPTION]...
-
-OPTION arguments can be:
-  -D, --dump           dump addr info without error injection
-  -c, --cpu=CPU_ID     target CPU, the default is CPU0
-  -d, --domain=DomID   target domain, the default is Xen itself
-  -p, --page           physical page address, the default is 0x180020
-  -t, --type=error     error type
-
-For detail help, please refer to "./xen-mceinj -h"
-- 
2.11.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 2/5] tools/tests: Drop run runes
  2021-06-15 16:19 [PATCH 0/5] tools/tests: More cleanup for automation improvements Andrew Cooper
  2021-06-15 16:19 ` [PATCH 1/5] tools/tests: Drop obsolete mce-test infrastructure Andrew Cooper
@ 2021-06-15 16:19 ` Andrew Cooper
  2021-06-16  6:44   ` Jan Beulich
  2021-06-15 16:19 ` [PATCH 3/5] tests/resource: Rework Makefile Andrew Cooper
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Andrew Cooper @ 2021-06-15 16:19 UTC (permalink / raw)
  To: Xen-devel
  Cc: Andrew Cooper, Ian Jackson, Wei Liu, Jan Beulich,
	Roger Pau Monné,
	Juergen Gross

These aren't implemented consistently.  The one in resource/ is useless as the
binary needs running in dom0, and the layout in cpu-policy/ demonstrates the
weakness of this approach with multiple binaries.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Jackson <iwj@xenproject.org>
CC: Wei Liu <wl@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Juergen Gross <jgross@suse.com>
---
 tools/tests/cpu-policy/Makefile   | 4 ----
 tools/tests/resource/Makefile     | 4 ----
 tools/tests/vpci/Makefile         | 4 ----
 tools/tests/x86_emulator/Makefile | 4 ----
 4 files changed, 16 deletions(-)

diff --git a/tools/tests/cpu-policy/Makefile b/tools/tests/cpu-policy/Makefile
index 70ff154da6..53b4f28b2a 100644
--- a/tools/tests/cpu-policy/Makefile
+++ b/tools/tests/cpu-policy/Makefile
@@ -17,10 +17,6 @@ endif
 .PHONY: all
 all: $(TARGET-y)
 
-.PHONY: run
-run: $(TARGET-y)
-	./$(TARGET-y)
-
 .PHONY: clean
 clean:
 	$(RM) -f -- *.o .*.d .*.d2 test-cpu-policy
diff --git a/tools/tests/resource/Makefile b/tools/tests/resource/Makefile
index 4bef482966..da5e2a4f9b 100644
--- a/tools/tests/resource/Makefile
+++ b/tools/tests/resource/Makefile
@@ -6,10 +6,6 @@ TARGET := test-resource
 .PHONY: all
 all: $(TARGET)
 
-.PHONY: run
-run: $(TARGET)
-	./$(TARGET)
-
 .PHONY: clean
 clean:
 	$(RM) -f -- *.o $(TARGET) $(DEPS_RM)
diff --git a/tools/tests/vpci/Makefile b/tools/tests/vpci/Makefile
index 5075bc2be2..f172cefd3d 100644
--- a/tools/tests/vpci/Makefile
+++ b/tools/tests/vpci/Makefile
@@ -6,10 +6,6 @@ TARGET := test_vpci
 .PHONY: all
 all: $(TARGET)
 
-.PHONY: run
-run: $(TARGET)
-	./$(TARGET)
-
 $(TARGET): vpci.c vpci.h list.h main.c emul.h
 	$(HOSTCC) -g -o $@ vpci.c main.c
 
diff --git a/tools/tests/x86_emulator/Makefile b/tools/tests/x86_emulator/Makefile
index 7b07c31bbd..7b3f58b7a2 100644
--- a/tools/tests/x86_emulator/Makefile
+++ b/tools/tests/x86_emulator/Makefile
@@ -7,10 +7,6 @@ TARGET := test_x86_emulator
 .PHONY: all
 all:
 
-.PHONY: run
-run: $(TARGET)
-	./$(TARGET)
-
 # Add libx86 to the build
 vpath %.c $(XEN_ROOT)/xen/lib/x86
 
-- 
2.11.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 3/5] tests/resource: Rework Makefile
  2021-06-15 16:19 [PATCH 0/5] tools/tests: More cleanup for automation improvements Andrew Cooper
  2021-06-15 16:19 ` [PATCH 1/5] tools/tests: Drop obsolete mce-test infrastructure Andrew Cooper
  2021-06-15 16:19 ` [PATCH 2/5] tools/tests: Drop run runes Andrew Cooper
@ 2021-06-15 16:19 ` Andrew Cooper
  2021-06-15 16:49   ` Andrew Cooper
  2021-06-15 16:19 ` [PATCH 4/5] tests/cpu-policy: " Andrew Cooper
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Andrew Cooper @ 2021-06-15 16:19 UTC (permalink / raw)
  To: Xen-devel
  Cc: Andrew Cooper, Ian Jackson, Wei Liu, Jan Beulich,
	Roger Pau Monné,
	Juergen Gross

In particular, fill in the install/uninstall rules so this test can be
packaged to be automated sensibly.

Make all object files depend on the Makefile, and us $(TARGET) when
appropriate.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Jackson <iwj@xenproject.org>
CC: Wei Liu <wl@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Juergen Gross <jgross@suse.com>
---
 tools/tests/resource/Makefile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/tests/resource/Makefile b/tools/tests/resource/Makefile
index da5e2a4f9b..b22eb6fc21 100644
--- a/tools/tests/resource/Makefile
+++ b/tools/tests/resource/Makefile
@@ -16,9 +16,12 @@ distclean: clean
 
 .PHONY: install
 install: all
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC_BIN)
 
 .PHONY: uninstall
 uninstall:
+	$(RM) -f -- $(DESTDIR)$(LIBEXEC_BIN)/$(TARGET)
 
 CFLAGS += -Werror
 CFLAGS += $(CFLAGS_xeninclude)
@@ -30,7 +33,9 @@ LDFLAGS += $(LDLIBS_libxenctrl)
 LDFLAGS += $(LDLIBS_libxenforeignmemory)
 LDFLAGS += $(APPEND_LDFLAGS)
 
-test-resource: test-resource.o
+*.o: Makefile
+
+$(TARGET): test-resource.o
 	$(CC) -o $@ $< $(LDFLAGS)
 
 -include $(DEPS_INCLUDE)
-- 
2.11.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 4/5] tests/cpu-policy: Rework Makefile
  2021-06-15 16:19 [PATCH 0/5] tools/tests: More cleanup for automation improvements Andrew Cooper
                   ` (2 preceding siblings ...)
  2021-06-15 16:19 ` [PATCH 3/5] tests/resource: Rework Makefile Andrew Cooper
@ 2021-06-15 16:19 ` Andrew Cooper
  2021-06-15 16:19 ` [PATCH 5/5] tests/xenstore: " Andrew Cooper
  2021-06-16  6:38 ` [PATCH 0/5] tools/tests: More cleanup for automation improvements Jan Beulich
  5 siblings, 0 replies; 16+ messages in thread
From: Andrew Cooper @ 2021-06-15 16:19 UTC (permalink / raw)
  To: Xen-devel
  Cc: Andrew Cooper, Ian Jackson, Wei Liu, Jan Beulich,
	Roger Pau Monné,
	Juergen Gross

In particular, fill in the install/uninstall rules so this test can be
packaged to be automated sensibly.

Rework TARGET-y to be TARGETS, drop the unconditional -O3 and use the default
instead, and drop CFLAGS from the link line but honour APPEND_LDFLAGS.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Jackson <iwj@xenproject.org>
CC: Wei Liu <wl@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Juergen Gross <jgross@suse.com>
---
 tools/tests/cpu-policy/Makefile | 29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/tools/tests/cpu-policy/Makefile b/tools/tests/cpu-policy/Makefile
index 53b4f28b2a..ab3e0ffde3 100644
--- a/tools/tests/cpu-policy/Makefile
+++ b/tools/tests/cpu-policy/Makefile
@@ -1,25 +1,23 @@
 XEN_ROOT = $(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-TARGET-y := test-cpu-policy
+TARGETS :=
 
 # For brevity, these tests make extensive use of designated initialisers in
 # anonymous unions, but GCCs older than 4.6 can't cope.  Ignore the test in
 # this case.
-ifneq ($(clang),y)
-TARGET-$(call cc-ver,$(CC),lt,0x040600) :=
-endif
-
-ifeq ($(TARGET-y),)
+ifneq ($(gcc)$(call cc-ver,$(CC),lt,0x040600),yy)
+TARGETS += test-cpu-policy
+else
 $(warning Test harness not built, use newer compiler than "$(CC)" (version $(shell $(CC) -dumpversion)))
 endif
 
 .PHONY: all
-all: $(TARGET-y)
+all: $(TARGETS)
 
 .PHONY: clean
 clean:
-	$(RM) -f -- *.o .*.d .*.d2 test-cpu-policy
+	$(RM) -f -- *.o $(TARGETS) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
@@ -27,15 +25,24 @@ distclean: clean
 
 .PHONY: install
 install: all
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+	$(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC_BIN))
 
 .PHONY: uninstall
+uninstall:
+	$(RM) -f -- $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/,$(TARGETS))
 
-CFLAGS += -Werror $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -O3
+CFLAGS += -Werror -D__XEN_TOOLS__
+CFLAGS += $(CFLAGS_xeninclude)
 CFLAGS += $(APPEND_CFLAGS)
 
-vpath %.c ../../../xen/lib/x86
+LDFLAGS += $(APPEND_LDFLAGS)
+
+vpath %.c $(XEN_ROOT)/xen/lib/x86
+
+*.o: Makefile
 
 test-cpu-policy: test-cpu-policy.o msr.o cpuid.o policy.o
-	$(CC) $(CFLAGS) $^ -o $@
+	$(CC) $^ -o $@ $(LDFLAGS)
 
 -include $(DEPS_INCLUDE)
-- 
2.11.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 5/5] tests/xenstore: Rework Makefile
  2021-06-15 16:19 [PATCH 0/5] tools/tests: More cleanup for automation improvements Andrew Cooper
                   ` (3 preceding siblings ...)
  2021-06-15 16:19 ` [PATCH 4/5] tests/cpu-policy: " Andrew Cooper
@ 2021-06-15 16:19 ` Andrew Cooper
  2021-06-15 17:37   ` Andrew Cooper
  2021-06-16  6:38 ` [PATCH 0/5] tools/tests: More cleanup for automation improvements Jan Beulich
  5 siblings, 1 reply; 16+ messages in thread
From: Andrew Cooper @ 2021-06-15 16:19 UTC (permalink / raw)
  To: Xen-devel
  Cc: Andrew Cooper, Ian Jackson, Wei Liu, Jan Beulich,
	Roger Pau Monné,
	Juergen Gross

In particular, fill in the install/uninstall rules so this test can be
packaged to be automated sensibly.

Rename xs-test to test-xenstore to be consistent with other tests.  Honour
APPEND_FLAGS too.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Ian Jackson <iwj@xenproject.org>
CC: Wei Liu <wl@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Juergen Gross <jgross@suse.com>
---
 .gitignore                                         |  1 -
 tools/tests/xenstore/.gitignore                    |  1 +
 tools/tests/xenstore/Makefile                      | 31 +++++++++++++++-------
 .../tests/xenstore/{xs-test.c => test-xenstore.c}  |  0
 4 files changed, 23 insertions(+), 10 deletions(-)
 create mode 100644 tools/tests/xenstore/.gitignore
 rename tools/tests/xenstore/{xs-test.c => test-xenstore.c} (100%)

diff --git a/.gitignore b/.gitignore
index d4b90303b2..8ebb51b6c5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -275,7 +275,6 @@ tools/tests/x86_emulator/*sse*.[ch]
 tools/tests/x86_emulator/test_x86_emulator
 tools/tests/x86_emulator/x86_emulate
 tools/tests/x86_emulator/xop*.[ch]
-tools/tests/xenstore/xs-test
 tools/tests/vpci/list.h
 tools/tests/vpci/vpci.[hc]
 tools/tests/vpci/test_vpci
diff --git a/tools/tests/xenstore/.gitignore b/tools/tests/xenstore/.gitignore
new file mode 100644
index 0000000000..4b44f5dd60
--- /dev/null
+++ b/tools/tests/xenstore/.gitignore
@@ -0,0 +1 @@
+test-xenstore
diff --git a/tools/tests/xenstore/Makefile b/tools/tests/xenstore/Makefile
index a367d88803..3c7b7073fd 100644
--- a/tools/tests/xenstore/Makefile
+++ b/tools/tests/xenstore/Makefile
@@ -1,11 +1,7 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -Werror
-
-CFLAGS += $(CFLAGS_libxenstore)
-
-TARGETS-y := xs-test
+TARGETS-y := test-xenstore
 TARGETS := $(TARGETS-y)
 
 .PHONY: all
@@ -16,14 +12,31 @@ build: $(TARGETS)
 
 .PHONY: clean
 clean:
-	$(RM) *.o $(TARGETS) *~ $(DEPS_RM)
+	$(RM) -f -- *.o $(TARGETS) $(DEPS_RM)
 
 .PHONY: distclean
 distclean: clean
+	$(RM) -f -- *~
+
+.PHONY: install
+install: all
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+	$(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC_BIN))
+
+.PHONY: uninstall
+uninstall:
+	$(RM) -f -- $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/,$(TARGETS))
+
+CFLAGS += -Werror
+CFLAGS += $(CFLAGS_libxenstore)
+CFLAGS += $(APPEND_CFLAGS)
+
+LDFLAGS += $(LDLIBS_libxenstore)
+LDFLAGS += $(APPEND_LDFLAGS)
 
-xs-test: xs-test.o Makefile
-	$(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenstore)
+%.o: Makefile
 
-install uninstall:
+test-xenstore: test-xenstore.o
+	$(CC) -o $@ $< $(LDFLAGS)
 
 -include $(DEPS_INCLUDE)
diff --git a/tools/tests/xenstore/xs-test.c b/tools/tests/xenstore/test-xenstore.c
similarity index 100%
rename from tools/tests/xenstore/xs-test.c
rename to tools/tests/xenstore/test-xenstore.c
-- 
2.11.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 3/5] tests/resource: Rework Makefile
  2021-06-15 16:19 ` [PATCH 3/5] tests/resource: Rework Makefile Andrew Cooper
@ 2021-06-15 16:49   ` Andrew Cooper
  0 siblings, 0 replies; 16+ messages in thread
From: Andrew Cooper @ 2021-06-15 16:49 UTC (permalink / raw)
  To: Xen-devel
  Cc: Ian Jackson, Wei Liu, Jan Beulich, Roger Pau Monné, Juergen Gross

On 15/06/2021 17:19, Andrew Cooper wrote:
> In particular, fill in the install/uninstall rules so this test can be
> packaged to be automated sensibly.
>
> Make all object files depend on the Makefile, and us $(TARGET) when
> appropriate.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Ian Jackson <iwj@xenproject.org>
> CC: Wei Liu <wl@xen.org>
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> CC: Juergen Gross <jgross@suse.com>
> ---
>  tools/tests/resource/Makefile | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tools/tests/resource/Makefile b/tools/tests/resource/Makefile
> index da5e2a4f9b..b22eb6fc21 100644
> --- a/tools/tests/resource/Makefile
> +++ b/tools/tests/resource/Makefile
> @@ -16,9 +16,12 @@ distclean: clean
>  
>  .PHONY: install
>  install: all
> +	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
> +	$(INSTALL_PROG) $(TARGET) $(DESTDIR)$(LIBEXEC_BIN)
>  
>  .PHONY: uninstall
>  uninstall:
> +	$(RM) -f -- $(DESTDIR)$(LIBEXEC_BIN)/$(TARGET)

I've finally figured out where $(RM) comes from.  Its a GNU Make
default, and has ` -f` included.

I've altered this and later patches in the series to take this into account.

~Andrew


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 5/5] tests/xenstore: Rework Makefile
  2021-06-15 16:19 ` [PATCH 5/5] tests/xenstore: " Andrew Cooper
@ 2021-06-15 17:37   ` Andrew Cooper
  0 siblings, 0 replies; 16+ messages in thread
From: Andrew Cooper @ 2021-06-15 17:37 UTC (permalink / raw)
  To: Xen-devel
  Cc: Ian Jackson, Wei Liu, Jan Beulich, Roger Pau Monné, Juergen Gross

On 15/06/2021 17:19, Andrew Cooper wrote:
> In particular, fill in the install/uninstall rules so this test can be
> packaged to be automated sensibly.
>
> Rename xs-test to test-xenstore to be consistent with other tests.  Honour
> APPEND_FLAGS too.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

It turns out that the absence of install rule previously meant that this
wasn't covered by CI.

It triggers test-xenstore.c:486:5: error: ignoring return value of
'asprintf', declared with attribute warn_unused_result
[-Werror=unused-result] on newer GCCs.

~Andrew


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/5] tools/tests: More cleanup for automation improvements
  2021-06-15 16:19 [PATCH 0/5] tools/tests: More cleanup for automation improvements Andrew Cooper
                   ` (4 preceding siblings ...)
  2021-06-15 16:19 ` [PATCH 5/5] tests/xenstore: " Andrew Cooper
@ 2021-06-16  6:38 ` Jan Beulich
  2021-06-16 13:22   ` Andrew Cooper
  5 siblings, 1 reply; 16+ messages in thread
From: Jan Beulich @ 2021-06-16  6:38 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Ian Jackson, Wei Liu, Roger Pau Monné, Juergen Gross, Xen-devel

On 15.06.2021 18:19, Andrew Cooper wrote:
> Jan/Roger: x86_emulator and vpci use $(HOSTCC) not $(CC).  While they are unit
> tests, we still potentially want to run them in dom0 rather than the build
> environment - particularly for x86_emulator which is heavily CPUID based and
> wants to run on a wide set of hardware.  Any issues moving them off $(HOSTCC)?

Well, yes, I'm afraid: If anything, we may need to build two binaries,
or build the one binary two different ways: The "run" (and "run32" for
the emulator harness) target wants a binary built with HOSTCC. The
install target (which prior to your series does nothing) indeed wants
building with CC. So maybe we want something like

install: HOSTCC:=$(CC)

plus suitable detection of whether the opposite set of objects are
presently in the build area, requiring a full rebuild? (Of course this
will work only as long as HOSTCC isn't used for any build time helper
binaries. See "x86emul: test AMX insns" for when this starts not to be
the case anymore for the emulator harness. So we'd need yet another
variable to express this detail.)

Jan



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/5] tools/tests: Drop run runes
  2021-06-15 16:19 ` [PATCH 2/5] tools/tests: Drop run runes Andrew Cooper
@ 2021-06-16  6:44   ` Jan Beulich
  2021-06-16 13:08     ` Andrew Cooper
  0 siblings, 1 reply; 16+ messages in thread
From: Jan Beulich @ 2021-06-16  6:44 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Ian Jackson, Wei Liu, Roger Pau Monné, Juergen Gross, Xen-devel

On 15.06.2021 18:19, Andrew Cooper wrote:
> --- a/tools/tests/x86_emulator/Makefile
> +++ b/tools/tests/x86_emulator/Makefile
> @@ -7,10 +7,6 @@ TARGET := test_x86_emulator
>  .PHONY: all
>  all:
>  
> -.PHONY: run
> -run: $(TARGET)
> -	./$(TARGET)
> -
>  # Add libx86 to the build
>  vpath %.c $(XEN_ROOT)/xen/lib/x86
>  

This is not only incomplete, but actively (specifically here for my
own frequent using of it, but other tests I do run occasionally as
well, and then also that same way) harming things as long as you
don't introduce an alternative way. Note the top-level Makefile
making use of these rules, and note also the run32 companion here.

Jan



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/5] tools/tests: Drop obsolete mce-test infrastructure
  2021-06-15 16:19 ` [PATCH 1/5] tools/tests: Drop obsolete mce-test infrastructure Andrew Cooper
@ 2021-06-16  6:46   ` Jan Beulich
  2021-06-16 12:51     ` Andrew Cooper
  0 siblings, 1 reply; 16+ messages in thread
From: Jan Beulich @ 2021-06-16  6:46 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Ian Jackson, Wei Liu, Roger Pau Monné, Juergen Gross, Xen-devel

On 15.06.2021 18:19, Andrew Cooper wrote:
> mce-test has a test suite, but it depends on xend, needs to run in-tree, and
> requires manual setup of at least one guest, and manual parameters to pass
> into cases.  Drop the test infrasturcture.
> 
> Move the one useful remaining item, xen-mceinj, into misc/, fixing some minor
> style issues as it goes.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

While I'm not generally in favor of dropping testing code, given the
constraints you mention
Acked-by: Jan Beulich <jbeulich@suse.com>

Jan



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 1/5] tools/tests: Drop obsolete mce-test infrastructure
  2021-06-16  6:46   ` Jan Beulich
@ 2021-06-16 12:51     ` Andrew Cooper
  0 siblings, 0 replies; 16+ messages in thread
From: Andrew Cooper @ 2021-06-16 12:51 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Ian Jackson, Wei Liu, Roger Pau Monné, Juergen Gross, Xen-devel

On 16/06/2021 07:46, Jan Beulich wrote:
> On 15.06.2021 18:19, Andrew Cooper wrote:
>> mce-test has a test suite, but it depends on xend, needs to run in-tree, and
>> requires manual setup of at least one guest, and manual parameters to pass
>> into cases.  Drop the test infrasturcture.
>>
>> Move the one useful remaining item, xen-mceinj, into misc/, fixing some minor
>> style issues as it goes.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> While I'm not generally in favor of dropping testing code, given the
> constraints you mention
> Acked-by: Jan Beulich <jbeulich@suse.com>

Thanks.

Testing at this level is really in the OSSTest/XenRT realm, as it
involves coordination between guests and checking logs after the fact. 
However, the need to pass raw addresses around to make any of it work in
the first place make this manual in practice.

~Andrew



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/5] tools/tests: Drop run runes
  2021-06-16  6:44   ` Jan Beulich
@ 2021-06-16 13:08     ` Andrew Cooper
  2021-06-16 13:59       ` Jan Beulich
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew Cooper @ 2021-06-16 13:08 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Ian Jackson, Wei Liu, Roger Pau Monné, Juergen Gross, Xen-devel

On 16/06/2021 07:44, Jan Beulich wrote:
> On 15.06.2021 18:19, Andrew Cooper wrote:
>> --- a/tools/tests/x86_emulator/Makefile
>> +++ b/tools/tests/x86_emulator/Makefile
>> @@ -7,10 +7,6 @@ TARGET := test_x86_emulator
>>  .PHONY: all
>>  all:
>>  
>> -.PHONY: run
>> -run: $(TARGET)
>> -	./$(TARGET)
>> -
>>  # Add libx86 to the build
>>  vpath %.c $(XEN_ROOT)/xen/lib/x86
>>  
> This is not only incomplete, but actively (specifically here for my
> own frequent using of it, but other tests I do run occasionally as
> well, and then also that same way) harming things as long as you
> don't introduce an alternative way. Note the top-level Makefile
> making use of these rules, and note also the run32 companion here.

Honestly, this makefile is borderline impossible to follow.  I failed to
make the install runes work, which is part of why I deferred the
unit-like tests for now.

But I'm taking this as a strong preference to keep the run target?

TBH, this patch is a little on the side of the rest of the series.  I
stand by my commit message though - these are inconsistent, and buggy in
at least one case.

~Andrew



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/5] tools/tests: More cleanup for automation improvements
  2021-06-16  6:38 ` [PATCH 0/5] tools/tests: More cleanup for automation improvements Jan Beulich
@ 2021-06-16 13:22   ` Andrew Cooper
  2021-06-16 14:14     ` Jan Beulich
  0 siblings, 1 reply; 16+ messages in thread
From: Andrew Cooper @ 2021-06-16 13:22 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Ian Jackson, Wei Liu, Roger Pau Monné, Juergen Gross, Xen-devel

On 16/06/2021 07:38, Jan Beulich wrote:
> On 15.06.2021 18:19, Andrew Cooper wrote:
>> Jan/Roger: x86_emulator and vpci use $(HOSTCC) not $(CC).  While they are unit
>> tests, we still potentially want to run them in dom0 rather than the build
>> environment - particularly for x86_emulator which is heavily CPUID based and
>> wants to run on a wide set of hardware.  Any issues moving them off $(HOSTCC)?
> Well, yes, I'm afraid: If anything, we may need to build two binaries,
> or build the one binary two different ways: The "run" (and "run32" for
> the emulator harness) target wants a binary built with HOSTCC. The
> install target (which prior to your series does nothing) indeed wants
> building with CC. So maybe we want something like
>
> install: HOSTCC:=$(CC)
>
> plus suitable detection of whether the opposite set of objects are
> presently in the build area, requiring a full rebuild? (Of course this
> will work only as long as HOSTCC isn't used for any build time helper
> binaries. See "x86emul: test AMX insns" for when this starts not to be
> the case anymore for the emulator harness. So we'd need yet another
> variable to express this detail.)

Having slept on the problem overnight, I'm going to argue that HOSTCC is
conceptually wrong to use here in the first place.

In an arm64 environment, cross-compiling x86_64, this will explode
everywhere, and the fault is with using HOSTCC rather than CC.

HOSTCC is specifically for compiling utilities executed as part of the
build.  Tests, and particularly arch-specific ones like x86_emulate, are
not in this category.  Whether you happen to be able to run
test_x86_emulator in the build environment is a property of whether
you're cross-compiling.

For a non-cross-compiled builds, HOSTCC and CC are largely
interchangeable, and won't impact the ability to run the binary in the
build environment.

~Andrew



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 2/5] tools/tests: Drop run runes
  2021-06-16 13:08     ` Andrew Cooper
@ 2021-06-16 13:59       ` Jan Beulich
  0 siblings, 0 replies; 16+ messages in thread
From: Jan Beulich @ 2021-06-16 13:59 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Ian Jackson, Wei Liu, Roger Pau Monné, Juergen Gross, Xen-devel

On 16.06.2021 15:08, Andrew Cooper wrote:
> On 16/06/2021 07:44, Jan Beulich wrote:
>> On 15.06.2021 18:19, Andrew Cooper wrote:
>>> --- a/tools/tests/x86_emulator/Makefile
>>> +++ b/tools/tests/x86_emulator/Makefile
>>> @@ -7,10 +7,6 @@ TARGET := test_x86_emulator
>>>  .PHONY: all
>>>  all:
>>>  
>>> -.PHONY: run
>>> -run: $(TARGET)
>>> -	./$(TARGET)
>>> -
>>>  # Add libx86 to the build
>>>  vpath %.c $(XEN_ROOT)/xen/lib/x86
>>>  
>> This is not only incomplete, but actively (specifically here for my
>> own frequent using of it, but other tests I do run occasionally as
>> well, and then also that same way) harming things as long as you
>> don't introduce an alternative way. Note the top-level Makefile
>> making use of these rules, and note also the run32 companion here.
> 
> Honestly, this makefile is borderline impossible to follow.  I failed to
> make the install runes work, which is part of why I deferred the
> unit-like tests for now.

Well, yes, it's not pretty, but I lack ideas for a clear improvement.

> But I'm taking this as a strong preference to keep the run target?

Yes, and not just here. Any test that can be run directly in the build
tree would imo better have such a target, so re-building and running
it can be invoked with a single make invocation. Having to re-build
the entire tools/ in order to then (re-)run one of these tests is, in
particular, way too much latency.

Jan



^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH 0/5] tools/tests: More cleanup for automation improvements
  2021-06-16 13:22   ` Andrew Cooper
@ 2021-06-16 14:14     ` Jan Beulich
  0 siblings, 0 replies; 16+ messages in thread
From: Jan Beulich @ 2021-06-16 14:14 UTC (permalink / raw)
  To: Andrew Cooper
  Cc: Ian Jackson, Wei Liu, Roger Pau Monné, Juergen Gross, Xen-devel

On 16.06.2021 15:22, Andrew Cooper wrote:
> On 16/06/2021 07:38, Jan Beulich wrote:
>> On 15.06.2021 18:19, Andrew Cooper wrote:
>>> Jan/Roger: x86_emulator and vpci use $(HOSTCC) not $(CC).  While they are unit
>>> tests, we still potentially want to run them in dom0 rather than the build
>>> environment - particularly for x86_emulator which is heavily CPUID based and
>>> wants to run on a wide set of hardware.  Any issues moving them off $(HOSTCC)?
>> Well, yes, I'm afraid: If anything, we may need to build two binaries,
>> or build the one binary two different ways: The "run" (and "run32" for
>> the emulator harness) target wants a binary built with HOSTCC. The
>> install target (which prior to your series does nothing) indeed wants
>> building with CC. So maybe we want something like
>>
>> install: HOSTCC:=$(CC)
>>
>> plus suitable detection of whether the opposite set of objects are
>> presently in the build area, requiring a full rebuild? (Of course this
>> will work only as long as HOSTCC isn't used for any build time helper
>> binaries. See "x86emul: test AMX insns" for when this starts not to be
>> the case anymore for the emulator harness. So we'd need yet another
>> variable to express this detail.)
> 
> Having slept on the problem overnight, I'm going to argue that HOSTCC is
> conceptually wrong to use here in the first place.
> 
> In an arm64 environment, cross-compiling x86_64, this will explode
> everywhere, and the fault is with using HOSTCC rather than CC.

In principle, if there wasn't the massive amount of inline assembly,
and if the emulator wasn't just re-executing the instructions it is
asked to emulate, building all of this on Arm ought to be possible.
But with the code we have this simply makes no sense.

> HOSTCC is specifically for compiling utilities executed as part of the
> build.  Tests, and particularly arch-specific ones like x86_emulate, are
> not in this category.

Hmm, right now they definitely are. Running them directly (which is
their only purpose right now, with the install targets doing nothing)
from the build tree puts them into this category. But they aren't
anymore as soon as you want to install them. Hence the need to have
two modes here.

>  Whether you happen to be able to run
> test_x86_emulator in the build environment is a property of whether
> you're cross-compiling.

In a way, yes. I'd consider the run32 target to also be cross-like,
yet that binary can then still be run from the build tree (if the
distro supports 32-bit binaries).

> For a non-cross-compiled builds, HOSTCC and CC are largely
> interchangeable, and won't impact the ability to run the binary in the
> build environment.

Not exactly, I think. If I override CC but not HOSTCC (which I do
normally), I still don't need to worry about that other CC finding
all the bits and pieces it needs for building a host binary. For the
C compiler this may not mean much, but the C++ compiler (if we used
it and hence would need to treat it similarly) wants e.g. its own
copies of the headers, which may not be readily available. I will
admit that my environment may be pretty non-standard, as I run non-
default compilers (and binutils) also directly from their build
trees. But things have been working fine this way for all sorts of
projects, so I expect the test harness here to not break in this
regard.

Jan



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2021-06-16 14:14 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15 16:19 [PATCH 0/5] tools/tests: More cleanup for automation improvements Andrew Cooper
2021-06-15 16:19 ` [PATCH 1/5] tools/tests: Drop obsolete mce-test infrastructure Andrew Cooper
2021-06-16  6:46   ` Jan Beulich
2021-06-16 12:51     ` Andrew Cooper
2021-06-15 16:19 ` [PATCH 2/5] tools/tests: Drop run runes Andrew Cooper
2021-06-16  6:44   ` Jan Beulich
2021-06-16 13:08     ` Andrew Cooper
2021-06-16 13:59       ` Jan Beulich
2021-06-15 16:19 ` [PATCH 3/5] tests/resource: Rework Makefile Andrew Cooper
2021-06-15 16:49   ` Andrew Cooper
2021-06-15 16:19 ` [PATCH 4/5] tests/cpu-policy: " Andrew Cooper
2021-06-15 16:19 ` [PATCH 5/5] tests/xenstore: " Andrew Cooper
2021-06-15 17:37   ` Andrew Cooper
2021-06-16  6:38 ` [PATCH 0/5] tools/tests: More cleanup for automation improvements Jan Beulich
2021-06-16 13:22   ` Andrew Cooper
2021-06-16 14:14     ` Jan Beulich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.