debuggers.hg

changeset 22684:a69ceb6ded92

Xen MCE test: all test cases

Implement the test cases. Each of cases will call the common function,
then call mce inject tool. README for Xen MCE test suite, include the
framwork and test instruction.

Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Signed-off-by: Haicheng Li<haicheng.li@intel.com>
Signed-off-by: Xudong Hao <xudong.hao@intel.com>
author Keir Fraser <keir@xen.org>
date Fri Dec 24 10:23:08 2010 +0000 (2010-12-24)
parents ca0b26180f32
children 0133cf2a72f5
files tools/tests/mce-test/Makefile tools/tests/mce-test/README tools/tests/mce-test/cases/srao_llc/dom0/cases.sh tools/tests/mce-test/cases/srao_llc/guest/cases.sh tools/tests/mce-test/cases/srao_llc/xen/cases.sh tools/tests/mce-test/cases/srao_mem/dom0/cases.sh tools/tests/mce-test/cases/srao_mem/guest/cases.sh tools/tests/mce-test/cases/srao_mem/xen/cases.sh tools/tests/mce-test/cases/ucna_llc/dom0/cases.sh tools/tests/mce-test/cases/ucna_llc/guest/cases.sh tools/tests/mce-test/cases/ucna_llc/xen/cases.sh
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/tests/mce-test/Makefile	Fri Dec 24 10:23:08 2010 +0000
     1.3 @@ -0,0 +1,7 @@
     1.4 +.PHONY: all clean
     1.5 +
     1.6 +all: 
     1.7 +	$(MAKE) -C tools
     1.8 +
     1.9 +clean:
    1.10 +	$(MAKE) -C tools clean
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/tests/mce-test/README	Fri Dec 24 10:23:08 2010 +0000
     2.3 @@ -0,0 +1,75 @@
     2.4 +Xen MCE test suite
     2.5 +---------------
     2.6 +
     2.7 +The Xen MCE test suite is a collection of tools and test scripts for
     2.8 +testing the Xen MCE processing features. The goal is to cover
     2.9 +most Xen MCE processing code paths and features with automation tests.
    2.10 +
    2.11 +
    2.12 +In the Package
    2.13 +--------------
    2.14 +
    2.15 +Here is a short description of what is included in the package
    2.16 +
    2.17 +README
    2.18 +	This is document
    2.19 +
    2.20 +Makefile
    2.21 +	For compile
    2.22 +
    2.23 +cases/*
    2.24 +	Contains all test cases, which may be organized in sub-directories, 
    2.25 +	the interface of test case is a shell script under cases/, such as:
    2.26 +	   -- cases/srao_mem/dom0/cases.sh
    2.27 +
    2.28 +config/*
    2.29 +	Contains test configuration files, which specifies the parameters 
    2.30 +	for test cases, etc.
    2.31 +
    2.32 +lib/*
    2.33 +	Contains some shell scripts, in which some common shell
    2.34 +	functions and variable definitions are defined to be used by
    2.35 +	test cases.
    2.36 +
    2.37 +tools/*
    2.38 +	Tools used by MCE test suites, now only xen-mceinj tool.
    2.39 +
    2.40 +results/
    2.41 +	When test is done, the test result will be placed in this
    2.42 +	directory, test results	of various cases may be in corresponding 
    2.43 +	directory. 
    2.44 +	For example, files in
    2.45 +	    results/srao_mem_dom0/result
    2.46 +	is the result for test case cases/srao_mem/dom0/cases.sh, there will
    2.47 +	be 3 result conditions: PASSED/FAILED/NORESULT.
    2.48 +		results/<test_case>/testlog   #the test log during testing
    2.49 +		results/<test_case>/mcelog    #mcelog output during testing
    2.50 +		results/<test_case>/xenlog    #Xen log during testing
    2.51 +		results/<test_case>/gklog     #VM guest kernel log during testing
    2.52 +		results/<test_case>/guest_config   #config file used to create guest
    2.53 +
    2.54 +
    2.55 +Test Instruction
    2.56 +----------------
    2.57 +
    2.58 +1.	make sure you have a dom0 with mce support
    2.59 +	CONFIG_X86_MCE=y
    2.60 +	CONFIG_X86_MCE_INTEL=y
    2.61 +	CONFIG_X86_MCE_AMD=y
    2.62 +	CONFIG_X86_MCE_THRESHOLD=y
    2.63 +	CONFIG_X86_MCE_INJECT=y
    2.64 +
    2.65 +2.	run system at xen and start xend. A installed guest image is
    2.66 +	necessary when do guest MCE error injection.
    2.67 +3.	compile tools that used to test. in mce-test, $make.
    2.68 +	Note: make sure compile xen/tools before do this step
    2.69 +4.	run test cases that you want.
    2.70 +	e.g. $sh cases/srao_mem/dom0/cases.sh -d 0 -p 0x0200 -c 2 -t 1
    2.71 +5.	get test result in results directory
    2.72 +
    2.73 +
    2.74 +Notes
    2.75 +----------------
    2.76 +All test cases fake a error and inject this error in 0x180020, For Xen
    2.77 +test cases(e.g. cases/srao_mem/xen/cases.sh), error happen on every page 
    2.78 +may cause a Xen panic. 
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tools/tests/mce-test/cases/srao_llc/dom0/cases.sh	Fri Dec 24 10:23:08 2010 +0000
     3.3 @@ -0,0 +1,74 @@
     3.4 +#!/bin/bash
     3.5 +#
     3.6 +# Copyright (c) 2010, Intel Corporation
     3.7 +# 
     3.8 +# This program is free software; you can redistribute it and/or
     3.9 +# modify it under the terms of the GNU General Public License version
    3.10 +# 2 as published by the Free Software Foundation.
    3.11 +# 
    3.12 +# This program is distributed in the hope that it will be useful, but
    3.13 +# WITHOUT ANY WARRANTY; without even the implied warranty of
    3.14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    3.15 +# General Public License for more details.
    3.16 +# 
    3.17 +# You should have received a copy of the GNU General Public License
    3.18 +# along with this program; if not, write to the Free Software Foundation,
    3.19 +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
    3.20 +#
    3.21 +# Author: Xudong Hao <xudong.hao@intel.com>
    3.22 +#
    3.23 +
    3.24 +sd=$(dirname $0)
    3.25 +export ROOT=`(cd $sd/../../../; pwd)`
    3.26 +export this_case=srao_llc_dom0
    3.27 +
    3.28 +. $ROOT/lib/xen-mceinj-tool.sh
    3.29 +
    3.30 +usage()
    3.31 +{
    3.32 +    echo "Usage: ./cases.sh [-options] [arguments]"
    3.33 +    echo "================Below are the optional options================"
    3.34 +    echo -e "\t-d domainID\t: 0"
    3.35 +    echo -e "\t-c injcpu\t: which cpu to inject error"
    3.36 +    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
    3.37 +    echo -e "\t\t\tBy default, the GPA is 0x180020"
    3.38 +    echo -e "\t-h help"
    3.39 +    exit 0
    3.40 +}
    3.41 +
    3.42 +while getopts ":c:d:p:h" option
    3.43 +do
    3.44 +    case "$option" in
    3.45 +    c) injcpu=$OPTARG;;
    3.46 +    d) domid=$OPTARG;;
    3.47 +    p) pageaddr=$OPTARG;;
    3.48 +    h) usage;;
    3.49 +    *) echo "invalid option!"; usage;;
    3.50 +    esac
    3.51 +done
    3.52 +
    3.53 +[ -z $domid ] && domid=0
    3.54 +
    3.55 +inject()
    3.56 +{
    3.57 +    mce_inject_trigger $MCE_SRAO_LLC -d $domid -u $injcpu -p $pageaddr 
    3.58 +    if [ $? -eq 0 ]; then
    3.59 +        show "  Passed: Successfully to fake and inject a MCE error"
    3.60 +    else
    3.61 +        show "  Failed: Fake error and inject fail !!"
    3.62 +        return 1
    3.63 +    fi
    3.64 +    return 0
    3.65 +}
    3.66 +
    3.67 +do_main()
    3.68 +{
    3.69 +    ret_val=0
    3.70 +    clean_env
    3.71 +    inject || ret_val=1
    3.72 +    xen_verify || ret_val=1
    3.73 +    mcelog_verify $MCE_SRAO_LLC || ret_val=1
    3.74 +    gen_result $ret_val
    3.75 +}
    3.76 +
    3.77 +do_main "$@"
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/tools/tests/mce-test/cases/srao_llc/guest/cases.sh	Fri Dec 24 10:23:08 2010 +0000
     4.3 @@ -0,0 +1,95 @@
     4.4 +#!/bin/bash
     4.5 +#
     4.6 +# Copyright (c) 2010, Intel Corporation
     4.7 +# 
     4.8 +# This program is free software; you can redistribute it and/or
     4.9 +# modify it under the terms of the GNU General Public License version
    4.10 +# 2 as published by the Free Software Foundation.
    4.11 +# 
    4.12 +# This program is distributed in the hope that it will be useful, but
    4.13 +# WITHOUT ANY WARRANTY; without even the implied warranty of
    4.14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    4.15 +# General Public License for more details.
    4.16 +# 
    4.17 +# You should have received a copy of the GNU General Public License
    4.18 +# along with this program; if not, write to the Free Software Foundation,
    4.19 +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
    4.20 +#
    4.21 +# Author: Xudong Hao <xudong.hao@intel.com>
    4.22 +#
    4.23 +
    4.24 +sd=$(dirname $0)
    4.25 +export ROOT=`(cd $sd/../../../; pwd)`
    4.26 +export this_case=srao_llc_guest
    4.27 +
    4.28 +. $ROOT/lib/xen-mceinj-tool.sh
    4.29 +
    4.30 +usage()
    4.31 +{
    4.32 +    echo "Usage: ./cases.sh [-options] [arguments]"
    4.33 +    echo "================Below are the must have options==============="
    4.34 +    echo -e "\t-i image\t: guest image"
    4.35 +    echo -e "\t-m memory\t: set guest virtual memory"
    4.36 +    echo "========                                              ========"
    4.37 +    echo "================Below are the optional options================"
    4.38 +    echo -e "\t-u vcpus\t: set guest virtual cpus number"
    4.39 +    echo -e "\t-c injcpu\t: which cpu to inject error"
    4.40 +    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
    4.41 +    echo -e "\t\t\tBy default, the GPA is 0x180020"
    4.42 +    echo -e "\t-h help"
    4.43 +    exit 0
    4.44 +}
    4.45 +
    4.46 +[ $# -lt 1 ] && usage
    4.47 +
    4.48 +while getopts ":i:u:m:c:p:hl:" option
    4.49 +do
    4.50 +    case "$option" in
    4.51 +    i) image=$OPTARG; offset=`kpartx -l $image | awk '{print $NF*512}'`;;
    4.52 +    u) vcpus=$OPTARG;;
    4.53 +    m) memory=$OPTARG;;
    4.54 +    c) injcpu=$OPTARG;;
    4.55 +    p) pageaddr=$OPTARG;;
    4.56 +    l) early_kill="0";;
    4.57 +    h) usage;;
    4.58 +    *) echo "invalid option!"; usage;;
    4.59 +    esac
    4.60 +done
    4.61 +
    4.62 +
    4.63 +start_guest()
    4.64 +{
    4.65 +    create_hvm_guest $image -u $vcpus -m $memory
    4.66 +    if [ $? -ne 0 ]; then
    4.67 +        echo "  Create guest fail!"
    4.68 +        return 1
    4.69 +    fi
    4.70 +    return 0
    4.71 +}
    4.72 +
    4.73 +inject()
    4.74 +{
    4.75 +    mce_inject_trigger $MCE_SRAO_LLC -u $injcpu -p $pageaddr 
    4.76 +    if [ $? -eq 0 ]; then
    4.77 +        show "  Passed: Successfully to fake and inject a MCE error"
    4.78 +    else
    4.79 +        show "  Failed: Fake error and inject fail !!"
    4.80 +        return 1
    4.81 +    fi
    4.82 +    return 0
    4.83 +}
    4.84 +
    4.85 +do_main()
    4.86 +{
    4.87 +    ret_val=0
    4.88 +    clean_env
    4.89 +    start_guest || ret_val=1
    4.90 +    inject || ret_val=1
    4.91 +    xen_verify || ret_val=1
    4.92 +    guest_verify || ret_val=1
    4.93 +    mcelog_verify $MCE_SRAO_LLC || ret_val=1
    4.94 +    des_guest
    4.95 +    gen_result $ret_val
    4.96 +}
    4.97 +
    4.98 +do_main "$@"
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/tools/tests/mce-test/cases/srao_llc/xen/cases.sh	Fri Dec 24 10:23:08 2010 +0000
     5.3 @@ -0,0 +1,70 @@
     5.4 +#!/bin/bash
     5.5 +#
     5.6 +# Copyright (c) 2010, Intel Corporation
     5.7 +# 
     5.8 +# This program is free software; you can redistribute it and/or
     5.9 +# modify it under the terms of the GNU General Public License version
    5.10 +# 2 as published by the Free Software Foundation.
    5.11 +# 
    5.12 +# This program is distributed in the hope that it will be useful, but
    5.13 +# WITHOUT ANY WARRANTY; without even the implied warranty of
    5.14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    5.15 +# General Public License for more details.
    5.16 +# 
    5.17 +# You should have received a copy of the GNU General Public License
    5.18 +# along with this program; if not, write to the Free Software Foundation,
    5.19 +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
    5.20 +#
    5.21 +# Author: Xudong Hao <xudong.hao@intel.com>
    5.22 +#
    5.23 +
    5.24 +sd=$(dirname $0)
    5.25 +export ROOT=`(cd $sd/../../../; pwd)`
    5.26 +export this_case=srao_llc_xen
    5.27 +
    5.28 +. $ROOT/lib/xen-mceinj-tool.sh
    5.29 +
    5.30 +usage()
    5.31 +{
    5.32 +    echo "Usage: ./cases.sh [-options] [arguments]"
    5.33 +    echo "================Below are the optional options================"
    5.34 +    echo -e "\t-c injcpu\t: which cpu to inject error"
    5.35 +    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
    5.36 +    echo -e "\t\t\tBy default, the GPA is 0x180020"
    5.37 +    echo -e "\t-h help"
    5.38 +    exit 0
    5.39 +}
    5.40 +
    5.41 +while getopts ":c:p:h" option
    5.42 +do
    5.43 +    case "$option" in
    5.44 +    c) injcpu=$OPTARG;;
    5.45 +    p) pageaddr=$OPTARG;;
    5.46 +    h) usage;;
    5.47 +    *) echo "invalid option!"; usage;;
    5.48 +    esac
    5.49 +done
    5.50 +
    5.51 +inject()
    5.52 +{
    5.53 +    mce_inject_trigger $MCE_SRAO_LLC -u $injcpu -p $pageaddr 
    5.54 +    if [ $? -eq 0 ]; then
    5.55 +        show "  Passed: Successfully to fake and inject a MCE error"
    5.56 +    else
    5.57 +        show "  Failed: Fake error and inject fail !!"
    5.58 +        return 1
    5.59 +    fi
    5.60 +    return 0
    5.61 +}
    5.62 +
    5.63 +do_main()
    5.64 +{
    5.65 +    ret_val=0
    5.66 +    clean_env
    5.67 +    inject || ret_val=1
    5.68 +    xen_verify || ret_val=1
    5.69 +    mcelog_verify $MCE_SRAO_LLC || ret_val=1
    5.70 +    gen_result $ret_val
    5.71 +}
    5.72 +
    5.73 +do_main "$@"
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/tools/tests/mce-test/cases/srao_mem/dom0/cases.sh	Fri Dec 24 10:23:08 2010 +0000
     6.3 @@ -0,0 +1,74 @@
     6.4 +#!/bin/bash
     6.5 +#
     6.6 +# Copyright (c) 2010, Intel Corporation
     6.7 +# 
     6.8 +# This program is free software; you can redistribute it and/or
     6.9 +# modify it under the terms of the GNU General Public License version
    6.10 +# 2 as published by the Free Software Foundation.
    6.11 +# 
    6.12 +# This program is distributed in the hope that it will be useful, but
    6.13 +# WITHOUT ANY WARRANTY; without even the implied warranty of
    6.14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    6.15 +# General Public License for more details.
    6.16 +# 
    6.17 +# You should have received a copy of the GNU General Public License
    6.18 +# along with this program; if not, write to the Free Software Foundation,
    6.19 +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
    6.20 +#
    6.21 +# Author: Xudong Hao <xudong.hao@intel.com>
    6.22 +#
    6.23 +
    6.24 +sd=$(dirname $0)
    6.25 +export ROOT=`(cd $sd/../../../; pwd)`
    6.26 +export this_case=srao_mem_dom0
    6.27 +
    6.28 +. $ROOT/lib/xen-mceinj-tool.sh
    6.29 +
    6.30 +usage()
    6.31 +{
    6.32 +    echo "Usage: ./cases.sh [-options] [arguments]"
    6.33 +    echo "================Below are the optional options================"
    6.34 +    echo -e "\t-d domainID\t: 0"
    6.35 +    echo -e "\t-c injcpu\t: which cpu to inject error"
    6.36 +    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
    6.37 +    echo -e "\t\t\tBy default, the GPA is 0x180020"
    6.38 +    echo -e "\t-h help"
    6.39 +    exit 0
    6.40 +}
    6.41 +
    6.42 +while getopts ":c:d:p:h" option
    6.43 +do
    6.44 +    case "$option" in
    6.45 +    c) injcpu=$OPTARG;;
    6.46 +    d) domid=$OPTARG;;
    6.47 +    p) pageaddr=$OPTARG;;
    6.48 +    h) usage;;
    6.49 +    *) echo "invalid option!"; usage;;
    6.50 +    esac
    6.51 +done
    6.52 +
    6.53 +[ -z $domid ] && domid=0
    6.54 +
    6.55 +inject()
    6.56 +{
    6.57 +    mce_inject_trigger $MCE_SRAO_MEM -d $domid -u $injcpu -p $pageaddr 
    6.58 +    if [ $? -eq 0 ]; then
    6.59 +        show "  Passed: Successfully to fake and inject a MCE error"
    6.60 +    else
    6.61 +        show "  Failed: Fake error and inject fail !!"
    6.62 +        return 1
    6.63 +    fi
    6.64 +    return 0
    6.65 +}
    6.66 +
    6.67 +do_main()
    6.68 +{
    6.69 +    ret_val=0
    6.70 +    clean_env
    6.71 +    inject || ret_val=1
    6.72 +    xen_verify || ret_val=1
    6.73 +    mcelog_verify $MCE_SRAO_MEM || ret_val=1
    6.74 +    gen_result $ret_val
    6.75 +}
    6.76 +
    6.77 +do_main "$@"
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/tools/tests/mce-test/cases/srao_mem/guest/cases.sh	Fri Dec 24 10:23:08 2010 +0000
     7.3 @@ -0,0 +1,95 @@
     7.4 +#!/bin/bash
     7.5 +#
     7.6 +# Copyright (c) 2010, Intel Corporation
     7.7 +# 
     7.8 +# This program is free software; you can redistribute it and/or
     7.9 +# modify it under the terms of the GNU General Public License version
    7.10 +# 2 as published by the Free Software Foundation.
    7.11 +# 
    7.12 +# This program is distributed in the hope that it will be useful, but
    7.13 +# WITHOUT ANY WARRANTY; without even the implied warranty of
    7.14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    7.15 +# General Public License for more details.
    7.16 +# 
    7.17 +# You should have received a copy of the GNU General Public License
    7.18 +# along with this program; if not, write to the Free Software Foundation,
    7.19 +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
    7.20 +#
    7.21 +# Author: Xudong Hao <xudong.hao@intel.com>
    7.22 +#
    7.23 +
    7.24 +sd=$(dirname $0)
    7.25 +export ROOT=`(cd $sd/../../../; pwd)`
    7.26 +export this_case=srao_mem_guest
    7.27 +
    7.28 +. $ROOT/lib/xen-mceinj-tool.sh
    7.29 +
    7.30 +usage()
    7.31 +{
    7.32 +    echo "Usage: ./cases.sh [-options] [arguments]"
    7.33 +    echo "================Below are the must have options==============="
    7.34 +    echo -e "\t-i image\t: guest image"
    7.35 +    echo -e "\t-m memory\t: set guest virtual memory"
    7.36 +    echo "========                                              ========"
    7.37 +    echo "================Below are the optional options================"
    7.38 +    echo -e "\t-u vcpus\t: set guest virtual cpus number"
    7.39 +    echo -e "\t-c injcpu\t: which cpu to inject error"
    7.40 +    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
    7.41 +    echo -e "\t\t\tBy default, the GPA is 0x180020"
    7.42 +    echo -e "\t-h help"
    7.43 +    exit 0
    7.44 +}
    7.45 +
    7.46 +[ $# -lt 1 ] && usage
    7.47 +
    7.48 +while getopts ":i:u:m:c:p:hl:" option
    7.49 +do
    7.50 +    case "$option" in
    7.51 +    i) image=$OPTARG; offset=`kpartx -l $image | awk '{print $NF*512}'`;;
    7.52 +    u) vcpus=$OPTARG;;
    7.53 +    m) memory=$OPTARG;;
    7.54 +    c) injcpu=$OPTARG;;
    7.55 +    p) pageaddr=$OPTARG;;
    7.56 +    l) early_kill="0";;
    7.57 +    h) usage;;
    7.58 +    *) echo "invalid option!"; usage;;
    7.59 +    esac
    7.60 +done
    7.61 +
    7.62 +
    7.63 +start_guest()
    7.64 +{
    7.65 +    create_hvm_guest $image -u $vcpus -m $memory
    7.66 +    if [ $? -ne 0 ]; then
    7.67 +        echo "  Create guest fail!"
    7.68 +        return 1
    7.69 +    fi
    7.70 +    return 0
    7.71 +}
    7.72 +
    7.73 +inject()
    7.74 +{
    7.75 +    mce_inject_trigger $MCE_SRAO_MEM -u $injcpu -p $pageaddr 
    7.76 +    if [ $? -eq 0 ]; then
    7.77 +        show "  Passed: Successfully to fake and inject a MCE error"
    7.78 +    else
    7.79 +        show "  Failed: Fake error and inject fail !!"
    7.80 +        return 1
    7.81 +    fi
    7.82 +    return 0
    7.83 +}
    7.84 +
    7.85 +do_main()
    7.86 +{
    7.87 +    ret_val=0
    7.88 +    clean_env
    7.89 +    start_guest || ret_val=1
    7.90 +    inject || ret_val=1
    7.91 +    xen_verify || ret_val=1
    7.92 +    guest_verify || ret_val=1
    7.93 +    mcelog_verify $MCE_SRAO_MEM || ret_val=1
    7.94 +    des_guest
    7.95 +    gen_result $ret_val
    7.96 +}
    7.97 +
    7.98 +do_main "$@"
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/tools/tests/mce-test/cases/srao_mem/xen/cases.sh	Fri Dec 24 10:23:08 2010 +0000
     8.3 @@ -0,0 +1,70 @@
     8.4 +#!/bin/bash
     8.5 +#
     8.6 +# Copyright (c) 2010, Intel Corporation
     8.7 +# 
     8.8 +# This program is free software; you can redistribute it and/or
     8.9 +# modify it under the terms of the GNU General Public License version
    8.10 +# 2 as published by the Free Software Foundation.
    8.11 +# 
    8.12 +# This program is distributed in the hope that it will be useful, but
    8.13 +# WITHOUT ANY WARRANTY; without even the implied warranty of
    8.14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    8.15 +# General Public License for more details.
    8.16 +# 
    8.17 +# You should have received a copy of the GNU General Public License
    8.18 +# along with this program; if not, write to the Free Software Foundation,
    8.19 +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
    8.20 +#
    8.21 +# Author: Xudong Hao <xudong.hao@intel.com>
    8.22 +#
    8.23 +
    8.24 +sd=$(dirname $0)
    8.25 +export ROOT=`(cd $sd/../../../; pwd)`
    8.26 +export this_case=srao_mem_xen
    8.27 +
    8.28 +. $ROOT/lib/xen-mceinj-tool.sh
    8.29 +
    8.30 +usage()
    8.31 +{
    8.32 +    echo "Usage: ./cases.sh [-options] [arguments]"
    8.33 +    echo "================Below are the optional options================"
    8.34 +    echo -e "\t-c injcpu\t: which cpu to inject error"
    8.35 +    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
    8.36 +    echo -e "\t\t\tBy default, the GPA is 0x180020"
    8.37 +    echo -e "\t-h help"
    8.38 +    exit 0
    8.39 +}
    8.40 +
    8.41 +while getopts ":c:p:h" option
    8.42 +do
    8.43 +    case "$option" in
    8.44 +    c) injcpu=$OPTARG;;
    8.45 +    p) pageaddr=$OPTARG;;
    8.46 +    h) usage;;
    8.47 +    *) echo "invalid option!"; usage;;
    8.48 +    esac
    8.49 +done
    8.50 +
    8.51 +inject()
    8.52 +{
    8.53 +    mce_inject_trigger $MCE_SRAO_MEM -u $injcpu -p $pageaddr 
    8.54 +    if [ $? -eq 0 ]; then
    8.55 +        show "  Passed: Successfully to fake and inject a MCE error"
    8.56 +    else
    8.57 +        show "  Failed: Fake error and inject fail !!"
    8.58 +        return 1
    8.59 +    fi
    8.60 +    return 0
    8.61 +}
    8.62 +
    8.63 +do_main()
    8.64 +{
    8.65 +    ret_val=0
    8.66 +    clean_env
    8.67 +    inject || ret_val=1
    8.68 +    xen_verify || ret_val=1
    8.69 +    mcelog_verify $MCE_SRAO_MEM || ret_val=1
    8.70 +    gen_result $ret_val
    8.71 +}
    8.72 +
    8.73 +do_main "$@"
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/tools/tests/mce-test/cases/ucna_llc/dom0/cases.sh	Fri Dec 24 10:23:08 2010 +0000
     9.3 @@ -0,0 +1,73 @@
     9.4 +#!/bin/bash
     9.5 +#
     9.6 +# Copyright (c) 2010, Intel Corporation
     9.7 +# 
     9.8 +# This program is free software; you can redistribute it and/or
     9.9 +# modify it under the terms of the GNU General Public License version
    9.10 +# 2 as published by the Free Software Foundation.
    9.11 +# 
    9.12 +# This program is distributed in the hope that it will be useful, but
    9.13 +# WITHOUT ANY WARRANTY; without even the implied warranty of
    9.14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    9.15 +# General Public License for more details.
    9.16 +# 
    9.17 +# You should have received a copy of the GNU General Public License
    9.18 +# along with this program; if not, write to the Free Software Foundation,
    9.19 +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
    9.20 +#
    9.21 +# Author: Xudong Hao <xudong.hao@intel.com>
    9.22 +#
    9.23 +
    9.24 +sd=$(dirname $0)
    9.25 +export ROOT=`(cd $sd/../../../; pwd)`
    9.26 +export this_case=ucna_llc_dom0
    9.27 +
    9.28 +. $ROOT/lib/xen-mceinj-tool.sh
    9.29 +
    9.30 +usage()
    9.31 +{
    9.32 +    echo "Usage: ./cases.sh [-options] [arguments]"
    9.33 +    echo "================Below are the optional options================"
    9.34 +    echo -e "\t-d domainID\t: 0"
    9.35 +    echo -e "\t-c injcpu\t: which cpu to inject error"
    9.36 +    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
    9.37 +    echo -e "\t\t\tBy default, the GPA is 0x180020"
    9.38 +    echo -e "\t-h help"
    9.39 +    exit 0
    9.40 +}
    9.41 +
    9.42 +while getopts ":c:d:p:h" option
    9.43 +do
    9.44 +    case "$option" in
    9.45 +    c) injcpu=$OPTARG;;
    9.46 +    d) domid=$OPTARG;;
    9.47 +    p) pageaddr=$OPTARG;;
    9.48 +    h) usage;;
    9.49 +    *) echo "invalid option!"; usage;;
    9.50 +    esac
    9.51 +done
    9.52 +
    9.53 +[ -z $domid ] && domid=0
    9.54 +
    9.55 +inject()
    9.56 +{
    9.57 +    mce_inject_trigger $CMCI_UCNA_LLC -d $domid -u $injcpu -p $pageaddr 
    9.58 +    if [ $? -eq 0 ]; then
    9.59 +        show "  Passed: Successfully to fake and inject a MCE error"
    9.60 +    else
    9.61 +        show "  Failed: Fake error and inject fail !!"
    9.62 +        return 1
    9.63 +    fi
    9.64 +    return 0
    9.65 +}
    9.66 +
    9.67 +do_main()
    9.68 +{
    9.69 +    ret_val=0
    9.70 +    clean_env
    9.71 +    inject || ret_val=1
    9.72 +    mcelog_verify $CMCI_UCNA_LLC || ret_val=1
    9.73 +    gen_result $ret_val
    9.74 +}
    9.75 +
    9.76 +do_main "$@"
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/tools/tests/mce-test/cases/ucna_llc/guest/cases.sh	Fri Dec 24 10:23:08 2010 +0000
    10.3 @@ -0,0 +1,93 @@
    10.4 +#!/bin/bash
    10.5 +#
    10.6 +# Copyright (c) 2010, Intel Corporation
    10.7 +# 
    10.8 +# This program is free software; you can redistribute it and/or
    10.9 +# modify it under the terms of the GNU General Public License version
   10.10 +# 2 as published by the Free Software Foundation.
   10.11 +# 
   10.12 +# This program is distributed in the hope that it will be useful, but
   10.13 +# WITHOUT ANY WARRANTY; without even the implied warranty of
   10.14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   10.15 +# General Public License for more details.
   10.16 +# 
   10.17 +# You should have received a copy of the GNU General Public License
   10.18 +# along with this program; if not, write to the Free Software Foundation,
   10.19 +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
   10.20 +#
   10.21 +# Author: Xudong Hao <xudong.hao@intel.com>
   10.22 +#
   10.23 +
   10.24 +sd=$(dirname $0)
   10.25 +export ROOT=`(cd $sd/../../../; pwd)`
   10.26 +export this_case=ucna_llc_guest
   10.27 +
   10.28 +. $ROOT/lib/xen-mceinj-tool.sh
   10.29 +
   10.30 +usage()
   10.31 +{
   10.32 +    echo "Usage: ./cases.sh [-options] [arguments]"
   10.33 +    echo "================Below are the must have options==============="
   10.34 +    echo -e "\t-i image\t: guest image"
   10.35 +    echo -e "\t-m memory\t: set guest virtual memory"
   10.36 +    echo "========                                              ========"
   10.37 +    echo "================Below are the optional options================"
   10.38 +    echo -e "\t-u vcpus\t: set guest virtual cpus number"
   10.39 +    echo -e "\t-c injcpu\t: which cpu to inject error"
   10.40 +    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
   10.41 +    echo -e "\t\t\tBy default, the GPA is 0x180020"
   10.42 +    echo -e "\t-h help"
   10.43 +    exit 0
   10.44 +}
   10.45 +
   10.46 +[ $# -lt 1 ] && usage
   10.47 +
   10.48 +while getopts ":i:u:m:c:p:hl:" option
   10.49 +do
   10.50 +    case "$option" in
   10.51 +    i) image=$OPTARG; offset=`kpartx -l $image | awk '{print $NF*512}'`;;
   10.52 +    u) vcpus=$OPTARG;;
   10.53 +    m) memory=$OPTARG;;
   10.54 +    c) injcpu=$OPTARG;;
   10.55 +    p) pageaddr=$OPTARG;;
   10.56 +    l) early_kill="0";;
   10.57 +    h) usage;;
   10.58 +    *) echo "invalid option!"; usage;;
   10.59 +    esac
   10.60 +done
   10.61 +
   10.62 +
   10.63 +start_guest()
   10.64 +{
   10.65 +    create_hvm_guest $image -u $vcpus -m $memory
   10.66 +    if [ $? -ne 0 ]; then
   10.67 +        echo "  Create guest fail!"
   10.68 +        return 1
   10.69 +    fi
   10.70 +    return 0
   10.71 +}
   10.72 +
   10.73 +inject()
   10.74 +{
   10.75 +    mce_inject_trigger $CMCI_UCNA_LLC -u $injcpu -p $pageaddr 
   10.76 +    if [ $? -eq 0 ]; then
   10.77 +        show "  Passed: Successfully to fake and inject a MCE error"
   10.78 +    else
   10.79 +        show "  Failed: Fake error and inject fail !!"
   10.80 +        return 1
   10.81 +    fi
   10.82 +    return 0
   10.83 +}
   10.84 +
   10.85 +do_main()
   10.86 +{
   10.87 +    ret_val=0
   10.88 +    clean_env
   10.89 +    start_guest || ret_val=1
   10.90 +    inject || ret_val=1
   10.91 +    mcelog_verify $CMCI_UCNA_LLC || ret_val=1
   10.92 +    des_guest
   10.93 +    gen_result $ret_val
   10.94 +}
   10.95 +
   10.96 +do_main "$@"
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/tools/tests/mce-test/cases/ucna_llc/xen/cases.sh	Fri Dec 24 10:23:08 2010 +0000
    11.3 @@ -0,0 +1,69 @@
    11.4 +#!/bin/bash
    11.5 +#
    11.6 +# Copyright (c) 2010, Intel Corporation
    11.7 +# 
    11.8 +# This program is free software; you can redistribute it and/or
    11.9 +# modify it under the terms of the GNU General Public License version
   11.10 +# 2 as published by the Free Software Foundation.
   11.11 +# 
   11.12 +# This program is distributed in the hope that it will be useful, but
   11.13 +# WITHOUT ANY WARRANTY; without even the implied warranty of
   11.14 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
   11.15 +# General Public License for more details.
   11.16 +# 
   11.17 +# You should have received a copy of the GNU General Public License
   11.18 +# along with this program; if not, write to the Free Software Foundation,
   11.19 +# Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
   11.20 +#
   11.21 +# Author: Xudong Hao <xudong.hao@intel.com>
   11.22 +#
   11.23 +
   11.24 +sd=$(dirname $0)
   11.25 +export ROOT=`(cd $sd/../../../; pwd)`
   11.26 +export this_case=ucna_llc_xen
   11.27 +
   11.28 +. $ROOT/lib/xen-mceinj-tool.sh
   11.29 +
   11.30 +usage()
   11.31 +{
   11.32 +    echo "Usage: ./cases.sh [-options] [arguments]"
   11.33 +    echo "================Below are the optional options================"
   11.34 +    echo -e "\t-c injcpu\t: which cpu to inject error"
   11.35 +    echo -e "\t-p pageaddr\t: Guest Physical Address to inject error"
   11.36 +    echo -e "\t\t\tBy default, the GPA is 0x180020"
   11.37 +    echo -e "\t-h help"
   11.38 +    exit 0
   11.39 +}
   11.40 +
   11.41 +while getopts ":c:p:h" option
   11.42 +do
   11.43 +    case "$option" in
   11.44 +    c) injcpu=$OPTARG;;
   11.45 +    p) pageaddr=$OPTARG;;
   11.46 +    h) usage;;
   11.47 +    *) echo "invalid option!"; usage;;
   11.48 +    esac
   11.49 +done
   11.50 +
   11.51 +inject()
   11.52 +{
   11.53 +    mce_inject_trigger $CMCI_UCNA_LLC -u $injcpu -p $pageaddr 
   11.54 +    if [ $? -eq 0 ]; then
   11.55 +        show "  Passed: Successfully to fake and inject a MCE error"
   11.56 +    else
   11.57 +        show "  Failed: Fake error and inject fail !!"
   11.58 +        return 1
   11.59 +    fi
   11.60 +    return 0
   11.61 +}
   11.62 +
   11.63 +do_main()
   11.64 +{
   11.65 +    ret_val=0
   11.66 +    clean_env
   11.67 +    inject || ret_val=1
   11.68 +    mcelog_verify $CMCI_UCNA_LLC || ret_val=1
   11.69 +    gen_result $ret_val
   11.70 +}
   11.71 +
   11.72 +do_main "$@"