diff options
Diffstat (limited to 'tools/tests')
-rw-r--r-- | tools/tests/mce-test/Makefile | 7 | ||||
-rw-r--r-- | tools/tests/mce-test/README | 75 | ||||
-rw-r--r-- | tools/tests/mce-test/cases/srao_llc/dom0/cases.sh | 74 | ||||
-rw-r--r-- | tools/tests/mce-test/cases/srao_llc/guest/cases.sh | 95 | ||||
-rw-r--r-- | tools/tests/mce-test/cases/srao_llc/xen/cases.sh | 70 | ||||
-rw-r--r-- | tools/tests/mce-test/cases/srao_mem/dom0/cases.sh | 74 | ||||
-rw-r--r-- | tools/tests/mce-test/cases/srao_mem/guest/cases.sh | 95 | ||||
-rw-r--r-- | tools/tests/mce-test/cases/srao_mem/xen/cases.sh | 70 | ||||
-rw-r--r-- | tools/tests/mce-test/cases/ucna_llc/dom0/cases.sh | 73 | ||||
-rw-r--r-- | tools/tests/mce-test/cases/ucna_llc/guest/cases.sh | 93 | ||||
-rw-r--r-- | tools/tests/mce-test/cases/ucna_llc/xen/cases.sh | 69 |
11 files changed, 795 insertions, 0 deletions
diff --git a/tools/tests/mce-test/Makefile b/tools/tests/mce-test/Makefile new file mode 100644 index 0000000000..7c80eb35f7 --- /dev/null +++ b/tools/tests/mce-test/Makefile @@ -0,0 +1,7 @@ +.PHONY: all clean + +all: + $(MAKE) -C tools + +clean: + $(MAKE) -C tools clean diff --git a/tools/tests/mce-test/README b/tools/tests/mce-test/README new file mode 100644 index 0000000000..65e6d1b045 --- /dev/null +++ b/tools/tests/mce-test/README @@ -0,0 +1,75 @@ +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 new file mode 100644 index 0000000000..8f63eaa7a1 --- /dev/null +++ b/tools/tests/mce-test/cases/srao_llc/dom0/cases.sh @@ -0,0 +1,74 @@ +#!/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, write to the Free Software Foundation, +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# +# 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 new file mode 100644 index 0000000000..16b0b8e696 --- /dev/null +++ b/tools/tests/mce-test/cases/srao_llc/guest/cases.sh @@ -0,0 +1,95 @@ +#!/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, write to the Free Software Foundation, +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# +# 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 new file mode 100644 index 0000000000..49e3e38ad9 --- /dev/null +++ b/tools/tests/mce-test/cases/srao_llc/xen/cases.sh @@ -0,0 +1,70 @@ +#!/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, write to the Free Software Foundation, +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# +# 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 new file mode 100644 index 0000000000..ea896d5084 --- /dev/null +++ b/tools/tests/mce-test/cases/srao_mem/dom0/cases.sh @@ -0,0 +1,74 @@ +#!/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, write to the Free Software Foundation, +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# +# 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 new file mode 100644 index 0000000000..2d6e054861 --- /dev/null +++ b/tools/tests/mce-test/cases/srao_mem/guest/cases.sh @@ -0,0 +1,95 @@ +#!/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, write to the Free Software Foundation, +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# +# 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 new file mode 100644 index 0000000000..7f0e213c2a --- /dev/null +++ b/tools/tests/mce-test/cases/srao_mem/xen/cases.sh @@ -0,0 +1,70 @@ +#!/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, write to the Free Software Foundation, +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# +# 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 new file mode 100644 index 0000000000..ab30ffcd35 --- /dev/null +++ b/tools/tests/mce-test/cases/ucna_llc/dom0/cases.sh @@ -0,0 +1,73 @@ +#!/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, write to the Free Software Foundation, +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# +# 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 new file mode 100644 index 0000000000..5212770b51 --- /dev/null +++ b/tools/tests/mce-test/cases/ucna_llc/guest/cases.sh @@ -0,0 +1,93 @@ +#!/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, write to the Free Software Foundation, +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# +# 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 new file mode 100644 index 0000000000..d1f6db5266 --- /dev/null +++ b/tools/tests/mce-test/cases/ucna_llc/xen/cases.sh @@ -0,0 +1,69 @@ +#!/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, write to the Free Software Foundation, +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +# +# 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 "$@" |