make mce-test a submodule

cloning mce-test from

    git://github.com/andikleen/mce-test.git

and use it as a submodule of git.

Signed-off-by: Caspar Zhang <caspar@casparzhang.com>
Reviewed-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Reviewed-by: Andi Kleen <andi.kleen@intel.com>
Acked-by: Shubham Goyal <shubham@linux.vnet.ibm.com>
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..e9eefdb
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "testcases/kernel/mce-test"]
+	path = testcases/kernel/mce-test
+	url = git://github.com/andikleen/mce-test.git
diff --git a/README b/README
index 52a5979..55d5177 100644
--- a/README
+++ b/README
@@ -1,36 +1,3 @@
-MCE APEI INJ testing cases 
-=========================
-
-Nov 6th, 2009
-
-Jiajia Zheng
-
-Start
-------------
-This test suite is based on apei-inj APEI haredware injection tool. 
-It's structure and usage are the same with soft-inj test suite.
-To be root and invoke simple test driver on test configuration file as follow
-	drivers/simple/driver.sh config/simple_apei_ucr.conf
-
-Test Dependencies
------------------
-MCE APEI INJ test suite has following dependencies on kernel and other tools:
-
-* Make sure following configuration options are enabled in linux kernel:
-	CONFIG_FTRACE=y
-	CONFIG_FUNCTION_TRACER=y
-
-* page-types:
-  A tool to query page types, which is accompanied with Linux kernel
-  source (2.6.32 or newer, $KERNEL_SRC/Documentation/vm/page-types.c).
-  For detail, please see 3.4 in doc/howto.txt.
-
-* simple-process:
-  APEI hardware injection will inject an error to a page used by this simple-process.  Intall simple-process.
-	cd mce-test/tools/simple_process
-	make
-
-
 Linux Test Project
 (Maintained by: Shubham Goyal <shubham@linux.vnet.ibm.com>)
 
@@ -243,7 +210,7 @@
 CONFIG_SECURITY_SELINUX_ENABLE_SECMARK_DEFAULT=y
 
 CONFIG_SECURITY_SELINUX_POLICYDB_VERSION_MAX=y
-You don't want this one unless you are running Fedora 3 or 4.  
+You don't want this one unless you are running Fedora 3 or 4.
 On anything newer, it will cause unnecessary policy expansion.
 
 CONFIG_SECURITY_SMACK=y
diff --git a/testcases/kernel/mce-test b/testcases/kernel/mce-test
new file mode 160000
index 0000000..95e136a
--- /dev/null
+++ b/testcases/kernel/mce-test
@@ -0,0 +1 @@
+Subproject commit 95e136a3b0cde818448d5fcff5bf75d58600dc0d
diff --git a/testcases/kernel/mce-test/COPYING b/testcases/kernel/mce-test/COPYING
deleted file mode 100644
index 60549be..0000000
--- a/testcases/kernel/mce-test/COPYING
+++ /dev/null
@@ -1,340 +0,0 @@
-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-		    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-			    NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-	    How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) 19yy  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) 19yy name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/testcases/kernel/mce-test/Makefile b/testcases/kernel/mce-test/Makefile
deleted file mode 100644
index f0cdc21..0000000
--- a/testcases/kernel/mce-test/Makefile
+++ /dev/null
@@ -1,41 +0,0 @@
-.PHONY:	test clean distclean reset test-simple test-kdump
-
-all:
-	$(MAKE) -C tools
-	$(MAKE) -C tsrc
-	$(MAKE) -C stress
-
-clean:
-	$(MAKE) -C tools clean
-	$(MAKE) -C tsrc clean
-	$(MAKE) -C stress clean
-	$(MAKE) reset
-
-distclean:
-	$(MAKE) -C tools distclean
-	$(MAKE) -C tsrc distclean
-	$(MAKE) -C stress distclean
-	$(MAKE) reset
-	rm -rf bin/*
-
-reset:
-	rm -rf work/*
-	rm -rf results/*
-
-test: test-simple test-stress
-
-test-simple:
-	$(MAKE) reset
-	./drivers/simple/driver.sh simple.conf
-	$(MAKE) -C tsrc test
-
-# requires LTP & page-types to be installed
-test-stress:
-	$(MAKE) -C stress test
-
-# requires special packages to be installed
-test-kdump:
-	$(MAKE) reset
-	./drivers/simple/driver.sh simple.conf
-	./drivers/kdump/driver.sh kdump.conf
-	$(MAKE) -C tsrc test
diff --git a/testcases/kernel/mce-test/README b/testcases/kernel/mce-test/README
deleted file mode 100644
index 6992755..0000000
--- a/testcases/kernel/mce-test/README
+++ /dev/null
@@ -1,111 +0,0 @@
-MCE test suite
----------------
-
-The MCE test suite is a collection of tools and test scripts for
-testing the Linux kernel MCE processing features. The goal is to cover
-most Linux kernel 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 document
-
-COPYING
-	GNU General Public License
-
-Makefile
-	Top level make file for MCE test suite
-
-drivers/*
-	Contains test drivers, which drive test procedure and do some
-	common works for test drivers. There is one directory for each
-	test driver, the user interface of a driver is the driver.sh
-	in corresponding directory, such as:
-	    drivers/kdump/driver.sh
-	is user interface of kdump test driver.
-
-cases/*
-	Contains all test cases, which may be organized in
-	sub-directories, the interface of a class of test cases is a
-	shell script under cases/, such as:
-	   -- cases/soft-inj/panic/cases.sh
-		is for test cases triggered by soft-inject and may cause system 
-		panic during testing.
-	   -- cases/apei-inj/ucr/cases.sh  
-		is for test cases triggered by apei-inject.
-
-config/*
-	Contains test configuration files, which specifies the
-	parameters for test driver, which test cases are used in test,
-	the parameters for test cases, etc.
-
-tsrc/*
-	Some standalone test programs for various parts of the machine
-	check code.
-
-lib/*
-	Contains some shell scripts, in which some common shell
-	functions and variable definitions are defined to be used by
-	multiple test drivers or test cases.
-
-tools/*
-	Some tools used by MCE test suites.
-
-doc/*
-	Documentation for MCE test suites include howto and
-	descriptions of every test case.
-
-results/
-	When test is done, the test result will be placed in this
-	directory, test results for a specific test driver will be
-	placed in corresponding directory, such as test results of
-	kdump test driver will be placed in "results/kdump". General
-	test result is in results/$driver/result; additional results
-	of various cases may be in corresponding directory, for
-	example, files in
-	    results/kdump/soft-inj/panic/fatal/
-	is for additional result for test case soft-inj/panic/fatal.
-
-work/
-	During test, some temporary file will be put in work
-	directory, temporary files for a specific test driver will be
-	placed in corresponding directory, such as temporary files of
-	kdump test driver will be placed in "work/kdump". Test log is
-	in work/$driver/log.
-
-bin/
-	Some tools used by test drivers or test cases will be
-	installed into this directory.
-
-stress/
-	Linux MCE stress test suite.
-
-Test Instruction
-----------------
-
-Please refer to corresponding section in doc/howto.txt.
-
-Very quick way to test this:
-	be root
-	make sure you have a kernel with CONFIG_X86_MCE_INJECT
-	and CONFIG_HWPOISON_INJECT and soft-offlining support
-	run "make test"
-
-Futher Information
-------------------
-
-For futher information about MCE test suite, please refer to documents
-in doc sub-directory.
-
-doc/howto.txt:		a more detailed HOWTO document
-
-doc/stress-howto.txt:	Detailed HOWTO document for MCE stress test suite
-
-doc/cases/*.txt:	Description of every test case, including test
-			objective, code patch tested, reference and
-			expected results
diff --git a/testcases/kernel/mce-test/cases/apei-inj/README b/testcases/kernel/mce-test/cases/apei-inj/README
deleted file mode 100644
index 3ae91b4..0000000
--- a/testcases/kernel/mce-test/cases/apei-inj/README
+++ /dev/null
@@ -1,33 +0,0 @@
-MCE APEI INJ testing cases 
-=========================
-
-Nov 6th, 2009
-
-Jiajia Zheng
-
-Start
-------------
-This test suite is based on apei-inj APEI haredware injection tool. 
-It's structure and usage are the same with soft-inj test suite.
-To be root and invoke simple test driver on test configuration file as follow
-	drivers/simple/driver.sh config/simple_apei_ucr.conf
-
-Test Dependencies
------------------
-MCE APEI INJ test suite has following dependencies on kernel and other tools:
-
-* Make sure following configuration options are enabled in linux kernel:
-	CONFIG_FTRACE=y
-	CONFIG_FUNCTION_TRACER=y
-
-* page-types:
-  A tool to query page types, which is accompanied with Linux kernel
-  source (2.6.32 or newer, $KERNEL_SRC/Documentation/vm/page-types.c).
-  For detail, please see 3.4 in doc/howto.txt.
-
-* simple-process:
-  APEI hardware injection will inject an error to a page used by this simple-process.  Intall simple-process.
-	cd mce-test/tools/simple_process
-	make
-
-
diff --git a/testcases/kernel/mce-test/cases/apei-inj/ucr/cases.sh b/testcases/kernel/mce-test/cases/apei-inj/ucr/cases.sh
deleted file mode 100644
index 2364bdc..0000000
--- a/testcases/kernel/mce-test/cases/apei-inj/ucr/cases.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/bash
-#
-# APEI injection based test cases : memory patrol scrub cases: test cases
-# are triggered via the apei-inject, and they will not trigger kernel panic.
-#
-# Copyright (C) 2008, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#           Zheng Jiajia <jiajia.zheng@intel.com>
-#
-# This file is released under the GPLv2.
-#
-
-. $ROOT/lib/functions.sh
-. $ROOT/lib/dirs.sh
-. $ROOT/lib/mce.sh
-. $ROOT/lib/apei-inject.sh
-
-enumerate()
-{
-    apei_inject_enumerate
-}
-
-trigger()
-{
-    case "$bcase" in
-        mem_uncorrected)
-            start_tracing "do_machine_check"
-            ;;
-        *)
-            echo '!!! Unknown case: $this_case !!!'
-    esac
-    apei_inject_trigger
-    stop_tracing
-}
-
-get_result()
-{
-    apei_inject_get_klog
-    get_gcov drivers/acpi/apei/einj.c
-
-    case "$bcase" in
-	mem_uncorrected)
-	    get_mcelog_from_dev $mcelog_result
-	    ;;
-	*)
-	    echo '!!! Unknown case: $this_case !!!'
-    esac
-}
-
-verify()
-{
-    case "$bcase" in
-	mem_uncorrected)
-	    apei_inject_verify_mcelog
-	    verify_klog $klog
-            apei_inject_verify_trace "do_machine_check"
-	    ;;
-	*)
-	    echo "!!! Unknown case: $this_case !!!"
-    esac
-}
-
-apei_inject_main "$@"
diff --git a/testcases/kernel/mce-test/cases/apei-inj/ucr/data/mem_uncorrected b/testcases/kernel/mce-test/cases/apei-inj/ucr/data/mem_uncorrected
deleted file mode 100644
index a6601e9..0000000
--- a/testcases/kernel/mce-test/cases/apei-inj/ucr/data/mem_uncorrected
+++ /dev/null
@@ -1 +0,0 @@
-TYPE 0x10
diff --git a/testcases/kernel/mce-test/cases/apei-inj/ucr/refer/mem_uncorrected b/testcases/kernel/mce-test/cases/apei-inj/ucr/refer/mem_uncorrected
deleted file mode 100644
index 43889f1..0000000
--- a/testcases/kernel/mce-test/cases/apei-inj/ucr/refer/mem_uncorrected
+++ /dev/null
@@ -1,10 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED SRAO 0xcf
-MCGSTATUS RIPV MCIP
-MISC 0x8c
-ADDR 0x1234
-RIP 0x73:0x2eadbabe
-
-
-
-
diff --git a/testcases/kernel/mce-test/cases/soft-inj/non-panic/cases.sh b/testcases/kernel/mce-test/cases/soft-inj/non-panic/cases.sh
deleted file mode 100755
index d277e11..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/non-panic/cases.sh
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/bin/bash
-#
-# Software injection based test cases - non-panic cases: test cases
-# are triggered via the mce-inject tool, and they will not trigger kernel
-# panic.
-#
-# Copyright (C) 2008, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is released under the GPLv2.
-#
-
-. $ROOT/lib/functions.sh
-. $ROOT/lib/dirs.sh
-. $ROOT/lib/mce.sh
-. $ROOT/lib/soft-inject.sh
-
-enumerate()
-{
-    soft_inject_enumerate
-}
-
-trigger()
-{
-    soft_inject_trigger
-}
-
-get_result()
-{
-    soft_inject_get_klog
-    get_gcov arch/x86/kernel/cpu/mcheck/mce.c
-
-    case "$bcase" in
-	corrected|corrected_hold|corrected_over|corrected_no_en)
-	    get_mcelog_from_dev $mcelog_result
-	    ;;
-	*)
-	    echo '!!! Unknown case: $this_case !!!'
-    esac
-}
-
-verify()
-{
-    local removes="TSC TIME PROCESSOR"
-    case "$bcase" in
-	corrected|corrected_hold|corrected_over|corrected_no_en)
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    ;;
-	*)
-	    echo "!!! Unknown case: $this_case !!!"
-    esac
-}
-
-soft_inject_main "$@"
diff --git a/testcases/kernel/mce-test/cases/soft-inj/non-panic/data/corrected b/testcases/kernel/mce-test/cases/soft-inj/non-panic/data/corrected
deleted file mode 100644
index 22af584..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/non-panic/data/corrected
+++ /dev/null
@@ -1,14 +0,0 @@
-# 
-# log corrected machine checks
-CPU 0 BANK 1
-STATUS CORRECTED
-ADDR 0xabcd
-HOLD
-CPU 1 BANK 0
-#  
-CPU 1 BANK 2
-STATUS CORRECTED
-MISC 0xabcd
-ADDR 0x1234
-HOLD
-CPU 0 BANK 0
diff --git a/testcases/kernel/mce-test/cases/soft-inj/non-panic/data/corrected_hold b/testcases/kernel/mce-test/cases/soft-inj/non-panic/data/corrected_hold
deleted file mode 100644
index 1c9da73..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/non-panic/data/corrected_hold
+++ /dev/null
@@ -1,10 +0,0 @@
-# 
-# log two corrected machine checks
-CPU 0 BANK 1
-STATUS CORRECTED
-ADDR 0xabcd
-HOLD
-#  
-CPU 1 BANK 2
-STATUS CORRECTED
-ADDR 0x1234
diff --git a/testcases/kernel/mce-test/cases/soft-inj/non-panic/data/corrected_no_en b/testcases/kernel/mce-test/cases/soft-inj/non-panic/data/corrected_no_en
deleted file mode 100644
index 9ea50c2..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/non-panic/data/corrected_no_en
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-CPU 0 BANK 3
-STATUS VAL
-HOLD
-CPU 1 BANK 0
\ No newline at end of file
diff --git a/testcases/kernel/mce-test/cases/soft-inj/non-panic/data/corrected_over b/testcases/kernel/mce-test/cases/soft-inj/non-panic/data/corrected_over
deleted file mode 100644
index 21214cf..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/non-panic/data/corrected_over
+++ /dev/null
@@ -1,4 +0,0 @@
-CPU 0 BANK 2
-STATUS VAL OVER EN
-HOLD
-CPU 1 BANK 0
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic/cases.sh b/testcases/kernel/mce-test/cases/soft-inj/panic/cases.sh
deleted file mode 100755
index 919f833..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic/cases.sh
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/bin/bash
-#
-# Software injection based test cases - panic cases: test cases are
-# triggered via the mce-inject tool, and they will trigger kernel panic.
-#
-# Copyright (C) 2008, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is released under the GPLv2.
-#
-
-. $ROOT/lib/functions.sh
-. $ROOT/lib/dirs.sh
-. $ROOT/lib/mce.sh
-. $ROOT/lib/soft-inject.sh
-
-enumerate()
-{
-    soft_inject_enumerate
-}
-
-trigger()
-{
-    reset_severity_cov
-    soft_inject_trigger
-}
-
-get_result()
-{
-    soft_inject_get_klog
-    get_gcov arch/x86/kernel/cpu/mcheck/mce.c
-    get_severity_cov
-
-    case "$bcase" in
-	fatal*)
-	    soft_inject_get_mcelog
-	    ;;
-	*)
-	    echo '!!! Unknown case: $this_case !!!'
-    esac
-}
-
-verify()
-{
-    local removes="TSC TIME PROCESSOR"
-    local curr_cpu_panic=": Fatal machine check on current CPU"
-    local fatal_panic="Fatal Machine check"
-    local pcc_exp="Processor context corrupt"
-    case "$bcase" in
-	fatal|fatal_irq|fatal_over)
-	    removes="$removes RIP"
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "$fatal_panic"
-	    soft_inject_verify_exp "$pcc_exp"
-	    ;;
-	fatal_ripv|fatal_eipv|fatal_userspace)
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "$fatal_panic"
-	    soft_inject_verify_exp "$pcc_exp"
-	    ;;
-	fatal_no_en)
-	    removes="$removes RIP"
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "Machine check from unknown source"
-	    ;;
-	fatal_timeout)
-	    removes="$removes RIP"
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "$curr_cpu_panic"
-	    soft_inject_verify_timeout
-	    soft_inject_verify_exp "$pcc_exp"
-	    ;;
-	fatal_timeout_ripv)
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "$curr_cpu_panic"
-	    soft_inject_verify_timeout
-	    soft_inject_verify_exp "$pcc_exp"
-	    ;;
-	*)
-	    echo "!!! Unknown case: $this_case !!!"
-    esac
-}
-
-soft_inject_main "$@"
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal b/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal
deleted file mode 100644
index b24942b..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal
+++ /dev/null
@@ -1,8 +0,0 @@
-# WARNING
-# this will panic your machine!
-# don't try casually
-CPU 0 BANK 4
-MCGSTATUS MCIP
-STATUS FATAL S
-RIP 12343434
-MISC 11
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_eipv b/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_eipv
deleted file mode 100644
index 7e6a93a..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_eipv
+++ /dev/null
@@ -1,7 +0,0 @@
-# WARNING
-# this will panic your machine!
-# don't try casually
-CPU 1 BANK 4
-MCGSTATUS MCIP EIPV
-STATUS FATAL S
-RIP 0x10:0x12343434
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_irq b/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_irq
deleted file mode 100644
index 63ef36b..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_irq
+++ /dev/null
@@ -1,9 +0,0 @@
-# WARNING
-# this will panic your machine!
-# don't try casually
-CPU 0 BANK 4
-MCGSTATUS MCIP
-STATUS FATAL S
-RIP 12343434
-MISC 11
-IN_IRQ
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_no_en b/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_no_en
deleted file mode 100644
index 12da496..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_no_en
+++ /dev/null
@@ -1,8 +0,0 @@
-# WARNING
-# this will panic your machine!
-# don't try casually
-CPU 0 BANK 4
-MCGSTATUS MCIP
-STATUS UC VAL PCC S
-RIP 0x10:12343434
-MISC 11
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_over b/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_over
deleted file mode 100644
index 6f44419..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_over
+++ /dev/null
@@ -1,9 +0,0 @@
-# WARNING
-# this will panic your machine!
-# don't try casually
-CPU 0 BANK 4
-MCGSTATUS MCIP
-STATUS FATAL OVER S
-RIP 12343434
-MISC 11
-
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_ripv b/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_ripv
deleted file mode 100644
index 1978747..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_ripv
+++ /dev/null
@@ -1,7 +0,0 @@
-# WARNING
-# this will panic your machine!
-# don't try casually
-CPU 1 BANK 4
-MCGSTATUS MCIP RIPV
-STATUS FATAL S
-RIP 0x10:0x12343434
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_timeout b/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_timeout
deleted file mode 100644
index c910141..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_timeout
+++ /dev/null
@@ -1,9 +0,0 @@
-# WARNING
-# this will panic your machine!
-# don't try casually
-CPU 0 BANK 4
-MCGSTATUS MCIP
-STATUS FATAL S
-RIP 0x10:0x12343434
-MISC 0xb
-NOBROADCAST
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_timeout_ripv b/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_timeout_ripv
deleted file mode 100644
index 0e34e00..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_timeout_ripv
+++ /dev/null
@@ -1,9 +0,0 @@
-# WARNING
-# this will panic your machine!
-# don't try casually
-CPU 0 BANK 4
-MCGSTATUS MCIP RIPV
-STATUS FATAL S
-RIP 0x10:0x12343434
-MISC 0xb
-NOBROADCAST
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_userspace b/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_userspace
deleted file mode 100644
index 3b8fe7f..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic/data/fatal_userspace
+++ /dev/null
@@ -1,7 +0,0 @@
-# WARNING
-# this will panic your machine!
-# don't try casually
-CPU 1 BANK 4
-MCGSTATUS MCIP EIPV
-STATUS FATAL S
-RIP 0x73:0x12343434
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic/refer/fatal_no_en b/testcases/kernel/mce-test/cases/soft-inj/panic/refer/fatal_no_en
deleted file mode 100644
index 893cc07..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic/refer/fatal_no_en
+++ /dev/null
@@ -1 +0,0 @@
-# empty mcelog
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_noser/cases.sh b/testcases/kernel/mce-test/cases/soft-inj/panic_noser/cases.sh
deleted file mode 100755
index 9637b9b..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_noser/cases.sh
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/bin/bash
-#
-# Software injection based test cases: test cases are triggered via
-# the mce-inject tool.
-#
-# Copyright (C) 2009, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is released under the GPLv2.
-#
-
-. $ROOT/lib/functions.sh
-. $ROOT/lib/dirs.sh
-. $ROOT/lib/mce.sh
-. $ROOT/lib/soft-inject.sh
-
-enumerate()
-{
-    soft_inject_enumerate
-}
-
-trigger()
-{
-    reset_severity_cov
-    soft_inject_trigger
-}
-
-get_result()
-{
-    soft_inject_get_klog
-    get_gcov arch/x86/kernel/cpu/mcheck/mce.c
-    soft_inject_get_mcelog
-    get_severity_cov
-}
-
-verify()
-{
-    local removes="TSC TIME PROCESSOR"
-    local over_exp="Overflowed uncorrected"
-    local fatal_panic=": Fatal Machine check"
-    local curr_cpu_panic=": Fatal machine check on current CPU"
-    case "$bcase" in
-	uc_over|uc_over_corrected)
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "$fatal_panic"
-	    soft_inject_verify_exp "$over_exp"
-	    ;;
-	uc_over_timeout)
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "$curr_cpu_panic"
-	    soft_inject_verify_exp "$over_exp"
-	    soft_inject_verify_timeout
-	    ;;
-	*)
-	    echo "!!! Unknown case: $this_case !!!"
-    esac
-}
-
-soft_inject_main "$@"
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_noser/data/uc_over b/testcases/kernel/mce-test/cases/soft-inj/panic_noser/data/uc_over
deleted file mode 100644
index 397c48a..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_noser/data/uc_over
+++ /dev/null
@@ -1,6 +0,0 @@
-# this should just kill the process
-CPU 0 BANK 2
-STATUS UNCORRECTED OVER
-MCGSTATUS RIPV EIPV MCIP
-ADDR 0x1234
-RIP 0x10:0xdeadbabe
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_noser/data/uc_over_corrected b/testcases/kernel/mce-test/cases/soft-inj/panic_noser/data/uc_over_corrected
deleted file mode 100644
index 3dac1ce..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_noser/data/uc_over_corrected
+++ /dev/null
@@ -1,13 +0,0 @@
-CPU 1 BANK 1
-MCGSTATUS RIPV MCIP
-STATUS CORRECTED
-RIP 0x13:0x12345678
-IN_PROC
-EXCP
-HOLD
-
-CPU 0 BANK 2
-STATUS UNCORRECTED OVER
-MCGSTATUS RIPV EIPV MCIP
-ADDR 0x1234
-RIP 0x10:0xdeadbabe
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_noser/data/uc_over_timeout b/testcases/kernel/mce-test/cases/soft-inj/panic_noser/data/uc_over_timeout
deleted file mode 100644
index 3b89831..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_noser/data/uc_over_timeout
+++ /dev/null
@@ -1,6 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED OVER
-MCGSTATUS RIPV EIPV MCIP
-ADDR 0x1234
-RIP 0x10:0xdeadbabe
-NOBROADCAST
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/cases.sh b/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/cases.sh
deleted file mode 100755
index 35cc343..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/cases.sh
+++ /dev/null
@@ -1,108 +0,0 @@
-#!/bin/bash
-#
-# Software injection based test cases: test cases are triggered via
-# the mce-inject tool.
-#
-# Copyright (C) 2008, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is released under the GPLv2.
-#
-
-. $ROOT/lib/functions.sh
-. $ROOT/lib/dirs.sh
-. $ROOT/lib/mce.sh
-. $ROOT/lib/soft-inject.sh
-
-enumerate()
-{
-    soft_inject_enumerate
-}
-
-trigger()
-{
-    reset_severity_cov
-    soft_inject_trigger
-}
-
-get_result()
-{
-    soft_inject_get_klog
-    get_gcov arch/x86/kernel/cpu/mcheck/mce.c
-    soft_inject_get_mcelog
-    get_severity_cov
-}
-
-verify()
-{
-    local mce_panic
-    local removes="TSC TIME PROCESSOR"
-    local pcc_exp="Processor context corrupt"
-    local knoripv_exp="In kernel and no restart IP"
-    local no_mcip_exp="MCIP not set in MCA handler"
-    local no_eripv_exp="Neither restart nor error IP"
-    local over_exp="Overflowed uncorrected"
-    local fatal_panic=": Fatal Machine check"
-    local curr_cpu_panic=": Fatal machine check on current CPU"
-    local unknown_src_panic=": Machine check from unknown source"
-    case "$bcase" in
-	fatal_severity)
-	    removes="$removes RIP"
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "$fatal_panic"
-	    soft_inject_verify_exp "$pcc_exp"
-	    ;;
-	uncorrected)
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "$fatal_panic"
-	    soft_inject_verify_exp "$knoripv_exp"
-	    ;;
-	uncorrected_timeout*)
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "$curr_cpu_panic"
-	    soft_inject_verify_timeout
-	    soft_inject_verify_exp "$knoripv_exp"
-	    ;;
-	uc_no_mcip)
-	    removes="$removes RIP"
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "$fatal_panic"
-	    soft_inject_verify_exp "$no_mcip_exp"
-	    ;;
-	uc_no_mcip_timeout)
-	    removes="$removes RIP"
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "$curr_cpu_panic"
-	    soft_inject_verify_exp "$no_mcip_exp"
-	    soft_inject_verify_timeout
-	    ;;
-	uc_no_eripv)
-	    removes="$removes RIP"
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "$fatal_panic"
-	    soft_inject_verify_exp "$no_eripv_exp"
-	    ;;
-	uc_no_eripv_timeout)
-	    removes="$removes RIP"
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "$curr_cpu_panic"
-	    soft_inject_verify_exp "$no_eripv_exp"
-	    soft_inject_verify_timeout
-	    ;;
-	unknown)
-	    verify_klog $klog
-	    soft_inject_verify_panic "$unknown_src_panic"
-	    ;;
-	*)
-	    echo "!!! Unknown case: $this_case !!!"
-    esac
-}
-
-soft_inject_main "$@"
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/fatal_severity b/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/fatal_severity
deleted file mode 100644
index 4dfd8ed..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/fatal_severity
+++ /dev/null
@@ -1,16 +0,0 @@
-# WARNING
-# this will panic your machine!
-# don't try casually
-CPU 0 BANK 3
-MCGSTATUS RIPV EIPV MCIP
-# S is regarded as SRAO for SER_P = 1 and ignored otherwise
-STATUS UNCORRECTED S
-RIP 0x10:0x12343434
-MISC 0x2314
-ADDR 0xabcd1234
-HOLD
-
-CPU 1 BANK 1
-MCGSTATUS MCIP
-STATUS FATAL S
-RIP 0x10:0xabcdcdcd
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uc_no_eripv b/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uc_no_eripv
deleted file mode 100644
index 91f3b17..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uc_no_eripv
+++ /dev/null
@@ -1,5 +0,0 @@
-CPU 0 BANK 1
-STATUS UNCORRECTED S
-MCGSTATUS MCIP
-ADDR 0x1234
-RIP 0x10:0xdeadbabe
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uc_no_eripv_timeout b/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uc_no_eripv_timeout
deleted file mode 100644
index 23cd098..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uc_no_eripv_timeout
+++ /dev/null
@@ -1,6 +0,0 @@
-CPU 0 BANK 1
-STATUS UNCORRECTED S
-MCGSTATUS MCIP
-ADDR 0x1234
-RIP 0x10:0xdeadbabe
-NOBROADCAST
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uc_no_mcip b/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uc_no_mcip
deleted file mode 100644
index c4ac81a..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uc_no_mcip
+++ /dev/null
@@ -1,4 +0,0 @@
-CPU 0 BANK 1
-STATUS UNCORRECTED S
-ADDR 0x1234
-RIP 0x10:0xdeadbabe
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uc_no_mcip_timeout b/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uc_no_mcip_timeout
deleted file mode 100644
index 3f31a4f..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uc_no_mcip_timeout
+++ /dev/null
@@ -1,5 +0,0 @@
-CPU 0 BANK 1
-STATUS UNCORRECTED S
-ADDR 0x1234
-RIP 0x10:0xdeadbabe
-NOBROADCAST
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uncorrected b/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uncorrected
deleted file mode 100644
index 7930350..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uncorrected
+++ /dev/null
@@ -1,7 +0,0 @@
-# this should just kill the process
-CPU 0 BANK 2
-STATUS UNCORRECTED S
-MCGSTATUS EIPV MCIP
-ADDR 0x1234
-RIP 0x10:0xdeadbabe
-IN_PROC
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uncorrected_timeout b/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uncorrected_timeout
deleted file mode 100644
index 4a469cd..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/uncorrected_timeout
+++ /dev/null
@@ -1,8 +0,0 @@
-# this should just kill the process
-CPU 0 BANK 2
-STATUS UNCORRECTED S
-MCGSTATUS EIPV MCIP
-ADDR 0x1234
-RIP 0x10:0xdeadbabe
-IN_PROC
-NOBROADCAST
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/unknown b/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/unknown
deleted file mode 100644
index 25ecb5b1..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_npcc/data/unknown
+++ /dev/null
@@ -1,3 +0,0 @@
-# this should just kill the process
-CPU 0 BANK 2
-STATUS UC S
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/cases.sh b/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/cases.sh
deleted file mode 100755
index 8aec7df..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/cases.sh
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/bin/bash
-#
-# Software injection based test cases: test cases are triggered via
-# mce-inject tool.
-#
-# Copyright (C) 2009, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is released under the GPLv2.
-#
-
-. $ROOT/lib/functions.sh
-. $ROOT/lib/dirs.sh
-. $ROOT/lib/mce.sh
-. $ROOT/lib/soft-inject.sh
-
-enumerate()
-{
-    soft_inject_enumerate
-}
-
-trigger()
-{
-    reset_severity_cov
-    soft_inject_trigger
-}
-
-get_result()
-{
-    soft_inject_get_klog
-    get_gcov arch/x86/kernel/cpu/mcheck/mce.c
-    soft_inject_get_mcelog
-    get_severity_cov
-}
-
-verify()
-{
-    local removes="TSC TIME PROCESSOR"
-    local fatal_panic=": Fatal Machine check"
-    local curr_cpu_panic=": Fatal machine check on current CPU"
-    local unknown_src_panic=": Machine check from unknown source"
-    local no_eripv_exp="Neither restart nor error IP"
-    case "$bcase" in
-	s0_ar1)
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "$fatal_panic"
-	    soft_inject_verify_exp "Illegal combination (UCNA with AR=1)"
-	    ;;
-	srar_over)
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "$fatal_panic"
-	    soft_inject_verify_exp "Action required with lost events"
-	    ;;
-	srar_unkown)
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_panic "$fatal_panic"
-	    soft_inject_verify_exp "Action required; unknown MCACOD"
-	    ;;
-        srar_no_en)
-            soft_inject_verify_mcelog
-            verify_klog $klog
-            soft_inject_verify_panic "Machine check from unknown source"
-            ;;
-	srao_mem_scrub_noripv|srao_ewb_noripv)
-            soft_inject_verify_mcelog
-            verify_klog $klog
-            soft_inject_verify_panic "$fatal_panic"
-            soft_inject_verify_exp "$no_eripv_exp"
-            ;;
-	*)
-	    echo "!!! Unknown case: $this_case !!!"
-    esac
-}
-
-soft_inject_main "$@"
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/s0_ar1 b/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/s0_ar1
deleted file mode 100644
index 85e931a..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/s0_ar1
+++ /dev/null
@@ -1,5 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED AR
-MCGSTATUS RIPV EIPV MCIP
-ADDR 0x1234
-RIP 0x10:0xdeadbabe
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/srao_ewb_noripv b/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/srao_ewb_noripv
deleted file mode 100644
index 4518ff1..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/srao_ewb_noripv
+++ /dev/null
@@ -1,5 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED SRAO 0x17a
-MCGSTATUS MCIP
-ADDR 0x1234
-MISC 0x8c
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/srao_mem_scrub_noripv b/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/srao_mem_scrub_noripv
deleted file mode 100644
index c9e2fd4..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/srao_mem_scrub_noripv
+++ /dev/null
@@ -1,5 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED SRAO 0xc0
-MCGSTATUS MCIP
-ADDR 0x1234
-MISC 0x8c
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/srar_no_en b/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/srar_no_en
deleted file mode 100644
index 378e58c..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/srar_no_en
+++ /dev/null
@@ -1,6 +0,0 @@
-CPU 0 BANK 2
-STATUS VAL UC SRAR
-MCGSTATUS EIPV MCIP
-ADDR 0x1234
-RIP 0x73:0x2eadbabe
-
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/srar_over b/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/srar_over
deleted file mode 100644
index 9e341d5..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/srar_over
+++ /dev/null
@@ -1,5 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED SRAR OVER
-MCGSTATUS EIPV MCIP
-ADDR 0x1234
-RIP 0x73:0x1eadbabe
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/srar_unkown b/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/srar_unkown
deleted file mode 100644
index e3d42a6..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/data/srar_unkown
+++ /dev/null
@@ -1,5 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED SRAR
-MCGSTATUS EIPV MCIP
-ADDR 0x1234
-RIP 0x73:0x2eadbabe
diff --git a/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/refer/srar_no_en b/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/refer/srar_no_en
deleted file mode 100644
index ea30561..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/panic_ucr/refer/srar_no_en
+++ /dev/null
@@ -1 +0,0 @@
-#empty
diff --git a/testcases/kernel/mce-test/cases/soft-inj/poll_noser/cases.sh b/testcases/kernel/mce-test/cases/soft-inj/poll_noser/cases.sh
deleted file mode 100644
index 4a3b285..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/poll_noser/cases.sh
+++ /dev/null
@@ -1,49 +0,0 @@
-#!/bin/bash
-#
-# Software injection based test cases: test cases are triggered via
-# the mce-inject tool.
-#
-# Copyright (C) 2009, Intel Corp.
-#   Author: Jiajia Zheng <jiajia.zheng@intel.com>
-#
-# This file is released under the GPLv2.
-#
-
-. $ROOT/lib/functions.sh
-. $ROOT/lib/dirs.sh
-. $ROOT/lib/mce.sh
-. $ROOT/lib/soft-inject.sh
-
-enumerate()
-{
-    soft_inject_enumerate
-}
-
-trigger()
-{
-    reset_severity_cov
-    soft_inject_trigger
-}
-
-get_result()
-{
-    soft_inject_get_klog
-    get_gcov arch/x86/kernel/cpu/mcheck/mce.c
-    soft_inject_get_mcelog
-    get_severity_cov
-}
-
-verify()
-{
-    local removes="TSC TIME PROCESSOR"
-    case "$bcase" in
-        uc_poll)
-            soft_inject_verify_mcelog
-            verify_klog $klog
-            ;;
-	*)
-	    echo "!!! Unknown case: $this_case !!!"
-    esac
-}
-
-soft_inject_main "$@"
diff --git a/testcases/kernel/mce-test/cases/soft-inj/poll_noser/data/uc_poll b/testcases/kernel/mce-test/cases/soft-inj/poll_noser/data/uc_poll
deleted file mode 100644
index ef81543..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/poll_noser/data/uc_poll
+++ /dev/null
@@ -1,6 +0,0 @@
-CPU 1 BANK 4
-MCGSTATUS MCIP
-STATUS UNCORRECTED
-RIP 12343434
-MISC 11
-POLL
diff --git a/testcases/kernel/mce-test/cases/soft-inj/poll_noser/refer/uc_poll b/testcases/kernel/mce-test/cases/soft-inj/poll_noser/refer/uc_poll
deleted file mode 100644
index ea30561..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/poll_noser/refer/uc_poll
+++ /dev/null
@@ -1 +0,0 @@
-#empty
diff --git a/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/cases.sh b/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/cases.sh
deleted file mode 100755
index dc9fc6a..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/cases.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-#
-# Software injection based test cases: test cases are triggered via
-# mce-inject tool.
-#
-# Copyright (C) 2009, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is released under the GPLv2.
-#
-
-. $ROOT/lib/functions.sh
-. $ROOT/lib/dirs.sh
-. $ROOT/lib/mce.sh
-. $ROOT/lib/soft-inject.sh
-
-enumerate()
-{
-    soft_inject_enumerate
-}
-
-trigger()
-{
-    reset_severity_cov
-    soft_inject_trigger
-}
-
-get_result()
-{
-    soft_inject_get_klog
-    get_gcov arch/x86/kernel/cpu/mcheck/mce.c
-    soft_inject_get_mcelog
-    get_severity_cov
-}
-
-verify()
-{
-    local removes="TSC TIME PROCESSOR"
-    case "$bcase" in
-	ucna|ucna_over|srar_poll)
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    ;;
-        fatal_poll)
-            removes="$removes RIP"
-            soft_inject_verify_mcelog
-            verify_klog $klog
-            ;;
-	*)
-	    echo "!!! Unknown case: $this_case !!!"
-    esac
-}
-
-soft_inject_main "$@"
diff --git a/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/data/fatal_poll b/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/data/fatal_poll
deleted file mode 100644
index 7efb316..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/data/fatal_poll
+++ /dev/null
@@ -1,6 +0,0 @@
-CPU 1 BANK 4
-MCGSTATUS MCIP
-STATUS FATAL
-RIP 12343434
-MISC 11
-POLL
diff --git a/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/data/srar_poll b/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/data/srar_poll
deleted file mode 100644
index f57b5de..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/data/srar_poll
+++ /dev/null
@@ -1,9 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED SRAR
-MCGSTATUS EIPV MCIP
-ADDR 0x1234
-RIP 0x73:0x2eadbabe
-POLL
-HOLD
-CPU 1 BANK 0
-
diff --git a/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/data/ucna b/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/data/ucna
deleted file mode 100644
index 2419b63..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/data/ucna
+++ /dev/null
@@ -1,7 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED UCNA
-ADDR 0x1234
-MISC 0x8c
-POLL
-HOLD
-CPU 1 BANK 0
\ No newline at end of file
diff --git a/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/data/ucna_over b/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/data/ucna_over
deleted file mode 100644
index c630057..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/data/ucna_over
+++ /dev/null
@@ -1,6 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED UCNA OVER
-ADDR 0x1234
-MISC 0x8c
-POLL
-
diff --git a/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/refer/srar_poll b/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/refer/srar_poll
deleted file mode 100644
index ea30561..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/poll_ucr/refer/srar_poll
+++ /dev/null
@@ -1 +0,0 @@
-#empty
diff --git a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/cases.sh b/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/cases.sh
deleted file mode 100755
index 054a97b..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/cases.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/bash
-#
-# Software injection based test cases: test cases are triggered via
-# mce-inject tool.
-#
-# Copyright (C) 2009, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is released under the GPLv2.
-#
-
-. $ROOT/lib/functions.sh
-. $ROOT/lib/dirs.sh
-. $ROOT/lib/mce.sh
-. $ROOT/lib/soft-inject.sh
-
-enumerate()
-{
-    soft_inject_enumerate
-}
-
-trigger()
-{
-    reset_severity_cov
-    soft_inject_trigger
-}
-
-get_result()
-{
-    soft_inject_get_klog
-    soft_inject_get_mcelog
-    get_gcov arch/x86/kernel/cpu/mcheck/mce.c
-    get_severity_cov
-}
-
-verify()
-{
-    local removes="TSC TIME PROCESSOR"
-    case "$bcase" in
-	srao_*)
-	    soft_inject_verify_mcelog
-	    verify_klog $klog
-	    soft_inject_verify_return_val
-	    ;;
-	*)
-	    echo "!!! Unknown case: $this_case !!!"
-    esac
-}
-
-soft_inject_main "$@"
diff --git a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_corrected b/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_corrected
deleted file mode 100644
index ec24a0d..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_corrected
+++ /dev/null
@@ -1,11 +0,0 @@
-CPU 1 BANK 1
-MCGSTATUS RIPV MCIP
-STATUS CORRECTED
-EXCP
-HOLD
-
-CPU 0 BANK 2
-STATUS UNCORRECTED SRAO
-MCGSTATUS RIPV MCIP
-ADDR 0x1234
-RIP 0x73:0x1eadbabe
diff --git a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_ewb b/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_ewb
deleted file mode 100644
index 7dba8c0..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_ewb
+++ /dev/null
@@ -1,6 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED SRAO 0x17a
-MCGSTATUS RIPV MCIP
-ADDR 0x1234
-MISC 0x8c
-RIP 0x73:0x1eadbabe
diff --git a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_mem_scrub b/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_mem_scrub
deleted file mode 100644
index b4704b6..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_mem_scrub
+++ /dev/null
@@ -1,6 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED SRAO 0xc0
-MCGSTATUS RIPV MCIP
-ADDR 0x1234
-MISC 0x8c
-RIP 0x73:0x1eadbabe
diff --git a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_no_en b/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_no_en
deleted file mode 100644
index afac76b..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_no_en
+++ /dev/null
@@ -1,5 +0,0 @@
-CPU 0 BANK 2
-STATUS VAL UC SRAO
-MCGSTATUS RIPV MCIP
-ADDR 0x1234
-RIP 0x73:0x1eadbabe
diff --git a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_over b/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_over
deleted file mode 100644
index c5b337d..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_over
+++ /dev/null
@@ -1,5 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED SRAO OVER
-MCGSTATUS RIPV MCIP
-ADDR 0x1234
-RIP 0x73:0x1eadbabe
diff --git a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_ucna b/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_ucna
deleted file mode 100644
index 80afaca..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_ucna
+++ /dev/null
@@ -1,11 +0,0 @@
-CPU 1 BANK 1
-MCGSTATUS RIPV MCIP
-STATUS UNCORRECTED UCNA
-EXCP
-HOLD
-
-CPU 0 BANK 2
-STATUS UNCORRECTED SRAO
-MCGSTATUS RIPV MCIP
-ADDR 0x1234
-RIP 0x73:0x1eadbabe
diff --git a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_unknown b/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_unknown
deleted file mode 100644
index 63e465a..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/data/srao_unknown
+++ /dev/null
@@ -1,5 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED SRAO
-MCGSTATUS RIPV MCIP
-ADDR 0x1234
-RIP 0x73:0x1eadbabe
diff --git a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/refer/srao_corrected b/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/refer/srao_corrected
deleted file mode 100644
index 63e465a..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/refer/srao_corrected
+++ /dev/null
@@ -1,5 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED SRAO
-MCGSTATUS RIPV MCIP
-ADDR 0x1234
-RIP 0x73:0x1eadbabe
diff --git a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/refer/srao_no_en b/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/refer/srao_no_en
deleted file mode 100644
index ea30561..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/refer/srao_no_en
+++ /dev/null
@@ -1 +0,0 @@
-#empty
diff --git a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/refer/srao_ucna b/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/refer/srao_ucna
deleted file mode 100644
index 65d78c8..0000000
--- a/testcases/kernel/mce-test/cases/soft-inj/recoverable_ucr/refer/srao_ucna
+++ /dev/null
@@ -1,6 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED SRAO
-MCGSTATUS RIPV MCIP
-ADDR 0x1234
-RIP 0x73:0x1eadbabe
-
diff --git a/testcases/kernel/mce-test/config/kdump.conf b/testcases/kernel/mce-test/config/kdump.conf
deleted file mode 100644
index e87ddc5..0000000
--- a/testcases/kernel/mce-test/config/kdump.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-
-CASES="soft-inj/panic/cases.sh soft-inj/panic_npcc/cases.sh"
-COREDIR="/var/crash"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
-VMLINUX=$KSRC_DIR/vmlinux
diff --git a/testcases/kernel/mce-test/config/kdump_noser.conf b/testcases/kernel/mce-test/config/kdump_noser.conf
deleted file mode 100644
index e44a135..0000000
--- a/testcases/kernel/mce-test/config/kdump_noser.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-
-CASES="soft-inj/panic/cases.sh soft-inj/panic_npcc/cases.sh soft-inj/panic_noser/cases.sh"
-COREDIR="/var/crash"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
-VMLINUX=$KSRC_DIR/vmlinux
diff --git a/testcases/kernel/mce-test/config/kdump_panic.conf b/testcases/kernel/mce-test/config/kdump_panic.conf
deleted file mode 100644
index b2acc63..0000000
--- a/testcases/kernel/mce-test/config/kdump_panic.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-
-CASES="soft-inj/panic/cases.sh"
-COREDIR="/var/crash"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
-VMLINUX=$KSRC_DIR/vmlinux
diff --git a/testcases/kernel/mce-test/config/kdump_panic_noser.conf b/testcases/kernel/mce-test/config/kdump_panic_noser.conf
deleted file mode 100644
index b4562d3..0000000
--- a/testcases/kernel/mce-test/config/kdump_panic_noser.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-
-CASES="soft-inj/panic_noser/cases.sh"
-COREDIR="/var/crash"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
-VMLINUX=$KSRC_DIR/vmlinux
diff --git a/testcases/kernel/mce-test/config/kdump_panic_npcc.conf b/testcases/kernel/mce-test/config/kdump_panic_npcc.conf
deleted file mode 100644
index b5c5e8c..0000000
--- a/testcases/kernel/mce-test/config/kdump_panic_npcc.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-
-CASES="soft-inj/panic_npcc/cases.sh"
-COREDIR="/var/crash"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
-VMLINUX=$KSRC_DIR/vmlinux
diff --git a/testcases/kernel/mce-test/config/kdump_panic_ucr.conf b/testcases/kernel/mce-test/config/kdump_panic_ucr.conf
deleted file mode 100644
index c7508b2..0000000
--- a/testcases/kernel/mce-test/config/kdump_panic_ucr.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-
-CASES="soft-inj/panic_ucr/cases.sh"
-COREDIR="/var/crash"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
-VMLINUX=$KSRC_DIR/vmlinux
diff --git a/testcases/kernel/mce-test/config/kdump_ser.conf b/testcases/kernel/mce-test/config/kdump_ser.conf
deleted file mode 100644
index 71182a6..0000000
--- a/testcases/kernel/mce-test/config/kdump_ser.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-
-CASES="soft-inj/panic/cases.sh soft-inj/panic_npcc/cases.sh soft-inj/panic_ucr/cases.sh"
-COREDIR="/var/crash"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
-VMLINUX=$KSRC_DIR/vmlinux
diff --git a/testcases/kernel/mce-test/config/simple.conf b/testcases/kernel/mce-test/config/simple.conf
deleted file mode 100644
index be6d2f1..0000000
--- a/testcases/kernel/mce-test/config/simple.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-
-CASES="soft-inj/non-panic/cases.sh soft-inj/panic/cases.sh soft-inj/panic_npcc/cases.sh"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
diff --git a/testcases/kernel/mce-test/config/simple_non_panic.conf b/testcases/kernel/mce-test/config/simple_non_panic.conf
deleted file mode 100644
index 7d1a5d3..0000000
--- a/testcases/kernel/mce-test/config/simple_non_panic.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-
-CASES="soft-inj/non-panic/cases.sh"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
diff --git a/testcases/kernel/mce-test/config/simple_nopanic_noser.conf b/testcases/kernel/mce-test/config/simple_nopanic_noser.conf
deleted file mode 100644
index 835d9e6..0000000
--- a/testcases/kernel/mce-test/config/simple_nopanic_noser.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-
-CASES="soft-inj/non-panic/cases.sh soft-inj/poll_noser/cases.sh"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
diff --git a/testcases/kernel/mce-test/config/simple_nopanic_ser.conf b/testcases/kernel/mce-test/config/simple_nopanic_ser.conf
deleted file mode 100644
index a82cdb7..0000000
--- a/testcases/kernel/mce-test/config/simple_nopanic_ser.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-
-CASES="soft-inj/non-panic/cases.sh soft-inj/poll_ucr/cases.sh soft-inj/recoverable_ucr/cases.sh"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
diff --git a/testcases/kernel/mce-test/config/simple_noser.conf b/testcases/kernel/mce-test/config/simple_noser.conf
deleted file mode 100644
index b562070..0000000
--- a/testcases/kernel/mce-test/config/simple_noser.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-
-CASES="soft-inj/non-panic/cases.sh soft-inj/panic/cases.sh soft-inj/panic_npcc/cases.sh soft-inj/panic_noser/cases.sh soft-inj/poll_noser/cases.sh"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
diff --git a/testcases/kernel/mce-test/config/simple_panic.conf b/testcases/kernel/mce-test/config/simple_panic.conf
deleted file mode 100644
index 35e96c8..0000000
--- a/testcases/kernel/mce-test/config/simple_panic.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-
-CASES="soft-inj/panic/cases.sh"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
diff --git a/testcases/kernel/mce-test/config/simple_panic_noser.conf b/testcases/kernel/mce-test/config/simple_panic_noser.conf
deleted file mode 100644
index 6694b31..0000000
--- a/testcases/kernel/mce-test/config/simple_panic_noser.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-
-CASES="soft-inj/panic_noser/cases.sh"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
diff --git a/testcases/kernel/mce-test/config/simple_panic_npcc.conf b/testcases/kernel/mce-test/config/simple_panic_npcc.conf
deleted file mode 100644
index 04a3f23..0000000
--- a/testcases/kernel/mce-test/config/simple_panic_npcc.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-
-CASES="soft-inj/panic_npcc/cases.sh"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
diff --git a/testcases/kernel/mce-test/config/simple_panic_ucr.conf b/testcases/kernel/mce-test/config/simple_panic_ucr.conf
deleted file mode 100644
index 84d0d00..0000000
--- a/testcases/kernel/mce-test/config/simple_panic_ucr.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-
-CASES="soft-inj/panic_ucr/cases.sh"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
diff --git a/testcases/kernel/mce-test/config/simple_poll_noser.conf b/testcases/kernel/mce-test/config/simple_poll_noser.conf
deleted file mode 100644
index 6b7eb79..0000000
--- a/testcases/kernel/mce-test/config/simple_poll_noser.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-
-CASES="soft-inj/poll_noser/cases.sh"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
diff --git a/testcases/kernel/mce-test/config/simple_poll_ucr.conf b/testcases/kernel/mce-test/config/simple_poll_ucr.conf
deleted file mode 100644
index f21038c..0000000
--- a/testcases/kernel/mce-test/config/simple_poll_ucr.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-
-CASES="soft-inj/poll_ucr/cases.sh"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
diff --git a/testcases/kernel/mce-test/config/simple_recoverable_ucr.conf b/testcases/kernel/mce-test/config/simple_recoverable_ucr.conf
deleted file mode 100644
index d140845..0000000
--- a/testcases/kernel/mce-test/config/simple_recoverable_ucr.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-
-CASES="soft-inj/recoverable_ucr/cases.sh"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
diff --git a/testcases/kernel/mce-test/config/simple_ser.conf b/testcases/kernel/mce-test/config/simple_ser.conf
deleted file mode 100644
index b6a3bf2..0000000
--- a/testcases/kernel/mce-test/config/simple_ser.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-
-CASES="soft-inj/non-panic/cases.sh soft-inj/panic/cases.sh soft-inj/panic_npcc/cases.sh soft-inj/poll_ucr/cases.sh soft-inj/panic_ucr/cases.sh soft-inj/recoverable_ucr/cases.sh"
-GCOV=1
-KSRC_DIR=/lib/modules/$(uname -r)/build
diff --git a/testcases/kernel/mce-test/doc/cases/soft-inj_non-panic.txt b/testcases/kernel/mce-test/doc/cases/soft-inj_non-panic.txt
deleted file mode 100644
index df89dfb..0000000
--- a/testcases/kernel/mce-test/doc/cases/soft-inj_non-panic.txt
+++ /dev/null
@@ -1,66 +0,0 @@
-Overall:(4 cases)
-
-- Test method
-  * Preparation
-    + Disable mcelog cron job
-  * Add cases/soft-inj/non-panic/cases.sh into configuration file, and invoke
-    a test driver on it.
-- Common
-  * Test script of test cases in this file can be found in
-    cases/soft-inj/non-panic/cases.sh
-
-
-1. corrected
-
-- Objective:
-  * Test machine_check_poll() and mce_log()
-- Code path tested:
-  * machine_check_poll()
-  * mce_get_rip(), branch without EIPV, RIPV, rip_msr
-  * mce_log()
-- Reference:
-  * Inject data file: cases/soft-inj/non-panic/data/corrected
-- Expected results:
-  * MCE records gotten via /dev/mcelog is same as injected ones
-  * No warning or bug during kernel processing
-
-
-2. corrected hold
-
-- Objective:
-  * Whether is there race condition in machine_check_poll() and mce_log(),
-    multiple machine_check_poll() or mce_log() may be run simultaneously
-    on difference CPU.
-- Code path tested:
-  * same as corrected
-- Reference:
-  * Inject data file: cases/soft-inj/non-panic/data/corrected_hold
-- Expected results:
-  * MCE records gotten via /dev/mcelog is same as injected ones
-  * No warning or bug during kernel processing
-
-
-3. corrected over
-
-- Objective:
-  * Test OVER processing
-- Code path tested:
-  * same as 1
-- Reference:
-  * Inject data file: cases/soft-inj/non-panic/data/corrected_over
-- Expected results:
-  * MCE records gotten via /dev/mcelog is same as injected ones
-  * No warning or bug during kernel processing
-
-
-4. corrected without EN
-
-- Objective:
-  * Test no EN processing
-- Code path tested:
-  * same as 1
-- Reference:
-  * Inject data file: cases/soft-inj/non-panic/data/corrected_no_en
-- Expected results:
-  * MCE records gotten via /dev/mcelog is same as injected ones
-  * No warning or bug during kernel processing
diff --git a/testcases/kernel/mce-test/doc/cases/soft-inj_panic.txt b/testcases/kernel/mce-test/doc/cases/soft-inj_panic.txt
deleted file mode 100644
index f068d8d..0000000
--- a/testcases/kernel/mce-test/doc/cases/soft-inj_panic.txt
+++ /dev/null
@@ -1,173 +0,0 @@
-Overall: (9 cases)
-
-- Test method
-  * Add cases/soft-inj/panic/cases.sh into configuration file, and invoke
-    a test driver on it.
-- Common
-  * Test script of test cases in this file can be found in
-    cases/soft-inj/panic/cases.sh
-
-1. fatal
-
-- Objective:
-  * Test MSR read logic of MCE handler
-  * Test synchronization between monarch and subject
-  * Test logic to recognize a fatal (PCC) MCE
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_end()
-  * mce_reign() until mce_panic("Fatal Machine check",)
-  * mce_severity()
-  * mce_timeout() except if (*t <= 0) branch
-  * mce_panic()
-  * print_mce()
-  * mce_log()
-- Reference:
-  * Inject data file: cases/soft-inj/panic/data/fatal
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "Processor context corrupt"
-
-
-2. fatal timeout
-
-- Objective:
-  * Test logic of timeout during monarch/subject synchronization
-  * Test logic to recognize a fatal (PCC) MCE
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_timeout() if (*t <= 0) branch
-  * mce_severity()
-  * mce_panic("Fatal machine check on current CPU",);
-  * print_mce()
-  * mce_log()
-- Reference:
-  * Inject data file: cases/soft-inj/panic/data/fatal_timeout
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal machine check on current CPU"
-  * Exception message is "Processor context corrupt"
-  * Timeout message is "Some CPUs didn't answer in synchronization"
-
-
-3. fatal in irq
-
-- Objective:
-  * Test fatal MCE occur in IRQ context
-  * Test logic to recognize a fatal (PCC) MCE
-- Code path tested:
-  * Same as fatal
-- Reference:
-  * Inject data file: cases/soft-inj/panic/data/fatal_irq
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "Processor context corrupt"
-
-
-4. fatal with RIPV
-
-- Objective:
-  * Test combination of PCC and RIPV
-  * Test logic to recognize a fatal (PCC) MCE
-- Code path tested:
-  * MCG_STATUS_RIPV branch of switch(m.mcgstatus) in do_machine_check
-  * Others are same as fatal
-- Reference:
-  * Inject data file: cases/soft-inj/panic/data/fatal_ripv
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "Processor context corrupt"
-
-
-5. fatal timeout with RIPV
-
-- Objective:
-  * Test timeout logic of combination of PCC and RIPV
-  * Test logic to recognize a fatal (PCC) MCE
-- Code path tested:
-  * MCG_STATUS_RIPV branch of switch(m.mcgstatus) in do_machine_check
-  * Others are same as fatal_timeout
-- Reference:
-  * Inject data file: cases/soft-inj/panic/data/fatal_timeout_ripv
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal machine check on current CPU"
-  * Exception message is "Processor context corrupt"
-  * Timeout message is "Some CPUs didn't answer in synchronization"
-
-
-6. fatal with OVER
-
-- Objective:
-  * Test OVER flag in MCI_STATUS processing
-  * Test logic to recognize a fatal (PCC) MCE
-- Code path tested:
-  * Same as fatal
-- Reference:
-  * Inject data file: cases/soft-inj/panic/data/fatal_over
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "Processor context corrupt"
-
-
-7. fatal and UC without EN
-
-- Objective:
-  * Test no EN processing. Only one MCE can be injected on one CPU, so
-    a MCE without EN are injected on other CPU.
-  * Test logic to recognize a fatal (PCC) MCE
-- Code path tested:
-  * Same as fatal except no EN branch in do_machine_check()
-- Reference:
-  * Inject data file: cases/soft-inj/panic/data/fatal_no_en
-  * Reference MCE records: cases/soft-inj/panic/refer/fatal_no_en
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Machine check from unknown source"
-  * No exception message
-
-8. fatal with EIPV
-
-- Objective:
-  * Test combination of PCC and EIPV
-  * Test logic to recognize a fatal (PCC) MCE
-- Code path tested:
-  * Same as fatal
-- Reference:
-  * Inject data file: cases/soft-inj/panic/data/fatal_eipv
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "Processor context corrupt"
-
-
-9. fatal in userspace
-
-- Objective:
-  * Test of PCC in userspace
-  * Test logic to recognize a fatal (PCC) MCE
-- Code path tested:
-  * Same as fatal
-- Reference:
-  * Inject data file: cases/soft-inj/panic/data/fatal_eipv
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "Processor context corrupt"
-
-
diff --git a/testcases/kernel/mce-test/doc/cases/soft-inj_panic_noser.txt b/testcases/kernel/mce-test/doc/cases/soft-inj_panic_noser.txt
deleted file mode 100644
index 27a5735..0000000
--- a/testcases/kernel/mce-test/doc/cases/soft-inj_panic_noser.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-Overall: (3 cases)
-
-- Test method
-  * Add cases/soft-inj/panic_noser/cases.sh into configuration file, and invoke
-    a test driver on it.
-- Common
-  * Test script of test cases in this file can be found in
-    cases/soft-inj/panic_noser/cases.sh
-
-1. uc_over
-
-- Objective:
-  * Test MSR read logic of MCE handler
-  * Test synchronization between monarch and subject
-  * Test logic of uncorrected with UC and OVER
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_timeout() except if (*t <= 0) branch
-  * mce_log()
-  * mce_end()
-  * mce_severity()
-  * mce_reign() until mce_panic("Fatal Machine check",)
-  * mce_panic()
-  * print_mce()
-- Reference:
-  * Inject data file: cases/soft-inj/panic_noser/data/uc_over
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "Overflowed uncorrected"
-
-
-2. uc_over_corrected
-
-- Objective:
-  * Test synchronization between monarch and subject
-  * Test logic of uncorrected and corrected
-  * Test logic of uncorrected with UC and OVER
-  * Test logic of corrected with EXCP
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_timeout() except if (*t <= 0) branch
-  * mce_log()
-  * mce_end()
-  * mce_severity()
-  * mce_reign() until mce_panic("Fatal Machine check",)
-  * mce_panic()
-  * print_mce()
-- Reference:
-  * Inject data file: cases/soft-inj/panic_noser/data/uc_over_corrected
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "Overflowed uncorrected"
-
-
-3. uc_over_timeout
-
-- Objective:
-  * Test logic of timeout during monarch/subject synchronization
-  * Test logic of uncorrected with UC and OVER
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_timeout() if (*t <= 0) branch
-  * mce_log()
-  * mce_severity()
-  * mce_panic("Fatal machine check on current CPU",)
-  * print_mce()
-- Reference:
-  * Inject data file: cases/soft-inj/panic_noser/data/uc_over_timeout
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal machine check on current CPU"
-  * Exception message is "Overflowed uncorrected"
-  * Timeout message is "Some CPUs didn't answer in synchronization"
-
-
diff --git a/testcases/kernel/mce-test/doc/cases/soft-inj_panic_npcc.txt b/testcases/kernel/mce-test/doc/cases/soft-inj_panic_npcc.txt
deleted file mode 100644
index fa4b5a1..0000000
--- a/testcases/kernel/mce-test/doc/cases/soft-inj_panic_npcc.txt
+++ /dev/null
@@ -1,145 +0,0 @@
-Overall:(8 cases)
-
-- Test method
-  * Preparation
-    + Disable mcelog cron job
-  * Add cases/soft-inj/panic_npcc/cases.sh into configuration file, and invoke
-    a test driver on it.
-- Common
-  * Test script of test cases in this file can be found in
-    cases/soft-inj/panic_npcc/cases.sh
-
-
-1. fatal severity
-
-- Objective:
-  * Test severity comparison logic of MCE handler
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_end()
-  * mce_severity()
-  * mce_regin() for_each_possible_loops loops(check mce-severity message)
-  * mce_panic()
-  * mce_log()
-  * print_mce()
-- Reference:
-  * Inject data file: cases/soft-inj/panic_npcc/data/fatal_severity
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "Processor context corrupt"
-
-
-2. uncorrected
-
-- Objective:
-  * Test MCE handler logic for EIPV MCE in kernel space
-- Code path tested:
-  * Same as falta severity
-- Reference:
-  * Inject data file: cases/soft-inj/panic_npcc/data/uncorrected
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "In kernel and no restart IP"
-
-
-3. uncorrected timeout
-
-- Objective:
-  * Test MCE handler timeout logic for EIPV MCE in kernel space
-- Code path tested:
-  * do_machine_check()
-  * mce_start() until timeout
-  * mce_severity()
-  * mce_panic("Fatal machine check on current CPU", )
-  * mce_log()
-  * print_mce()
-- Reference:
-  * Inject data file: cases/soft-inj/panic_npcc/data/uncorrected_timeout
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal machine check on current CPU"
-  * Exception message is "In kernel and no restart IP"
-  * Timeout message is "Some CPUs didn't answer in synchronization"
-
-
-4. uncorrected without MCIP
-
-- Objective:
-  * Test MCE handler logic for MCE without PCC, MCIP, EIPV and RIPV
-- Code path tested:
-  * Same as fatal severity
-- Reference:
-  * Inject data file: cases/soft-inj/panic_npcc/data/uncorrected_no_mcip
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "MCIP not set in MCA handler"
-
-
-5. uncorrect timeout without MCIP
-
-- Objective:
-  * Test MCE handler timeout logic for MCE without PCC, MCIP, EIPV and RIPV
-- Code path tested:
-  * Same as uncorrected timeout
-- Reference:
-  * Inject data file: cases/soft-inj/panic_npcc/data/uncorrected_no_mcip_timeout
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal machine check on current CPU"
-  * Kernel panic message is "MCIP not set in MCA handler"
-  * Timeout message is "Some CPUs didn't answer in synchronization"
-
-
-6. uncorrected without EIPV and RIPV
-
-- Objective:
-  * Test MCE handler logic for EIPV and RIPV MCE in kernel space
-- Code path tested:
-  * Same as uncorrected
-- Reference:
-  * Inject data file: cases/soft-inj/panic_npcc/data/uncorrected_no_eripv
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "Neither restart nor error IP"
-
-
-7. uncorrected timeout without EIPV and RIPV
-
-- Objective:
-  * Test MCE handler timout logic for EIPV|RIPV MCE in kernel space
-- Code path tested:
-  * Same as uncorrected timeout
-- Reference:
-  * Inject data file: cases/soft-inj/panic_npcc/data/uncorrected_no_eripv_timeout
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "In kernel and no restart IP"
-  * Timeout message is "Some CPUs didn't answer in synchronization"
-
-
-8. unknown
-
-- Objective:
-  * Test logic for MCE from unknown source (external?)
-- Code path tested:
-  * mce_reign(), mce_panic("Machine check from unknown source") branch
-  * Others are same as fatal severity
-- Reference:
-  * Inject data file: cases/soft-inj/panic_npcc/data/unknown
-- Expected result:
-  * No warning or bug during kernel processing.
-  * Kernel panic message is "Machine check from unknown source"
-  * No exception and timeout message.
diff --git a/testcases/kernel/mce-test/doc/cases/soft-inj_panic_ucr.txt b/testcases/kernel/mce-test/doc/cases/soft-inj_panic_ucr.txt
deleted file mode 100644
index 867c0b7..0000000
--- a/testcases/kernel/mce-test/doc/cases/soft-inj_panic_ucr.txt
+++ /dev/null
@@ -1,135 +0,0 @@
-Overall: (6 cases)
-
-- Test method
-  * Add cases/soft-inj/panic_ucr/cases.sh into configuration file, and invoke
-    a test driver on it.
-- Common
-  * Test script of test cases in this file can be found in
-    cases/soft-inj/panic_ucr/cases.sh
-
-1. s0_ar1
-
-- Objective:
-  * Test MSR read logic of MCE handler
-  * Test synchronization between monarch and subject
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_timeout() except if (*t <= 0) branch
-  * mce_log()
-  * mce_end()
-  * mce_severity()
-  * mce_reign() until mce_panic("Fatal Machine check",)
-  * mce_panic()
-  * print_mce()
-- Reference:
-  * Inject data file: cases/soft-inj/panic_ucr/data/s0_ar1
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "Illegal combination (UCNA with AR=1)"
-
-
-2. srar_over
-
-- Objective:
-  * Test logic of timeout during monarch/subject synchronization
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_timeout() except if (*t <= 0) branch
-  * mce_log()
-  * mce_end()
-  * mce_severity()
-  * mce_reign() until mce_panic("Fatal Machine check",)
-  * mce_panic();
-  * print_mce()
-- Reference:
-  * Inject data file: cases/soft-inj/panic_ucr/data/srar_over
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "Action required with lost events"
-
-
-3. srar_unknown
-
-- Objective:
-  * Test fatal MCE occur in IRQ context
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_timeout() except if (*t <= 0) branch
-  * mce_log()
-  * mce_end()
-  * mce_severity()
-  * mce_reign() until mce_panic("Fatal Machine check",)
-  * mce_panic()
-  * print_mce()
-- Reference:
-  * Inject data file: cases/soft-inj/panic_ucr/data/srar_unknown
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "Action required; unknown MCACOD"
-
-
-4. srar_no_en
-
-- Objective:
-  * Test fatal MCE occur
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_timeout() except if (*t <= 0) branch
-  * mce_log()
-  * mce_end()
-  * mce_severity()
-  * mce_reign() until mce_panic("Machine check from unknown source",)
-  * mce_panic()
-  * print_mce()
-- Reference:
-  * Inject data file: cases/soft-inj/panic_ucr/data/srar_no_en
-  * Reference MCE records: cases/soft-inj/panic_ucr/refer/srar_no_en
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Machine check from unknown source"
-
-5.srao_ewb_noripv
-- Objective:
-  * Test MCE handler logic for EIPV and RIPV MCE in kernel space
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_end()
-  * mce_severity()
-  * mce_regin() for_each_possible_loops loops(check mce-severity message)
-  * mce_panic()
-  * mce_log()
-  * print_mce()
-- Reference:
-  * Inject data file: cases/soft-inj/recoverable_ucr/data/srao_ewb_noripv
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "Neither restart nor error IP"
-
-6.srao_mem_scrub_noripv
-- Objective:
-  * Test MCE handler logic for EIPV and RIPV MCE in kernel space
-- Code path tested:
-  * the same as srao_ewb_noripv
-- Reference:
-  * Inject data file:
-  * cases/soft-inj/recoverable_ucr/data/srao_mem_scrub_noripv
-- Expected result:
-  * No warning or bug during kernel processing.
-  * MCE records collected via kernel panic log is same as reference ones.
-  * Kernel panic message is "Fatal Machine check"
-  * Exception message is "Neither restart nor error IP"
-
diff --git a/testcases/kernel/mce-test/doc/cases/soft-inj_poll_ucr.txt b/testcases/kernel/mce-test/doc/cases/soft-inj_poll_ucr.txt
deleted file mode 100644
index ed41a10..0000000
--- a/testcases/kernel/mce-test/doc/cases/soft-inj_poll_ucr.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-Overall:(2 cases)
-
-- Test method
-  * Preparation
-    + Disable mcelog cron job
-  * Add cases/soft-inj/panic_ucr/cases.sh into configuration file, and invoke
-    a test driver on it.
-- Common
-  * Test script of test cases in this file can be found in
-    cases/soft-inj/panic_ucr/cases.sh
-
-
-1. ucna
-
-- Objective:
-  * Test severity comparison logic of MCE handler
-  * Test logic of uncorrected with POLL
-- Code path tested:
-  * machine_check_poll() except
-        if (!(flags & MCP_UC) &&
-            (m.status & (mce_ser ? MCI_STATUS_S : MCI_STATUS_UC))
-  * mce_log()
-- Reference:
-  * Inject data file: cases/soft-inj/poll_ucr/data/ucna
-- Expected result:
-  * MCE records collected via kernel panic log is same as reference ones.
-  * No warning or bug during kernel processing.
-
-
-2. ucna_over
-
-- Objective:
-  * Test severity comparison logic of MCE handler
-  * Test logic of uncorrected with POLL
-- Code path tested:
-  * machine_check_poll() except
-        if (!(flags & MCP_UC) &&
-            (m.status & (mce_ser ? MCI_STATUS_S : MCI_STATUS_UC))
-  * mce_log()
-- Reference:
-  * Inject data file: cases/soft-inj/poll_ucr/data/ucna_over
-- Expected result:
-  * MCE records collected via kernel panic log is same as reference ones.
-  * No warning or bug during kernel processing.
diff --git a/testcases/kernel/mce-test/doc/cases/soft-inj_recoverable_ucr.txt b/testcases/kernel/mce-test/doc/cases/soft-inj_recoverable_ucr.txt
deleted file mode 100644
index 4b10338..0000000
--- a/testcases/kernel/mce-test/doc/cases/soft-inj_recoverable_ucr.txt
+++ /dev/null
@@ -1,138 +0,0 @@
-overall: (7 cases)
-
-- Test method
-  * Add cases/soft-inj/recoverable_ucr/cases.sh into configuration file, and invoke a test driver on it.
-- Common
-  * Test script of test cases in this file can be found in
-    cases/soft-inj/recoverable_ucr/cases.sh
-
-1.srao_corrected
-
-- Objective:
-  * Test logic of uncorrected and corrected
-  * Test logic of uncorrected with S
-  * Test logic of corrected with EXCP
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_timeout() except if (*t <= 0) branch
-  * mce_severity()
-  * mce_log()
-  * mce_end()
-  * mce_reign()
-  * mce_report_event()
-- Reference:
-  * Inject data file: cases/soft-inj/recoverable_uc/data/srao_corrected
-- Expected result:
-  * No warning or bug during kernel processing.
-  * Exception message is "Action optional unknown MCACOD"
-
-2.srao_ewb
-- Objective:
-  * Test logic of uncorrected with S
-  * Test logic of UCR errors detected during last level cache(LLC) explicit writebacks.
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_timeout() except if (*t <= 0) branch
-  * mce_severity()
-  * mce_ring_add()
-  * mce_log()
-  * mce_end()
-  * mce_reign()
-- Reference:
-  * Inject data file: cases/soft-inj/recoverable_uc/data/srao_ewb
-- Expected result:
-  * No warning or bug during kernel processing.
-  * Exception message is "Action optional: last level cache writeback error"
-
-3.srao_mem_scrub
-- Objective:
-  * Test logic of uncorrected with S
-  * Test logic of UCR errors detected on data load
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_timeout() except if (*t <= 0) branch
-  * mce_severity()
-  * mce_ring_add()
-  * mce_log()
-  * mce_end()
-  * mce_reign()
-- Reference:
-  * Inject data file: cases/soft-inj/recoverable_uc/data/srao_mem_scrub
-- Expected result:
-  * No warning or bug during kernel processing.
-  * Exception message is "Action optional: memory scrubbing error"
-
-4.srao_no_en
-- Objective:
-  * Test no EN processing.
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_timeout() except if (*t <= 0) branch
-  * mce_severity()
-  * mce_end()
-  * mce_reign()
-  * mce_panic()
-- Reference:
-  * Inject data file: cases/soft-inj/recoverable_uc/data/srao_no_en
-- Expected result:
-  * No warning or bug during kernel processing.
-  * Kernel panic message is "Machine check from unknown source"
-
-5.srao_over
-- Objective:
-  * Test logic of uncorrected with S and OVER
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_timeout() except if (*t <= 0) branch
-  * mce_severity()
-  * mce_log()
-  * mce_end()
-  * mce_reign()
-- Reference:
-  * Inject data file: cases/soft-inj/recoverable_uc/data/srao_over
-- Expected result:
-  * No warning or bug during kernel processing.
-  * Exception message is "Action optional with lost events"
-
-6.srao_ucna
-- Objective:
-  * Test logic of uncorrected with S
-  * Test logic of ucna
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_timeout() except if (*t <= 0) branch
-  * mce_severity()
-  * mce_get_rip()
-  * mce_log()
-  * mce_end()
-  * mce_reign()
-- Reference:
-  * Inject data file: cases/soft-inj/recoverable_uc/data/srao_ucna
-- Expected result:
-  * No warning or bug during kernel processing.
-  * Exception message is "Action optional with unknown MCACOD"
-
-7.srao_unknown
-- Objective:
-  * Test logic of uncorrected with S
-- Code path tested:
-  * do_machine_check()
-  * mce_start()
-  * mce_timeout() except if (*t <= 0) branch
-  * mce_severity()
-  * mce_get_rip()
-  * mce_log()
-  * mce_end()
-  * mce_reign()
-- Reference:
-  * Inject data file: cases/soft-inj/recoverable_uc/data/srao_unknown
-- Expected result:
-  * No warning or bug during kernel processing.
-  * Exception message is "Action optional with unknown MCACOD"
-
diff --git a/testcases/kernel/mce-test/doc/howto.txt b/testcases/kernel/mce-test/doc/howto.txt
deleted file mode 100644
index 418e728..0000000
--- a/testcases/kernel/mce-test/doc/howto.txt
+++ /dev/null
@@ -1,516 +0,0 @@
-
-MCE test suite HOWTO
-====================
-
-11 November 2008
-
-Huang Ying
-
-Section 4.2 (Test with kdump test driver) is based on the README of
-LTP kdump test case.
-
-Abstract
---------
-
-This document explains the structure and design of MCE test suite, the
-kernel patch and user space tools needed for automatic tests, usage
-guide and how to add new test cases into test suite.
-
-0. Quick shortcut
-------------------
-
-- Install the Linux kernel with full MCE injection support, including
-  latest Linux kernel (2.6.31) and MCE injection enhancement patchset
-  in: http://ftp.kernel.org/pub/linux/kernel/people/yhuang/mce/. Make
-  sure following configuration options are enabled:
-
-  CONFIG_X86_MCE=y
-  CONFIG_X86_MCE_INTEL=y
-  CONFIG_X86_MCE_INJECT=y or CONFIG_X86_MCE_INJECT=m
-
-- Get mcelog git version from 
-  git://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git.
-  and install in /usr/sbin (or rather first in your $PATH)
-
-  git clone git://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git
-  cd mcelog
-  make
-  sudo make install
-
-- Get mce-inject git version from
-  git://git.kernel.org/pub/scm/utils/cpu/mce/mce-inject.git.
-
-  git clone git://git.kernel.org/pub/scm/utils/cpu/mce/mce-inject.git
-  cd mce-inject
-  make
-  sudo make install
-
-- Install page-types tool (sec 3.4), which is accompanied with Linux kernel
-  source (2.6.32 or newer).
-
-  cd $KERNEL_SRC/Documentation/vm/
-  gcc -o page-types page-types.c
-  cp page-types /usr/bin/
-
-- Run make test
-  This will do the basic tests, but not the more complicated kdump ones.
-  For more information on those read below.
-
-1. Introduction
----------------
-
-The MCE test suite is a collection of tools and test scripts for
-testing the Linux kernel MCE processing features. The goal is to cover
-most Linux kernel MCE processing code paths and features with
-automation tests.
-
-If you just want to start testing as quickly as possible, you can skip
-section 2 and section 3, and go section 4.1 directly.
-
-
-2. Structure
-------------
-
-The main intention behind the design is to re-use test cases amongst
-various test methods (represented as test drivers), such as kdump
-based, kernel MCE panic log (tolerant=3) based, etc.
-
-2.1 Test cases
-
-Test cases are grouped into test case classes. The test cases in one
-class share the similar triggering, result collecting and result
-verifying methods. They can be used in same set of test drivers. The
-interface of a test case class is a shell script, usually named as
-cases.sh under a sub-directory of cases/. The following command line
-option should be supported by the test case class shell script:
-
-cases.sh enumerate		enumerate test cases in class, print test
-				case names to stdout
-cases.sh trigger		trigger the test case
-cases.sh get_result		get the result of test case
-cases.sh verify			verify the result of test case, and print
-				the verify result to stdout
-
-When execute cases.sh [trigger|get_result|verify], the test case is
-specified via environment variable this_case, which must be one of the
-test case names returned by "cases.sh enumerate".
-
-Other environment variables are also used to pass some information
-from driver to test cases, such as:
-
-this_case			name current test case
-driver				name of test driver
-klog				file name which holds kernel log during test
-KSRC_DIR (for gcov)		kernel source code directory
-GCOV (for gcov)			gcov collection method
-vmcore (for kdump)		vmcore file name
-reboot (for kdump)		indicate there is a reboot between test
-				case trigger and test case verify, some
-				context has been gone.
-
-Several test case classes are provided with the test suite. 
-cases/soft-inj/* is based on mce-inject MCE software injection tool.
-cases/apei-inj/* is based on apei-inj APEI haredware injection tool.
-
-cases/<injection tool>/<class name>/cases.sh	Interface of the test case class
-cases/<injection tool>/<class name>/data/	Directory contains data file
-cases/<injection tool>/<class name>/refer/	Directory contains data file for
-					reference MCE records if necessary.
-
-For document of various test cases, please refer to doc/cases/*.
-
-2.2 Test drivers
-
-Test drivers drive the test procedure, its main structure is a loop
-over test case classes specified in configuration file. For each test
-case class, test driver loops over test cases returned by "cases.sh
-enumerate". And, for each test case, it calls "cases.sh" to trigger,
-get_result and verify the test case. Test driver also do some common
-work for test cases, such as kdump driver collects vmcore file, and
-invoking gcovdump command to get gcov data file.
-
-The interface of test driver is driver.sh, which is usually put in
-drivers/<driver_name>/ directory. The test configuration file should
-be used as the only command line parameter for driver.sh. Test case
-classes should be specified in test configuration file as CASES
-variable, details below.
-
-2.3 Test configuration file
-
-Test configuration file is a shell script to specify parameters for
-test drivers and test cases. It must be put in config/ directory. The
-parameters are represented as shell variables as follow:
-
-CASES				Name of test case classes, separate by
-				white space.
-START_BACKGROUND		Shell command to start a background process
-				during testing, used for random testing.*
-STOP_BACKGROUND			Shell command to stop the background process
-				during testing.
-COREDIR (for kdump)		directory contains Linux kernel crash core
-				dump after kdump.
-VMLINUX (for kdump, gcov)	vmlinux of Linux kernel
-GCOV (for gcov)			Enable GCOV if set none zero.
-KSRC_DIR (for gcov)		Kernel source code directory
-
-* To test MCE processing under random environment, a background
-  process can be automatically run simultaneously during MCE
-  testing. The start/stop command is specified via START_BACKGROUND
-  and STOP_BACKGROUND.
-
-2.4 Test result
-
-After test, the general test result will go results/<driver_name>/result.
-The format of general test result is as follow:
-
-<test case name>:
-  Passed: item 1 description
-  Failed: item 2 description
-  ...
-  Passed: item n description
-
-One blank line is used to separate test cases.
-
-Additional test result for various test cases will go
-"results/<driver_name>/<case_name>/<xxx>. For in-package test case
-class, additional test results include:
-
-results/<driver_name>/<injection_tool>/<case_name>/klog
-				Kernel log during testing
-results/<driver_name>/<injection_tool>/<case_name>/mcelog
-				mcelog output during testing
-results/<driver_name>/<injection_tool>/<case_name>/mcelog_refer
-				mcelog output reference
-results/<driver_name>/<injection_tool>/<case_name>/mce_64.c.gcov (for gcov)
-				gcov output file
-
-
-3. Tools
---------
-
-3.1 mce-inject
-
-mce-inject is a software MCE injection tool, which is based on Linux
-kernel software MCE injection mechanism. To inject a MCE into Linux
-kernel via mce-inject, a data file should be provided. The syntax is
-similar to the logging output by mcelog with some extensions. 
-Please refer to the documentation of mce-inject for more information.
-
-The mce-inject program must be executable in $PATH.
-
-3.2 mcelog
-
-mcelog read /dev/mcelog and prints the stored machine check records to
-stdout. It is used by MCE test suite to verify MCE records generated
-by kernel is same as reference records, at most time, same as input
-records. The current git mcelog version is needed for MCE test suite to
-work properly. Please refer to document of mcelog for more
-information. The latest mcelog can be gotten via git snapshot from
-git://git.kernel.org/pub/scm/utils/cpu/mce/mcelog.git.
-
-Note you need the git version of mcelog available in $PATH.
-
-3.3 gcovdump
-
-gcov is a test coverage tool, the original implementation is used for
-user space program only. LTP (Linux Test Project) provides the kernel
-gcov support. But MCE test involves panic or kdump, so gcovdump is
-developed to dump gcov data from kdump crash dump core. gcovdump has
-been merged by LTP cvs. For more information please refer to gcovdump
-document. The latest gcovdump can be gotten from cvs:
-http://ltp.cvs.sourceforge.net/viewvc/ltp/utils/analysis/gcov-kdump/.
-
-3.4 page-types
-A tool to query page types, which is accompanied with Linux kernel 
-source (2.6.32 or newer, $KERNEL_SRC/Documentation/vm/page-types.c).
-It is required for MCE apei-inj testing. 
-
-4. Usage Guide
---------------
-
-4.1 Test with simple test driver
-
-4.1.1 Simple test driver
-
-The simple test driver just call cases.sh of test cases one by one in
-a loop. So it is not permitted for test cases to trigger real panic or
-reboot during test. For MCE testing, a special processing mode to just
-log everything in case of MCE is used for the simple test driver, it
-is enabled via set MCE parameter "tolerant=3" during
-testing. "tolerant" can be set via writing:
-    /sys/devices/system/machinecheck/machinecheck0/tolerant
-
-4.1.2 test instruction
-
-The following is the basic test instruction, for some additional
-features such as gcov support, please refer to corresponding
-instructions.
-
-a. Linux kernel and user space tools as follow should be installed
-
-   - A Linux kernel with full MCE injection support (see 0)
-   - mce-inject tool (see 3.1)
-   - mcelog with proper version (see 3.2)
-   - page-types (see 3.4)
-
-b. Modify config/simple.conf or create a new test configuration
-   file. Refer to section 2.3 for more instruction about test
-   configuration file.
-
-c. Run "make". Carefully check for any errors.
-
-d. It is recommended to stop cron before testing. Because there
-   might be another mcelog reading events running on background
-   by cron, which will upset the test.
-
-      /etc/init.d/crond stop
-
-e. To be root and invoke simple test driver on test configuration file
-   as follow
-
-       Run "make test" to do all the standard tests that do not require
-       special set up.
-
-f. General test result will go results/simple/result. Test log will go
-   work/simple/log. Additional test results for various test cases
-   will go results/simple/<test case>/<xxx>. For more details about
-   in-package test case class, please refer to section 2.1.
-
-
-4.2 Test with kdump test driver
-
-4.2.1 kdump test driver
-
-The kdump test driver is based on the kdump test case in Linux Test
-Project, thank LTP for their excellent work!
-
-The kdump driver helps run tests which trigger crash/panic and
-generate result and report via kdump.  The test scripts cycle through a
-series of crash/panic scenarios. Each test cycle does the following:
-
-a.  Triggers a test case which triggers crash/panic (MCE with tolerant=1).
-b.  Kdump kernel boots and saves a vmcore.
-c.  System reboots to 1st kernel.
-d.  Verifies test case, generate result and report.
-e.  After a 1 to 2 minute delay, the next test case is run.
-
-4.2.2 test instruction
-
-Follow the steps to setup kdump test driver.
-
-The test driver is written for SuSE Linux Enterprise Server 10 (and
-onward releases), OpenSUSE, Fedora, Debian, as well as RedHat
-Enterprise Linux 5. Since KDUMP is supported by the above mentioned
-distro's the test driver was written and tested on them. Contribution
-towards supporting more distributions are welcome.
-
-a. Install Linux kernel with full MCE injection and KDUMP support. In
-   addition to MCE injection support in section 0, the following
-   configuration options should be enabled too:
-
-   CONFIG_KEXEC=y
-   CONFIG_CRASH_DUMP=y
-
-b. Install these additional packages:
-
-   For SLES10 or OpenSUSE Distro:
-
-     * kernel-kdump
-     * kernel-source
-     * kexec-tools
-
-   For RHEL5 or Fedora distro:
-
-     * kexec-tools
-     * kernel-devel
-
-c. Configure where to put the kdump /proc/vmcore files. The path should be
-   specified via COREDIR in test configuration file.
-   By default, the kdump /proc/vmcore files will be put into /var/crash.
-
-   For SLES10 or OpenSUSE Distro:
-     * edit KDUMP_SAVEDIR in /etc/sysconfig/kdump
-   For RHEL5 or Fedora distro:
-     * edit path in /etc/kdump.conf
-
-d. In addition to bzImage and modules of Linux kernel should be
-   installed on test machine, the vmlinux of Linux kernel should be
-   put on test machine and specified via VMLINUX in test configuration
-   file.
-
-e. Make sure the partition where the test driver is running has space
-   for the tests results and one vmcore file (size of physical
-   memory).
-
-f. Now, reboot system. Test if kdump works by starting kdump and triggering
-   kernel panic.
-
-   For SLES10 or OpenSUSE Distro:
-    service boot.kdump restart
-    chkconfig boot.kdump on
-    echo "c" > /proc/sysrq-trigger
-
-   For RHEL5 or Fedora distro:
-    service kdump restart
-    /sbin/chkconfig kdump on
-    echo "c" > /proc/sysrq-trigger
-
-   After system reboot, check if there are vmcore files. By default, they are in /var/crash/*/. If yes, "kdump" works in the system.
-
-g. Create a new test configuration file or use a existing one in
-   config/, such as kdump.conf. Note: not all test case classes can be
-   used with kdump test driver, see "important points" below.
-
-h. Run "make". Carefully check for any errors.
-
-i. To be root and run "drivers/kdump/driver.sh <conf>" or "make test-kdump" (for a full test)
-
-j. After test is done, the test log of the last run of kdump driver will
-   be displayed on main console.
-
-Few Important points to remember:
-
-- kdump test driver request that a real panic should be triggered when
-  test case is triggered. So not all test case classes can be used
-  with kdump test driver, for example, all test case classes for
-  corrected MCE can not be used with kdump test driver.
-
-- If you need to stop the tests before all test cases have run, run
-  "crontab -r" and "killall driver.sh" within 1 minute after the 1st
-  kernel reboots. Then, if you'd like to carry on tests from that point
-  on, run:
-    rm work/kdump/stamps/setupped
-    drivers/kdump/driver.sh <conf>
-  If you'd like to start tests from the beginning, run:
-    make reset
-    drivers/kdump/driver.sh <conf>
-
-- If a failure occurs when booting the kdump kernel, you'll need to
-  manually reset the system so it reboots back to the 1st kernel and
-  continues on to the next test. For this reason, it's best to monitor
-  the tests from a console. If possible, setup a serial console (not a
-  must, any type of console setup will do). If using minicom, enable
-  saving of kernel messages displayed on minicom into a file, by
-  pressing ctrl+a+l on the console. Else, when it is observed that the
-  kdump kernel has failed to boot, manually copy the boot message into
-  a file to enable the debugging the cause of the hang.
-
-- The results are saved in results/kdump/result, which also shows
-  where you are in the test run. When the "Test run complete" entry
-  appears in that file, you're done. Verbose log can be found at
-  work/log.
-
-- The test machine would be unavailable for any other work during the
-  period of the test run.
-
-4.3 Gcov support
-
-Gcov is a test coverage tool. It can be used to discover untested
-parts of program, collect branch taken statistics to optimize program,
-etc. In MCE test suite, it is used to get test coverage, that is,
-which C statements are covered by each test case.
-
-Gcov support is optional, if you don't care about test coverage
-information, just skip this section.
-
-a. Make sure your kernel has gcov support. You can find lasted kernel
-   gcov patches from:
-       http://ltp.sourceforge.net/coverage/gcov.php
-
-   A README for kernel gcov can be found from:
-       http://ltp.sourceforge.net/coverage/gcov/readme.php
-
-   Notes: CONFIG_GCOV_ALL does not work for me. Add the line
-       EXTRA_CFLAGS += $(KBUILD_GCOV_FLAGS)
-   to the respective Makefiles are more stable. For example, this line
-   can be added into "linux/arch/x86/kernel/cpu/mcheck/Makefile"
-
-b. If you want to use gcov with kdump test driver, please install
-   gcovdump tool(see section 3.4). The latest gcovdump can be gotten
-   from cvs:
-   http://ltp.cvs.sourceforge.net/viewvc/ltp/utils/analysis/gcov-kdump/.
-
-c. Linux kernel source source code should be put on the test
-   machine. Its root directory should be specified in test
-   configuration file via KSRC_DIR.
-
-d. In addition to bzImage and modules of Linux kernel should be
-   installed on test machine, the vmlinux of Linux kernel should be
-   put on test machine and specified via VMLINUX of test configuration
-   file.
-
-e. Make sure gcov is available in your test system. It comes with gcc
-   package normally. If kdump test driver is used, a tool named
-   gcovdump is also needed to dump *.gcda from crash dump image.
-
-f. In test configuration file, make sure the following setting is
-   available:
-
-       # enable GCOV support
-       GCOV=1
-       # kernel source is needed to get gcov graph
-       KSRC_DIR=<kernel source directory>
-       VMLINUX=<vmlinux>
-
-g. After testing, *.c.gcov will be generated in test case result
-   directory, such as
-   results/kdump/soft-inj/non-panic/corrected/mce_64.c.gcov.
-
-h. To merge gcov graph data from several test cases, a tool named
-   gcov_merge.py in tools sub-directory can be used. For example,
-
-       tools/gcov_merge results/kdump/soft-inj/*/*/mce_64.c.gcov
-
-   Will output merged gcov graph from all test cases under
-   soft-inj. This can be used to check coverage of several test cases.
-
-4.4 tool
-
-Some tools are provided to help analyze test result.
-
-- tools/grep_result.sh
-
-  Grep from general test result (results/<driver_name>/result) in
-  terms of test case instead of line, because the result of one test
-  case may span several line.
-
-  Usage:
-      cat results/<driver_name>/result | tools/grep_result.sh <grep options>
-
-  Where <grep options> are same as options available to /bin/grep.
-
-- tools/loop-mce-test
-
-  Run mce test cases in a loop. It exits on failure of any one of the test
-  cases. This script is using simple test driver.
-
-  Usage:
-      ./loop-mce-test <config_file>
- 
-  Note that only simple test configure file can be used here.
-
-5. Add test cases
------------------
-
-5.1 Add test case to in-package test class
-
-All in-package test classes use mce-inject software injection tool and
-follows same structure. The steps to add a new test case is as follow:
-
-a. Find an appropriate test case class to add your test case.
-
-b. Add a new mce-inject data file into to cases/soft-inj/<class name>/data/.
-
-c. If the reference mcelog is different from mce-inject input data
-   file, put that reference file into cases/soft-inj/<class_name>/refer/.
-
-d. In cases/soft-inj/<class name>/cases.sh, there are shell commands
-   "case" in shell functions get_result() and verify(). Add a branch
-   in each shell command "case" for your test case.
-
-5.2 Add test class
-
-To add a new test class, add a cases.sh under a sub-directory of
-cases/, and follow the test case class interface definition in section
-2.1. The general result output format should follow that in section
-2.4.
diff --git a/testcases/kernel/mce-test/doc/stress-howto.txt b/testcases/kernel/mce-test/doc/stress-howto.txt
deleted file mode 100644
index f96a0ec..0000000
--- a/testcases/kernel/mce-test/doc/stress-howto.txt
+++ /dev/null
@@ -1,340 +0,0 @@
-MCE Stress Test HOWTO
-====================
-
-Oct 10th, 2009
-
-Haicheng Li
-
-
-Abstract
---------
-
-This document explains the design and structure of MCE stress test suite,
-the kernel configurations and user space tools required for automated
-stress testing, as well as usage guide and etc.
-
-
-0. Quick Shortcut
------------------
-
-- Install the Linux kernel (2.6.32 or newer) with full MCA recovery support.
-  Make sure following configuration options are enabled:
-
-  CONFIG_X86_MCE=y
-  CONFIG_MEMORY_FAILURE=y
-
-  With these two options enabled, you can do stress testing thru madvise
-  syscall (sec 4.1).
-
-- Install page-types tool (sec 3.3), which is accompanied with Linux kernel
-  source (2.6.32 or newer).
-
-  # cd $KERNEL_SRC/Documentation/vm/
-  # gcc -o page-types page-types.c 
-  # cp page-types /usr/bin/
-
-- Get latest LTP (Linux Test Project) image from http://ltp.sf.net. Refer
-  to INSTALL of LTP to install LTP on your machine.
-
-- Build and run stress testing
-
-  # make
-  # cd stress
-  # ./hwpoison.sh -d $YOUR_PARTITION -M -o $YOUR_LTP_DIR -N
-
-  Note here, '-d $YOUR_PARTITION' is a mandatory option. Test will create 
-  all temporary files on $YOUR_PARTITION, and error injection will just
-  affect the pages associated with $$YOUR_PARTITION. So you must provide a
-  free disk partition to stress test driver!
-
-  This will do the stress testing thru madvise syscall (sec 4.1). However,
-  there are more advanced test methods provided (sec 4.2, 4.3).
-
-Note, for all examples in the rest of this doc, it is supposed that $PWD is
-the stress subdir.  
-
-1. Overview
------------
-
-The MCE stress test suite is a collection of tools and test scripts, which
-intends to achieve stress testing on Linux kernel MCA high level handlers
-that include HWPosion page recovery, soft page offline, and so on.
-
-In general, this test suite is designed to do stress testing thru various
-test interfaces, i.e. madvise syscall, HWPoison page injector, and APEI
-injector (see ACPI4.0 spec). And it's able to support most of popular
-Linux File Systems (FS), that is, there is an option for user to specify which
-FS type they want the test to be running on.
-
-If you just want to start testing as quickly as possible, you can skip
-section 2 & 3, just go to section 4 directly.
-
-
-2. Design Details
------------------
-
-The MCE stress test suite consists of four parts: test driver, workload
-controller, customized workloads, and background workloads.
-
-The main test idea is described as below:
-- Test driver launchs various customized workloads to continuously generate
-  lots of pages with expected page states, Note, all of these workloads know
-  about their expected results that should not be affected by Linux MCE high
-  level handlers.
-- Then test driver injects MCE errors to these pages thru either madvise 
-  syscall or HWPoison injector or APEI injector. While Linux Kernel handling
-  these MCE errors, all the workloads continue running normally,
-- After long time running, test driver will collect test result of each
-  workload to see if any unexpected failures happened. In such a way, it can 
-  decide if any bug is found.
-- If any system panics or FS corruption happens, that means there must be a
-  bug. It's the bottom line to decide if test gets pass.
-
-2.1 Test Driver
-
-Test driver (a.k.a hwpoison.sh) drives the whole test procedure. It's
-responsible for managing test environment, setting up error injection 
-interface, controlling test progress, launching workloads, injecting page 
-errors, as well as recording test logs and reporting test result.
-
-For detailed usage of hwpoison.sh test driver, please refer to:
-# ./hwpoison.sh -h
-
-2.2 Workload Controller
-
-Workload controller needs to have various test workloads running parallelly
-and continuously within a required duration time. We select ltp-pan
-program of Linux Test Project (LTP) as the workload controller of this
-stress test suite.
-
-Test driver (hwpoison.sh) interacts with ltp-pan in following ways:
-- hwpoison.sh generates a test config file that lists the workload type
-  to be launched by ltp-pan.
-- hwpoison also passes test duration time and other workload specific
-  parameters to ltp-pan via test config file.
-- ltp-pan makes each workload run and get finished in time, then test driver
-  can get the result of each workload via corresponding result files.
-- finally, hwpoison.sh will decide the overall test result based on each
-  workload result, and report final result out.
-
-2.3 Customized Workloads
-
-There are three types of customized workloads, which are intended to generate 
-pages with various page state.
-
-* Type0: page-poisoning workload, meant to cover:
-  - anonymous pages operations.
-  - file data operations.
-
-* Type1: fs-metadata workload, meant to cover:
-  - inode operations.
-
-* Type2: fs_type specific workload, meant to cover:
-  - extended functions of some special FS.
-
-2.4 Background Workloads
-
-LTP is selected as the background workload to simulate normal system
-operations in background while stress testing is running.
-
-Besides LTP, there are also some alternatives, like AIM. We might extend more
-background workloads in future.
-
-2.5 Test Result
-
-How to determine that stress testing gets pass?
-- at least no kernel panics happens during stress testing.
-- fsck on the target disk at the end of stress testing should get pass.
-- there is no failure found by customized workloads, especially for
-  page-poisoning workload.
-
-Where to get detailed test result?
-- When stress testing is done, the general test result is recorded in
-  result/hwpoison.result, and the general test log is in result/hwpoison.log.
-  However, you can specify them in following way:
-  # hwpoison.sh -r $YOUR_RESULT -l $YOUR_LOG
-- The test result and test log of each workload are recorded as
-  log/$workload/$workload.result and log/$workload/$workload.log.
-  For example, for page-poisoning workload, its test result and test logs are
-  log/page-poisoning/page-poisoning.result and 
-  log/page-poisoning/page-poisoning.log.
-- Besides, under each workload result dir, you can find other extra logs
-  like pan_log, pan_output and etc. These logs are generated by ltp-pan 
-  workload controller. Usually they can help you understand what has been 
-  going on with ltp-pan while workload is running. Pls. refer to ltp-pan doc
-  for details.
-
-
-3. Tools
---------
-
-3.1 page-poisoning
-
-It is the page-poisoning workload. page-poisoning workload is an extension of
-tinjpage test program with a multi-process model. It spawns thousands of
-processes that inject HWPosion error to various pages simultaneously thru
-madvise syscall. Then it checks if these errors get handled correctly, 
-i.e. whether each test process receives or doesn't receive SIGBUS signal as 
-expected.
-
-For more info about page-poisoning workload, pls. read through README file
-under stress/tools/page-poisoning/.
-
-3.2 fs-metadata
-
-It is the fs-metadata workload. fs-metadata is designed to test i-node
-operations with heavy workload and make sure every i-node operation gets
-the expected result. In details, it firstly generates a huge directory
-hierarchy on the target disk, then it performs unlink operations on this
-directory hierarchy and duplicate a copy of the directory, finally it
-checks if these two directories are same as expected.
-
-For more info about fs-metadata workload, pls. read through README file
-under stress/tools/fs-metadata/.
-
-3.3 page-types
-
-page-types is a tool to query the page type of every memory page in the
-system. We use it to filter out pages with required page types. Test will
-inject error to these pages via error injector, although the page filter
-of HWPosion handler in Linux Kernel will filter them out for a second
-time. Note, the reason we need to use page-types to do first time filtering
-is just about performance.
-
-To install page-types on your test machine:
-
-  # cd $KERNEL_SRC/Documentation/vm/
-  # gcc -o page-types page-types.c 
-  # cp page-types /usr/bin/
-
-3.4 ltp-pan
-
-It's the workload controller of this stress test suite. In fact, ltp-pan
-is the test harness of LTP (Linux Test Project), and is included in
-LTP package. For more information, please refer to ltp-pan document of LTP.
-
-
-4. Usage Guide
---------------
-
-This section is trying to show you how to conduct the stress testing thru
-various test interfaces. 
-
-As an example, we choose to run stress testing based on partition /dev/sda1 
-for 1 hour. Note, we've installed LTP to /ltp.  
-
-4.1 Stress Test thru Madvise Syscall.
-
-To run this stress testing, you need to strictly follow below test
-instructions. 
-
-* Test instructions:
-
-- make sure following kernel options are enabled:
-  CONFIG_X86_MCE=y
-  CONFIG_MEMORY_FAILURE=y
-
-- build and run stress testing
-  # make
-  # ./hwpoison.sh -d $YOUR_PARTITION -M -o $YOUR_LTP_DIR
-
-* Example: 
-
-- launch testing
-  # ./hwpoison.sh -d /dev/sda1 -M -t 3600
-
-- general test results
-  result: result/hwpoison.result
-  logs: result/hwpoison.log
-
-- detailed workload results
-  result: log/page-poisoning/page-poisoning.result
-  log: log/page-poisoning/page-poisoning.log
-
-4.2 Stress Test thru HWPosion Page Injector
-
-This is the default test method of this stress test suite.
-
-To run this stress testing, you need to strictly follow below test
-instructions. 
-
-* Test instructions:
-
-- make sure following kernel options are enabled:
-  CONFIG_X86_MCE=y
-  CONFIG_MEMORY_FAILURE=y
-  CONFIG_DEBUG_KERNEL=y
-  CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y
-  CONFIG_HWPOISON_INJECT=y
-
-- build and run stress testing
-  # make
-  # ./hwpoison.sh -d $YOUR_PARTITION -o $YOUR_LTP_DIR -L 
-
-* Example: 
-
-- launch testing
-  # ./hwpoison.sh -d /dev/sda1 -t 3600 -L
-
-- general test results
-  result: result/hwpoison.result
-  logs: result/hwpoison.log
-
-- detailed workload results
-  fs-metadata result: log/fs-metadata/fs-metadata.result
-  fs-metadata log: log/fs-metadata/fs-metadata.log
-  ltp result: log/ltp/ltp.result
-  ltp log: log/ltp/ltp.log
-  fs-specific result: log/fs-specific/fs-specific.result
-  fs-specific log: log/fs-specific/fs-specific.log
-
-4.3 Stress Test thru APEI Injector
-
-To run this stress testing, you need to follow below test instructions. 
-
-* Test instructions:
-
-- make sure following kernel options are enabled:
-  CONFIG_X86_MCE=y
-  CONFIG_X86_MCE_INTEL=y
-  CONFIG_MEMORY_FAILURE=y
-  CONFIG_ACPI_APEI=y
-  CONFIG_ACPI_APEI_EINJ=y
-
-- build and run stress testing
-  # make
-  # ./hwpoison.sh -d $YOUR_PARTITION -o $YOUR_LTP_DIR -L -A
-
-* Example: 
-
-- launch testing
-  # ./hwpoison.sh -d /dev/sda1 -t 3600 -L -A
-
-- general test results
-  result: result/hwpoison.result
-  logs: result/hwpoison.log
-
-- detailed workload results
-  fs-metadata result: log/fs-metadata/fs-metadata.result
-  fs-metadata log: log/fs-metadata/fs-metadata.log
-  ltp result: log/ltp/ltp.result
-  ltp log: log/ltp/ltp.log
-  fs-specific result: log/fs-specific/fs-specific.result
-  fs-specific log: log/fs-specific/fs-specific.log
-
-
-5. FAQs
--------
-
-Here is a collection of frequently asked questions:
-
-Q: How to tell test driver not to format my disk partition?
-A: Use the option '-N'.
-
-Q: Can three types of tests run on same sytem simultaneously?
-A: No. There are limitations in Linux Kernel HWPoison page filtering.  
-
-Q: Can I run this stress testing on multiple disks parallely?
-A: Yes. But it requires updated Kernel patches for HWPosion page filtering.
-   Now, it just supports one same test with same pagetype flags specified. 
-
diff --git a/testcases/kernel/mce-test/doc/verify.txt b/testcases/kernel/mce-test/doc/verify.txt
deleted file mode 100644
index 129d93b..0000000
--- a/testcases/kernel/mce-test/doc/verify.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-To verify the result of MCE testing, the MCE record from kernel (via
-/dev/mcelog or panic information) should be compared with reference
-MCE record (for software inject error: the input MCE record). To
-compare MCE record, the following scheme is proposed:
-
-- Define a standard MCE record representation format. It should be
-  human readable, compatible with MCE parser in mce-inject, easy to
-  manipulate in shell (such as remove a field), easy to compare
-  (literally).
-
-  One MCE record is as follow:
-
-  CPU NUMBER
-  BANK NUMBER
-  TSC NUMBER
-  RIP NUMBER
-  ADDR NUMBER
-  MISC NUMBER
-  STATUS NUMBER
-  MCGSTATUS NUMBER
-
-  Multiple MCE records are separated by one empty line.
-
-- Enhance mce-inject or develop a new tool to convert from other
-  format to standard format.
-
-- Develop a new tool based on /usr/sbin/mcelog to output mce-inject
-  compatible MCE record. Because there may be different (uncompatible
-  version) /usr/sbin/mcelog on different machine.
-
-- During verifying, firstly convert various MCE recoards from kernel
-  and reference MCE records to standard format, then compare the
-  standard format MCE records in shell.
diff --git a/testcases/kernel/mce-test/drivers/kdump/driver.sh b/testcases/kernel/mce-test/drivers/kdump/driver.sh
deleted file mode 100755
index 6016582..0000000
--- a/testcases/kernel/mce-test/drivers/kdump/driver.sh
+++ /dev/null
@@ -1,299 +0,0 @@
-#!/bin/bash -xe
-#
-# Kdump test driver: test case will trigger panic, and then crash
-# dump. The test result is collected via dumped vmcore. For more
-# information about kdump dirver please refer to doc/README.kdump.
-#
-# Copyright (C) 2008, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is based on kdump test case in LTP.
-#
-# This file is released under the GPLv2.
-#
-
-sd=$(dirname "$0")
-export ROOT=`(cd $sd/../..; pwd)`
-
-export driver=kdump
-
-. $ROOT/lib/functions.sh
-setup_path
-. $ROOT/lib/dirs.sh
-. $ROOT/lib/mce.sh
-
-setup_crontab ()
-{
-    echo "Setup crontab."
-
-    set +e
-    crontab -r
-    set -e
-
-    # crontab in some distros will not read from STDIN.
-
-    cat <<EOF > $WDIR/kdump.cron
-SHELL=/bin/bash
-PATH=/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
-MAILTO=root
-@reboot cd "$(pwd)"; ${0} $conf >> $WDIR/log 2>&1; cat $WDIR/log > /dev/console
-EOF
-
-    crontab $WDIR/kdump.cron
-
-    echo "Enable cron daemon by default."
-
-    if [ -f /etc/init.d/crond ]; then
-        cron=crond
-    else
-        # SUSE
-        cron=cron
-    fi
-
-    # Red Hat and SUSE.
-    if [ -x "/sbin/chkconfig" ]; then
-        /sbin/chkconfig "${cron}" on
-
-    # Debian and Ubuntu.
-    elif [ -x "/sbin/update-rc.d" ]; then
-        /sbin/update-rc.d "${cron}" defaults
-    fi
-}
-
-setup_kdump ()
-{
-    echo "Start kdump daemon."
-
-    if [ -f /etc/init.d/kdump ]; then
-	    daemon=kdump
-    else
-	    #SLE11
-	    daemon=boot.kdump
-    fi
-
-    /etc/init.d/"${daemon}" restart
-
-    echo "Enable kdump daemon by default."
-    # Red Hat and SUSE.
-    if [ -x "/sbin/chkconfig" ]; then
-        /sbin/chkconfig "${daemon}" on
-
-    # Debian and Ubuntu.
-    elif [ -x "/sbin/update-rc.d" ]; then
-        /sbin/update-rc.d "${daemon}" defaults
-    fi
-}
-
-get_klog()
-{
-    klog=$RDIR/$this_case/klog
-    cat <<EOF > $WDIR/get_klog_gdb.cmd
-dump memory $klog log_buf log_buf+log_end
-EOF
-    set +e
-    gdb -batch -batch-silent -x $WDIR/get_klog_gdb.cmd $VMLINUX $vmcore \
-	> /dev/null 2>&1
-    ret=$?
-    set -e
-    if [ $ret -eq 0 -a -s $klog ]; then
-	export klog
-    else
-	echo "  Failed: can not get kernel log"
-	rm -rf $klog
-    fi
-}
-
-dump_gcov()
-{
-    if [ -z "$GCOV" ]; then
-	return
-    fi
-    if ! chk_gcov; then
-	echo "gcov is not supported by kernel or there is no " \
-	    "gcov utility installed"
-	echo "disabling gcov support"
-	unset GCOV
-	return
-    fi
-    if [ -z "$KSRC_DIR" ]; then
-	echo "  Failed: please set KSRC_DIR for GCOV"
-	return
-    else
-	KSRC_DIR=$(set -P && cd "$KSRC_DIR" && pwd)
-	if [ -z "$KSRC_DIR"]; then
-	    echo "  Failed: Invalid KSRC_DIR, please check your setup"
-	    return
-	fi
-    fi
-    export KSRC_DIR
-    local gcov_head_raw=$WDIR/dump_gcov_head_raw
-    cat <<EOF > $WDIR/dump_gcov_gdb.cmd
-dump value $gcov_head_raw (void *)gcov_info_head
-EOF
-    set +e
-    gdb -batch -batch-silent -x $WDIR/dump_gcov_gdb.cmd $VMLINUX $vmcore \
-	> /dev/null 2>&1
-    ret=$?
-    set -e
-    if [ $ret -ne 0 -o ! -s $gcov_head_raw ]; then
-	echo "  Failed: can not get kernel gcov_info_head"
-	return
-    fi
-    wl=$(stat -c '%s' $gcov_head_raw)
-    h=$(echo -n 0x; od -A n -t x$wl $gcov_head_raw | tr -d ' ')
-    if ! gcovdump -g $h $vmcore &> /dev/null; then
-	echo "  Failed: can not dump kernel gcov info"
-	return
-    fi
-cat <<"EOF" > $WDIR/dump_gcov_deskew.sh
-    fn="$1"
-    bfn=$(basename "$fn")
-    dbfn="${bfn##\.tmp_}"
-    if [ -z "$dbfn" ]; then
-        return
-    fi
-    d=$(dirname "$fn")
-    cp $fn "$d/$dbfn"
-EOF
-    chmod +x $WDIR/dump_gcov_deskew.sh
-    find $KSRC_DIR \( -name '*.tmp_*gcno' -o -name '*.tmp_*gcda' \) \
-        -exec $WDIR/dump_gcov_deskew.sh \{\} \;
-
-    export GCOV=dump
-}
-
-get_result ()
-{
-    vmcore=$(ls -t "${COREDIR}"/*/vmcore* 2>/dev/null | head -1)
-
-    if [ -n "$vmcore" -a -f "$vmcore" ]; then
-	export vmcore
-	get_klog
-	dump_gcov
-    else
-	echo "  Failed: can not get vmcore"
-    fi
-
-    export reboot=1
-
-    $CDIR/$case_sh get_result
-}
-
-verify_case ()
-{
-    if [ -z "$vmcore" ]; then
-	echo "  Failed: can not got vmcore"
-    fi
-    $CDIR/$case_sh verify
-}
-
-trigger_case ()
-{
-    # Be careful to define COREDIR.
-    rm -rf "${COREDIR}"/*
-
-    # Save STDIO buffers.
-    sync
-    $CDIR/$case_sh trigger
-}
-
-# Start test.
-if [ $# -lt 1 ]; then
-    die "Usage: $0 <config>"
-fi
-
-conf=$(basename "$1")
-
-. $CONF_DIR/$conf
-
-driver_prepare
-set_tolerant 1
-set_panic_on_oops 0
-
-# Check mandatory variables.
-if [ -z "${COREDIR}" ]; then
-    die "Fail: some mandatory variables are missing from configuration file."
-fi
-
-# Reboot the machine first to take advantage of boot parameter
-# changes.
-if [ ! -f $WDIR/stamps/setupped ]; then
-    echo "Setup test environment."
-
-    setup_crontab
-
-    $SDIR/setup.sh $CONF_DIR/$conf
-
-    echo > $WDIR/stamps/setupped
-
-    echo "System is going to reboot."
-    /sbin/shutdown -r now
-    sleep 60
-    exit -1
-fi
-
-#if mce_inject is a module, it is ensured to have been loaded
-if modinfo mce_inject > /dev/null 2>&1; then
-    if ! lsmod | grep -q mce_inject; then
-        if ! modprobe mce_inject; then
-	    die "module mce_inject isn't supported ?"
-        fi
-    fi
-fi
-
-for case_sh in ${CASES}; do
-    for this_case in $($CDIR/$case_sh enumerate); do
-	export this_case
-	_this_case=$(echo $this_case | tr '/' '_')
-
-	if [ -f $WDIR/stamps/${_this_case}_done ]; then
-	    continue
-	fi
-
-        # First Test.
-	if [ ! -f $WDIR/stamps/first_test_checked ]; then
-            echo "First test..."
-            echo "Verify Boot Loader."
-            if ! grep 'crashkernel=' /proc/cmdline; then
-		die "Fail: error changing Boot Loader, no crashkernel=."
-            fi
-            setup_kdump
-	    echo > $WDIR/stamps/first_test_checked
-	fi
-
-	if [ ! -f $WDIR/stamps/${_this_case}_triggered ]; then
-	    echo > $WDIR/stamps/${_this_case}_triggered
-
-	    mkdir -p $RDIR/$this_case
-	    rm -rf $RDIR/$this_case/*
-	    echo -e "\n$this_case:" | tee -a $RDIR/result
-
-	    echo "Running current test $this_case."
-
-	    trigger_case | tee -a $RDIR/result
-
-	    triggering=1
-	fi
-
-	sleep 5
-
-	if [ -z "$triggering" ]; then
-            (get_result; verify_case) | tee -a $RDIR/result
-	else
-	    echo "  Failed: Failed to trigger kdump" | tee -a $RDIR/result
-	fi
-	echo > $WDIR/stamps/${_this_case}_done
-
-        # Wait for system to fully boot and leave a chance for user to
-        # stop test
-	sleep 55
-    done
-done
-
-echo "Test run complete" | tee -a $RDIR/result
-
-# We are done.
-# Reset.
-crontab -r
-
-exit 0
diff --git a/testcases/kernel/mce-test/drivers/kdump/setup.sh b/testcases/kernel/mce-test/drivers/kdump/setup.sh
deleted file mode 100755
index f90742c..0000000
--- a/testcases/kernel/mce-test/drivers/kdump/setup.sh
+++ /dev/null
@@ -1,105 +0,0 @@
-#!/bin/bash -ex
-#
-# Setup for kdump test driver.
-#
-# This file is copied from kdump test case of LTP.
-#
-# This file is released under the GPLv2.
-#
-
-conf=${1}
-arch=$(uname -m)
-kver=$(uname -r)
-
-. "${conf}"
-
-echo "Verify Kernel version >= 2.6.16."
-# Kernel might in the following format.
-# x.y.z-1.el
-# x.y.z.1.el
-kx=${kver%%.*}
-tmp=${kver#*.}
-ky=${tmp%%.*}
-tmp=${tmp#*.}
-tmp=${tmp%%.*}
-kz=${tmp%%-*}
-
-if [ "${kx}" -lt 2 ]; then
-    error=1
-
-elif [ "${kx}" -eq 2 ]; then
-    if [ "${ky}" -lt 6 ]; then
-        error=1
-
-    elif [ "${ky}" -eq 6 ]; then
-        if [ "${kz}" -lt 16 ]; then
-            error=1
-        fi
-    fi
-fi
-
-if [ "${error}" ]; then
-    echo "Fail: kernel version ${kver} is less than 2.6.16."
-fi
-
-
-echo "Verify user is root."
-if [ $(id -u) != 0 ]; then
-    echo "Fail: root is required."
-    error=1
-fi
-
-
-echo "Verify prerequisite."
-if [ ! -x "/sbin/kexec" ]; then
-    echo "Fail: kexec-tools not found."
-    error=1
-fi
-
-if [ ! -d "/lib/modules/${kver}/build" ]; then
-    echo "Fail: kernel-devel not found."
-    error=1
-fi
-
-if [ "${CRASH}" ] && [ "${CRASH}" -eq 1 ]; then
-    if [ ! -x "/usr/bin/crash" ]; then
-        echo "Fail: crash not found."
-        error=1
-    fi
-
-    if [ ! -f "${VMLINUX}" ]; then
-        echo "Fail: kernel-debuginfo not found."
-        error=1
-    fi
-fi
-
-# Final result.
-if [ "${error}" ]; then
-    echo "Please fixed the above failures before continuing."
-    exit 1
-fi
-
-echo "Modify Boot Loader."
-if [ "${arch}" = "ppc64" ]; then
-    args="crashkernel=256M@32M xmon=off"
-elif [ "${arch}" = "i686" ]; then
-    args="crashkernel=128M@16M nmi_watchdog=1"
-elif [ "${arch}" = "ia64" ]; then
-    args="crashkernel=512M@256M"
-else
-    args="crashkernel=128M@16M"
-fi
-
-if [ -x "/sbin/grubby" ]; then
-    /sbin/grubby --default-kernel |
-     xargs /sbin/grubby --args="${args}" --update-kernel
-
-else
-    echo "Warn: please make sure the following arguments are in Boot\
- Loader:"
-    echo "$args"
-    echo "Hit any key when ready."
-    read
-fi
-
-exit 0
diff --git a/testcases/kernel/mce-test/drivers/simple/driver.sh b/testcases/kernel/mce-test/drivers/simple/driver.sh
deleted file mode 100755
index ebc9d2a..0000000
--- a/testcases/kernel/mce-test/drivers/simple/driver.sh
+++ /dev/null
@@ -1,132 +0,0 @@
-#!/bin/bash
-#
-# Simple test driver: run test cases one by one, assuming test case
-# will not trigger panic or reboot.
-#
-# Copyright (C) 2008, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is released under the GPLv2.
-#
-
-sd=$(dirname "$0")
-export ROOT=`(cd $sd/../..; pwd)`
-
-export driver=simple
-
-. $ROOT/lib/functions.sh
-setup_path
-. $ROOT/lib/dirs.sh
-. $ROOT/lib/mce.sh
-
-tmp_klog=$WDIR/simple_klog_tmp
-
-chk_err()
-{
-    if [ \( -n "$DEBUG_MCE_TEST" \) -a \( -s $err_log \) ]; then
-	cat $err_log
-    fi
-}
-
-klog_begin()
-{
-    dmesg > $tmp_klog.1
-}
-
-klog_end()
-{
-    dmesg | sed -e '1d' > $tmp_klog.2
-    diff $tmp_klog.1 $tmp_klog.2 | grep '^> ' | sed 's/> \(.*\)/\1/' > $klog
-}
-
-trigger()
-{
-    reset_gcov
-
-    $CDIR/$case_sh trigger
-}
-
-get_result()
-{
-    $CDIR/$case_sh get_result
-}
-
-test_all()
-{
-    if [ -n "$GCOV" ]; then
-	if chk_gcov; then
-	    export GCOV=copy
-	    export KSRC_DIR
-	else
-	    echo "gcov is not supported by kernel or there is no " \
-		"gcov utility installed"
-	    echo "disabling gcov support."
-	    unset GCOV
-	fi
-    fi
-
-    #if mce_inject is a module, it is ensured to have been loaded
-    modinfo mce_inject > /dev/null 2>&1
-    if [ $? -eq 0 ]; then
-        lsmod | grep mce_inject > /dev/null 2>&1
-        [ $? -eq 0 ] || modprobe mce_inject
-        [ $? -eq 0 ] || die "module mce_inject isn't supported ?"
-    fi
-
-    for case_sh in $CASES; do
-	for this_case in $($CDIR/$case_sh enumerate); do
-	    set_fake_panic 1
-
-	    export this_case
-	    mkdir -p $RDIR/$this_case
-	    rm -rf $RDIR/$this_case/*
-	    echo -e "\n$this_case:" | tee -a $RDIR/result
-	    klog=$RDIR/$this_case/klog
-
-	    mkdir -p $WDIR/$this_case
-	    rm -rf $WDIR/$this_case/*
-	    local err_log=$WDIR/$this_case/err_log
-
-	    klog_begin
-	    trigger 2>$err_log | tee -a $RDIR/result
-	    chk_err
-	    random_sleep
-	    klog_end
-	    get_result 2>$err_log | tee -a $RDIR/result
-	    chk_err
-	    $CDIR/$case_sh verify 2>$err_log | tee -a $RDIR/result
-	    chk_err
-
-	    set_fake_panic 0
-	done
-    done
-}
-
-if [ $# -lt 1 ]; then
-    die "Usage: $0 <config>"
-fi
-
-conf=$(basename "$1")
-
-. $CONF_DIR/$conf
-
-driver_prepare
-set_panic_on_oops 0
-
-if [ -n "$START_BACKGROUND" ]; then
-    eval $START_BACKGROUND
-else
-    start_background
-fi
-
-[ -d $RDIR ] && mv $RDIR --backup=numbered -T $RDIR.old
-[ -d $WDIR ] && mv $WDIR --backup=numbered -T $WDIR.old
-
-test_all
-
-if [ -n "$STOP_BACKGROUND" ]; then
-    eval $STOP_BACKGROUND
-else
-    stop_background
-fi
-
diff --git a/testcases/kernel/mce-test/kvm/README b/testcases/kernel/mce-test/kvm/README
deleted file mode 100644
index c625b2d..0000000
--- a/testcases/kernel/mce-test/kvm/README
+++ /dev/null
@@ -1,62 +0,0 @@
-KVM RAS Test Suite
-==================
-The KVM RAS Test Suite is a collection of test scripts for testing the
-Linux kernel MCE processing features in KVM guest system.
-
-Jan 26th, 2010
-
-Jiajia Zheng
-
-
-In the Package
-----------------
-
-Here is a short description of what is included in the package
-
-host/*
-	Contains host test scripts, which drive test procedure on host system.
-guest/*
-	Contains guest test scripts, which drive test procedure on guest system.
-
-Dependencies
-----------------
-
-KVM RAS Test Suite has following dependencies on kernel and other tools:
-
-* Linux Kernel:
-  Version 2.6.32 or newer, with MCA high level handlers enabled.
-
-* page-types:
-  A tool to query page types, which is accompanied with Linux kernel
-  source (2.6.32 or newer, $KERNEL_SRC/Documentation/vm/page-types.c).
-
-* simple_process:
-  A process constantly access the allocated memeory. (../tools/simple_process)
-
-Installation
----------------
-1. Build host kernel with
-	CONFIG_KVM=y
-	CONFIG_KVM_INTEL=y
-2. Create a testing dirctory on host system and put the host test scripts
-   and test tool (page-types) into it.
-   By default, the testing directory is /test.
-3. Use ssh-keygen to generate public and privite keys, and copy them into the
-   testing directory on host system.
-4. Mount guest image
-5. Create a testing dirctory on guest system and copy guest test script and
-   tools (page-types, simple_process) into it.
-   By default, the testing directory is /test.
-6. Use qemu to start guest system, install page-types and simple_process on
-   guest system.
-     gcc -o page-types page-types.c
-     cd simple_process
-     make
-
-Start Testing
----------------
-Run testing by
-	./host_run.sh <option> <argument>
-You can get the help information by
-	./host_run.sh -h
-
diff --git a/testcases/kernel/mce-test/kvm/guest/guest_run.sh b/testcases/kernel/mce-test/kvm/guest/guest_run.sh
deleted file mode 100644
index 384e1f4..0000000
--- a/testcases/kernel/mce-test/kvm/guest/guest_run.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-#
-# Test script for KVM RAS
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; version
-# 2.
-#
-# 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 find a copy of v2 of the GNU General Public License somewhere
-# on your Linux system; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Copyright (C) 2010, Intel Corp.
-# Author: Jiajia Zheng <jiajia.zheng@intel.com>
-#
-
-GUEST_DIR=`dirname $0`
-guest_page=$GUEST_DIR/guest_page
-guest_tmp=$GUEST_DIR/guest_tmp
-
-killall simple_process
-$GUEST_DIR/simple_process/simple_process > /dev/null &
-
-$GUEST_DIR/page-types/page-types -p `pidof simple_process` -LN -b anon > $guest_page
-if [ -s $guest_page ]; then
-	ADDR_KLOG=`awk '$2 != "offset" {print "0x"$2}' $guest_page | sed -n -e '1p'`
-	ADDR=`echo $ADDR_KLOG"000"`
-	echo "guest physical address is $ADDR" > $guest_tmp
-fi
-
diff --git a/testcases/kernel/mce-test/kvm/host/SRAO b/testcases/kernel/mce-test/kvm/host/SRAO
deleted file mode 100644
index cecffa1..0000000
--- a/testcases/kernel/mce-test/kvm/host/SRAO
+++ /dev/null
@@ -1,4 +0,0 @@
-CPU 0 BANK 2
-STATUS UNCORRECTED SRAO 0x17a
-MCGSTATUS MCIP RIPV
-MISC 0x8c
diff --git a/testcases/kernel/mce-test/kvm/host/guest_init b/testcases/kernel/mce-test/kvm/host/guest_init
deleted file mode 100644
index b16d2b4..0000000
--- a/testcases/kernel/mce-test/kvm/host/guest_init
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-
-# Source function library.
-. /etc/init.d/functions
-
-
-RETVAL=0
-
-start() {
-
-    touch /root/jobdone
-    mount -t debugfs null /sys/kernel/debug
-    echo 1 > /sys/kernel/debug/mce/fake_ser_p
-    echo 1 > /proc/sys/vm/memory_failure_early_kill
-    sh GUESTRUN &
-    return "$RETVAL"
-}
-
-stop() {
-    return "$RETVAL"
-}
-
-# See how we were called.
-case "$1" in
-  start)
-	start
-	;;
-  stop)
-	stop
-	;;
-  *)
-	echo $"Usage: $0 {start|stop}"
-	exit 3
-esac
-
-exit "$RETVAL"
-
diff --git a/testcases/kernel/mce-test/kvm/host/host_run.sh b/testcases/kernel/mce-test/kvm/host/host_run.sh
deleted file mode 100644
index 10884d0..0000000
--- a/testcases/kernel/mce-test/kvm/host/host_run.sh
+++ /dev/null
@@ -1,282 +0,0 @@
-#!/bin/bash
-#
-# Test script for KVM RAS
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; version
-# 2.
-#
-# 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 find a copy of v2 of the GNU General Public License somewhere
-# on your Linux system; if not, write to the Free Software Foundation,
-# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# Copyright (C) 2010, Intel Corp.
-# Author: Jiajia Zheng <jiajia.zheng@intel.com>
-#
-
-image=""
-mce_inject_file=""
-
-HOST_DIR="/test"
-GUEST_DIR="/test"
-host_key_pub="$HOST_DIR/id_rsa.pub"
-host_key_priv="$HOST_DIR/id_rsa"
-early_kill="1"
-
-kernel=""
-initrd=""
-root=""
-
-usage()
-{
-	echo "Usage: ./host_run.sh [-options] [arguments]"
-	echo "================Below are the must have options==============="
-	echo -e "\t-i image\t: guest image"
-	echo -e "\t-f mcefile\t: which mce data file to inject"
-	echo "================Below are the optional options================"
-	echo -e "\t-d hostdir\t: where you put the test scripts on host system"
-	echo -e "\t\t\tBy default, hostdir is set to $HOST_DIR"
-	echo -e "\t-g guestdir\t: where you put the test scripts on guest system"
-	echo -e "\t\t\tBy default, hostdir is set to $GUEST_DIR"
-	echo -e "\t-b pubkey\t: host public key"
-	echo -e "\t\t\tBy default, host public key is $host_key_pub"
-	echo -e "\t-p privkey\t: host privite key"
-	echo -e "\t\t\tBy default, host privite key is $host_key_priv"
-	echo -e "\t-o offset\t: guest image offset (optional) "
-	echo -e "\t\t\tBy default, offset is calculated by kpartx "
-        echo -e "\t-l latekill\t: disable early kill in guest system"
-        echo -e "\t\t\tBy default, earlykill is enabled "
-	echo "============If you want to specify the guest kernel==========="
-	echo "============please set below options all together============="
-	echo -e "\t-k kernel\t: guest kernel"
-	echo -e "\t-n initrd\t: guest initrd"
-	echo -e "\t-r root\t\t: guest root partition"
-	exit 0
-}
-
-while getopts ":i:f:d:g:o:b:p:k:n:r:h:l" option
-do
-        case $option in
-		i) image=$OPTARG; offset=`kpartx -l $image | awk '{print $NF*512}'`;;
-		f) mce_inject_file=$OPTARG;;
-		d) HOST_DIR=$OPTARG; host_key_pub=$HOST_DIR/id_rsa.pub; host_key_priv=$HOST_DIR/id_rsa;;
-		g) GUEST_DIR=$OPTARG;;
-		b) host_key_pub=$OPTARG;;
-		p) host_key_priv=$OPTARG;;
-		o) offset=$OPTARG;;
-		l) early_kill="0";;
-		k) kernel=$OPTARG;;
-		n) initrd=$OPTARG;;
-		r) root=$OPTARG;;
-		h) usage;;
-		*) echo "invalid option!"; usage;;
-        esac
-done
-
-
-guest_script=$GUEST_DIR/guest_run.sh
-guest_tmp=$GUEST_DIR/guest_tmp
-guest_page=$GUEST_DIR/guest_page
-GUEST_PHY=""
-
-guest_init=$HOST_DIR/guest_init
-host_start=$HOST_DIR/host_start
-pid_file=$HOST_DIR/pid_file
-monitor_console=""
-serial_console=""
-monitor_console_output=$HOST_DIR/monitor_console_output
-serial_console_output=$HOST_DIR/serial_console_output
-host_tmp=$HOST_DIR/host_tmp
-mce_inject_data=$HOST_DIR/mce_inject_data
-
-
-invalid()
-{
-	echo $1
-	echo "Try \`./host_run.sh -h\` for more information."
-	exit 0
-}
-
-check_env()
-{
-	[ -z $image ] && invalid "please input the guest image!"
-	[ ! -e $image ] && invalid "guest image $image does not exist!"
-	[ -z $mce_inject_file ] && invalid "please input the mce data file!"
-	[ ! -e $mce_inject_file ] && invalid "mce data file $mce_inject_file does not exist!"
-
-	[ ! -e $host_key_pub ] && invalid "host public key does not exist!"
-	[ ! -e $host_key_priv ] && invalid "host privite key does not exist!"
-	chmod 600 $host_key_pub
-	chmod 600 $host_key_priv
-}
-
-#Guest Image Preparation
-image_prepare()
-{
-	mnt=`mktemp -d`
-	mount -oloop,offset=$offset $image $mnt && echo "mount image to $mnt "
-	if [ $? -ne 0 ]; then
-	    echo "mount image failed!"
-	    return 1
-	fi
-
-	[ ! -e $mnt$guest_script ] && umount $mnt && invalid "Invalid guest directory!"
-	rm -f $mnt/etc/rc3.d/S99kvm_ras
-	rm -f $mnt$guest_tmp $mnt$guest_page
-
-	if [ ! -d $mnt/root/.ssh ]; then
-	    mkdir $mnt/root/.ssh
-	    chmod 700 $mnt/root/.ssh
-	fi
-	cat $host_key_pub >> $mnt/root/.ssh/authorized_keys
-        kvm_ras=/etc/init.d/kvm_ras
-	sed "s#EARLYKILL#$early_kill#g" $guest_init | sed "s#GUESTRUN#$guest_script#g" > $mnt$kvm_ras
-	chmod a+x $mnt$kvm_ras
-	ln -s $kvm_ras $mnt/etc/rc3.d/S99kvm_ras
-	sleep 2
-	umount $mnt
-	sleep 2
-	rm -rf $mnt
-	return 0
-}
-
-#Start guest system
-start_guest()
-{
-	local i
-	if [ ! -z $kernel ]; then
-	    if [ ! -z $initrd ]; then
-		if [ ! -z $root ]; then
-		    append="root=$root ro loglevel=8 mce=3 console=ttyS0,115200n8 console=tty0"
-	            qemu-system-x86_64 -hda $image -kernel $kernel -initrd $initrd --append "$append" \
-		    -net nic,model=rtl8139 -net user,hostfwd=tcp::5555-:22 -monitor pty -serial pty \
-		    -pidfile $pid_file > $host_start 2>&1 &
-		    sleep 5
-		else
-		    invalid "please specify the guest root partition!"
-		fi
-	    else
-		invalid "please specify the guest initrd!"
-	    fi
-	else
-	    echo "Start the default kernel on guest system"
-	    qemu-system-x86_64 -hda $image -net nic,model=rtl8139 -net user,hostfwd=tcp::5555-:22 \
-	    -monitor pty -serial pty -pidfile $pid_file > $host_start 2>&1 &
-	    sleep 5
-	fi
-	monitor_console=`awk '{print $NF}' $host_start | sed -n -e '1p'`
-	serial_console=`awk '{print $NF}' $host_start | sed -n -e '2p'`
-	QUME_PID=`cat $pid_file`
-	echo "monitor console is $monitor_console"
-	echo "serial console is $serial_console"
-	echo "Waiting for guest system start up..."
-}
-
-check_guest_alive()
-{
-	for i in 1 2 3 4 5 6 7 8 9
-	do
-	    sleep 10
-            ssh -i $host_key_priv localhost -p 5555 echo "" > /dev/null 2>&1
-	    if [ $? -eq 0 ]; then
-		return 0
-	    else
-		echo "Waiting..."
-	    fi
-	done
-	return 1
-}
-
-addr_translate()
-{
-	#Get Guest physical address
-        scp -i $host_key_priv -P 5555 localhost:$guest_tmp $guest_tmp > /dev/null 2>&1
-	if [ $? -ne 0 ]; then
-		echo "Failed to get Guest physical address, quit testing!"
-		exit 0
-	fi
-	sleep 2
-	GUEST_PHY=`awk '{print $NF}' $guest_tmp`
-	echo "Guest physical address is $GUEST_PHY"
-	sleep 2
-
-	#Get Host virtual address
-	echo p2v $GUEST_PHY > $monitor_console
-	cat $monitor_console > $monitor_console_output &
-	sleep 5
-	HOST_VIRT=`awk '/address/{print $NF}' $monitor_console_output |cut -b 3-11`
-	echo "Host virtual address is $HOST_VIRT"
-
-	#Get Host physical address
-	page-types/page-types -p $QUME_PID -LN -b anon | grep $HOST_VIRT > $host_tmp
-	sleep 5
-	ADDR=`cat $host_tmp | awk '{print "0x"$2"000"}' `
-	echo "Host physical address is $ADDR"
-}
-
-error_inj()
-{
-	#Inject SRAO error
-	cat $mce_inject_file > $mce_inject_data
-	echo "ADDR $ADDR" >> $mce_inject_data
-	mce-inject $mce_inject_data
-}
-
-
-get_guest_klog()
-{
-        cat $serial_console > $serial_console_output &
-}
-
-check_guest_klog()
-{
-	GUEST_PHY_KLOG=`echo $GUEST_PHY | sed 's/000$//'`
-	echo "Guest physical klog address is $GUEST_PHY_KLOG"
-	cat $serial_console_output | grep "MCE $GUEST_PHY_KLOG"
-	if [ $? -ne 0 ]; then
-		return 1
-	fi
-	return 0
-}
-
-
-
-check_env
-image_prepare
-if [ $? -ne 0 ]; then
-    echo "Mount Guest image failed, quit testing!"
-else
-    start_guest
-    get_guest_klog
-    check_guest_alive
-    if [ $? -ne 0 ]; then
-        echo "Start Guest system failed, quit testing!"
-    else
-	sleep 5
-        addr_translate
-        error_inj
-	sleep 5
-	check_guest_klog
-	if [ $? -ne 0 ]; then
-            echo "FAIL: Did not get expected log!"
-	    exit 0
-	else
-	    echo "PASS: Inject error into guest!"
-	fi
-	sleep 10
-	check_guest_alive
-	if [ $? -ne 0 ]; then
-            echo "FAIL: Guest System could have died!"
-	else
-	    echo "PASS: Guest System alive!"
-	fi
-    fi
-fi
-
-rm -f $host_start $monitor_console_output $serail_console_output $host_tmp $pid_file $mce_inject_data
diff --git a/testcases/kernel/mce-test/lib/apei-inject.sh b/testcases/kernel/mce-test/lib/apei-inject.sh
deleted file mode 100644
index a1ed34c..0000000
--- a/testcases/kernel/mce-test/lib/apei-inject.sh
+++ /dev/null
@@ -1,180 +0,0 @@
-#
-# APEI library: APEI specific functions
-#
-# Copyright (C) 2008, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#           Zheng Jiajia <jiajia.zheng@intel.com>
-# This file is released under the GPLv2.
-#
-
-. $ROOT/lib/soft-inject.sh
-
-if [ -n "$this_case" ]; then
-    bcase=$(basename $this_case)
-fi
-mcelog_result=$RDIR/$this_case/mcelog
-klog=$RDIR/$this_case/klog
-
-apei_mce_reformat()
-{
-    local inf="$1"
-    local outf="$2"
-    local tmpf=$WDIR/mce_reformat_for_cmp
-    sed "s/0x//g" $inf | grep -v 'STATUS 0x0' | \
-        grep -v 'STATUS 0x800000000000000' | sort > "$tmpf"
-    awk '/^STATUS/ {print $2}' $tmpf | cut -b 1-3 > $outf
-    awk '/MCGSTATUS/ {if ($4=="") print $2; else print $4;}' $tmpf >> $outf
-}
-
-apei_mce_cmp()
-{
-    [ $# -eq 2 ] || die "missing parameter for mce_cmp"
-    local m1="$1"
-    local m2="$2"
-    local tmpf1=$WDIR/mce_cmp_1
-    local tmpf2=$WDIR/mce_cmp_2
-
-    apei_mce_reformat "$m1" $tmpf1 
-    apei_mce_reformat "$m2" $tmpf2 
-    diff $tmpf1 $tmpf2 > /dev/null
-}
-
-apei_inject_verify_mcelog()
-{
-    if [ -f $RDIR/$this_case/mcelog ]; then
-        mcelog_refer=$SDIR/refer/$bcase
-        mce-inject --dump $mcelog_refer > $RDIR/$this_case/mcelog_refer
-        if apei_mce_cmp $RDIR/$this_case/mcelog $RDIR/$this_case/mcelog_refer; then 
-            echo "  Passed: MCE log is ok"
-        else
-            echo "  Failed: MCE log is different from input"
-        fi
-    else
-        echo "  Failed: no MCE log result"
-    fi
-}
-
-
-apei_inject_get_klog()
-{
-    soft_inject_get_klog
-}
-
-apei_inject_get_mcelog()
-{
-    soft_inject_get_mcelog
-}
-
-# verify return value
-apei_inject_verify_return_val()
-{
-    soft_inject_verify_return_val
-}
-
-apei_inject_verify_kill()
-{
-    soft_inject_verify_kill
-}
-
-apei_inject_enumerate()
-{
-    soft_inject_enumerate
-}
-
-apei_inject_trigger()
-{
-    check_debugfs
-    #APEI_IF should be defined after debugfs is mounted
-    APEI_IF=`mount | grep debugfs | cut -d ' ' -f3`/apei/einj
-
-    #if einj is a module, it is ensured to have been loaded
-    modinfo einj > /dev/null 2>&1
-    if [ $? -eq 0 ]; then
-	[ -d $APEI_IF ] || modprobe einj
-        [ $? -eq 0 ] || die "module einj isn't supported ?"
-    fi
-
-    mcelog &> /dev/null
-    TYPE=`awk '/^TYPE/{print $2}' $SDIR/data/$bcase`
-    echo $TYPE > $APEI_IF/error_type
-    killall simple_process
-    $TDIR/simple_process/simple_process > /dev/null &
-
-    page-types -p `pidof simple_process` -LN -b ano > $RDIR/$this_case/page
-
-    ADDR=`awk '$2 != "offset" {print "0x"$2"000"}' $RDIR/$this_case/page | sed -n -e '1p'`
-    echo $ADDR > $APEI_IF/param1
-
-    echo "1" > $APEI_IF/error_inject
-
-    ret=$?
-    echo $ret > $RDIR/$this_case/return
-    sleep 1
-}
-
-start_tracing()
-{
-    [ $# -eq 1 ] || die "missing parameter for get_panic_from_mcelog: please set filter for ftrace"
-    [ -d /sys/kernel/debug/tracing ] || die "no tracing"
-    echo "function_graph" > /sys/kernel/debug/tracing/current_tracer
-    echo $1 > /sys/kernel/debug/tracing/set_ftrace_filter
-    echo "1" > /sys/kernel/debug/tracing/tracing_enabled
-}
-
-stop_tracing()
-{
-    [ -d /sys/kernel/debug/tracing ] || die "no tracing"
-    echo "0" > /sys/kernel/debug/tracing/tracing_enabled
-    cp /sys/kernel/debug/tracing/trace $RDIR/$this_case/
-    echo "nop" > /sys/kernel/debug/tracing/current_tracer
-}
-
-apei_inject_verify_trace()
-{
-    [ $# -eq 1 ] || die "missing parameter for apei_inject_verify_trace"
-    if grep "$1" $RDIR/$this_case/trace; then
-       echo "Passed: trace is correct"
-    else
-       echo "Failed: Nothing is traced"
-    fi
-}
-
-apei_inject_verify_panic()
-{
-    local mce_panic="$1"
-    verify_panic_via_klog $klog "$mce_panic"
-}
-
-apei_inject_verify_exp()
-{
-    verify_exp_via_klog $klog "$@"
-}
-
-apei_inject_verify_fail()
-{
-    verify_fail_via_klog $klog "$@"
-}
-
-apei_inject_main()
-{
-    op="$1"
-    shift
-
-    case "$op" in
-	enumerate)
-	    enumerate
-	    ;;
-	trigger)
-	    trigger "$@"
-	    ;;
-	get_result)
-	    get_result
-	    ;;
-	verify)
-	    verify
-	    ;;
-	*)
-	    die "Usage: $0 enumerate|trigger|get_result|verify"
-    esac
-    exit 0
-}
diff --git a/testcases/kernel/mce-test/lib/dirs.sh b/testcases/kernel/mce-test/lib/dirs.sh
deleted file mode 100755
index 9ca42b2..0000000
--- a/testcases/kernel/mce-test/lib/dirs.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# Setup environment variable for various directories.
-#
-# Copyright (C) 2008, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is released under the GPLv2.
-#
-
-RCDIR=cases
-RCONF_DIR=config
-RRDIR=results
-RWDIR=work
-RLDIR=lib
-
-SDIR=$(script_dir)
-CDIR=$ROOT/cases
-CONF_DIR=$ROOT/config
-RDIR=$ROOT/results/$driver
-WDIR=$ROOT/work/$driver
-LDIR=$ROOT/lib
-TDIR=$ROOT/tools
diff --git a/testcases/kernel/mce-test/lib/functions.sh b/testcases/kernel/mce-test/lib/functions.sh
deleted file mode 100755
index 1abccfc..0000000
--- a/testcases/kernel/mce-test/lib/functions.sh
+++ /dev/null
@@ -1,90 +0,0 @@
-#
-# Function library: provide common functions
-#
-# Copyright (C) 2008, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is released under the GPLv2.
-#
-
-setup_path()
-{
-    export PATH=$ROOT/bin:$PATH
-}
-
-script_dir()
-{
-    local rd=$(dirname "$0")
-    (cd $rd; pwd)
-}
-
-relative_path()
-{
-    local len1=${#1}
-    local len2=${#2}
-    if [ $len1 -eq 0 -o $len1 -ge $len2 -o "${2:0:$len1}" != "$1" ]; then
-	die "$2 is not the sub-path of $1!"
-    fi
-    len1=$((len1 + 1))
-    echo "${2:$len1}"
-}
-
-die()
-{
-    echo "DIE: $@"
-    echo "DIE: $@" 1>&2
-    exit -1
-}
-
-driver_prepare()
-{
-    mkdir -p $WDIR/stamps
-}
-
-check_kern_warning_bug()
-{
-    local f="$1"
-    [ -n "$f" ] || die "missing parameter for check_kern_warning"
-    grep -e '----\[ cut here \]---' $f > /dev/null || \
-	grep -e 'BUG:' $f > /dev/null
-}
-
-random_sleep()
-{
-    local s=$((RANDOM / 13107 + 5))
-    sleep $s
-}
-
-start_background()
-{
-    if [ -n "$BACKGROUND" ]; then
-	pid_background=$(bash -i -c "$BACKGROUND &>$WDIR/background_log & echo \$!")
-	if ! ps -p $pid_background > /dev/null; then
-	    die "Failed to start background testing: $BACKGROUND"
-	fi
-    fi
-}
-
-stop_background()
-{
-    if [ -n "$pid_background" ]; then
-	if ! kill -TERM -$pid_background &> /dev/null; then
-	    kill $pid_background || true
-	fi
-    fi
-}
-
-filter_fake_panic()
-{
-    local orig_klog=$1
-    local new_klog=$2
-    [ $# -eq 2 ] || die "missing parameter for filter_fake_panic"
-
-    local pn
-    pn=$(grep -n "Fake kernel panic" $orig_klog | cut -d ':' -f 1 | head -1)
-    if [ -z "$pn" ]; then
-	cp $orig_klog $new_klog
-    else
-	sed -n "1,${pn}p" < $orig_klog > $new_klog
-    fi
-}
diff --git a/testcases/kernel/mce-test/lib/mce.sh b/testcases/kernel/mce-test/lib/mce.sh
deleted file mode 100755
index 39eb3a8..0000000
--- a/testcases/kernel/mce-test/lib/mce.sh
+++ /dev/null
@@ -1,328 +0,0 @@
-#
-# MCE library: provide MCE specific functions
-#
-# Copyright (C) 2008, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is released under the GPLv2.
-#
-
-extract_mce_from_log()
-{
-    [ $# -eq 2 ] || die "missing parameter for extract_mce_from_log"
-    local log="$1"
-    local outf="$2"
-
-    sed '1,/HARDWARE ERROR/d' "$log" | \
-	mcelog --no-dmi --dump-raw-ascii --ascii > "$outf"
-}
-
-mce_reformat()
-{
-    [ $# -eq 2 ] || die "missing parameter for mce_reformat"
-    local org="$1"
-    local outf="$2"
-
-    mce-inject --dump "$org" > "$outf"
-}
-
-mce_reformat_for_cmp()
-{
-    local inf="$1"
-    local outf="$2"
-    local removes="$3"
-
-    local tmpf=$WDIR/mce_reformat_for_cmp
-
-    mce-inject --dump "$inf" > $tmpf
-
-    if [ -n "$removes" ]; then
-	for remove in $removes; do
-	    sed "/$remove/d" -i $tmpf
-	done
-    fi
-
-    cat $tmpf | tr '\n' '#' | sed '1,$s/##/\n/g' | \
-	grep -v '#STATUS 0x0#' | \
-	grep -v '#STATUS 0x800000000000000#' | sort > "$outf"
-}
-
-mce_cmp()
-{
-    [ $# -eq 3 ] || die "missing parameter for mce_cmp"
-    local m1="$1"
-    local m2="$2"
-    local removes="$3"
-
-    local tmpf1=$WDIR/mce_cmp_1
-    local tmpf2=$WDIR/mce_cmp_2
-
-    mce_reformat_for_cmp "$m1" $tmpf1 "$removes"
-    mce_reformat_for_cmp "$m2" $tmpf2 "$removes"
-    diff $tmpf1 $tmpf2 > /dev/null
-}
-
-get_mcelog_from_dev()
-{
-    [ $# -eq 1 ] || die "missing parameter for get_mcelog_from_dev"
-    local mcelog_result="$1"
-    if mcelog --dump-raw-ascii > "$mcelog_result"; then
-	true
-    else
-	echo "  Failed: can not get mce log from /dev/mcelog"
-    fi
-}
-
-# extract mcelog from kernel log
-get_mcelog_from_klog()
-{
-    [ $# -eq 2 ] || die "missing parameter for get_mcelog_from_klog"
-    local klog="$1"
-    local mcelog_result="$2"
-    if [ -f "$klog" ] && extract_mce_from_log "$klog" "$mcelog_result"; then
-	true
-    else
-	echo "  Failed: Can not extract mcelog from console log"
-    fi
-}
-
-mcelog_filter()
-{
-    [ $# -eq 2 ] || die "missing parameter for mcelog_filter"
-    local inf="$1"
-    local pat="$2"
-
-    mce-inject --dump "$inf" | tr '\n' '#' | sed '1,$s/##/\n/g' | \
-	grep -e "$pat"
-}
-
-chk_gcov()
-{
-    if [ -z "$GCOV" ]; then
-	return 1
-    fi
-
-    if [ -f /sys/kernel/debug/gcov/reset ] && which gcov > /dev/null; then
-	return 0
-    else
-	return 1
-    fi
-}
-
-reset_gcov()
-{
-    if [ -z "$GCOV" ]; then
-	return
-    fi
-    case $GCOV in
-	copy)
-	    echo 1 > /sys/kernel/debug/gcov/reset
-	    ;;
-	dump)
-	    true;
-	    ;;
-	*)
-	    echo "  Failed: can not reset gcov, invalid GCOV=$GCOV"
-	    return
-	    ;;
-    esac
-}
-
-get_gcov()
-{
-    [ $# -eq 1 ] || die "missing parameter for get_gcov"
-    local src_path=$1
-    local src_fn=$(basename $src_path)
-    local src_dir=$(dirname $src_path)
-    if [ -z "$GCOV" ]; then
-	return
-    fi
-    local abs_dir=$(cd -P $KSRC_DIR/$src_dir; pwd)
-    case $GCOV in
-	copy)
-	    for f in /sys/kernel/debug/gcov/$abs_dir/*.gc*; do
-		bf=$(basename $f)
-		cat $f > $abs_dir/$bf
-	    done
-	    ;;
-	dump)
-	    true
-	    ;;
-	*)
-	    echo "  Failed: can not get gcov path, invalid GCOV=$GCOV"
-	    return
-	    ;;
-    esac
-    if ! (cd $KSRC_DIR; gcov -o $src_dir $src_fn &> /dev/null) || \
-	! [ -s $KSRC_DIR/$src_fn.gcov ]; then
-	echo "  Failed: can not get gcov graph"
-	return
-    fi
-    cp $KSRC_DIR/$src_fn.gcov $RDIR/$this_case
-}
-
-reset_severity_cov()
-{
-    echo 1 > /sys/kernel/debug/mce/severities-coverage
-}
-
-get_severity_cov()
-{
-    local sev_cor=/sys/kernel/debug/mce/severities-coverage
-    if [ ! -f $sev_cor ]; then
-	echo "  Failed: can not get severities_coverage"
-	return
-    fi
-    cp $sev_cor $RDIR/$this_case
-}
-
-verify_klog()
-{
-    [ $# -eq 1 ] || die "missing parameter for verify_klog"
-    local klog="$1"
-    if [ -f "$klog" ]; then
-	if check_kern_warning_bug "$klog"; then
-	    echo "  Failed: kernel warning or bug during MCE"
-	else
-	    echo "  Passed: No kernel warning or bug"
-	fi
-    else
-	echo "  Failed: no kernel log"
-    fi
-}
-
-verify_panic_via_klog()
-{
-    [ $# -eq 2 ] || die "missing parameter for verify_panic"
-    local klog="$1"
-    local mce_panic="$2"
-    if [ ! -f "$klog" ]; then
-	echo "  Failed: no kernel log for checking panic"
-	return -1
-    fi
-
-    if grep "panic" "$klog" | grep "$mce_panic" > /dev/null; then
-	echo "  Passed: correct panic"
-    else
-	echo "  Failed: uncorrect panic, expected: $mce_panic"
-    fi
-}
-
-verify_timeout_via_klog()
-{
-    [ $# -eq 1 ] || die "missing parameter for verify_timeout"
-    local klog="$1"
-    if [ ! -f "$klog" ]; then
-	echo "  Failed: No kernel log for checking timeout"
-	return -1
-    fi
-
-    if grep "Some CPUs didn't answer in synchronization" "$klog" \
-	> /dev/null; then
-	echo "  Passed: timeout detected"
-    else
-	echo "  Failed: no timeout detected"
-    fi
-}
-
-verify_exp_via_klog()
-{
-    [ $# -ge 2 ] || die "missing parameter for verrify_exp_via_klog"
-    local klog="$1"
-    shift
-    if [ ! -f "$klog" ]; then
-	echo "  Failed: No kernel log for checking MCE exp"
-	return -1
-    fi
-
-    for exp in "$@"; do
-	if grep "Machine check: " "$klog" | grep "$exp" > /dev/null; then
-	    echo "  Passed: correct MCE exp"
-	    return
-	fi
-    done
-    echo "  Failed:  uncorrected MCE exp, expected: $exp"
-}
-
-get_panic_from_mcelog()
-{
-    [ $# -eq 1 ] || die "missing parameter for get_panic_from_mcelog"
-    local mcelog="$1"
-    local tmpf=$WDIR/get_panic_from_mcelog
-    local addr
-    if mcelog_filter $mcelog "#BANK 219#" | head -1 > $tmpf; then
-	local F="$(sed '1,$s/#/\n/g' $tmpf | awk '/MISC / { print $2 }')"
-	case "$F" in
-	    0x1) echo "Fatal machine check" ;;
-	    0x2) echo "Machine check from unknown source" ;;
-	    0x3) echo "Uncorrected data corruption machine check" ;;
-	    0x4) echo "Fatal machine check" ;;
-	    *) echo unknown panic $F ;;
-	esac
-    fi
-}
-
-verify_panic_msg()
-{
-    [ $# -eq 2 ] || die "missing parameter for verify_panic_msg"
-    local panic_msg="$1"
-    local mce_panic="$2"
-
-    if echo ": $panic_msg" | grep -e "$mce_panic" &> /dev/null; then
-	echo "  Passed: correct panic"
-    else
-	echo "  Failed: uncorrect panic, expected: $mce_panic"
-    fi
-}
-
-verify_timeout_via_mcelog()
-{
-    [ $# -eq 1 ] || die "missing parameter for verify_timeout"
-    local mcelog="$1"
-
-    if mcelog_filter $mcelog "#BANK 218#" &> /dev/null; then
-	echo "  Passed: timeout detected"
-    else
-	echo "  Failed: no timeout detected"
-    fi
-}
-
-set_tolerant()
-{
-    [ $# -eq 1 ] || die "missing parameter for set_tolerant"
-    echo -n $1 > /sys/devices/system/machinecheck/machinecheck0/tolerant
-}
-
-get_tolerant()
-{
-    cat /sys/devices/system/machinecheck/machinecheck0/tolerant
-}
-
-check_debugfs()
-{
-	mount|grep /sys/kernel/debug > /dev/null 2>&1
-	[ ! $? -eq 0 ] && mount -t debugfs none /sys/kernel/debug
-	mount|grep /sys/kernel/debug > /dev/null 2>&1
-	[ ! $? -eq 0 ] && die "Kernel without debugfs support ?"
-}
-
-# should be called after check_debugfs
-check_mce()
-{
-    DEBUGFS=`mount | grep debugfs | cut -d ' ' -f3 | head -1`
-    [ ! -d ${DEBUGFS}/mce ] && die "Kernel without CONFIG_X86_MCE_INJECT ?"
-}
-
-set_fake_panic()
-{
-    check_debugfs
-    check_mce
-    [ $# -eq 1 ] || die "missing parameter for set_fake_panic"
-    echo -n $1 > /sys/kernel/debug/mce/fake_panic
-}
-
-set_panic_on_oops()
-{
-    [ $# -eq 1 ] || die "missing parameter for set_panic_on_oops"
-    echo -n $1 > /proc/sys/kernel/panic_on_oops
-}
diff --git a/testcases/kernel/mce-test/lib/soft-inject.sh b/testcases/kernel/mce-test/lib/soft-inject.sh
deleted file mode 100755
index 571df3b..0000000
--- a/testcases/kernel/mce-test/lib/soft-inject.sh
+++ /dev/null
@@ -1,146 +0,0 @@
-#
-# Software Inject library: Software inject specific functions
-#
-# Copyright (C) 2008, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is released under the GPLv2.
-#
-
-if [ -n "$this_case" ]; then
-    bcase=$(basename $this_case)
-fi
-mcelog_result=$RDIR/$this_case/mcelog
-klog=$RDIR/$this_case/klog
-
-soft_inject_verify_mcelog()
-{
-    # check mcelog
-    if [ -f $RDIR/$this_case/mcelog ]; then
-	if [ -f $SDIR/refer/$bcase ]; then
-	    mcelog_refer=$SDIR/refer/$bcase
-	else
-	    mcelog_refer=$SDIR/data/$bcase
-	fi
-	mce_reformat $mcelog_refer $RDIR/$this_case/mcelog_refer
-
-	if mce_cmp $RDIR/$this_case/mcelog $mcelog_refer "$removes"; then
-	    echo "  Passed: MCE log is ok"
-	else
-	    echo "  Failed: MCE log is different from input"
-	fi
-    else
-	echo "  Failed: no MCE log result"
-    fi
-}
-
-soft_inject_get_klog()
-{
-    local klog=$RDIR/$this_case/klog
-    local orig_klog=$RDIR/$this_case/orig_klog
-
-    if [ -f $klog ]; then
-	cp $klog $orig_klog
-	filter_fake_panic $orig_klog $klog
-    fi
-}
-
-soft_inject_get_mcelog()
-{
-    case "$driver" in
-	simple*)
-	    get_mcelog_from_dev $mcelog_result
-	    ;;
-	kdump*)
-	    get_mcelog_from_klog $klog $mcelog_result
-	    ;;
-	*)
-	    echo '!!! Unsupported driver !!!'
-    esac
-}
-
-# verify return value
-soft_inject_verify_return_val()
-{
-    if [ -f $RDIR/$this_case/return ] && \
-	[ $(cat $RDIR/$this_case/return) -eq 0 ]; then
-	echo "  Passed: inject process continue"
-    else
-	echo "  Failed: inject process killed"
-    fi
-}
-
-soft_inject_verify_kill()
-{
-    if [ -f $RDIR/$this_case/return ] && \
-	[ $(cat $RDIR/$this_case/return) -eq 139 ]; then
-	echo "  Passed: inject process killed!"
-    else
-	echo "  Failed: Not killed"
-    fi
-}
-
-soft_inject_enumerate()
-{
-    local base=$(relative_path ${CDIR} ${SDIR})
-    [ -z "$base" ] && die "BUG!!! Please contact your software vendor!"
-    for c in $(cd $SDIR/data; ls *[^~]); do
-	echo $base/$c
-    done
-}
-
-soft_inject_trigger()
-{
-    mcelog &> /dev/null
-    case "$driver" in
-	kdump*)
-	    mce-inject --no-random $SDIR/data/$bcase
-	    ;;
-	*)
-	    mce-inject $SDIR/data/$bcase
-	    ;;
-    esac
-    ret=$?
-    echo $ret > $RDIR/$this_case/return
-    sleep 1
-}
-
-soft_inject_verify_panic()
-{
-    local mce_panic="$1"
-    verify_panic_via_klog $klog "$mce_panic"
-}
-
-soft_inject_verify_timeout()
-{
-    verify_timeout_via_klog $klog
-}
-
-soft_inject_verify_exp()
-{
-    verify_exp_via_klog $klog "$@"
-}
-
-soft_inject_main()
-{
-    op="$1"
-    shift
-
-    case "$op" in
-	enumerate)
-	    enumerate
-	    ;;
-	trigger)
-	    trigger "$@"
-	    ;;
-	get_result)
-	    get_result
-	    ;;
-	verify)
-	    verify
-	    ;;
-	*)
-	    die "Usage: $0 enumerate|trigger|get_result|verify"
-    esac
-    exit 0
-}
diff --git a/testcases/kernel/mce-test/stress/Makefile b/testcases/kernel/mce-test/stress/Makefile
deleted file mode 100644
index 2469b30..0000000
--- a/testcases/kernel/mce-test/stress/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-CFLAGS := -g -Wall
-LDFLAGS := -g
-
-export CFLAGS
-export LDFLAGS
-
-all:
-	mkdir -p bin
-	$(MAKE) -C tools install
-
-clean:
-	$(MAKE) -C tools clean
-	rm -rf bin log result runtest
-
-distclean: clean
-
-test: all stress-soft stress-hard
-
-stress-soft:
-	@echo "run soft stress tester for 60 seconds"
-	./hwpoison.sh -T -C 1 -t 60 -S
-
-stress-hard:
-	@echo "run hard stress tester for 60 seconds"
-	./hwpoison.sh -T -C 20 -t 60 -M
diff --git a/testcases/kernel/mce-test/stress/README b/testcases/kernel/mce-test/stress/README
deleted file mode 100644
index 7523905..0000000
--- a/testcases/kernel/mce-test/stress/README
+++ /dev/null
@@ -1,75 +0,0 @@
-MCE Stress Test Suite 
-=====================
-
-Oct 10th, 2009
-
-Haicheng Li
-
-
-About the MCE stress test suite
--------------------------------
-
-The MCE stress test suite is a collection of tools and test scripts, which
-intends to achieve stress testing for Linux kernel MCA high level handlers
-that include HWPosion page recovery, soft page offline, and so on.
-
-In general, this test suite is designed to do stress testing thru various
-test interfaces, i.e. madvise syscall, HWPoison page injector, and APEI
-injector (see ACPI4.0 spec). And it's able to support most of popular
-Linux File Systems (FS), that is, there is an option (i.e. -f) for user to
-specify which FS type they want the test to be running on.
-
-
-Test Dependencies
------------------
-MCE stress test suite has following dependencies on kernel and other tools:
-
-* Linux Kernel:
-  Version 2.6.32 or newer, with MCA high level handlers enabled.
-
-* ltp-pan: 
-  A test harness of Linux Test Project, http://ltp.sf.net.
-
-* page-types:
-  A tool to query page types, which is accompanied with Linux kernel
-  source (2.6.32 or newer, $KERNEL_SRC/Documentation/vm/page-types.c).
-
-Pls. refer to the HOWTO doc (../doc/stress-howto.txt) to setup your test
-enviroment.
-
-
-In the package
----------------
-Here is a short description of what is included in this test suite. 
-
-README
-        This document.
-
-../doc/stress-howto.txt
-	HOWTO doc, including design details and usage guide.
-
-Makefile
-        Makefile for MCE stress test suite.
-
-hwposion.sh
-	Test driver.
-
-tools/*
-	Test workloads.		
-
-
-Get Started
------------
-Pls. read through the HOWTO doc (../doc/stress-howto.txt) before you start
-the stress testing on your system.
-
-You can also get help on specific test options in following way:
-# ./hwpoison.sh -h
-
-
-Warning!
---------
-Be careful with these tests!
-
-Don't run them on production systems. They should not cause problems on 
-properly functioning systems, they are intended to find (or cause) problems.
diff --git a/testcases/kernel/mce-test/stress/hwpoison.sh b/testcases/kernel/mce-test/stress/hwpoison.sh
deleted file mode 100644
index 375ba6d..0000000
--- a/testcases/kernel/mce-test/stress/hwpoison.sh
+++ /dev/null
@@ -1,1061 +0,0 @@
-#! /bin/bash
-#
-# Stress test driver for Linux MCA High Level Handlers
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; version
-# 2.
-#
-# 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 find a copy of v2 of the GNU General Public License somewhere
-# on your Linux system; if not, write to the Free Software Foundation, 
-# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
-#
-# Copyright (C) 2009, Intel Corp.
-# Author: Haicheng Li <haicheng.li@intel.com>
-#
-
-#set -x
-sd=$(dirname "$0")
-export ROOT=`(cd $sd/..; pwd)`
-
-. $ROOT/lib/mce.sh
-
-DEBUG=0
-
-silent_exec()
-{
-	local cmd=$@
-
-	if [ $DEBUG -eq 0 ]; then
-		$cmd > /dev/null 2>&1
-	else
-		$cmd
-	fi
-	return $?
-}
-
-silent_exec_background()
-{
-	local cmd=$@
-
-	if [ $DEBUG -eq 0 ]; then
-		$cmd > /dev/null 2>&1 & 
-	else
-		$cmd & 
-	fi
-	return $?
-}
-
-_print()
-{
-	echo $* > $g_tty
-}
-
-dbp()
-{
-	[ $DEBUG -ne 1 ] && return
-	_print -en "\\033[0;33m" # set font color as yellow
-	_print "[debug] $*" > $g_tty
-	echo "[debug] $*" >> $g_logfile
-	_print -en "\\033[0;39m"    # restore font color to normal
-}
-
-log()
-{
-	_print -en "\\033[0;33m" # set font color as yellow
-	_print "[info] $*" > $g_tty
-	echo "[info] $*" >> $g_logfile
-	_print -en "\\033[0;39m"    # restore font color to normal
-}
-
-begin()
-{
-	_print -n "$*" > $g_tty
-	_print -en "\\033[0;32m" # set font color as green
-	_print -e "\t [start]" > $g_tty
-	echo -e "$* \t [start]" >> $g_logfile
-	_print -en "\\033[0;39m"    # restore font color to normal
-}
-
-end()
-{
-	_print -n "$*" > $g_tty
-	_print -en "\\033[0;32m" # set font color as green
-	_print -e "\t [done]" > $g_tty
-	echo -e "$* \t [done]" >> $g_logfile
-	_print -en "\\033[0;39m"    # restore font color to normal
-}
-
-err()
-{
-	_print -en "\\033[0;31m" # set font color as red
-	echo > $g_tty
-	echo "Test aborted by unexpected error!" > $g_tty
-	_print "[error] !!! $* !!!" > $g_tty
-	echo > $g_tty
-	echo "Test aborted by unexpected error!" >> $g_result 
-	echo "[error] !!! $* !!!" >> $g_result 
-	echo "[error] !!! $* !!!" >> $g_logfile 
-	_print -en "\\033[0;39m"    # restore font color to normal
-	exit 1
-}
-
-die()
-{
-	err $@
-}
-
-invalid()
-{
-	_print -en "\\033[0;31m" # set font color as red
-	echo > $g_tty
-	echo "Test aborted by unexpected error!" > $g_tty
-	_print "[error] !!! $* !!!" > $g_tty
-	echo > $g_tty
-	echo "Try \`./hwposion -h\` for more information." > $g_tty
-	echo > $g_tty
-	echo "Test aborted by unexpected error!" >> $g_result 
-	echo "[error] !!! $* !!!" >> $g_result 
-	echo "[error] !!! $* !!!" >> $g_logfile 
-	_print -en "\\033[0;39m"    # restore font color to normal
-	exit 1
-}
-
-result()
-{
-	_print -en "\\033[0;34m" # set font color as blue
-	_print -e "$*" > $g_tty
-	echo -e "$*" >> $g_result 
-	echo -e "$*" >> $g_logfile
-	_print -en "\\033[0;39m"    # restore font color to normal
-}
-
-setup_meminfo()
-{
-	local maxmem=0
-	local lowmem_s=0
-	local lowmem_e=0
-	local highmem_s=0
-	local highmem_e=0
-	local tmp=
-
-	lowmem_s=`printf "%i" 0x100000`	# start pfn of mem < 4G
-	let "g_lowmem_s=$lowmem_s / $g_pgsize"
-	tmp=`cat /proc/iomem | grep  "System RAM" | grep 100000- | awk -F "-" '{print $2}' | awk '{print $1}'`
-	lowmem_e=`printf "%i" "0x$tmp"`
-	let "g_lowmem_e=$lowmem_e / $g_pgsize"
-	log "low mem: 0x100000 (pfn: $g_lowmem_s) ~ 0x$tmp (pfn: $g_lowmem_e)"
-
-	highmem_s=`printf "%i" 0x100000000`	# start pfn of highmem > 4G
-	let "g_highmem_s=$highmem_s / $g_pgsize"
-	tmp=`cat /proc/iomem | grep  "System RAM" | grep 100000000- | awk -F "-" '{print $2}' | awk '{print $1}'`
-	if [ -n "$tmp" ]; then
-		highmem_e=`printf "%i" "0x$tmp"`
-		let "g_highmem_e=$highmem_e / $g_pgsize"
-		log "high mem: 0x100000000 (pfn: $g_highmem_s) ~ 0x$tmp (pfn: $g_highmem_e)"
-	fi
-
-	maxmem=`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`
-	let "g_maxpfn= $maxmem / 4"
-	log "max pfn number: g_maxpfn = $g_maxpfn"
-}
-
-setup_errinj()
-{
-	local dev_major=
-	local dev_minor=
-	local rc=0
-
-	if [ $g_soft_offline -eq 1 ]; then
-	        [ -f "$g_debugfs/hwpoison/corrupt-filter-enable" ] && echo 0 > $g_debugfs/hwpoison/corrupt-filter-enable
-	        return
-	fi
-	if [ $g_madvise -eq 1 ]; then
-		[ -f "$g_debugfs/hwpoison/corrupt-filter-enable" ] && echo 0 > $g_debugfs/hwpoison/corrupt-filter-enable
-		# to avoid unexpected page-state changing in background while testing.
-		echo 70 > /proc/sys/vm/dirty_background_ratio
-		echo 70 > /proc/sys/vm/dirty_ratio
-		echo 1000000 > /proc/sys/vm/dirty_expire_centisecs
-		return
-	fi	
-	dev_major=0x`/usr/bin/stat --format=%t $g_dev` > /dev/null 2>&1
-	[ $? -ne 0 ] && rc=1
-	dev_minor=0x`/usr/bin/stat --format=%T $g_dev` > /dev/null 2>&1
-	[ $? -ne 0 ] && rc=1
-	[ $rc -eq 1 ] && invalid "invalid device: no inode # can be found"
-	echo $dev_major > $g_debugfs/hwpoison/corrupt-filter-dev-major
-	echo $dev_minor > $g_debugfs/hwpoison/corrupt-filter-dev-minor
-	[ $g_pgtype = "all" -a -f "$g_debugfs/hwpoison/corrupt-filter-flags-mask" ] && echo 0 > $g_debugfs/hwpoison/corrupt-filter-flags-mask
-	[ -f "$g_debugfs/hwpoison/corrupt-filter-enable" ] && echo 1 > $g_debugfs/hwpoison/corrupt-filter-enable
-	return
-}
-
-setup_fs()
-{
-	local mkfs="mkfs.$g_fstype"
-	local mkfs_opts="-q"
-	local mount_opts
-
-	[ $g_fstype = reiserfs ] && mkfs="mkreiserfs"
-	[ $g_fstype = ocfs2 ] && mkfs_opts="$mkfs_opts -M local"
-	[ $g_fstype = cifs ] && mount_opts="-o password="""
-	mkdir -p $g_testdir || err "cannot mkdir $g_testdir"
-	if [ $g_nomkfs -eq 0 -a $g_netfs -eq 0 ]; then 
-		silent_exec which $mkfs || err "mkfs: unsupported fstype: $g_fstype"
-		if [ $g_force -eq 0 -a $g_fstype != "ocfs2" ]; then
-			echo -n "test will format $g_dev to $g_fstype, continue [y/n]? "
-			read in
-			[ $in = 'y' -o $in = "yes" -o $in = 'Y' ] || err "$mkfs on $g_dev is cancelled"
-		fi
-		begin "-- $mkfs $g_dev"
-		if [ $g_fstype = "vfat" -o $g_fstype = "msdos" -o $g_fstype = "btrfs" ]; then
-			mkfs_opts=""
-		elif [ $g_fstype = "xfs" ]; then
-			mkfs_opts="-f"
-		fi
-		[ $g_fstype = ocfs2 ] && echo -n "test will format $g_dev to $g_fstype, continue [y/n]? "
-		silent_exec $mkfs $mkfs_opts $g_dev || err "cannot $mkfs $mkfs_opts on $g_dev"
-		end "-- $mkfs $g_dev"
-	fi
-	if [ $g_netfs -eq 0 ]; then
-		silent_exec mount -t $g_fstype $g_dev $g_testdir || err "cannot mount $g_fstype fs: $g_dev to $g_testdir"
-	else
-		silent_exec mount -t $g_fstype $mount_opts $g_netdev $g_testdir || err "cannot mount $g_fstype $mount_opts fs: $g_netdev to $g_testdir"
-	fi
-}
-
-check_env()
-{
-	check_debugfs
-	g_debugfs=`mount | grep debugfs | cut -d ' ' -f3`
-	[ -z "$g_tty" ] && invalid "$g_tty does not exist"
-	if [ $g_test -eq 0 ]; then
-		if [ $g_fstype = "nfs" -o $g_fstype = "cifs" ]; then
-			g_netfs=1
-			[ -z $g_netdev ] && invalid "net device is not specified"
-		fi
-		[ -z "$g_dev" ] && invalid "device is not specified"
-		[ -b $g_dev ] || invalid "invalid device: $g_dev"
-		if [ $g_netfs -eq 0 ]; then
-			df | grep $g_dev > /dev/null 2>&1 && invalid "device $g_dev has been mounted by others"
-		else
-			df | grep $g_netdev > /dev/null 2>&1 && invalid "device $g_netdev has been mounted by others"
-		fi
-	fi
-	[ -d $g_bindir ] || invalid "no bin subdir there"
-	if [ $g_madvise -eq 0 -o $g_recycle -ne 0 ]; then
-		silent_exec which $g_pagetool || invalid "no $g_pagetool tool on the system"
-		g_pagetool=`which $g_pagetool`
-		dbp "Found the tool: $g_pagetool"
-	fi
-	if [ $g_pfninj -eq 1 ]; then
-		if [ $g_soft_offline -eq 1 ]; then
-		        [ -f $g_sysfs_mem/soft_offline_page ] || invalid "pls. ensure soft_offline_page is enabled"
-		else
-			#if hwpoison_inject is a module, it is ensured to have been loaded
-			modinfo hwpoison_inject > /dev/null 2>&1
-			if [ $? -eq 0 ]; then
-			        [ -d $g_debugfs/hwpoison/ ] || modprobe hwpoison_inject
-			        [ $? -eq 0 ] || invalid "module hwpoison_inject isn't supported ?"
-			fi
-		fi
-	fi
-	[ $g_recycle -ne 0 ] && {
-	        [ -f $g_debugfs/hwpoison/unpoison-pfn ] || invalid "pls. insmod hwpoison_inject module with unpoison-pfn support"
-	}
-	if [ $g_apei -eq 1 ]; then
-		#if einj is a module, it is ensured to have been loaded
-		modinfo einj > /dev/null 2>&1
-		if [ $? -eq 0 ]; then
-			[ -d $g_debugfs/apei/einj ] || modprobe einj
-			[ $? -eq 0 ] || invalid "module apei_inj isn't supported ?"
-		fi
-	fi
-	[ -d $g_ltproot -a -f $g_ltppan ] || invalid "no ltp-pan on the machine: $g_ltppan"
-	if [ $g_runltp -eq 1 ]; then
-		[ -d $g_ltproot -a -f $g_ltproot/runltp ] || invalid "no runltp on the machine"
-	fi
-	[ $g_duration -eq 0 ] && invalid "test duration is set as 0 second"
-}
-
-setup_log()
-{
-	mkdir -p $g_resultdir
-	rm -rf $g_logdir
-	mkdir -p $g_logdir
-	echo "# hwpoison.sh $g_parameter" > $g_logfile
-	echo "# hwpoison.sh $g_parameter" > $g_result
-	[ $g_test -eq 0 ] && clear > $g_tty
-	echo "# hwpoison.sh $g_parameter" > $g_tty
-}
-
-setup_env() 
-{
-	begin "setup test environment"
-	mkdir -p $g_casedir  
-	check_env	
-	setup_errinj
-	setup_meminfo
-	trap "cleanup" 0
-	[ $g_test -eq 0 ] && setup_fs
-	export PATH="${PATH}:$g_bindir"
-	end "setup test environment"
-}
-
-run_ltp()
-{
-	local ltp_failed=$g_logdir/ltp/ltp_failed
-	local ltp_log=$g_logdir/ltp/ltp_log
-	local ltp_output=$g_logdir/ltp/ltp_output
-	local ltp_tmp=$g_testdir/ltp_tmp
-
-	begin "launch ltp workload in background"
-	mkdir -p $g_logdir/ltp
-	echo -n "" > $ltp_failed
-	echo -n "" > $ltp_log
-	echo -n "" > $ltp_output
-	mkdir -p $ltp_tmp
-	silent_exec_background $g_ltproot/runltp -d $ltp_tmp -l $ltp_log -o $ltp_output -r $g_ltproot -t ${g_duration}s -C $ltp_failed 
-	g_pid_ltp=$!
-	end "launch ltp workload in background (pid: $g_pid_ltp)"
-}
-
-ltp_result()
-{
-	local num=0;
-	local ltp_failed=$g_logdir/ltp/ltp_failed
-	local ltp_output=$g_logdir/ltp/ltp_output
-	
-	[ -f $ltp_failed ] || {
-		result "\tltp -- error: no ltp result there"
-		result "\t    log: $ltp_output"
-		g_failed=`expr $g_failed + 1`
-		return
-	}
-	num=`wc -l $ltp_failed | awk '{print $1}'`
-	if [ $num -ne 0 ]; then
-		result "\tltp -- $num case(s) failed"
-		result "\t    log: $ltp_output"
-		g_failed=`expr $g_failed + 1`
-	else
-		result "\tltp -- all tests pass"
-	fi
-}
-
-
-fs_metadata()
-{
-	local dir=$g_logdir/fs_metadata	
-	local result=$dir/fs_metadata.result
-	local log=$dir/fs_metadata.log
-	local pan_log=$dir/pan_log
-	local pan_output=$dir/pan_output
-	local pan_zoo=$dir/pan_zoo
-	local pan_failed=$dir/pan_failed
-	local tmp=$g_testdir/fs_metadata
-	local threads=
-	local node_number=5
-	local tree_depth=6
-
-	if [ $g_children -eq 0 ]; then
-		let "threads= $g_duration / 720"
-	else
-		threads=$g_children
-	fi
-	[ $threads -gt 10 ] && threads=10 && node_number=6
-	[ $threads -eq 0 ] && threads=1
-
-	begin "launch fs_metadata workload"
-	mkdir -p $dir
-	echo -n "" > $pan_failed
-	echo -n "" > $pan_log
-	echo -n "" > $pan_output
-	echo -n "" > $pan_zoo
-	log "setup fs_metadata test environment"
-	silent_exec_background rm -rf $tmp
-	mkdir -p $tmp || err "cannot create dir: $tmp"
-
-	echo "fs_metadata fs-metadata.sh $tree_depth $node_number $threads $g_duration $result $tmp $log" > $g_casedir/fs_metadata 
-	dbp "g_ltppan -n fs_metadata -a $pan_zoo -f $g_casedir/fs_metadata -o $pan_output -l $pan_log -C $pan_failed &"
-	silent_exec_background $g_ltppan -n fs_metadata -a $pan_zoo -f $g_casedir/fs_metadata -o $pan_output -l $pan_log -C $pan_failed
-	g_pid_fsmeta=$!
-	sleep $g_interval
-	silent_exec grep "abort" $log && err "failed to launch fs_metadata workload, it might be due to insufficient disk space, pls read $log for details!"
-	end "launch fs_metadata workload (pid: $g_pid_fsmeta)"
-}
-
-fs_metadata_result()
-{
-	local fail_num=0;
-	local pass_num=0;
-	local dir=$g_logdir/fs_metadata	
-	local result=$dir/fs_metadata.result
-	local log=$dir/fs_metadata.log
-
-	[ -f $result ] || {
-		result "\tfs_metadata -- error: no result there"
-		result "\t    details: $log"
-		g_failed=`expr $g_failed + 1`
-		return
-	}
-	fail_num=`grep FAIL $result | awk -F : '{print $NF}'`
-	pass_num=`grep PASS $result | awk -F : '{print $NF}'`
-	[ -z "$fail_num" ] && fail_num=0 && pass_num=0
-	if [ $fail_num -ne 0 ]; then
-		result "\tfs_metadata -- $fail_num tests failed, $pass_num tests pass."
-		result "\t    details: $result"
-		g_failed=`expr $g_failed + 1`
-	else
-		if [ $pass_num -eq 0 ]; then
-			result "\tfs_metadata -- no test finished"
-			result "\t    details: $log"
-			g_failed=`expr $g_failed + 1`
-		else 
-			result "\tfs_metadata -- all $pass_num tests got pass"
-		fi
-	fi
-
-	return
-}
-
-# fs_specific workload, TBD
-fs_specific()
-{
-	begin "launch $g_fstype specific workload"
-
-	touch $g_logdir/fs_specific
-#	$g_ltppan -n fs_specific -a $g_logdir/fs_specific -f $g_casedir/fs_specific -t ${g_duration}s &
-	end "launch $g_fstype specific workload"
-}
-
-page_poisoning()
-{
-	local dir=$g_logdir/page_poisoning	
-	local pan_failed=$dir/pan_failed
-	local pan_log=$dir/pan_log
-	local pan_output=$dir/pan_output
-	local tmp=$g_testdir/page_poisoning
-	local pan_zoo=$dir/pan_zoo
-	local result=$dir/page_poisoning.result
-	local log=$dir/page_poisoning.log
-	local opts=
-
-	begin "-- launch page_poisoning test"
-	mkdir -p $dir
-	echo -n "" > $pan_failed
-	echo -n "" > $pan_log
-	echo -n "" > $pan_output
-	echo -n "" > $pan_zoo
-	echo -n "" > $log
-	echo -n "" > $result
-	mkdir -p $tmp || err "cannot create dir: $tmp"
-
-	[ $g_children -ne 0 ] && opts="-i $g_children"
-
-	echo "page_poisoning page-poisoning -l $log -r $result -t $tmp $opts" > $g_casedir/page_poisoning
-	dbp "$g_ltppan -n page_poisoning -a $pan_zoo -f $g_casedir/page_poisoning -t ${g_duration}s -o $pan_output -l $pan_log -C $pan_failed &"
-	silent_exec_background $g_ltppan -n page_poisoning -a $pan_zoo -f $g_casedir/page_poisoning -t ${g_duration}s -o $pan_output -l $pan_log -C $pan_failed 
-	g_pid_madv=$!
-	end "-- launch page_poisoning test (pid: $g_pid_madv)"
-}
-
-page_poisoning_result()
-{
-	local fail_num=0
-	local pass_num=0
-	local dir=$g_logdir/page_poisoning	
-	local result=$dir/page_poisoning.result
-	local log=$dir/page_poisoning.log
-	
-	[ -f $result ] || {
-		result "\tpage_poisoning -- error: no result file there"
-		result "\t    details: $log"
-		g_failed=`expr $g_failed + 1`
-		return
-	}
-	fail_num=`grep FAILED $result | wc -l | awk '{print $1}'`
-	pass_num=`grep PASS $result | wc -l | awk '{print $1}'`
-	if [ $fail_num -ne 0 ]; then
-		result "\tpage_poisoning -- $fail_num tests failed, $pass_num tests pass."
-		result "\t    details: $result"
-		g_failed=`expr $g_failed + 1`
-	else
-		if [ $pass_num -eq 0 ]; then
-			result "\tpage_poisoning -- no case finished"
-			result "\t    details: $log"
-			g_failed=`expr $g_failed + 1`
-		else 
-			result "\tpage_poisoning -- all $pass_num tests got pass"
-		fi
-	fi
-
-	return
-}
-
-run_workloads()
-{
-	fs_metadata
-	#fs_specific
-	return
-}
-
-_pfn_unpoison()
-{
-	local pg=$1
-
-	echo $pg > $g_debugfs/hwpoison/unpoison-pfn
-	dbp "echo $pg > $g_debugfs/hwpoison/unpoison-pfn"
-}
-
-pfn_unpoison()
-{
-	local pg_list=
-	local pg=0
-	local pfn=0
-	local cur=
-	local i=0
-	local inj=_pfn_unpoison
-
-	pg_list=`$g_pagetool -NLrb hwpoison | grep -v offset | cut -f1`
-	for pg in $pg_list
-	do
-		$inj 0x$pg > /dev/null 2>&1
-	done
-}
-
-show_progress()
-{
-	local cur=
-	local rest=0
-	local percent=0
-	local next=0
-	local msg="hwpoison page error injection"
-
-	[ $g_soft_offline -eq 1 ] && msg="page soft offline"
-
-	cur=`date +%s` 
-	[ "$cur" -ge "$g_time_e" ] && return
-	rest=`expr $g_time_e - $cur`
-	let "percent= ($g_duration - $rest) * 100 / $g_duration"
-	[ $percent -eq 0 ] && return
-	if [ $g_recycle -ne 0 ]; then
-		let "g_last=(($percent-$g_percent)*$g_duration)+$g_last"
-		[ $g_last -ge $g_recycle ] && {
-			g_last=0
-			pfn_unpoison
-		}
-	fi
-	[ $percent -gt 10 ] && let "next= $percent - 10"
-	[ $g_percent -ne 0 -a $g_percent -gt $next ] && return
-	g_percent=$percent
-	log "$msg: $g_percent% pages done"
-}
-
-_pfn_hwpoison()
-{
-	local pfn=$1
-
-	echo $pfn > $g_debugfs/hwpoison/corrupt-pfn
-	dbp "echo $pfn > $g_debugfs/hwpoison/corrupt-pfn"
-}
-
-_pfn_soft_offline()
-{
-	local pfn=$1
-	local i
-	local j
-	local paddr
-
-	i=`printf "%i" $pfn`
-	let "j=$i * $g_pgsize"
-	paddr=`printf "0x%x" $j`
-	echo $paddr > $g_sysfs_mem/soft_offline_page
-	dbp "echo $paddr > $g_sysfs_mem/soft_offline_page"
-}
-
-pfn_inj()
-{
-	local pg_list=
-	local pg=0
-	local pfn=0
-	local cur=
-	local i=0
-	local inj=_pfn_hwpoison
-
-	[ $g_soft_offline -eq 1 ] && inj=_pfn_soft_offline
-	if [ $g_pgtype = "all" ]; then
-		pfn=$g_lowmem_s 	# start from 1M.
-		while [ "$pfn" -lt "$g_maxpfn" ]
-		do
-			pg=`printf "%x" $pfn`
-			$inj 0x$pg > /dev/null 2>&1
-			pfn=`expr $pfn + 1`
-			[ $pfn -gt $g_lowmem_e ] && pfn=$g_highmem_s
-			[ $pfn -gt $g_highmem_e ] && break
-			i=`expr $i + 1`
-			if [ $i -eq $g_progress ]; then
-				cur=`date +%s`
-				[ "$cur" -ge "$g_time_e" ] && break
-				show_progress
-				i=0 
-			fi
-		done
-	else
-		silent_exec $g_pagetool -Nrb $g_pgtype || err "unsupported pagetype, pls. refer to command: $g_pagetool -h"
-		pg_list=`$g_pagetool -NLrb $g_pgtype | grep -v offset | cut -f1`
-		for pg in $pg_list
-		do
-			$inj 0x$pg > /dev/null 2>&1
-			i=`expr $i + 1`
-			if [ $i -eq $g_progress ]; then
-				cur=`date +%s`
-				[ "$cur" -ge "$g_time_e" ] && break
-				show_progress
-				i=0 
-			fi
-		done
-	fi
-}
-
-_apei_inj()
-{
-	local pfn=`printf "%x" $1`
-	local type=$2
-
-	echo $type > $g_debugfs/apei/einj/error_type
-	echo "0x${pfn}000" > $g_debugfs/apei/err_inj/error_address
-	echo "1" > $g_debugfs/apei/einj/error_inject
-}
-
-apei_ewb_ucr()
-{
-	_apei_inj $1 0x2	
-}
-
-apei_mem_ucr()
-{
-	_apei_inj $1 0x10
-}
-
-apei_inj()
-{
-	local pg_list=
-	local pg=
-	local cur=
-	local i=0
-
-	pg_list=`$g_pagetool -NLrb $g_pgtype | grep -v offset | cut -f1`
-	for pg in $pg_list
-	do
-		apei_mem_ucr $pg 
-		i=`expr $i + 1`
-		if [ $i -eq $g_progress ]; then
-			cur=`date +%s`
-			[ "$cur" -ge "$g_time_e" ] && break
-			show_progress
-			i=0 
-		fi
-	done
-
-	return
-}
-
-err_inject()
-{
-	local cur=
-	local i=0
-	local msg="hwpoison page error injection"
-	local MSG="inject HWPOISON error to pages"
-
-	if [ $g_soft_offline -eq 1 ]; then
-	        msg="page soft offline"
-	        MSG="soft OFFLINE pages"
-	fi
-	if [ $g_madvise -eq 1 ]; then
-		begin "$MSG thru madvise syscall"
-	else
-		begin "$MSG ($g_pgtype)"
-	fi
-	let "g_progress=$g_duration * 10"
-	g_time_s=`date +%s`	
-	g_time_e=`expr $g_time_s + $g_duration`
-	cur=$g_time_s
-	if [ $g_madvise -eq 1 ]; then
-		page_poisoning	
-		log "$msg: 0% pages done"
-		show_progress
-	else
-	        log "$msg: 0% pages done"
-	fi
-	while [ "$cur" -lt "$g_time_e" ]
-	do
-		if [ $g_madvise -eq 0 ]; then 
-			show_progress 
-			[ $g_apei -eq 1 ] && apei_inj
-			[ $g_pfninj -eq 1 ] && pfn_inj
-		else 
-			if [ $i -eq $g_progress ]; then
-				show_progress
-				i=0 
-			fi
-			i=`expr $i + 1`
-		fi	
-		cur=`date +%s` 
-	done
-	log "$msg: 100% pages done"
-	# wait workloads to be finished.	
-	sleep $g_interval 
-
-	if [ $g_madvise -eq 1 ]; then
-		end "$MSG thru madvise syscall"
-	else
-		end "$MSG ($g_pgtype)"
-	fi
-}
-
-fsck_err()
-{
-	local dir=$g_logdir/fsck	
-	local result=$dir/fsck.result
-	local log=$dir/fsck.log
-
-	echo "FAILED: $@" > $result
-	echo "FAILED: $@" > $log
-}
-
-fsck_pass()
-{
-	local dir=$g_logdir/fsck	
-	local result=$dir/fsck.result
-	local log=$dir/fsck.log
-
-	echo "PASS: $@" > $result
-	echo "PASS: $@" > $log
-}
-
-run_fsck()
-{
-	local dir=$g_logdir/fsck
-	local result=$dir/fsck.result
-	local log=$dir/fsck.log
-	local fsck=fsck.$g_fstype
-	local opts=""
-
-	mkdir -p $dir
-	echo -n "" > $log
-	echo -n "" > $result
-
-	[ $g_fstype = "btrfs" ] && fsck="btrfsck"
-	[ $g_fstype = "reiserfs" ] && {
-	        fsck="reiserfsck"
-	        opts="-y"
-	}
-	begin "launch $fsck on $g_dev to check test result"
-	silent_exec which $fsck || {
-		fsck_err "fsck: unsupported fstype: $g_fstype"
-		return
-	}
-	fs_sync
-	silent_exec umount -f $g_dev || sleep $g_interval
-	df | grep $g_dev > /dev/null 2>&1
-	if [ $? -eq 0 ]; then
-		silent_exec umount $g_dev || {
-			fsck_err "cannot umount $g_dev to do $fsck"
-			return
-		}
-	fi
-	$fsck $opts $g_dev || fsck_err "err #$? while $fsck on $g_dev"
-	silent_exec mount -t $g_fstype $g_dev $g_testdir || {
-		fsck_err "cannot mount $g_testdir back after fsck_check"
-		return
-	}
-	fsck_pass "$fsck got pass on $g_dev"
-	end "launch $fsck on $g_dev to check test result"
-}
-
-fsck_result()
-{
-	local dir=$g_logdir/fsck	
-	local result=$dir/fsck.result
-	local log=$dir/fsck.log
-	local fail_num=0;
-	local pass_num=0;
-	[ -f $result ] || { 
-		result "\tfsck.$g_fstype -- no result found" 
-		result "\t    details: $log"
-		g_failed=`expr $g_failed + 1`
-		return
-	}
-
-	fail_num=`grep FAILED $result | wc -l | awk '{print $1}'`
-	pass_num=`grep PASS $result | wc -l | awk '{print $1}'`
-	if [ $fail_num -ne 0 ]; then
-		result "\tfsck.$g_fstype -- failed"
-		result "\t    log: $log"
-		g_failed=`expr $g_failed + 1`
-	else
-		if [ $pass_num -eq 0 ]; then
-			result "\tfsck.$g_fstype -- not executed"
-			result "\t    log: $log"
-			g_failed=`expr $g_failed + 1`
-		else 
-			result "\tfsck.$g_fstype -- fsck on $g_dev got pass"
-		fi
-	fi
-}
-
-result_check()
-{
-	begin "-- collecting test result"
-	result "#############################################"
-	result "result summary:"
-	if [ $g_madvise -eq 1 ]; then
-		page_poisoning_result
-	else
-		fs_metadata_result
-		[ $g_runltp -eq 1 ] && ltp_result
-	fi
-	[ $g_netfs -eq 0 -a $g_test -eq 0 ] && fsck_result
-	result ""
-	result "totally $g_failed task-groups report failures"
-	result "#############################################"
-	end "-- collecting test result"
-}
-
-usage()
-{
-	echo "Usage: ./hwpoison.sh -d /dev/device [-options] [arguments]"
-	echo
-	echo "Stress Testing for Linux MCA High Level Handlers: "
-	echo -e "\t-c console\t: target tty console to print test log" 
-	echo -e "\t-d device\t: target block device to run test on" 
-	echo -e "\t-f fstype\t: filesystem type to be tested"
-	echo -e "\t-i interval\t: sleep interval (default is $g_interval seconds)"
-	echo -e "\t-l logfile\t: log file"
-	echo -e "\t-n netdev\t: target network disk to run test on"
-	echo -e "\t-o ltproot\t: ltp root directory (default is $g_ltproot/)"
-	echo -e "\t-p pagetype\t: page type to inject error "
-	echo -e "\t-r result\t: result file"
-	echo -e "\t-s pagesize\t: page size on the system (default is $g_pgsize bytes)"
-	echo -e "\t-t duration\t: test duration time (default is $g_duration seconds)"
-	echo -e "\t-A \t\t: use APEI to inject error"
-	echo -e "\t-C children\t: process num of workloads"
-	echo -e "\t-F \t\t: execute as force mode, no interaction with user"
-	echo -e "\t-L \t\t: run ltp in background"
-	echo -e "\t-M \t\t: run page_poisoning test thru madvise syscall"
-	echo -e "\t-N \t\t: do not mkfs target block device"
-	echo -e "\t-R recyle\t: automatically unpoison pages after running recyle seconds"
-	echo -e "\t-S \t\t: test soft page offline"
-	echo -e "\t-T \t\t: test mode, run test in local dir other than on target device"
-	echo -e "\t-V \t\t: verbose mode, show debug info"
-	echo -e "\t-h \t\t: print this page"
-	echo
-	echo -e "device:" 
-	echo -e "\tthis is a mandatory argument. typically, it's a disk partition." 
-	echo -e "\tall temporary files will be created on this device." 
-	echo -e "\terror injector will just inject errors to the pages associated" 
-	echo -e "\twith this device (except for the testing thru madvise syscall)." 
-	echo
-	echo -e "pagetype:"
- 	echo -e "\tdefault page type:" 
-	echo -e "\t    $g_pgtype"
-	echo -e "\tfor more details, pls. try \`page-types -h\`." 
-	echo -e "\tsee the definition of \"bits-spec\"." 
-	echo
-	echo -e "console:" 
-	echo -e "\ttest can print output to the console you specified." 
-	echo -e "\te.g. '-c /dev/tty1'" 
-	echo
-
-	exit 0
-}
-
-fs_sync()
-{
-	log "now to sync up the disk under testing, might need several minutes ..."
-	sync
-}
-
-stop_children()
-{
-	begin "-- cleaning up remaining tasks in background" 
-	if [ -n "$g_pid_madv" ]; then
-		silent_exec ps $g_pid_madv 
-		[ $? -eq 0 ] && { 
-			kill -15 $g_pid_madv > /dev/null 2>&1
-			sleep $g_interval
-		} 
-	fi
-	if [ -n "$g_pid_fsmeta" ]; then
-		silent_exec ps $g_pid_fsmeta 
-		[ $? -eq 0 ] && { 
-			kill -15 $g_pid_fsmeta > /dev/null 2>&1
-			sleep $g_interval
-		}
-	fi 
-	if [ -n "$g_pid_ltp" ]; then
-		silent_exec ps $g_pid_ltp 
-		[ $? -eq 0 ] && { 
-			kill -15 $g_pid_ltp > /dev/null 2>&1
-			sleep $g_interval
-		}
-	fi 
-	end "-- cleaning up remaining tasks in background" 
-}
-
-cleanup()
-{
-	log "!!! EXIT signal received, need to exit testing now. !!!"
-	begin "preparing to complete testing"
-	stop_children
-	fs_sync
-	result_check
-	if [ $g_netfs -eq 0 ]; then
-		df | grep $g_dev > /dev/null 2>&1 && silent_exec umount -f $g_dev
-	else
-		df | grep $g_netdev > /dev/null 2>&1 && silent_exec umount -f $g_netdev
-	fi
-	if [ $g_madvise -eq 1 ]; then
-	        echo $g_vm_dirty_background_ratio > /proc/sys/vm/dirty_background_ratio
-	        echo $g_vm_dirty_ratio > /proc/sys/vm/dirty_ratio
-	        echo $g_vm_dirty_expire_centisecs > /proc/sys/vm/dirty_expire_centisecs
-	fi
-	end "preparing to complete testing"
-	log "!!! Linux HWPOISON stress testing DONE !!!"
-	log "result: $g_result"
-	log "log: $g_logfile"
-	if [ $g_failed -ne 0 ]; then
-		exit 1
-	else
-		exit 0
-	fi
-}
-
-select_injector()
-{
-# for test mode, apei injector is not supported.
-	if [ $g_test -eq 1 ]; then
-		[ $g_apei -eq 1 ] && g_apei=0
-		if [ $g_madvise -eq 1 ]; then
-			g_pfninj=0
-		else
-			g_soft_offline=1
-		fi
-	fi
-
-# for non-test mode, apei injector is 1st priority.
-	if [ $g_apei -eq 1 ]; then
-		g_pfninj=0
-		g_madvise=0
-	fi
-
-	if [ $g_madvise -eq 1 ]; then
-		g_pfninj=0
-	fi
-}
-
-g_children=0	# child process num for each workload.
-		# 0 means using default child process num of each workload.
-g_dev=
-g_debugfs=
-g_netdev=
-g_fstype=ext3
-g_netfs=0
-g_nomkfs=0
-g_force=0
-let "g_duration=120"
-g_interval=5
-g_runltp=0
-g_ltproot="/ltp"
-g_ltppan="$g_ltproot/pan/ltp-pan"
-g_pagetool="page-types"
-g_madvise=0
-g_apei=0
-g_pfninj=1
-g_rootdir=`pwd`
-g_bindir=$g_rootdir/bin
-g_casedir=$g_rootdir/runtest
-g_logdir=$g_rootdir/log
-g_testdir=$g_rootdir/hwpoison
-g_resultdir=$g_rootdir/result
-g_logfile=$g_resultdir/hwpoison.log
-g_result=$g_resultdir/hwpoison.result
-g_failed=0
-g_time_s=
-g_time_e=
-g_tty=`tty`
-g_pid_madv=
-g_pid_fsmeta=
-g_pid_ltp=
-g_progress=
-g_percent=0
-g_pgtype="lru,referenced,readahead,swapcache,swapbacked,anonymous"
-g_pgsize=4096	# page size on the system
-g_maxpfn=	# maxpfn on the system
-g_highmem_s=	# start pfn of highmem 
-g_highmem_e=	# end pfn of highmem
-g_lowmem_s=	# start pfn of mem < 4G
-g_lowmem_e=	# end pfn of mem < 4G
-g_sysfs_mem="/sys/devices/system/memory"
-g_soft_offline=0
-g_test=0
-
-# recyle poisoned page
-g_recycle=0
-g_last=0
-
-# madvise injector specific global variable
-g_vm_dirty_background_ratio=`cat /proc/sys/vm/dirty_background_ratio`
-g_vm_dirty_ratio=`cat /proc/sys/vm/dirty_ratio`
-g_vm_dirty_expire_centisecs=`cat /proc/sys/vm/dirty_expire_centisecs`
-
-# test parameters
-g_parameter=$@
-
-while getopts ":c:d:f:hi:l:n:o:p:r:s:t:C:LMR:STAFNV" option
-do 
-	case $option in
-		c) g_tty=$OPTARG;;
-		d) g_dev=$OPTARG;;
-		f) g_fstype=$OPTARG;;
-		l) g_logfile=$OPTARG;;
-		t) g_duration=$OPTARG;;
-		i) g_interval=$OPTARG;;
-		n) g_netdev=$OPTARG;;
-		o) g_ltproot=$OPTARG
-		   g_ltppan="$g_ltproot/pan/ltp-pan";;
-		p) g_pgtype=$OPTARG;;
-		s) g_pgsize=$OPTARG;;
-		r) g_result=$OPTARG;;
-		C) g_children=$OPTARG;;
-		L) g_runltp=1;; 
-		M) g_madvise=1;;
-		R) g_recycle=$OPTARG;;
-		S) g_soft_offline=1;;
-		T) g_test=1;;
-		A) g_apei=1;;
-		F) g_force=1;;
-		N) g_nomkfs=1;;
-		V) DEBUG=1;;
-		h) usage;;
-		*) invalid "invalid option";;
-	esac
-done
-
-select_injector
-setup_log
-log "!!! Linux HWPOISON stress testing starts NOW !!!"
-log "!!! test will run about $g_duration seconds !!!"
-setup_env
-if [ $g_madvise -eq 0 ]; then
-	[ $g_runltp -eq 1 ] && run_ltp
-	run_workloads
-fi
-err_inject
-[ $g_netfs -eq 0 -a $g_test -eq 0 ] &&  run_fsck
diff --git a/testcases/kernel/mce-test/stress/tools/Makefile b/testcases/kernel/mce-test/stress/tools/Makefile
deleted file mode 100644
index ef78a90..0000000
--- a/testcases/kernel/mce-test/stress/tools/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-SUBDIRS ?= fs-metadata page-poisoning
-
-all:
-	@for i in ${SUBDIRS}; do        \
-		${MAKE} -C $$i $@;      \
-	done
-
-install:
-	@for i in ${SUBDIRS}; do        \
-		${MAKE} -C $$i $@;      \
-	done
-
-clean:
-	@for i in ${SUBDIRS}; do        \
-		${MAKE} -C $$i $@;      \
-	done
diff --git a/testcases/kernel/mce-test/stress/tools/fs-metadata/Makefile b/testcases/kernel/mce-test/stress/tools/fs-metadata/Makefile
deleted file mode 100644
index 3a88dfb..0000000
--- a/testcases/kernel/mce-test/stress/tools/fs-metadata/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-all: k-tree-gen k-tree-trav 
-
-k-tree-trav: k-tree-trav.o 
-
-k-tree-gen: k-tree-gen.o
-
-install: all
-	cp fs-metadata.sh k-thread.sh k-tree-gen k-tree-trav ../../bin
-
-clean:
-	rm -f k-tree-gen k-tree-trav *.o
diff --git a/testcases/kernel/mce-test/stress/tools/fs-metadata/README b/testcases/kernel/mce-test/stress/tools/fs-metadata/README
deleted file mode 100644
index 9d20a9d..0000000
--- a/testcases/kernel/mce-test/stress/tools/fs-metadata/README
+++ /dev/null
@@ -1,25 +0,0 @@
-File system metadata test program is used to test i-node operations
-with heavy workload. Make sure every i-node operation gets the
-expected result. This script creates a lot of directory entries with
-k-tree data structure.
-
-k-tree is a transformation of binary tree, For a binary tree, each father
-node has 2 children at most; but for a k-tree, it can has k children. We 
-need to test both file and directory, so we do some changes for k-tree 
-concept here. viz. each father node has k sub directories and k text files. 
-
-Note, test will caculate approximate disk space firstly based on the test  
-parameters from user. parameter tree_depth should be less than 10; 
-parameter node_number should be less than 20. If user passes a larger 
-number, it will generate a huge directory hierarchy, which might exhaust
-your disk space soon.
-
-As a suggestion, it's better to run the script on a free partition, so
-you can recover it easily by formatting disk after test gets finished!
-
-Here are the component list of fs-metadata test program.
-k-tree-gen		k-tree generator
-k-tree-trav		to modify a k-tree with i-nodes operations
-k-thread.sh		test thread
-fs-metadata.sh		the script to lauch test threads.
-
diff --git a/testcases/kernel/mce-test/stress/tools/fs-metadata/fs-metadata.sh b/testcases/kernel/mce-test/stress/tools/fs-metadata/fs-metadata.sh
deleted file mode 100644
index aac5adb..0000000
--- a/testcases/kernel/mce-test/stress/tools/fs-metadata/fs-metadata.sh
+++ /dev/null
@@ -1,266 +0,0 @@
-#/bin/bash
-#
-# File system metadata stress testing script v0.1 
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; version
-# 2.
-#
-# 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 find a copy of v2 of the GNU General Public License somewhere
-# on your Linux system; if not, write to the Free Software Foundation, 
-# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
-#
-# Copyright (C) 2009, Intel Corp.
-# Author: Shaohui Zheng <shaohui.zheng@intel.com>
-
-export K_CWD=$(cd $(dirname $0)>/dev/null;pwd)
-export K_VAR=$K_CWD/var
-export K_TREE_GEN=$K_CWD/k-tree-gen
-export K_TREE_TRAV=$K_CWD/k-tree-trav
-
-
-
-function summary_result()
-{
-	local total_nr=$(egrep "pass|fail" $K_RESULT | wc -l ) 
-	local pass_nr=$(grep pass $K_RESULT| wc -l ) 
-	local fail_nr=$(grep fail $K_RESULT| wc -l ) 
-	local end_ts=$(date +%s)
-	local run_time=$(expr $end_ts - $K_START_TS)
-
-	k_result "Finish fs-metadata testing within $run_time secs, $total_nr metadata "
-	k_result "testing finished."
-	k_result "PASS:$pass_nr"
-	k_result "FAIL:$fail_nr"
-	k_result "You can refer to result file $K_RESULT,"
-	k_result "and log file $K_LOG for details."
-
-	# cleanup
-	for pid in $(cat $K_THREADS_PID)
-	do
-		k_log "killing k-thread $pid"
-		run_quiet kill -9 $pid
-	done
-	: > $K_THREADS_PID
-}
-
-# run program and do not display the output
-function run_quiet()
-{
-	local cmd=$*
-	$cmd >/dev/null 2>&1
-	return $?
-}
-
-function abort_test()
-{
-	k_result "finish $sec secs fs stress testing, clean up the envirnment"
-	
-	# summary the test result
-	run_quiet unlink $K_FLAG
-	summary_result
-	exit 0
-}
-
-function usage()
-{
-	alert "File system metadata testing script v0.12 \n"
-	echo ""
-	echo "This script creates a lot of directory entries with k-tree data structure, "
-	echo "It covers i-node creation/removing/linking/unliking operation in heavy I/O "
-	echo "workloads."
-	echo ""
-	echo "A k-tree is a tranformation of binary tree, A binary has 2 children at most"
-	echo "in each node, but a k-tree has k sub-nodes. We test both file and directory"
-	echo "entries, So we do some changes. We create k sub directories and k text file"
-	echo "in each parent."
-	echo ""
-	echo "We will caculate approximate disk space, it depends on your parameter. For  "
-	echo "tree_depth, suggest to less than 10. For node_number, suggest to less 20.  "
-	echo "If you pass a large number as parameter, it generate a huge directory entry"
-	echo "it exhaust your disk space very fast, very hard to remove."
-	alert "\nWe suggest you to run the script in a standalone partition, you can format\n"
-	alert "it after test finished!\n"
-	echo ""
-	echo "Usage: "
-	echo -e "\ttree_depth node_number threads run_time(secs) [result_file] [temp_dir] [log_file]\n"
-	exit 0
-}
-
-function alert()
-{
-	echo -en "\\033[40;31m" # set font color as red
-	echo -en "$*"
-	echo -en "\\033[0;39m" # restore font color as normal
-}
-
-function k_result()
-{
-	echo [$(date "+%m-%d %H:%M:%S")] $* | tee -a $K_LOG
-	echo $* | egrep "pass|fail" 
-	ret_val=$?
-	if [ -f $K_FLAG ] ;then
-		 echo [$(date "+%m-%d %H:%M:%S")] $* >> $K_RESULT
-	fi
-
-	if [ ! -f $K_FLAG ] && [ $ret_val -ne 0 ] ;then
-		 echo [$(date "+%m-%d %H:%M:%S")] $* >> $K_RESULT
-	fi
-}
-
-function check_disk_space()
-{
-	run_quiet cd $K_CWD 
-	local depth=$(expr $1 + 1)
-	local width=$2
-	local thread=$3
-	local tree_size=$(echo "scale=2; (1-$width^$depth)/(1-$width) *2*4/1024 " | bc)
-	local total_size=$(echo "scale=2; $tree_size * 2 * $thread " | bc)
-	local free_space=$( df . -m  | awk '{ print $3}' | tail -1)
-
-	k_log "The k-tree size is $tree_size M, the total free space reqirements is about $total_size M."
-
-	local ready=$(echo $free_space $total_size | awk '{if($1>$2){printf "0"}else{printf"1"}}')
-	if [ $ready -ne 0 ];then
-		 k_log "You have $free_space M free space only, we can not finish your testing, abort it."
-		 return 1
-	else
-		 k_log "You have $free_space M free space, ready to run the testing."
-		 run_quiet cd -
-		 return 0
-	fi
-}
-
-function k_log()
-{
-	echo [$(date "+%m-%d %H:%M:%S")] $* | tee -a $K_LOG 
-}
-
-function k_thread()
-{
-	local dir=$1 
-	local depth=$2
-	local width=$3 
-	local result
-
-	# generate new tree
-	k_log "begin to generate tree $dir"
-	$K_TREE_GEN $depth $width
-	k_log "end to generate tree $dir"
-
-	cwd=$(pwd)
-	run_quiet cd $K_VAR
-	while [ -e $K_FLAG ]
-	do
-		new_dir=$dir-new
-		cp $dir $new_dir -pr
-		run_quiet cd $new_dir
-		k_log "thread $dir: begin to traverse dir $new_dir"
-		$K_TREE_TRAV $2 $3
-		k_log "thread $dir: end to traverse dir $new_dir"
-		run_quiet cd -
-		result=PASS
-		k_tree_diff $dir $new_dir || result=FAIL
-		k_result "thread $dir: $result to compare result between dir $dir and $new_dir" 
-		
-		rm $new_dir -fr
-	done
-	run_quiet cd $cwd 
-	# test ends, remove the oringal tree
-	rm $dir -fr
-}
-
-
-
-if [ $# -lt 4 ] ;then
-	usage
-	k_result "[end] invalid input $*"
-fi
-
-if [ $# -gt 4 ];then
-	K_RESULT=$5
-	if [ $(dirname $K_RESULT) = '.' ]; then
-		 K_RESULT=$K_CWD/$K_RESULT 
-	fi
-else
-	K_RESULT=$K_CWD/result.txt
-fi
-
-if [ $# -gt 5 ];then
-	K_VAR=$6
-	if [ $(dirname $K_VAR) = '.' ]; then
-		 K_VAR=$K_CWD/$K_VAR 
-	fi
-fi
-
-if [ $# -gt 6 ];then
-	K_LOG=$7
-	if [ $(dirname $K_RESULT) = '.' ]; then
-		 K_LOG=$K_VAR/$K_LOG 
-	fi
-else
-	K_LOG=$K_VAR/log.txt
-fi
-export K_FLAG=$K_VAR/fs_flag
-export K_START_TS=
-export K_THREADS_PID=$K_VAR/k-threads.pid
-export K_FS_METADATA_PID=$K_VAR/fs_metadata.pid
-export K_RESULT
-export K_LOG
-: > $K_RESULT
-: > $K_LOG
-
-#main portal
-[ -e $K_FLAG ] && unlink $K_FLAG
-k_result "[begin] fs-stress testing start with parameters: $*"
-
-check_disk_space $*
-if [ $? -ne 0 ];then
-	exit 1
-fi
-
-#clean up
-k_log "clean up testing environment"
-[ -d $K_VAR ]  && rm $K_VAR -fr
-mkdir -p $K_VAR 
-
-touch $K_FS_METADATA_PID
-touch $K_THREADS_PID
-echo $$ > $K_FS_METADATA_PID
-: > $K_THREADS_PID
-touch $K_FLAG
-
-run_quiet cd $K_VAR
-
-K_START_TS=$(date +%s)
-
-# signal handler
-trap abort_test 0
-
-#testing
-counter=0
-while [ $counter -lt $3 ];
-do
-	mkdir $counter -p
-	cur=$(pwd)
-	run_quiet cd $counter
-	#k_thread $counter $1 $2 &
-	$K_CWD/k-thread.sh $counter $1 $2 &
-	run_quiet cd $cur
-	counter=$(expr $counter + 1)
-done
-
-sec=$4
-sleep $sec
-
-# clean up
-# finish $4 mins fs stress testing
-k_log "[end] fs-stresting testing, all done!"
-
-
diff --git a/testcases/kernel/mce-test/stress/tools/fs-metadata/k-thread.sh b/testcases/kernel/mce-test/stress/tools/fs-metadata/k-thread.sh
deleted file mode 100644
index 75a29e4..0000000
--- a/testcases/kernel/mce-test/stress/tools/fs-metadata/k-thread.sh
+++ /dev/null
@@ -1,105 +0,0 @@
-#/bin/bash
-#
-# Test thread for File system metadata stress testing script
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; version
-# 2.
-#
-# 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 find a copy of v2 of the GNU General Public License somewhere
-# on your Linux system; if not, write to the Free Software Foundation, 
-# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
-#
-# Copyright (C) 2009, Intel Corp.
-# Author: Shaohui Zheng <shaohui.zheng@intel.com>
-
-# run program and do not display the output
-function run_quiet()
-{
-	local cmd=$*
-	$cmd >/dev/null 2>&1
-	return $?
-}
-
-function k_log()
-{
-	echo [$(date "+%m-%d %H:%M:%S")] $* | tee -a $K_LOG 
-}
-
-function k_result()
-{
-	echo [$(date "+%m-%d %H:%M:%S")] $* | tee -a $K_LOG
-	echo $* | egrep "pass|fail" 
-	ret_val=$?
-	if [ -f $K_FLAG ] ;then
-		 echo [$(date "+%m-%d %H:%M:%S")] $* >> $K_RESULT
-	fi
-
-	if [ ! -f $K_FLAG ] && [ $ret_val -ne 0 ] ;then
-		 echo [$(date "+%m-%d %H:%M:%S")] $* >> $K_RESULT
-	fi
-}
-
-# Compare 2 trees, if it is the same, return 0, or return 1
-#
-# we need to make sure whether the tree has changes after we 
-# finish a lot of meta operations on he heavy workloads, this 
-# function can compare the hierarchy between 2 trees.
-#
-# the basic idea is diff the output by command find.
-
-function k_tree_diff()
-{
-	local ta=$1 # tree a
-	local tb=$2 # tree b
-	
-	local md5a=$(run_quiet cd $ta; find | md5sum | awk '{ print $1}')
-	local md5b=$(run_quiet cd $tb; find | md5sum | awk '{ print $1}')
-
-	if [ $md5a = $md5b ];then
-		 return 0
-	else
-		 return 1
-	fi
-}
-
-
-dir=$1 
-depth=$2
-width=$3 
-result=
-
-k_log "thread $1 starts with pid $$"
-echo $$ | tee -a $K_THREADS_PID
-# generate new tree
-k_log "begin to generate tree $dir"
-$K_TREE_GEN $depth $width
-k_log "end to generate tree $dir"
-
-cwd=$(pwd)
-run_quiet cd $K_VAR
-while [ -e $K_FLAG ]
-do
-	new_dir=$dir-new
-	cp $dir $new_dir -pr
-	run_quiet cd $new_dir
-	k_log "thread $dir: begin to traverse dir $new_dir"
-	$K_TREE_TRAV $2 $3
-	k_log "thread $dir: end to traverse dir $new_dir"
-	run_quiet cd -
-	result=pass
-	k_tree_diff $dir $new_dir || result=fail
-	k_result "thread $dir: $result to compare result between dir $dir and $new_dir" 
-
-	rm $new_dir -fr
-done
-run_quiet cd $cwd 
-
-# test ends, remove the oringal tree
-rm $dir -fr
diff --git a/testcases/kernel/mce-test/stress/tools/fs-metadata/k-tree-gen.c b/testcases/kernel/mce-test/stress/tools/fs-metadata/k-tree-gen.c
deleted file mode 100644
index c381b45..0000000
--- a/testcases/kernel/mce-test/stress/tools/fs-metadata/k-tree-gen.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Metadata stress testing program for file system
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; version
- * 2.
- *
- * 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 find a copy of v2 of the GNU General Public License somewhere
- * on your Linux system; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * This program helps you to generate a k-tree in recusive.
- *
- * A k-tree is a tranformation of binary tree, A binary has 2
- * children at most in each node, but a k-tree has k sub-nodes.
- * We test both file and directory entries, So we do some changes.
- * We create k sub directories and k text file in each parent.
- *
- * Copyright (C) 2009, Intel Corp.
- * Author: Shaohui Zheng <shaohui.zheng@intel.com>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#define MAX_PATH 8192
-
-/*
- * k tree generator.
- *
- * parameters:
- * lvl: tree level number from button to top
- * node_nr: the maximun nodes number
- * return val: if it is leaf, return 0, or return 1
- */
-
-int k_tree_gen(int lvl, int node_nr)
-{
-	int cnt;
-	char dir[MAX_PATH], cwd[MAX_PATH], leaf[MAX_PATH];
-	if (lvl <= 0)
-		return 0;
-
-	for (cnt = 0; cnt < node_nr; cnt++) {
-		int fd = 0, fd2;
-		// generate dir name or file name
-		sprintf(dir, "%d-d", cnt);
-		sprintf(leaf, "%d-f", cnt);
-
-		// create an empty file
-		// API: open,close,dup,read,write,lseek
-		fd = open(leaf, O_CREAT | O_RDWR);
-		fd2 = dup(fd);
-		close(fd);
-		fd = fd2;
-		write(fd, leaf, 3);
-		lseek(fd, SEEK_SET, 0);
-		read(fd, leaf, 3);
-		close(fd);
-
-		// create directory entry
-		mkdir(dir, 0777);
-		getcwd(cwd, sizeof(cwd));
-		chdir(dir);
-		k_tree_gen(lvl - 1, node_nr);
-		chdir(cwd);
-	}
-
-	return 1;
-}
-
-int main(int argc, char **argv)
-{
-	if (argc < 2) {
-		printf("Usage: k-tree tree_depth tree_width\n");
-		return 1;
-	}
-
-	printf("Generate k tree (depth: %s, width: %s) ...\n", argv[1],
-	       argv[2]);
-	k_tree_gen(atoi(argv[1]), atoi(argv[2]));
-	printf("Generate k tree (depth: %s, width: %s), done\n", argv[1],
-	       argv[2]);
-	return 0;
-}
diff --git a/testcases/kernel/mce-test/stress/tools/fs-metadata/k-tree-trav.c b/testcases/kernel/mce-test/stress/tools/fs-metadata/k-tree-trav.c
deleted file mode 100644
index 5349462..0000000
--- a/testcases/kernel/mce-test/stress/tools/fs-metadata/k-tree-trav.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Metadata stress testing program for file system
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; version
- * 2.
- *
- * 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 find a copy of v2 of the GNU General Public License somewhere
- * on your Linux system; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * This program helps you to traverse each node in the k tree
- * Do the i-node operations on the all file entries in recursive
- *
- * Copyright (C) 2009, Intel Corp.
- * Author: Shaohui Zheng <shaohui.zheng@intel.com>
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#define MAX_PATH 8192
-
-/*
- * Traverse a k-tree in recusive
- *
- * parameters:
- * lvl: tree level number from button to top
- * node_nr: the maximun nodes number
- * return val: if it is leaf, return 0, or return 1
- */
-
-int k_tree_trav(int lvl, int node_nr)
-{
-	int cnt;
-	char dir[MAX_PATH], cwd[MAX_PATH], f1[MAX_PATH], f2[MAX_PATH],
-	    ln[MAX_PATH];
-	if (lvl <= 0)
-		return 0;
-
-	for (cnt = 0; cnt < node_nr; cnt++) {
-		sprintf(dir, "%d-d", cnt);
-		sprintf(f1, "%d-f", cnt);
-		sprintf(f2, "%d-f-t", cnt);
-		sprintf(ln, "%d-l", cnt);
-
-		// link and unlink testing for each file i-node
-		link(f1, f2);
-		unlink(f1);
-		rename(f2, f1);
-
-		// symlink testing
-		symlink(ln, f1);
-		unlink(ln);
-
-		getcwd(cwd, sizeof(cwd));
-		chmod(dir, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-		chdir(dir);
-		k_tree_trav(lvl - 1, node_nr);
-		chdir(cwd);
-	}
-
-	return 1;
-}
-
-int main(int argc, char **argv)
-{
-	if (argc < 2) {
-		printf("Usage: %s tree_depth tree_width\n", argv[0]);
-		return 1;
-	}
-
-	printf("Traverse k tree (depth: %s, width: %s)...\n", argv[1], argv[2]);
-	k_tree_trav(atoi(argv[1]), atoi(argv[2]));
-	printf("Traverse k tree (depth: %s, width: %s), done\n", argv[1],
-	       argv[2]);
-	return 0;
-}
diff --git a/testcases/kernel/mce-test/stress/tools/page-poisoning/Makefile b/testcases/kernel/mce-test/stress/tools/page-poisoning/Makefile
deleted file mode 100644
index ef93ade..0000000
--- a/testcases/kernel/mce-test/stress/tools/page-poisoning/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-all: page-poisoning
-
-page-poisoning: page-poisoning.o
-
-../../bin/page-poisoning: page-poisoning
-	cp page-poisoning ../../bin
-
-install: ../../bin/page-poisoning
-
-clean:
-	rm -f page-poisoning *.o
diff --git a/testcases/kernel/mce-test/stress/tools/page-poisoning/README b/testcases/kernel/mce-test/stress/tools/page-poisoning/README
deleted file mode 100644
index 58c11d7..0000000
--- a/testcases/kernel/mce-test/stress/tools/page-poisoning/README
+++ /dev/null
@@ -1,15 +0,0 @@
-Multi-process based page-poisoning test program.
-
-page-poisoning test program is an extension of tinjpage test program with a 
-multi-process model. It spawns thousands of processes that inject HWPosion 
-error to various pages simultaneously thru madvise syscall. Then it checks
-if these errors get handled correctly, i.e. whether each test process 
-receives or doesn't receive SIGBUS signal as expected.
-
-In details, page-poisoning is designed to cover all of possible userspace page
-types via following two test operations: 
-  - anonymous pages operations.
-  - file data operations.
-
-You can get detailed help info in following way:
-# ./page-poisoning -h
diff --git a/testcases/kernel/mce-test/stress/tools/page-poisoning/page-poisoning.c b/testcases/kernel/mce-test/stress/tools/page-poisoning/page-poisoning.c
deleted file mode 100644
index eae8078..0000000
--- a/testcases/kernel/mce-test/stress/tools/page-poisoning/page-poisoning.c
+++ /dev/null
@@ -1,894 +0,0 @@
-/*
- * Test program for Linux poison memory error recovery.
- * This program is extended from tinjpage with a multi-process model.
- *
- * This injects poison into various mapping cases and triggers the poison
- * handling.  Requires special injection support in the kernel.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; version
- * 2.
- *
- * 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 find a copy of v2 of the GNU General Public License somewhere
- * on your Linux system; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Authors: Andi Kleen, Fengguang Wu, Haicheng Li
- *
- */
-#define _GNU_SOURCE 1
-#include <stdio.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <setjmp.h>
-#include <errno.h>
-#include <string.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <getopt.h>
-#include <limits.h>
-
-#include <sys/mman.h>
-#include <sys/fcntl.h>
-#include <sys/types.h>
-#include <sys/shm.h>
-#include <sys/sem.h>
-#include <sys/wait.h>
-
-#define MADV_POISON 100
-
-#define PAGE_SIZE 4 * 1024
-#define SHM_SIZE 1		// in page_size.
-#define SHM_MODE 0600
-#define FILE_SIZE 1 * 1024 * 1024 * 1024
-#define LOG_BUFLEN 100
-
-#define INSTANCE_NUM 10000
-
-#define TEST_PASS 1
-#define TEST_FAIL 0
-
-static int PS = PAGE_SIZE;
-static int instance = 0;	// index of the child process.
-static int testid = 0;		// test index of the child process.
-static int test_types = 0;	// totoal test types.
-static int t_shm = -1;		// index of shm test case.
-static int failure = 0;		// result of child process.
-static int unexpected = 0;	// result of child process.
-static int early_kill = 0;
-struct test {
-	int id;
-	int result;
-};
-struct shm {
-	int id;
-	int ready;
-	int done;
-};
-struct ipc {
-	struct test test[INSTANCE_NUM];
-	struct shm shm;
-};
-static int ipc_entry;
-static int *shmptr = NULL;
-
-static pid_t g_pid[INSTANCE_NUM] = { 0 };
-static int shm_size = SHM_SIZE;
-static int child_num = INSTANCE_NUM;
-static int shm_child_num = 0;
-static char log_file[PATH_MAX];
-static FILE *log_fd = NULL;
-static char result_file[PATH_MAX];
-static FILE *result_fd = NULL;
-static char tmp_dir[PATH_MAX] = { '\0' };
-static int clean_env = 0;
-
-static int semid_ready = 0;
-
-static pid_t mypid;
-
-union semun {
-	int val;
-	struct semid_ds *buf;
-	unsigned short int *array;
-	struct semid_info *__buf;
-};
-
-enum rmode {
-	MREAD = 0,
-	MWRITE = 1,
-	MREAD_OK = 2,
-	MWRITE_OK = 3,
-	MNOTHING = -1,
-};
-
-static struct option opts[] = {
-	{"clean", 0, 0, 'C'},
-	{"help", 0, 0, 'h'},
-	{"instance", 0, 0, 'i'},
-	{"log", 0, 0, 'l'},
-	{"result", 0, 0, 'r'},
-	{"shmsize", 0, 0, 's'},
-	{"tmpdir", 0, 0, 't'},
-	{"", 0, 0, '\0'}
-};
-
-static void help(void)
-{
-	printf("Usage: page-poisoning [OPTION]...\n"
-	       "Stress test for Linux HWPOISON Page Recovery with multiple processes.\n"
-	       "\n"
-	       "Mandatory arguments to long options are mandatory for short options too.\n"
-	       "  -C, --clean                record log and result in clean files.\n"
-	       "  -h                         print this page\n"
-	       "  -i, --child_num=NUM        spawn NUM processes to do test (default NUM = %d)\n"
-	       "  -l, --log=LOG              record logs to file LOG.\n"
-	       "  -r, --result=RESULT        record test result to file RESULT.\n"
-	       "  -s, --shmsize=SIZE         each shared memory segment is SIZE-page based.\n"
-	       "  -t, --tmpdir=DIR           create temporary files in DIR.\n\n",
-	       INSTANCE_NUM);
-}
-
-static void err(const char *fmt, ...);
-static void mylog(const char *fmt, ...)
-{
-	char buf[LOG_BUFLEN] = { '\0' };
-	va_list args;
-	if (!log_fd)
-		err("no log file there\n");
-
-	va_start(args, fmt);
-	vsprintf(buf, fmt, args);
-	printf("[pid %d] %s", mypid, buf);
-	fprintf(log_fd, "[pid %d] %s", mypid, buf);
-	fflush(log_fd);
-	va_end(args);
-}
-
-static void result(const char *fmt, ...)
-{
-	char buf[LOG_BUFLEN] = { '\0' };
-	va_list args;
-	if (!result_fd)
-		err("no result file there\n");
-
-	va_start(args, fmt);
-	vsprintf(buf, fmt, args);
-	fprintf(result_fd, "[pid %d] %s", mypid, buf);
-	fflush(result_fd);
-	if (log_fd)
-		mylog("%s", buf);
-	va_end(args);
-}
-
-static void err(const char *fmt, ...)
-{
-	char buf[LOG_BUFLEN] = { '\0' };
-	va_list args;
-	va_start(args, fmt);
-
-	vsprintf(buf, fmt, args);
-	if (result_fd)
-		result("error: %s :%s\n", buf, strerror(errno));
-	else
-		perror(buf);
-	va_end(args);
-	exit(1);
-}
-
-static void *checked_mmap(void *start, size_t length, int prot, int flags,
-		   int fd, off_t offset)
-{
-	void *map = mmap(start, length, prot, flags, fd, offset);
-	if (map == (void *)-1L)
-		err("mmap");
-	return map;
-}
-
-static void munmap_reserve(void *page, int size)
-{
-	munmap(page, size);
-	mmap(page, size, PROT_NONE, MAP_PRIVATE | MAP_FIXED, 0, 0);
-}
-
-static void *xmalloc(size_t s)
-{
-	void *p = malloc(s);
-	if (!p)
-		exit(ENOMEM);
-	return p;
-}
-
-static int recovercount;
-static sigjmp_buf recover_ctx;
-static sigjmp_buf early_recover_ctx;
-static void *expected_addr;
-
-static void sighandler(int sig, siginfo_t * si, void *arg)
-{
-	mylog("signal %d code %d addr %p\n", sig, si->si_code, si->si_addr);
-	if (si->si_addr != expected_addr) {
-		result("failed: Unexpected address in signal %p (expected %p)\n",
-		       si->si_addr, expected_addr);
-		failure++;
-	}
-
-	if (--recovercount == 0) {
-		result("failed: I seem to be in a signal loop. bailing out.\n");
-		exit(1);
-	}
-
-	if (si->si_code == 4)
-		siglongjmp(recover_ctx, 1);
-	else
-		siglongjmp(early_recover_ctx, 1);
-}
-
-static void poison(char *msg, char *page, enum rmode mode)
-{
-	expected_addr = page;
-	recovercount = 5;
-
-	if (sigsetjmp(early_recover_ctx, 1) == 0) {
-		if (madvise(page, PS, MADV_POISON) != 0) {
-			if (errno == EINVAL) {
-				result("failed: Kernel doesn't support poison injection\n");
-				exit(0);
-			}
-			err("error: madvise: %s", strerror(errno));
-			return;
-		}
-
-		if (early_kill && (mode == MWRITE || mode == MREAD)) {
-			result("failed: %s: process is not early killed\n",
-			       msg);
-			failure++;
-		}
-
-		return;
-	}
-
-	if (early_kill) {
-		if (mode == MREAD_OK || mode == MWRITE_OK) {
-			result("failed: %s: killed\n", msg);
-			failure++;
-		} else
-			mylog("pass: recovered\n");
-	}
-}
-
-static void recover(char *msg, char *page, enum rmode mode)
-{
-	expected_addr = page;
-	recovercount = 5;
-
-	if (sigsetjmp(recover_ctx, 1) == 0) {
-		switch (mode) {
-		case MWRITE:
-			mylog("writing 2\n");
-			*page = 2;
-			break;
-		case MWRITE_OK:
-			mylog("writing 4\n");
-			*page = 4;
-			return;
-		case MREAD:
-			mylog("reading %x\n", *(unsigned char *)page);
-			break;
-		case MREAD_OK:
-			mylog("reading %x\n", *(unsigned char *)page);
-			return;
-		case MNOTHING:
-			return;
-		}
-		/* signal or kill should have happened */
-		result("failed: %s: page is not poisoned after injection\n", msg);
-		failure++;
-		return;
-	}
-	if (mode == MREAD_OK || mode == MWRITE_OK) {
-		result("failed: %s: killed\n", msg);
-		failure++;
-	} else
-		mylog("pass: recovered\n");
-}
-
-static void testmem(char *msg, char *page, enum rmode mode)
-{
-	mylog("%s poisoning page %p\n", msg, page);
-	poison(msg, page, mode);
-	recover(msg, page, mode);
-}
-
-static void expecterr(char *msg, int err)
-{
-	if (err) {
-		mylog("pass: expected error %d on %s\n", errno, msg);
-	} else {
-		result("failed: unexpected no error on %s\n", msg);
-		failure++;
-	}
-}
-
-/*
- * Any optional error is really a deficiency in the kernel VFS error reporting
- * and should be eventually fixed and turned into a expecterr
- */
-static void optionalerr(char *msg, int err)
-{
-	if (err) {
-		mylog("pass: expected error %d on %s\n", errno, msg);
-	} else {
-		mylog("LATER: expected likely incorrect no error on %s\n", msg);
-		unexpected++;
-	}
-}
-
-static int playfile(char *buf)
-{
-	int fd;
-	if (buf[0] == 0)
-		snprintf(buf, PATH_MAX, "%s/dirty%d", tmp_dir, mypid);
-	fd = open(buf, O_CREAT | O_RDWR | O_TRUNC, 0600);
-	if (fd < 0)
-		err("opening temporary file: %s", buf);
-
-	const int NPAGES = 5;
-	char *tmp = xmalloc(PS * NPAGES);
-	int i;
-	for (i = 0; i < PS * NPAGES; i++)
-		tmp[i] = i;
-	write(fd, tmp, PS * NPAGES);
-
-	lseek(fd, 0, SEEK_SET);
-	free(tmp);
-	return fd;
-}
-
-static void dirty_anonymous(void)
-{
-	struct ipc *ipc;
-	char *page;
-
-	if ((ipc = shmat(ipc_entry, 0, 0)) == (void *)-1)
-		err("shmat error\n");
-	ipc->test[instance].id = testid;
-	page = checked_mmap(NULL, PS, PROT_READ | PROT_WRITE,
-			    MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, 0, 0);
-	testmem("dirty", page, MWRITE);
-	if (!failure)
-		ipc->test[instance].result = TEST_PASS;
-	shmdt(ipc);
-}
-
-static void dirty_anonymous_unmap(void)
-{
-	struct ipc *ipc;
-	char *page;
-
-	if ((ipc = shmat(ipc_entry, 0, 0)) == (void *)-1)
-		err("shmat error\n");
-	ipc->test[instance].id = testid;
-	page = checked_mmap(NULL, PS, PROT_READ | PROT_WRITE,
-			    MAP_PRIVATE | MAP_ANONYMOUS | MAP_POPULATE, 0, 0);
-	testmem("dirty", page, MWRITE);
-	munmap_reserve(page, PS);
-	if (!failure)
-		ipc->test[instance].result = TEST_PASS;
-	shmdt(ipc);
-}
-
-static void mlocked_anonymous(void)
-{
-	struct ipc *ipc;
-	char *page;
-
-	if ((ipc = shmat(ipc_entry, 0, 0)) == (void *)-1)
-		err("shmat error\n");
-	ipc->test[instance].id = testid;
-	page = checked_mmap(NULL, PS, PROT_READ | PROT_WRITE,
-			    MAP_PRIVATE | MAP_ANONYMOUS | MAP_LOCKED, 0, 0);
-	testmem("mlocked", page, MWRITE);
-	if (!failure)
-		ipc->test[instance].result = TEST_PASS;
-	shmdt(ipc);
-}
-
-static void do_file_clean(int flags, char *name)
-{
-	char *page;
-	char fn[PATH_MAX];
-	snprintf(fn, PATH_MAX, "%s/clean%d", tmp_dir, mypid);
-	int fd = open(fn, O_RDWR | O_TRUNC | O_CREAT, 0600);
-	if (fd < 0)
-		err("opening temporary file: %s", fn);
-	write(fd, fn, 4);
-	page = checked_mmap(NULL, PS, PROT_READ | PROT_WRITE, MAP_SHARED | flags,
-			    fd, 0);
-	fsync(fd);
-	close(fd);
-	testmem(name, page, MREAD_OK);
-	/* reread page from disk */
-	mylog("reading %x\n", *(unsigned char *)page);
-	testmem(name, page, MWRITE_OK);
-}
-
-static void file_clean(void)
-{
-	struct ipc *ipc;
-
-	if ((ipc = shmat(ipc_entry, 0, 0)) == (void *)-1)
-		err("shmat error\n");
-	ipc->test[instance].id = testid;
-	do_file_clean(0, "file clean");
-	if (!failure)
-		ipc->test[instance].result = TEST_PASS;
-	shmdt(ipc);
-}
-
-static void file_clean_mlocked(void)
-{
-	struct ipc *ipc;
-
-	if ((ipc = shmat(ipc_entry, 0, 0)) == (void *)-1)
-		err("shmat error\n");
-	ipc->test[instance].id = testid;
-	do_file_clean(MAP_LOCKED, "file clean mlocked");
-	if (!failure)
-		ipc->test[instance].result = TEST_PASS;
-	shmdt(ipc);
-}
-
-static char *ndesc(char *buf, char *name, char *add)
-{
-	snprintf(buf, 100, "%s %s", name, add);
-	return buf;
-}
-
-static void do_file_dirty(int flags, char *name)
-{
-	char nbuf[100];
-	char *page;
-	char fn[PATH_MAX];
-	fn[0] = 0;
-	int fd = playfile(fn);
-
-	page = checked_mmap(NULL, PS, PROT_READ,
-			    MAP_SHARED | MAP_POPULATE | flags, fd, 0);
-	testmem(ndesc(nbuf, name, "initial"), page, MREAD);
-	expecterr("msync expect error", msync(page, PS, MS_SYNC) < 0);
-	close(fd);
-	munmap_reserve(page, PS);
-
-	fd = open(fn, O_RDONLY);
-	if (fd < 0)
-		err("reopening temp file");
-	page = checked_mmap(NULL, PS, PROT_READ, MAP_SHARED | MAP_POPULATE | flags,
-			    fd, 0);
-	recover(ndesc(nbuf, name, "populated"), page, MREAD_OK);
-	close(fd);
-	munmap_reserve(page, PS);
-
-	fd = open(fn, O_RDONLY);
-	if (fd < 0)
-		err("reopening temp file");
-	page = checked_mmap(NULL, PS, PROT_READ, MAP_SHARED | flags, fd, 0);
-	recover(ndesc(nbuf, name, "fault"), page, MREAD_OK);
-	close(fd);
-	munmap_reserve(page, PS);
-
-	fd = open(fn, O_RDWR);
-	char buf[128];
-	/* the earlier close has eaten the error */
-	optionalerr("explicit read after poison", read(fd, buf, sizeof buf) < 0);
-	optionalerr("explicit write after poison", write(fd, "foobar", 6) < 0);
-	optionalerr("fsync expect error", fsync(fd) < 0);
-	close(fd);
-
-	/* should unlink return an error here? */
-	if (unlink(fn) < 0)
-		perror("unlink");
-}
-
-static void file_dirty(void)
-{
-	struct ipc *ipc;
-
-	if ((ipc = shmat(ipc_entry, 0, 0)) == (void *)-1)
-		err("shmat error\n");
-	ipc->test[instance].id = testid;
-	do_file_dirty(0, "file dirty");
-	if (!failure)
-		ipc->test[instance].result = TEST_PASS;
-	shmdt(ipc);
-}
-
-static void file_dirty_mlocked(void)
-{
-	struct ipc *ipc;
-
-	if ((ipc = shmat(ipc_entry, 0, 0)) == (void *)-1)
-		err("shmat error\n");
-	ipc->test[instance].id = testid;
-	do_file_dirty(MAP_LOCKED, "file dirty mlocked");
-	if (!failure)
-		ipc->test[instance].result = TEST_PASS;
-	shmdt(ipc);
-}
-
-static void request_sem(int id, int num)
-{
-	struct sembuf sb;
-
-	sb.sem_num = num;
-	sb.sem_op = -1;
-	sb.sem_flg = 0;
-
-	semop(id, &sb, 1);
-}
-
-static void waiton_sem(int id, int num)
-{
-	struct sembuf sb;
-
-	sb.sem_num = num;
-	sb.sem_flg = 0;
-
-	sb.sem_op = -1;
-	semop(id, &sb, 1);
-	sb.sem_op = 0;
-	semop(id, &sb, 1);
-}
-
-static void release_sem(int id, int num)
-{
-	struct sembuf sb;
-
-	sb.sem_num = num;
-	sb.sem_op = 1;
-	sb.sem_flg = 0;
-
-	semop(id, &sb, 1);
-}
-
-static void clean_anonymous(void)
-{
-	char *page;
-	page = checked_mmap(NULL, PS, PROT_READ | PROT_WRITE,
-			    MAP_PRIVATE | MAP_ANONYMOUS, 0, 0);
-	testmem("clean", page, MWRITE_OK);
-}
-
-static void anon_clean(void)
-{
-	struct ipc *ipc;
-
-	if ((ipc = shmat(ipc_entry, 0, 0)) == (void *)-1)
-		err("shmat error\n");
-	ipc->test[instance].id = testid;
-	clean_anonymous();
-	if (!failure)
-		ipc->test[instance].result = TEST_PASS;
-	shmdt(ipc);
-}
-
-/* TBD
-static void survival(void)
-{
-	struct ipc *ipc;
-	char page;
-
-	if ((ipc = shmat(ipc_entry, 0, 0)) == (void *)-1)
-		err("shmat error\n");
-	ipc->test[instance].id = testid;
-	testmem("survial", &page, MNOTHING);
-	if (!failure)
-		ipc->test[instance].result = TEST_PASS;
-	shmdt(ipc);
-}
-*/
-
-static void shm_test(void)
-{
-	struct ipc *ipc;
-
-	if ((ipc = shmat(ipc_entry, 0, 0)) == (void *)-1)
-		err("shmat error\n");
-	ipc->test[instance].id = testid;
-
-	request_sem(semid_ready, 0);
-	if (!ipc->shm.ready) {
-		if ((ipc->shm.id = shmget(IPC_PRIVATE, shm_size * PS,
-					  SHM_MODE)) < 0)
-			err("shmget error\n");
-		ipc->shm.ready = 1;
-	}
-	if ((shmptr = shmat(ipc->shm.id, 0, 0)) == (void *)-1) {
-		err("shmat error\n");
-	} else
-		*shmptr = mypid;
-	release_sem(semid_ready, 0);
-
-	waiton_sem(semid_ready, 1);
-
-	request_sem(semid_ready, 0);
-	if (!ipc->shm.done) {
-		ipc->shm.done = 1;
-		testmem("shm dirty", (char *)shmptr, MWRITE);
-	} else
-		recover("shm dirty", (char *)shmptr, MREAD);
-	release_sem(semid_ready, 0);
-
-	if (!failure)
-		ipc->test[instance].result = TEST_PASS;
-	shmdt(shmptr);
-	shmdt(ipc);
-}
-
-static void setup_ipc(void)
-{
-	int size;
-	union semun sunion;
-	struct ipc *ipc;
-
-	size = sizeof(struct ipc);
-
-	if ((ipc_entry = shmget(IPC_PRIVATE, size, SHM_MODE)) < 0)
-		err("shmget error\n");
-	if ((ipc = shmat(ipc_entry, 0, 0)) == (void *)-1)
-		err("shmat error\n");
-	memset(ipc, 0, sizeof(struct ipc));
-	ipc->shm.id = -1;
-	shmdt(ipc);
-
-	semid_ready = semget(IPC_PRIVATE, 2, SHM_R | SHM_W);
-	sunion.val = 1;
-	semctl(semid_ready, 0, SETVAL, sunion);
-	if (t_shm != -1) {
-		if (((child_num - 1) % test_types) >= t_shm)
-			shm_child_num = (child_num - 1) / test_types + 1;
-		else
-			shm_child_num = (child_num - 1) / test_types;
-	}
-	if (shm_child_num) {
-		sunion.val = shm_child_num;
-		semctl(semid_ready, 1, SETVAL, sunion);
-		mylog("there are %d shm_child\n", shm_child_num);
-	}
-}
-
-static void free_ipc(void)
-{
-	struct ipc *ipc;
-
-	semctl(semid_ready, 0, IPC_RMID);
-	if ((ipc = shmat(ipc_entry, 0, 0)) == (void *)-1)
-		err("shmat error\n");
-	if (ipc->shm.id != -1)
-		shmctl(ipc->shm.id, IPC_RMID, 0);
-	shmdt(ipc);
-	shmctl(ipc_entry, IPC_RMID, 0);
-}
-
-static void cleanup(void)
-{
-	int i;
-	for (i = 0; i < instance; i++)
-		kill(g_pid[i], 9);	//kill the suviving child.
-	free_ipc();
-}
-
-struct testcase {
-	void (*f) (void);
-	char *name;
-	int survivable;
-} cases[] = {
-	{
-	shm_test, "shared memory test", 0}, {
-	anon_clean, "anonymous clean", 1}, {
-	dirty_anonymous, "anonymous dirty", 0}, {
-	dirty_anonymous_unmap, "anonymous dirty unmap", 0}, {
-	mlocked_anonymous, "anonymous dirty mlocked", 0}, {
-	file_clean, "file clean", 1}, {
-	file_dirty, "file dirty", 0}, {
-	file_clean_mlocked, "file clean mlocked", 1}, {
-	file_dirty_mlocked, "file dirty mlocked", 0},
-//      { survival, "survival", 0 },
-	{
-	NULL, NULL, 0}
-};
-
-static int run_test(int children)
-{
-	pid_t pid = -1;
-	int i = 0, rc = 0;
-	siginfo_t sig;
-	struct ipc *ipc;
-
-	for (i = 0; i < children; i++) {
-		pid = fork();
-		if (pid < 0) {
-			err("fork %d\n", i);
-			break;
-		} else if (pid == 0) {
-			int j = instance % test_types;
-			mypid = getpid();
-			testid = j;
-			cases[j].f();
-			exit(0);
-		} else {
-			g_pid[i] = pid;
-			++instance;
-			fflush(stdout);
-		}
-	}
-
-	mylog("have spawned %d processes\n", instance);
-	if (instance) {
-		if ((ipc = shmat(ipc_entry, 0, 0)) == (void *)-1)
-			err("shmat error\n");
-
-		for (i = 0; i < instance; i++) {
-			int t = ipc->test[i].id;
-
-			mylog("wait for Pid %d\n", g_pid[i]);
-			waitid(P_PID, g_pid[i], &sig, WEXITED);
-			if (ipc->test[i].result == TEST_PASS)
-				result("Ins %d: Pid %d: pass - %s\n", i,
-				      g_pid[i], cases[t].name);
-			else {
-				result("Ins %d: Pid %d: failed - %s\n", i,
-				       g_pid[i], cases[t].name);
-				failure++;
-			}
-		}
-		shmdt(ipc);
-	}
-
-	if (!failure)
-		result("\t!!! Page Poisoning Test got PASS. !!!\n\n");
-	else {
-		result("\t!!! Page Poisoning Test is FAILED (%d failures found). !!!\n\n",
-		         failure);
-		rc = 1;
-	}
-
-	return rc;
-}
-
-static void setup_log(void)
-{
-	int rc = 0;
-	if (clean_env)
-		log_fd = fopen(log_file, "w");
-	else
-		log_fd = fopen(log_file, "a");
-	if (!log_fd)
-		err("cannot open log file: %s\n", log_file);
-
-	if (clean_env)
-		result_fd = fopen(result_file, "w");
-	else
-		result_fd = fopen(result_file, "a");
-	if (!result_fd)
-		err("cannot open log file: %s\n", result_file);
-
-	if (tmp_dir[0] != '\0') {
-		rc = mkdir(tmp_dir, 0777);
-		if (rc && errno != EEXIST)
-			err("cannot create tmp dir: %s: %s\n", tmp_dir,
-			    strerror(errno));
-	}
-}
-
-static void free_log(void)
-{
-	fclose(log_fd);
-	fclose(result_fd);
-}
-
-static void main_sighandler(int sig, siginfo_t * si, void *arg)
-{
-	mylog("receive signal to get terminated\n");
-	cleanup();
-	exit(1);
-}
-
-static void setup_sig(void)
-{
-	struct sigaction sa = {
-		.sa_sigaction = main_sighandler,
-		.sa_flags = SA_SIGINFO
-	};
-	struct sigaction sa_bus = {
-		.sa_sigaction = sighandler,
-		.sa_flags = SA_SIGINFO
-	};
-
-	sigaction(SIGINT, &sa, NULL);
-	sigaction(SIGKILL, &sa, NULL);
-	sigaction(SIGTERM, &sa, NULL);
-	sigaction(SIGBUS, &sa_bus, NULL);
-}
-
-static void setup_test(void)
-{
-	struct testcase *t;
-	/* catch signals */
-	for (t = cases; t->f; t++)
-		if (t->f == shm_test)
-			t_shm = (t - cases);
-	test_types = t - cases;
-}
-
-int main(int argc, char **argv)
-{
-	int rc = 0, c, opt_index;
-
-	snprintf(log_file, sizeof(log_file), "page-poisoning.log");
-	snprintf(result_file, sizeof(result_file), "page-poisoning.result");
-	snprintf(tmp_dir, sizeof(tmp_dir), "./tmp");
-	while (1) {
-		c = getopt_long(argc, argv, "Chi:l:r:s:t:", opts, &opt_index);
-		if (c == -1)
-			break;
-		switch (c) {
-		case 'C':
-			clean_env = 1;
-			break;
-		case 'h':
-			help();
-			return 0;
-		case 'i':
-			child_num = strtol(optarg, NULL, 0);
-			if (child_num > INSTANCE_NUM)
-				child_num = INSTANCE_NUM;
-			break;
-		case 'l':
-			snprintf(log_file, sizeof(log_file), "%s", optarg);
-			break;
-		case 'r':
-			snprintf(result_file, sizeof(result_file), "%s",
-				 optarg);
-			break;
-		case 's':
-			shm_size = strtol(optarg, NULL, 0);
-			if (shm_size < SHM_SIZE)
-				shm_size = SHM_SIZE;
-			break;
-		case 't':
-			snprintf(tmp_dir, sizeof(tmp_dir), "%s", optarg);
-			break;
-		default:
-			help();
-			return 0;
-		}
-	}
-
-	if (!early_kill)
-		system("sysctl -w vm.memory_failure_early_kill=0");
-	mypid = getpid();
-	setup_log();
-	setup_test();
-	if (!child_num) {
-		mylog("end without test executed since child_num = 0\n");
-		return rc;
-	}
-
-	mylog("start page-poisoning test\n");
-	PS = getpagesize();
-	setup_ipc();
-	setup_sig();
-	rc = run_test(child_num);
-	free_ipc();
-	mylog("page-poisoning test done!\n");
-	free_log();
-
-	return rc;
-}
diff --git a/testcases/kernel/mce-test/tools/Makefile b/testcases/kernel/mce-test/tools/Makefile
deleted file mode 100644
index 42afa1c..0000000
--- a/testcases/kernel/mce-test/tools/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
-
-all:
-	$(MAKE) -C simple_process
-	$(MAKE) -C simple_process install
-clean:
-	$(MAKE) -C simple_process clean
-distclean: clean
diff --git a/testcases/kernel/mce-test/tools/gcov_merge.py b/testcases/kernel/mce-test/tools/gcov_merge.py
deleted file mode 100755
index 0ac9bed..0000000
--- a/testcases/kernel/mce-test/tools/gcov_merge.py
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/env python
-#
-# Merge gcov graph from several test cases. This can be used to check
-# the coverage of several test cases.
-#
-# Copyright (C) 2008, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is released under the GPLv2.
-
-import sys
-
-def die(str):
-    print str
-    sys.exit(-1)
-
-def die_on(cond, str):
-    if cond:
-        die(str)
-
-class GCovLine(object):
-    def __init__(self, l):
-        object.__init__(self)
-        self.parse(l)
-    def parse(self, l):
-        sep = l.find(':')
-        die_on(sep <= 0, 'input error format error')
-        remain = l[sep:]
-        scnt = l[:sep]
-        if scnt[-1] == '-':
-            count = -1
-        elif scnt[-1] == '#':
-            count = 0
-        else:
-            count = int(scnt)
-        self.sep = sep
-        self.count = count
-        self.remain = remain
-    def merge(self, gcl):
-        self.count = self.count + gcl.count
-    def write(self, of):
-        if self.count < 0:
-            of.write("%*s" % (self.sep, '-'))
-        elif self.count == 0:
-            of.write("%*s" % (self.sep, '#####'))
-        else:
-            of.write("%*d" % (self.sep, self.count))
-        of.write(self.remain)
-
-def parse(f):
-    return [GCovLine(l) for l in f]
-
-def merge(gcls1, gcls2):
-    for gcl1, gcl2 in zip(gcls1, gcls2):
-        gcl1.merge(gcl2)
-
-def gcov_merge(fns, of):
-    f = file(fns[0])
-    gcls_base = parse(f)
-
-    for fn in fns[1:]:
-        f = file(fn)
-        gcls = parse(f)
-        merge(gcls_base, gcls)
-
-    for gcl in gcls_base:
-        gcl.write(of)
-
-def usage():
-    print 'Usage: %s <gcov graph files>' % (sys.argv[0])
-
-if __name__ == '__main__':
-    if len(sys.argv) <= 1:
-        usage()
-        exit -1
-    gcov_merge(sys.argv[1:], sys.stdout)
diff --git a/testcases/kernel/mce-test/tools/grep_result.sh b/testcases/kernel/mce-test/tools/grep_result.sh
deleted file mode 100755
index 4ef74ad..0000000
--- a/testcases/kernel/mce-test/tools/grep_result.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-#
-# Filter out specified test case results from all results.
-#
-# Copyright (C) 2008, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is released under the GPLv2.
-#
-
-tr '\n' '|' | sed -e '1,$s/||/\n/g' | grep "$@" | sed -e '/^$/d' | \
-    sed -e '1,$s/^|\?\([^|].*[^|]\)|\?$/\1/' | sed -e '1,$i\ ' | tr '|' '\n'
diff --git a/testcases/kernel/mce-test/tools/loop-mce-test.sh b/testcases/kernel/mce-test/tools/loop-mce-test.sh
deleted file mode 100644
index 8d6775a..0000000
--- a/testcases/kernel/mce-test/tools/loop-mce-test.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/bash
-#
-# Run mce test cases in a loop. It exists on failure of any one of the test cases.
-# This script is using simple test driver.
-#
-#   Authors: Dean Nelson <dnelson@redhat.com>
-#           Zheng Jiajia <jiajia.zheng@intel.com>
-# This file is released under the GPLv2.
-#
-# Usage:
-#Run as root and invoke this test tool on test configure file. 
-#For example, ./loop-mce-test simple_ser.conf
-#Note that only simple test configure file is used and full path is not needed here.
-
-sd=$(dirname "$0")
-export ROOT=`(cd $sd/..; pwd)`
-prog=$(basename "$0")
-
-usage()
-{
-    echo "$prog <config>"
-    exit 1
-}
-
-. $ROOT/lib/functions.sh
-
-[ $# -eq 1 ] || usage
-config=$(basename "$1")
-[ -f $ROOT/config/$config ] || usage
-
-i=0
-while true ; do
-	((i=i+1))
-	echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!! loop $i"
-	rm $ROOT/results/simple/result
-
-	sh $ROOT/drivers/simple/driver.sh $ROOT/config/$1
-
-	sed -e'/gcov/d' $ROOT/results/simple/result | grep "Fail" > /dev/null
-	if [ $? = 0 ] ; then
-		echo "failed on loop $i"
-		exit 1
-	fi
-done
-
diff --git a/testcases/kernel/mce-test/tools/mce_shell.sh b/testcases/kernel/mce-test/tools/mce_shell.sh
deleted file mode 100755
index 09800cf..0000000
--- a/testcases/kernel/mce-test/tools/mce_shell.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#!/bin/bash
-#
-# Simulate the environment of mce-test driver or test case shell
-# script, used for debugging. You can invoking mce-test library
-# functions directly in shell created.
-#
-# Copyright (C) 2009, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is released under the GPLv2.
-#
-
-sd=$(dirname "$0")
-export ROOT=`(cd $sd/..; pwd)`
-
-if [ $# -eq 1 ]; then
-    export driver=$1
-else
-    export driver=simple
-fi
-
-tmpfile=$(mktemp)
-
-trap "rm $tmpfile" EXIT
-
-cat <<"EOF" > $tmpfile
-if [ -f /etc/bash.bashrc ]; then
-    source /etc/bash.bashrc
-fi
-
-if [ -f $HOME/.bashrc ]; then
-    source $HOME/.bashrc
-fi
-
-. $ROOT/lib/functions.sh
-setup_path
-. $ROOT/lib/dirs.sh
-. $ROOT/lib/mce.sh
-. $ROOT/lib/soft-inject.sh
-
-export PS1="MDE $driver: "
-
-echo "-----------------------------------------------------"
-echo "| MCE-test shell, You can use mce internal function |"
-echo "-----------------------------------------------------"
-EOF
-
-export PS1="MCE $driver: "
-/bin/bash --rcfile $tmpfile
-rm $tmpfile
diff --git a/testcases/kernel/mce-test/tools/scov_merge.py b/testcases/kernel/mce-test/tools/scov_merge.py
deleted file mode 100755
index f83b922..0000000
--- a/testcases/kernel/mce-test/tools/scov_merge.py
+++ /dev/null
@@ -1,68 +0,0 @@
-#!/usr/bin/env python
-#
-# Merge mce serverity coverage file from several test cases. This can
-# be used to check the coverage of several test cases.
-#
-# Copyright (C) 2009, Intel Corp.
-#   Author: Huang Ying <ying.huang@intel.com>
-#
-# This file is released under the GPLv2.
-
-import sys
-
-def die(str):
-    print str
-    sys.exit(-1)
-
-def die_on(cond, str):
-    if cond:
-        die(str)
-
-class SCovLine(object):
-    def __init__(self, l):
-        object.__init__(self)
-        self.parse(l)
-    def parse(self, l):
-        sep = l.find('\t')
-        die_on(sep <= 0, 'input error format error')
-        remain = l[sep:]
-        scnt = l[:sep]
-        count = int(scnt)
-        self.count = count
-        self.remain = remain
-    def merge(self, gcl):
-        self.count = self.count + gcl.count
-    def write(self, of):
-        if self.count == 0:
-            of.write("0")
-        else:
-            of.write("1")
-        of.write(self.remain)
-
-def parse(f):
-    return [SCovLine(l) for l in f]
-
-def merge(gcls1, gcls2):
-    for gcl1, gcl2 in zip(gcls1, gcls2):
-        gcl1.merge(gcl2)
-
-def scov_merge(fns, of):
-    f = file(fns[0])
-    gcls_base = parse(f)
-
-    for fn in fns[1:]:
-        f = file(fn)
-        gcls = parse(f)
-        merge(gcls_base, gcls)
-
-    for gcl in gcls_base:
-        gcl.write(of)
-
-def usage():
-    print 'Usage: %s <severities coverage files>' % (sys.argv[0])
-
-if __name__ == '__main__':
-    if len(sys.argv) <= 1:
-        usage()
-        exit -1
-    scov_merge(sys.argv[1:], sys.stdout)
diff --git a/testcases/kernel/mce-test/tools/simple_process/Makefile b/testcases/kernel/mce-test/tools/simple_process/Makefile
deleted file mode 100644
index d7c4e47..0000000
--- a/testcases/kernel/mce-test/tools/simple_process/Makefile
+++ /dev/null
@@ -1,13 +0,0 @@
-CFLAGS := -g -Wall
-
-all: simple_process
-
-install:
-	cp simple_process ../../bin
-
-simple_process: simple_process.o
-
-simple_process.o: simple_process.c
-
-clean:
-	rm -f simple_process *.o
diff --git a/testcases/kernel/mce-test/tools/simple_process/simple_process.c b/testcases/kernel/mce-test/tools/simple_process/simple_process.c
deleted file mode 100644
index 4832877..0000000
--- a/testcases/kernel/mce-test/tools/simple_process/simple_process.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-int main(void)
-{
-    void *p = malloc(128);
-    printf("allocating 128 bytes of memory\n");
-    while (1)
-    {
-	memset(p, 0, 128);
-    }
-  return 0;
-}
\ No newline at end of file
diff --git a/testcases/kernel/mce-test/tsrc/Makefile b/testcases/kernel/mce-test/tsrc/Makefile
deleted file mode 100644
index 5b10e9a..0000000
--- a/testcases/kernel/mce-test/tsrc/Makefile
+++ /dev/null
@@ -1,72 +0,0 @@
-LSRC := ../linux
-BROWSER := firefox
-
-CFLAGS += -I ${LSRC}/arch/x86/kernel/cpu/mcheck/ -g -Wall
-
-KFLAGS := -I ./kinclude
-
-EXE := tinjpage tsimpleinj tkillpoison tprctl tsoft tsoftinj thugetlb
-EXEKERNEL := tring ttable
-
-OBJ := $(addsuffix .o,${EXE})
-OBJKERNEL := $(addsuffix .o,${EXEKERNEL})
-
-.PHONY: clean distclean see test hard soft standalone
-
-all: standalone
-
-standalone: ${EXE}
-
-kernel: ${EXEKERNEL}
-
-tcases: tcases.c ${LSRC}/arch/x86/kernel/cpu/mcheck/mce-severity.c ${LSRC}/arch/x86/kernel/cpu/mcheck/mce-internal.h
-	${CC} ${CFLAGS} ${KFLAGS} -o tcases tcases.c
-
-ttable: ttable.c ${LSRC}/arch/x86/kernel/cpu/mcheck/mce-severity.c ${LSRC}/arch/x86/kernel/cpu/mcheck/mce-internal.h
-	${CC} ${CFLAGS} ${KFLAGS} -o ttable ttable.c
-
-tprctl: tprctl.o
-
-tring: tring.o 
-
-tring : LDFLAGS += -lpthread
-
-x.html: ttable
-	./ttable ${TFLAGS} > x.html
-
-.PHONY: see
-
-see: x.html
-	${BROWSER} x.html
-
-tinjpage: LDFLAGS += -lpthread
-
-.PHONY: clean distclean
-
-clean:
-	rm -f ${EXE} ${OBJ}
-	rm -f ${EXEKERNEL} ${OBJKERNEL}
-	rm -f x.html unpoison-failed offlined
-	rm -f ~test* ~poison*
-
-distclean: clean
-
-test: soft hard
-
-hard: standalone
-	./tinjpage
-	./tsimpleinj
-	if ! ./tkillpoison ; then echo "killed as expected" ; exit 0 ; else echo "didn't get killed" ; exit 1 ; fi
-	./tprctl
-
-soft: standalone
-	./tsoft
-	./tsoftinj
-	echo "Running soft offliner for 60 seconds"
-	./random_offline -t 60
-
-test-kernel: tcases
-	./tcases
-
-
-
diff --git a/testcases/kernel/mce-test/tsrc/README b/testcases/kernel/mce-test/tsrc/README
deleted file mode 100644
index 015f9e7..0000000
--- a/testcases/kernel/mce-test/tsrc/README
+++ /dev/null
@@ -1,59 +0,0 @@
-These are some standalone test programs for various parts of the
-machine check code:
-
-They can be all tested together by running "make test"
-This requires root rights and a kernel with soft offlining and hard
-offlining support.
-
-To use ttable and tcases you need to specify a linux source tree
-with the mce improvements patchkit added with make LSRC=/path/to/linux
-or symlink the linux tree to ../linux
-
-The programs requiring kernel sources are not in the all make target.
-If you want to build them use make requireskernel after you
-set up the kernel sources or specified LSRC.
-
-tcases
-
-Simple tester of a few test cases by running the machine check grader code
-in user space. This is an alternative to the more complete coverage
-in the main mce-test test cases.
-
-Doesn't aim to be complete, but more a quick sanity check, that 
-can be done without booting a kernel.
-
-ttable
-
-Generate a table of the output of the machine check grader. This gives
-an overview how all the status bits in the machine check architecture 
-are processed. Note that a few bits are tested outside the grader
-and this doesn't apply to corrected machine check interrupts.
-
-Use make see to render the output  using links -g (note this doesn't work
-with elinks as it is used on many distributions, in this case specify
-a different browser with make BROWSER=browserbinary see)
-
-tinjpage
-
-tinjpage is a coverage test for the hwpoison page recovery code
-in the kernel. It tests different cases by putting pages
-into different stages, triggering poison injection on them 
-and verifies the results.
-
-tinjpage requires a kernel with MADV_POISON injection support and the
-hwpoison testkit, but doesn't require a kernel tree and can be built directly with
-make tinjpage
-
-A few of the test cases are timing dependent and might require adjustment
-to run successfully.
-
-tinjpage-working
-
-Old version of tinjpage that tests much less cases, but might be more reliable.
-
-tring
-
-Old unit test program for the ring buffer used in mca recovery.
-Not in default Makefile target.
-
--Andi Kleen
diff --git a/testcases/kernel/mce-test/tsrc/hugepage.h b/testcases/kernel/mce-test/tsrc/hugepage.h
deleted file mode 100644
index d44e5ac..0000000
--- a/testcases/kernel/mce-test/tsrc/hugepage.h
+++ /dev/null
@@ -1,181 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <sys/mman.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-
-int HPS;
-char hugetlbfsdir[256];
-#ifndef UTILS
-#include "utils.h"
-#endif
-#define errmsg(x) fprintf(stderr, x), exit(1)
-
-void write_hugepage(char *addr, int size, char *avoid)
-{
-	int i, j;
-	for (i = 0; i < size; i++) {
-		if (addr == avoid)
-			continue;
-		for (j = 0; j < HPS; j++) {
-			*(addr + i * HPS + j) = (char)('a' + ((i + j) % 26));
-		}
-	}
-}
-
-/* return -1 if buffer content differs from the expected ones */
-int read_hugepage(char *addr, int size, char *avoid)
-{
-	int i, j;
-	int ret = 0;
-
-	for (i = 0; i < size; i++) {
-		if (addr == avoid)
-			continue;
-		for (j = 0; j < HPS; j++) {
-			if (*(addr + i * HPS + j) != (char)('a' + ((i + j) % 26))) {
-				printf("Mismatch at %d\n", i + j);
-				ret = -1;
-				break;
-			}
-		}
-	}
-	return ret;
-}
-
-int hugetlbfs_root(char *dir)
-{
-	int found = 0;
-	FILE *f = fopen("/proc/mounts", "r");
-	if (!f) err("open /proc/mounts");
-	char *line = NULL;
-	size_t linelen = 0;
-	char dummy[100];
-	while (getline(&line, &linelen, f) > 0) {
-		if (sscanf(line, "none %s hugetlbfs %[^ ]",
-			   dir, dummy) >= 2) {
-			found = 1;
-			break;
-		}
-	}
-	free(line);
-	fclose(f);
-	if (!found)
-		printf("cannot find hugetlbfs directory in /proc/mounts\n");
-	return found;
-}
-
-/* Assume there is only one types of hugepage size for now. */
-int gethugepagesize(void)
-{
-	int hpagesize = 0;
-	struct dirent *dent;
-	DIR *dir;
-	dir = opendir("/sys/kernel/mm/hugepages");
-	if (!dir) err("open /sys/kernel/mm/hugepages");
-	while ((dent = readdir(dir)) != NULL)
-		if (sscanf(dent->d_name, "hugepages-%dkB", &hpagesize) >= 1)
-			break;
-	closedir(dir);
-	return hpagesize * 1024;
-}
-
-void *alloc_shm_hugepage(int *key, int size)
-{
-	void *addr;
-	int shmid;
-	if ((shmid = shmget(*key, size,
-			    SHM_HUGETLB | IPC_CREAT | SHM_R | SHM_W)) < 0) {
-		perror("shmget");
-		return NULL;
-	}
-	addr = shmat(shmid, (void *)0x0UL, 0);
-	if (addr == (char *)-1) {
-		perror("Shared memory attach failure");
-		shmctl(shmid, IPC_RMID, NULL);
-		return NULL;
-	}
-	*key = shmid;
-	return addr;
-}
-
-void *alloc_anonymous_hugepage(int size, int private)
-{
-	void *addr;
-	int mapflag = MAP_ANONYMOUS | 0x40000; /* MAP_HUGETLB */
-	if (private)
-		mapflag |= MAP_PRIVATE;
-	else
-		mapflag |= MAP_SHARED;
-	if ((addr = mmap(0, size,
-			 PROT_READ|PROT_WRITE, mapflag, -1, 0)) == MAP_FAILED) {
-		perror("mmap");
-		return NULL;
-	}
-	return addr;
-}
-
-void *alloc_filebacked_hugepage(char *filepath, int size, int private, int *fd)
-{
-	int mapflag = MAP_SHARED;
-	void *addr;
-	if (private)
-		mapflag = MAP_PRIVATE;
-	if ((*fd = open(filepath, O_CREAT | O_RDWR, 0777)) < 0) {
-		perror("open");
-		return NULL;
-	}
-	if ((addr = mmap(0, size,
-			 PROT_READ|PROT_WRITE, mapflag, *fd, 0)) == MAP_FAILED) {
-		perror("mmap");
-		unlink(filepath);
-		return NULL;
-	}
-	return addr;
-}
-
-int free_shm_hugepage(int key, void *addr)
-{
-	if (shmdt((const void *)addr) != 0) {
-		perror("Detach failure");
-		shmctl(key, IPC_RMID, NULL);
-		return -1;
-	}
-	shmctl(key, IPC_RMID, NULL);
-	return 0;
-}
-
-int free_anonymous_hugepage(void *addr, int size)
-{
-	int ret = 0;
-	if (munmap(addr, size)) {
-		perror("munmap");
-		ret = -1;
-	}
-	return ret;
-}
-
-int free_filebacked_hugepage(void *addr, int size, int fd, char *filepath)
-{
-	int ret = 0;
-	if (munmap(addr, size)) {
-		perror("munmap");
-		ret = -1;
-	}
-	if (close(fd)) {
-		perror("close");
-		ret = -1;
-	}
-	if (filepath) {
-		if (unlink(filepath)) {
-			perror("unlink");
-			ret = -1;
-		}
-	} else {
-		fprintf(stderr, "Filepath not specified.\n");
-		ret = -1;
-	}
-	return ret;
-}
diff --git a/testcases/kernel/mce-test/tsrc/kinclude/README b/testcases/kernel/mce-test/tsrc/kinclude/README
deleted file mode 100644
index 4521cd1..0000000
--- a/testcases/kernel/mce-test/tsrc/kinclude/README
+++ /dev/null
@@ -1,3 +0,0 @@
-
-Fake kernel includes to build some kernel code in user context.
-
diff --git a/testcases/kernel/mce-test/tsrc/kinclude/linux/debugfs.h b/testcases/kernel/mce-test/tsrc/kinclude/linux/debugfs.h
deleted file mode 100644
index a366984..0000000
--- a/testcases/kernel/mce-test/tsrc/kinclude/linux/debugfs.h
+++ /dev/null
@@ -1,15 +0,0 @@
-
-static inline struct dentry *debugfs_create_file(const char *name, mode_t mode,
-				   struct dentry *parent, void *data,
-				   const struct file_operations *fops)
-{
-	return NULL;
-}
-
-static inline struct dentry *debugfs_create_dir(const char *name, struct dentry *parent)
-{
-	return NULL;
-}
-
-
-static inline void debugfs_remove(struct dentry *dentry) { } 
diff --git a/testcases/kernel/mce-test/tsrc/kinclude/linux/fs.h b/testcases/kernel/mce-test/tsrc/kinclude/linux/fs.h
deleted file mode 100644
index 964b343..0000000
--- a/testcases/kernel/mce-test/tsrc/kinclude/linux/fs.h
+++ /dev/null
@@ -1,10 +0,0 @@
-struct inode;
-struct file;
-struct dentry;
-
-struct file_operations {
-	ssize_t (*read) (struct file *, char  *, size_t, loff_t *);
-	int (*open) (struct inode *, struct file *);
-	int (*release) (struct inode *, struct file *);
-	ssize_t (*write) (struct file *, const char *, size_t, loff_t *);
-};
diff --git a/testcases/kernel/mce-test/tsrc/kinclude/linux/init.h b/testcases/kernel/mce-test/tsrc/kinclude/linux/init.h
deleted file mode 100644
index 77cd3ac..0000000
--- a/testcases/kernel/mce-test/tsrc/kinclude/linux/init.h
+++ /dev/null
@@ -1,5 +0,0 @@
-
-#define __init
-#define __user
-
-#define late_initcall(x) typeof(x) x __attribute__((used))
diff --git a/testcases/kernel/mce-test/tsrc/kinclude/linux/percpu.h b/testcases/kernel/mce-test/tsrc/kinclude/linux/percpu.h
deleted file mode 100644
index 55b111a..0000000
--- a/testcases/kernel/mce-test/tsrc/kinclude/linux/percpu.h
+++ /dev/null
@@ -1,9 +0,0 @@
-
-#define DECLARE_PER_CPU(x,y)
-#define BITS_PER_LONG (sizeof(long)*8)
-#define DECLARE_BITMAP(x,y) unsigned long x[((y) + BITS_PER_LONG - 1) / BITS_PER_LONG];
-#define MAX_NR_BANKS 32
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
-
-struct cpuinfo_x86;
-
diff --git a/testcases/kernel/mce-test/tsrc/kinclude/linux/seq_file.h b/testcases/kernel/mce-test/tsrc/kinclude/linux/seq_file.h
deleted file mode 100644
index 9b0c9f3..0000000
--- a/testcases/kernel/mce-test/tsrc/kinclude/linux/seq_file.h
+++ /dev/null
@@ -1,22 +0,0 @@
-
-#include <linux/fs.h>
-
-struct file;
-
-struct seq_file {
-};
-
-struct seq_operations {
-	void * (*start) (struct seq_file *m, loff_t *pos);
-	void (*stop) (struct seq_file *m, void *v);
-	void * (*next) (struct seq_file *m, void *v, loff_t *pos);
-	int (*show) (struct seq_file *m, void *v);
-};
-
-#define seq_printf(a, b, c...) printf(b , ## c)
-static inline int seq_open(struct file *f, const struct seq_operations *o) { return -1; }
-
-static inline ssize_t seq_read(struct file *a, char  *b, size_t c, loff_t *d) { return 0; }
-static inline ssize_t seq_write(struct file *a, const char  *b, size_t c, loff_t *d) { return 0; }
-static inline int seq_release(struct inode *a, struct file *b) { return 0; }
-
diff --git a/testcases/kernel/mce-test/tsrc/kinclude/linux/sysdev.h b/testcases/kernel/mce-test/tsrc/kinclude/linux/sysdev.h
deleted file mode 100644
index a6d1cd8..0000000
--- a/testcases/kernel/mce-test/tsrc/kinclude/linux/sysdev.h
+++ /dev/null
@@ -1,2 +0,0 @@
-
-struct sysdev_attribute {};
diff --git a/testcases/kernel/mce-test/tsrc/random_offline b/testcases/kernel/mce-test/tsrc/random_offline
deleted file mode 100644
index c380a86..0000000
--- a/testcases/kernel/mce-test/tsrc/random_offline
+++ /dev/null
@@ -1,156 +0,0 @@
-#!/bin/bash
-# randomly soft offline pages
-# random_offline options
-# -t seconds   runtime in seconds (default unlimited)
-# -m max-pages maximum pages to tie up before unpoisoning
-# -s seed      random seed
-# Note: running this for too long may still run out of memory
-# because unpoison cannot completely undo what soft offline
-# does to larger free memory areas (TBD in the kernel)
-# Author: Andi Kleen
-
-# fixme: uses time seed, non reproducible
-
-#mount -t debugfs none /debug
-
-THRESH=1000
-SEED=""
-RUNTIME=""
-DEBUG=/sys/kernel/debug
-
-fail() { 
-	echo "ERROR: $@"
-	exit 0
-}
-
-usage() { 
-	echo "Usage:"
-	echo "random_offline options"
-	echo -- "-t seconds   runtime in seconds (default unlimited)"
-	echo -- "-m max-pages maximum pages to tie up before unpoisoning"
-	echo -- "-s seed      random seed"
-	fail "Invalid option $1"
-}
-
-while getopts "t:m:s:" option ; do
-	case "$option" in 
-	t) RUNTIME=$OPTARG ;;
-	m) THRESH=$OPTARG ;;
-	s) SEED=$OPTARG ;;
-	*) usage $option ;;
-	esac
-done
-
-[ "$(whoami)" != root ] && fail "Not root"
-[ ! -d $DEBUG/hwpoison ] && mount -t debugfs none $DEBUG
-[ ! -d $DEBUG/hwpoison ] && fail "No debugfs"
-[ ! -w /sys/devices/system/memory/soft_offline_page ] && fail "No soft offlining support in kernel"
-[ ! -w $DEBUG/hwpoison/unpoison-pfn ] && fail "no unpoison support in kernel"
-
-end_of_memory() {
-	for i in /sys/firmware/memmap/* ; do
-		case "$(< $i/type)" in
-		"System RAM") ;;
-		*) continue ;;
-		esac	
-	
-		k=$(< $i/end)
-		k=${k/0x/}
-		k=$(echo $k | tr a-z A-Z)
-
-		echo "ibase=16; $k/1000" | bc
-	done | sort -n | tail -n1
-}
-
-E=$(end_of_memory)
-
-echo "soft offlining pages upto $E" 
-
-unpoison() { 
-	if [ ! -f offlined ] ; then
-		return
-	fi
-	
-	echo unpoisioning
-	while read i ; do 
-		#echo -n ,
-		#echo "u $i"
-		(( utotal++ ))
-	 	if ! echo $i | sed 's/000$//' > $DEBUG/hwpoison/unpoison-pfn ; then
-			echo "$i $?" >> unpoison-failed
-			echo "unpoisioning $i failed: $?"
-		else
-			(( usuccess++ ))
-		fi
-	done < offlined
-	echo done
-	echo
-}
-
-trap unpoison 0
-
-if [ "$SEED" = "" ] ; then
-	SEED=$(date +%s)
-fi
-RANDOM=$SEED
-echo "Using random seed $SEED"
-
-start=$(date +%s)
-failed=0
-ufailed=0
-success=0
-usuccess=0
-total=0
-utotal=0
-
-cbefore=$(grep HardwareCorrupted /proc/meminfo)
-
-
-(( k = 0 ))
-rm -f offlined unpoison-failed
-while true ; do 
-	T=$( 
-	R=$RANDOM
-	X=$(echo "obase=16; ($R%$E)*4096"  | bc)
-	echo 0x$X
-	) 
-	#echo "p $T" 
-	(( total++ )) 
-	if echo 2>/dev/null $T >/sys/devices/system/memory/soft_offline_page ; then
-		echo $T >> offlined
-		(( success++ )) 
-	else
-		#echo offlining $T failed $?
-		(( failed++ ))
-		true
-	fi
-	#echo -n . 
-
-	(( k++ )) 
-	if [ $k -gt $THRESH ] ; then
-		unpoison
-		(( k = 0 ))
-		rm offlined
-	fi
-
-	if [ ! -z "$RUNTIME" ] ; then
-		((DIFF = $(date +%s) - $start))
-		if [ $DIFF -gt "$RUNTIME" ] ; then
-			echo time over
-			trap 0
-			break
-		fi
-	fi
-done	
-
-if [ -f unpoison-failed ] ; then
-	ufailed=$(wc -l unpoison-failed | awk ' {print $1}')
-fi
-echo "soft-poison: success $success failed $failed of total $total"
-echo "unpoison-failed: success $usuccess failed $ufailed of total $utotal"
-echo "poisoned before: $cbefore"
-echo -n "poisoned after: "
-grep HardwareCorrupted /proc/meminfo
-
-### xxx automatic success/failure criteria?
-
diff --git a/testcases/kernel/mce-test/tsrc/run-huge-test.sh b/testcases/kernel/mce-test/tsrc/run-huge-test.sh
deleted file mode 100644
index 2b679d4..0000000
--- a/testcases/kernel/mce-test/tsrc/run-huge-test.sh
+++ /dev/null
@@ -1,168 +0,0 @@
-#!/bin/bash
-#
-# Test program for memory error handling for hugepages
-# Usage: ./run-huge-test.sh hugetlbfs_directory
-# Author: Naoya Horiguchi
-
-usage()
-{
-    echo "Usage: ./run-huge-test.sh hugetlbfs_directory" && exit 1
-}
-
-htdir=$1
-[ $# -ne 1 ] && usage
-[ ! -d $htdir ] && usage
-
-rm -rf $htdir/test*
-echo 1000 > /proc/sys/vm/nr_hugepages
-
-num=0
-
-exec_testcase() {
-    error=0
-    echo "TestCase $@"
-    hpage_size=$1
-    hpage_target=$2
-    num=$7
-
-    if [ "$3" = "head" ] ; then
-	hpage_target_offset=0
-    elif [ "$3" = "tail" ] ; then
-	hpage_target_offset=1
-    else
-	error=1
-    fi
-    hpage_target=$((hpage_target * 512 + hpage_target_offset))
-
-    if [ "$4" = "early" ] ; then
-	process_type="-e"
-    elif [ "$4" = "late_touch" ] ; then
-	process_type=""
-    elif [ "$4" = "late_avoid" ] ; then
-	process_type="-a"
-    else
-	error=1
-    fi
-
-    if [ "$5" = "anonymous" ] ; then
-	file_type="-A"
-    elif [ "$5" = "file" ] ; then
-	file_type="-f $num"
-    elif [ "$5" = "shm" ] ; then
-	file_type="-S"
-    else
-	error=1
-    fi
-
-    if [ "$6" = "fork_shared" ] ; then
-	share_type="-F"
-    elif [ "$6" = "fork_private_nocow" ] ; then
-	share_type="-Fp"
-    elif [ "$6" = "fork_private_cow" ] ; then
-	share_type="-Fpc"
-    else
-	error=1
-    fi
-
-    command="./thugetlb -x -m $hpage_size -o $hpage_target $process_type $file_type $share_type $htdir &"
-    echo $command
-    eval $command
-    wait $!
-    echo ""
-
-    return 0
-}
-
-num=$((num+1))
-exec_testcase 2 1 "head" "early" "file" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "early" "file" "fork_private_nocow" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "early" "file" "fork_private_cow" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "early" "shm" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "early" "anonymous" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "early" "anonymous" "fork_private_nocow" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "early" "anonymous" "fork_private_cow" $num
-
-num=$((num+1))
-exec_testcase 2 1 "head" "late_touch" "file" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "late_touch" "file" "fork_private_nocow" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "late_touch" "file" "fork_private_cow" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "late_touch" "shm" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "late_touch" "anonymous" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "late_touch" "anonymous" "fork_private_nocow" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "late_touch" "anonymous" "fork_private_cow" $num
-
-num=$((num+1))
-exec_testcase 2 1 "head" "late_avoid" "file" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "late_avoid" "file" "fork_private_nocow" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "late_avoid" "file" "fork_private_cow" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "late_avoid" "shm" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "late_avoid" "anonymous" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "late_avoid" "anonymous" "fork_private_nocow" $num
-num=$((num+1))
-exec_testcase 2 1 "head" "late_avoid" "anonymous" "fork_private_cow" $num
-
-num=$((num+1))
-exec_testcase 2 1 "tail" "early" "file" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "early" "file" "fork_private_nocow" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "early" "file" "fork_private_cow" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "early" "shm" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "early" "anonymous" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "early" "anonymous" "fork_private_nocow" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "early" "anonymous" "fork_private_cow" $num
-
-num=$((num+1))
-exec_testcase 2 1 "tail" "late_touch" "file" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "late_touch" "file" "fork_private_nocow" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "late_touch" "file" "fork_private_cow" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "late_touch" "shm" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "late_touch" "anonymous" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "late_touch" "anonymous" "fork_private_nocow" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "late_touch" "anonymous" "fork_private_cow" $num
-
-num=$((num+1))
-exec_testcase 2 1 "tail" "late_avoid" "file" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "late_avoid" "file" "fork_private_nocow" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "late_avoid" "file" "fork_private_cow" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "late_avoid" "shm" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "late_avoid" "anonymous" "fork_shared" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "late_avoid" "anonymous" "fork_private_nocow" $num
-num=$((num+1))
-exec_testcase 2 1 "tail" "late_avoid" "anonymous" "fork_private_cow" $num
-
-# free IPC semaphores used by thugetlb.c
-ipcs -s|grep $USER|cut -f2 -d' '|xargs ipcrm sem 
-
diff --git a/testcases/kernel/mce-test/tsrc/tcases.c b/testcases/kernel/mce-test/tsrc/tcases.c
deleted file mode 100644
index 81be58f..0000000
--- a/testcases/kernel/mce-test/tsrc/tcases.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Verify MCA grading engine against some examples.
- */
-#include <sys/types.h>
-#include <stdio.h>
-#define __KERNEL__ 1
-#include <asm/types.h>
-#include <asm/mce.h>
-#include <errno.h>
-
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof(*(x)))
-
-typedef unsigned long long u64;
-
-#define MCI_STATUS_S	 (1ULL<<56)  /* Signaled machine check */
-#define MCI_STATUS_AR	 (1ULL<<55)  /* Action required */
-
-int mce_ser = 1;
-int tolerant = 1;
-int panic_on_oops = 0;
-
-#include "mce-severity.c"
-
-char *resname[] = {
-#define R(x) [MCE_ ## x ## _SEVERITY] = #x
-	R(NO),
-	R(KEEP),
-	R(SOME),
-	R(AO),
-	R(AR),
-	R(PANIC),
-};
-#define VAL MCI_STATUS_VAL
-#define EN MCI_STATUS_EN
-#define PCC MCI_STATUS_PCC
-#define S MCI_STATUS_S
-#define AR MCI_STATUS_AR
-#define UC MCI_STATUS_UC
-
-int ring = 3;
-int fail;
-
-void test2(u64 flag, char *flagname, u64 mcg, char *mcgname, int result)
-{
-	struct mce m = {
-		.ip = 1,
-		.cs = ring,
-		.status = flag,
-		.mcgstatus = mcg,
-	};
-	int r;
-	char *msg;
-
-	if ((r = mce_severity(&m, tolerant, &msg)) != result) {
-		printf("%s %s expected %s got %s msg %s\n",
-		       flagname, mcgname, resname[result], resname[r], msg);
-		fail++;
-	}
-}
-
-#define TEST(flag, result) \
-	test2(flag, #flag, MCG_STATUS_MCIP|MCG_STATUS_RIPV, "mcip,ripv", \
-		MCE_ ## result ## _SEVERITY)
-
-void test(void)
-{
-	// corrected
-	TEST(VAL|EN, KEEP);
-
-	// uncorrected fatal
-	TEST(VAL|UC|PCC|EN|S|AR, PANIC);
-	TEST(VAL|UC|PCC|EN|S, PANIC);
-	TEST(VAL|UC|PCC|EN, PANIC);
-
-	// SW recoverable action required
-	// unknown mcacod -> panic
-	TEST(VAL|UC|EN|S|AR, PANIC);
-
-	// SW recoverable action optional
-	TEST(VAL|UC|EN|S|0xc0, AO);
-	// unknown mcacod
-	TEST(VAL|UC|EN|S|1, SOME);
-
-	// UCNA
-	TEST(VAL|UC|EN, KEEP);
-	TEST(VAL|UC, NO);	// linux clears. correct?
-}
-
-int main(void)
-{
-	ring = 3;
-	test();
-	ring = 0;
-	test();
-	if (fail == 0)
-		printf("SUCCESS\n");
-	else
-		printf("%d FAILURES\n", fail);
-	return fail;
-}
\ No newline at end of file
diff --git a/testcases/kernel/mce-test/tsrc/thugetlb.c b/testcases/kernel/mce-test/tsrc/thugetlb.c
deleted file mode 100644
index 17d08c8..0000000
--- a/testcases/kernel/mce-test/tsrc/thugetlb.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/*
- * Test program for memory error handling for hugepages
- * Author: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
- */
-#define _GNU_SOURCE 1
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <signal.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <sys/mman.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/sem.h>
-#include <sys/types.h>
-#include <sys/prctl.h>
-#include <sys/wait.h>
-#include "hugepage.h"
-
-#define FILE_BASE  "test"
-
-#define HPAGE_SIZE (2UL*1024*1024)
-#define BUF_SIZE   256
-#define PROTECTION (PROT_READ | PROT_WRITE)
-
-#ifndef SHM_HUGETLB
-#define SHM_HUGETLB 04000
-#endif
-
-/* Control early_kill/late_kill */
-#define PR_MCE_KILL 33
-#define PR_MCE_KILL_CLEAR   0
-#define PR_MCE_KILL_SET     1
-#define PR_MCE_KILL_LATE    0
-#define PR_MCE_KILL_EARLY   1
-#define PR_MCE_KILL_DEFAULT 2
-#define PR_MCE_KILL_GET 34
-
-#define MADV_HWPOISON		100
-#define MADV_SOFT_OFFLINE	101
-
-int PS; /* Page size */
-int file_size; /* Memory allocation size (hugepage unit) */
-/* Error injection position (page offset from the first hugepage head) */
-int corrupt_page;
-char filename[BUF_SIZE] = "/test";
-char filepath[BUF_SIZE];
-
-#define DEB printf("DEBUG [%d:%s:%d]\n", getpid(), __FILE__, __LINE__);
-
-static void usage(void)
-{
-	printf(
-"./thugetlb [-m memory] [-o offset] [-f file] [-xOeSAaFpch] hugetlbfs_directory\n"
-"            -m|--memory size(hugepage unit)    Size of hugetlbfs file\n"
-"            -o|--offset offset(page unit)      Position of error injection\n"
-"            -x|--inject                        Error injection switch\n"
-"            -O|--offline                       Soft offline switch\n"
-"            -e|--early-kill                    Set PR_MCE_KILL_EARLY\n"
-"            -S|--shm                           Use shmem with SHM_HUGETLB\n"
-"            -A|--anonymous                     Use MAP_ANONYMOUS\n"
-"            -a|--avoid-touch                   Avoid touching error page\n"
-"            -F|--fork\n"
-"            -p|--private\n"
-"            -c|--cow\n"
-"            -f|--filename string\n"
-"            -h|--help\n"
-"\n"
-	);
-}
-
-/*
- * semaphore get/put wrapper
- */
-int get_semaphore(int sem_id, struct sembuf *sembuffer)
-{
-	sembuffer->sem_num = 0;
-	sembuffer->sem_op  = -1;
-	sembuffer->sem_flg = SEM_UNDO;
-	return semop(sem_id, sembuffer, 1);
-}
-
-int put_semaphore(int sem_id, struct sembuf *sembuffer)
-{
-	sembuffer->sem_num = 0;
-	sembuffer->sem_op  = 1;
-	sembuffer->sem_flg = SEM_UNDO;
-	return semop(sem_id, sembuffer, 1);
-}
-
-static struct option opts[] = {
-	{ "memory"          , 1, NULL, 'm' },
-	{ "offset"          , 1, NULL, 'o' },
-	{ "inject"          , 0, NULL, 'x' },
-	{ "offline"         , 0, NULL, 'O' },
-	{ "early_kill"      , 0, NULL, 'e' },
-	{ "shm"             , 0, NULL, 'S' },
-	{ "anonymous"       , 0, NULL, 'A' },
-	{ "avoid-touch"     , 0, NULL, 'a' },
-	{ "fork"            , 0, NULL, 'F' },
-	{ "private"         , 0, NULL, 'p' },
-	{ "cow"             , 0, NULL, 'c' },
-	{ "filename"        , 1, NULL, 'f' },
-	{ "help"            , 0, NULL, 'h' },
-	{ NULL              , 0, NULL,  0  }
-};
-
-int main(int argc, char *argv[])
-{
-	void *addr;
-	int i;
-	int ret;
-	int fd = 0;
-	int semid;
-	int semaphore;
-	int inject = 0;
-	int madvise_code = MADV_HWPOISON;
-	int early_kill = 0;
-	int avoid_touch = 0;
-	int anonflag = 0;
-	int shmflag = 0;
-	int shmkey = 0;
-	int forkflag = 0;
-	int privateflag = 0;
-	int cowflag = 0;
-	char c;
-	pid_t pid = 0;
-	void *expected_addr = NULL;
-	struct sembuf sembuffer;
-
-	PS = getpagesize();
-	HPS = HPAGE_SIZE;
-	file_size = 1;
-	corrupt_page = -1;
-
-	if (argc == 1) {
-		usage();
-		exit(EXIT_FAILURE);
-	}
-
-	while ((c = getopt_long(argc, argv,
-				"m:o:xOeSAaFpcf:h", opts, NULL)) != -1) {
-		switch (c) {
-		case 'm':
-			file_size = strtol(optarg, NULL, 10);
-			break;
-		case 'o':
-			corrupt_page = strtol(optarg, NULL, 10);
-			break;
-		case 'x':
-			inject = 1;
-			break;
-		case 'O':
-			madvise_code = MADV_SOFT_OFFLINE;
-			break;
-		case 'e':
-			early_kill = 1;
-			break;
-		case 'S':
-			shmflag = 1;
-			break;
-		case 'A':
-			anonflag = 1;
-			break;
-		case 'a':
-			avoid_touch = 1;
-			break;
-		case 'F':
-			forkflag = 1;
-			break;
-		case 'p':
-			privateflag = 1;
-			break;
-		case 'c':
-			cowflag = 1;
-			break;
-		case 'f':
-			strcat(filename, optarg);
-			shmkey = strtol(optarg, NULL, 10);
-			break;
-		case 'h':
-			usage();
-			exit(EXIT_SUCCESS);
-		default:
-			usage();
-			exit(EXIT_FAILURE);
-		}
-	}
-
-	if (inject && corrupt_page * PS > file_size * HPAGE_SIZE)
-		errmsg("Target page is out of range.\n");
-
-	if (avoid_touch && corrupt_page == -1)
-		errmsg("Avoid which page?\n");
-
-	/* Construct file name */
-	if (access(argv[argc - 1], F_OK) == -1) {
-		usage();
-		exit(EXIT_FAILURE);
-	} else {
-		strcpy(filepath, argv[argc - 1]);
-		strcat(filepath, filename);
-	}
-
-	if (shmflag) {
-		addr = alloc_shm_hugepage(&shmkey, file_size * HPAGE_SIZE);
-		if (!addr)
-			errmsg("Failed in alloc_shm_hugepage()");
-	} else if (anonflag) {
-		addr = alloc_anonymous_hugepage(file_size * HPAGE_SIZE,
-						privateflag);
-		if (!addr)
-			errmsg("Failed in alloc_anonymous_hugepage()");
-	} else {
-		addr = alloc_filebacked_hugepage(filepath,
-						 file_size * HPAGE_SIZE,
-						 privateflag, &fd);
-		if (!addr)
-			errmsg("Failed in alloc_filebacked_hugepage()");
-	}
-
-	if (corrupt_page != -1 && avoid_touch)
-		expected_addr = (void *)(addr + corrupt_page / 512 * HPAGE_SIZE);
-
-	if (forkflag) {
-		semid = semget(IPC_PRIVATE, 1, 0666|IPC_CREAT);
-		if (semid == -1) {
-			perror("semget");
-			goto cleanout;
-		}
-		semaphore = semctl(semid, 0, SETVAL, 1);
-		if (semaphore == -1) {
-			perror("semctl");
-			goto cleanout;
-		}
-		if (get_semaphore(semid, &sembuffer)) {
-			perror("get_semaphore");
-			goto cleanout;
-		}
-	}
-
-	write_hugepage(addr, file_size, 0);
-	read_hugepage(addr, file_size, 0);
-
-	if (early_kill)
-		prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY,
-		      NULL, NULL);
-
-	/*
-	 * Intended order:
-	 *   1. Child COWs
-	 *   2. Parent madvise()s
-	 *   3. Child exit()s
-	 */
-	if (forkflag) {
-		pid = fork();
-		if (!pid) {
-			/* Semaphore is already held */
-			if (cowflag) {
-				write_hugepage(addr, 0, expected_addr);
-				read_hugepage(addr, 0, expected_addr);
-			}
-			if (put_semaphore(semid, &sembuffer))
-				err("put_semaphore");
-			usleep(1000);
-			/* Wait for madvise() to be done */
-			if (get_semaphore(semid, &sembuffer))
-				err("put_semaphore");
-			if (put_semaphore(semid, &sembuffer))
-				err("put_semaphore");
-			return 0;
-		}
-	}
-
-	/* Wait for COW */
-	if (forkflag && get_semaphore(semid, &sembuffer)) {
-		perror("get_semaphore");
-		goto cleanout;
-	}
-
-	if (inject && corrupt_page != -1) {
-		ret = madvise(addr + corrupt_page * PS, PS, madvise_code);
-		if (ret) {
-			printf("madivise return %d :", ret);
-			perror("madvise");
-			goto cleanout;
-		}
-	}
-
-	if (forkflag && put_semaphore(semid, &sembuffer)) {
-		perror("put_semaphore");
-		goto cleanout;
-	}
-
-	if (madvise_code != MADV_SOFT_OFFLINE);
-		write_hugepage(addr, file_size, expected_addr);
-	read_hugepage(addr, file_size, expected_addr);
-
-	if (forkflag) {
-		if (wait(&i) == -1)
-			err("wait");
-		if (semctl(semid, 0, IPC_RMID) == -1)
-			err("semctl(IPC_RMID)");
-	}
-cleanout:
-	if (shmflag) {
-		if (free_shm_hugepage(shmkey, addr) == -1)
-			exit(2);
-	} else if (anonflag) {
-		if (free_anonymous_hugepage(addr, file_size * HPAGE_SIZE) == -1)
-			exit(2);
-	} else {
-		if (free_filebacked_hugepage(addr, file_size * HPAGE_SIZE,
-					     fd, filepath) == -1)
-			exit(2);
-	}
-
-	return 0;
-}
diff --git a/testcases/kernel/mce-test/tsrc/tinjpage.c b/testcases/kernel/mce-test/tsrc/tinjpage.c
deleted file mode 100644
index f6d6a0f..0000000
--- a/testcases/kernel/mce-test/tsrc/tinjpage.c
+++ /dev/null
@@ -1,969 +0,0 @@
-/*
- * Test program for Linux poison memory error recovery.
- * This injects poison into various mapping cases and triggers the poison
- * handling.  Requires special injection support in the kernel.
- *
- * Copyright 2009, 2010 Intel Corporation
- *
- * tinjpage is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; version
- * 2.
- *
- * tinjpage 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 find a copy of v2 of the GNU General Public License somewhere
- * on your Linux system; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Authors: Andi Kleen, Fengguang Wu
- */
-#define _GNU_SOURCE 1
-#include <stdio.h>
-#include <signal.h>
-#include <unistd.h>
-#include <sys/fcntl.h>
-#include <sys/wait.h>
-#include <sys/mman.h>
-#include <stdlib.h>
-#include <setjmp.h>
-#include <errno.h>
-#include <string.h>
-#include <time.h>
-#include <pthread.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/sem.h>
-#include "utils.h"
-#include "hugepage.h"
-
-#define MADV_POISON 100
-
-#define TMPDIR "./"
-#define PATHBUFLEN 100
-
-#define Perror(x) failure++, perror(x)
-#define PAIR(x) x, sizeof(x)-1
-#define mb() asm volatile("" ::: "memory")
-#if defined(__i386__) || defined(__x86_64__)
-#define cpu_relax() asm volatile("rep ; nop" ::: "memory")
-#else
-#define cpu_relax() mb()
-#endif
-
-typedef unsigned long long u64;
-
-int PS;
-int failure;
-int unexpected;
-int early_kill;
-int test_hugepage;
-
-void *checked_mmap(void *start, size_t length, int prot, int flags,
-                   int fd, off_t offset)
-{
-	void *map = mmap(start, length, prot, flags, fd, offset);
-	if (map == (void*)-1L)
-		err("mmap");
-	return map;
-}
-
-void munmap_reserve(void *page, int size)
-{
-	if (munmap(page, size) < 0)
-		err("munmap");
-	if (mmap(page, size, PROT_NONE, MAP_PRIVATE|MAP_FIXED, 0, 0) < 0)
-		err("mmap2");
-}
-
-void *xmalloc(size_t s)
-{
-	void *p = malloc(s);
-	if (!p)
-		exit(ENOMEM);
-	return p;
-}
-
-static int ilog2(int n)
-{
-	int r = 0;
-	n--;
-	while (n) {
-		n >>= 1;
-		r++;
-	}
-	return r;
-}
-
-int recovercount;
-sigjmp_buf recover_ctx;
-sigjmp_buf early_recover_ctx;
-void *expected_addr;
-
-/* Work around glibc not defining this yet */
-struct my_siginfo {
-	int si_signo;
-	int si_errno;
-	int si_code;
-	union {
-	struct {
-		void  *_addr; /* faulting insn/memory ref. */
-#ifdef __ARCH_SI_TRAPNO
-		int _trapno;	/* TRAP # which caused the signal */
-#endif
-		short _addr_lsb; /* LSB of the reported address */
-	} _sigfault;
-	} _sifields;
-};
-#undef si_addr_lsb
-#define si_addr_lsb _sifields._sigfault._addr_lsb
-
-void sighandler(int sig, siginfo_t *si, void *arg)
-{
-	if (si->si_addr != expected_addr) {
-		printf("XXX: Unexpected address in signal %p (expected %p)\n", si->si_addr,
-			expected_addr);
-		failure++;
-	}
-
-	int lsb = ((struct my_siginfo *)si)->si_addr_lsb;
-	if (test_hugepage) {
-		if (lsb != ilog2(HPS)) {
-			printf("LATER: Unexpected addr lsb in siginfo %d\n", lsb);
-		}
-	} else {
-		if (lsb != ilog2(sysconf(_SC_PAGE_SIZE))) {
-			printf("LATER: Unexpected addr lsb in siginfo %d\n", lsb);
-		}
-	}
-
-	printf("\tsignal %d code %d addr %p\n", sig, si->si_code, si->si_addr);
-
-	if (--recovercount == 0) {
-		write(1, PAIR("I seem to be in a signal loop. bailing out.\n"));
-		exit(1);
-	}
-
-	if (si->si_code == 4)
-		siglongjmp(recover_ctx, 1);
-	else
-		siglongjmp(early_recover_ctx, 1);
-}
-
-enum rmode {
-	MREAD = 0,
-	MWRITE = 1,
-	MREAD_OK = 2,
-	MWRITE_OK = 3,
-	MNOTHING = -1,
-};
-
-void inject_madvise(char *page)
-{
-	if (madvise(page, PS, MADV_POISON) != 0) {
-		if (errno == EINVAL) {
-			printf("Kernel doesn't support poison injection\n");
-			exit(0);
-		}
-		Perror("madvise");
-	}
-}
-
-u64 page_to_pfn(char *page)
-{
-	static int pagemap_fd = -1;
-	u64 pfn;
-
-	if (pagemap_fd < 0)  {
-		pagemap_fd = open("/proc/self/pagemap", O_RDONLY);
-		if (pagemap_fd < 0)
-			err("/proc/self/pagemap not supported");
-	}
-
-	if (pread(pagemap_fd, &pfn, sizeof(u64),
-		((u64)page / PS)*sizeof(u64)) != sizeof(u64))
-		err("Cannot read from pagemap");
-
-	pfn &= (1ULL<<56)-1;
-	return pfn;
-}
-
-/*
- * Inject Action Optional #MC
- * with mce-inject using the software injector.
- *
- * This tests the low level machine check handler too.
- *
- * Slightly racy with page migration because we don't mlock the page.
- */
-void inject_mce_inject(char *page)
-{
-	u64 pfn = page_to_pfn(page);
-	FILE *mce_inject;
-
-	mce_inject = popen("mce-inject", "w");
-	if (!mce_inject) {
-		fprintf(stderr, "Cannot open pipe to mce-inject: %s\n",
-				strerror(errno));
-		exit(1);
-	}
-
-	fprintf(mce_inject,
-		"CPU 0 BANK 3 STATUS UNCORRECTED SRAO 0xc0\n"
-		"MCGSTATUS RIPV MCIP\n"
-		"ADDR %#llx\n"
-		"MISC 0x8c\n"
-		"RIP 0x73:0x1eadbabe\n", pfn);
-
-	if (ferror(mce_inject) || fclose(mce_inject) < 0) {
-		fprintf(stderr, "mce-inject failed: %s\n", strerror(errno));
-		exit(1);
-	}
-}
-
-void (*inject)(char *page) = inject_madvise;
-
-void poison(char *msg, char *page, enum rmode mode)
-{
-	expected_addr = page;
-	recovercount = 5;
-
-	if (sigsetjmp(early_recover_ctx, 1) == 0) {
-		inject(page);
-
-		if (early_kill && (mode == MWRITE || mode == MREAD)) {
-			printf("XXX: %s: process is not early killed\n", msg);
-			failure++;
-		}
-
-		return;
-	}
-
-	if (early_kill) {
-		if (mode == MREAD_OK || mode == MWRITE_OK) {
-			printf("XXX: %s: killed\n", msg);
-			failure++;
-		} else
-			printf("\trecovered\n");
-	}
-}
-
-void recover(char *msg, char *page, enum rmode mode)
-{
-	expected_addr = page;
-	recovercount = 5;
-
-	if (sigsetjmp(recover_ctx, 1) == 0) {
-		switch (mode) {
-		case MWRITE:
-			printf("\twriting 2\n");
-			*page = 2;
-			break;
-		case MWRITE_OK:
-			printf("\twriting 4\n");
-			*page = 4;
-			return;
-		case MREAD:
-			printf("\treading %x\n", *(unsigned char *)page);
-			break;
-		case MREAD_OK:
-			printf("\treading %x\n", *(unsigned char *)page);
-			return;
-		case MNOTHING:
-			return;
-		}
-		/* signal or kill should have happened */
-		printf("XXX: %s: page not poisoned after injection\n", msg);
-		failure++;
-		return;
-	}
-	if (mode == MREAD_OK || mode == MWRITE_OK) {
-		printf("XXX: %s: killed\n", msg);
-		failure++;
-	} else
-		printf("\trecovered\n");
-}
-
-void testmem(char *msg, char *page, enum rmode mode)
-{
-	printf("\t%s poisoning page %p\n", msg, page);
-	poison(msg, page, mode);
-	recover(msg, page, mode);
-}
-
-void expecterr(char *msg, int err)
-{
-	if (err) {
-		printf("\texpected error %d on %s\n", errno, msg);
-	} else {
-		failure++;
-		printf("XXX: unexpected no error on %s\n", msg);
-	}
-}
-
-/*
- * Any optional error is really a deficiency in the kernel VFS error reporting
- * and should be eventually fixed and turned into a expecterr
- */
-void optionalerr(char *msg, int err)
-{
-	if (err) {
-		printf("\texpected optional error %d on %s\n", errno, msg);
-	} else {
-		unexpected++;
-		printf("LATER: expected likely incorrect no error on %s\n", msg);
-	}
-}
-
-static int tmpcount;
-int tempfd(void)
-{
-	int fd;
-	char buf[PATHBUFLEN];
-	snprintf(buf, sizeof buf, TMPDIR "~poison%d",tmpcount++);
-	fd = open(buf, O_CREAT|O_RDWR, 0600);
-	if (fd >= 0)
-		unlink(buf);
-	if (fd < 0)
-		err("opening temporary file in " TMPDIR);
-	return fd;
-}
-
-int playfile(char *buf)
-{
-	int fd;
-	if (buf[0] == 0)
-		snprintf(buf, PATHBUFLEN, TMPDIR "~poison%d", tmpcount++);
-	fd = open(buf, O_CREAT|O_RDWR|O_TRUNC, 0600);
-	if (fd < 0)
-		err("opening temporary file in " TMPDIR);
-
-	const int NPAGES = 5;
-	char *tmp = xmalloc(PS * NPAGES);
-	int i;
-	for (i = 0; i < PS*NPAGES; i++)
-		tmp[i] = i;
-	write(fd, tmp, PS*NPAGES);
-
-	lseek(fd, 0, SEEK_SET);
-	return fd;
-}
-
-static void dirty_anonymous(void)
-{
-	char *page;
-	page = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_POPULATE, 0, 0);
-	testmem("dirty", page, MWRITE);
-}
-
-static void dirty_anonymous_unmap(void)
-{
-	char *page;
-	page = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_POPULATE, 0, 0);
-	testmem("dirty", page, MWRITE);
-	munmap_reserve(page, PS);
-}
-
-static void mlocked_anonymous(void)
-{
-	char *page;
-	page = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_LOCKED, 0, 0);
-	testmem("mlocked", page, MWRITE);
-}
-
-static void do_file_clean(int flags, char *name)
-{
-	char *page;
-	char fn[30];
-	snprintf(fn, 30, TMPDIR "~test%d", tmpcount++);
-	int fd = open(fn, O_RDWR|O_TRUNC|O_CREAT);
-	if (fd < 0)
-		err("open temp file");
-	write(fd, fn, 4);
-	page = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_SHARED|flags,
-		fd, 0);
-	fsync(fd);
-	close(fd);
-	testmem(name, page, MREAD_OK);
-	 /* reread page from disk */
-	printf("\t reading %x\n", *(unsigned char *)page);
-	testmem(name, page, MWRITE_OK);
-}
-
-static void file_clean(void)
-{
-	do_file_clean(0, "file clean");
-}
-
-static void file_clean_mlocked(void)
-{
-	do_file_clean(MAP_LOCKED, "file clean mlocked");
-}
-
-static char *ndesc(char *buf, char *name, char *add)
-{
-	snprintf(buf, 100, "%s %s", name, add);
-	return buf;
-}
-
-static void do_file_dirty(int flags, char *name)
-{
-	char nbuf[100];
-	char *page;
-	char fn[PATHBUFLEN];
-	fn[0] = 0;
-	int fd = playfile(fn);
-
-	page = checked_mmap(NULL, PS, PROT_READ,
-			MAP_SHARED|MAP_POPULATE|flags, fd, 0);
-	testmem(ndesc(nbuf, name, "initial"), page, MREAD);
-	expecterr("msync expect error", msync(page, PS, MS_SYNC) < 0);
-	close(fd);
-	munmap_reserve(page, PS);
-
-	fd = open(fn, O_RDONLY);
-	if (fd < 0) err("reopening temp file");
-	page = checked_mmap(NULL, PS, PROT_READ, MAP_SHARED|MAP_POPULATE|flags,
-				fd, 0);
-	recover(ndesc(nbuf, name, "populated"), page, MREAD_OK);
-	close(fd);
-	munmap_reserve(page, PS);
-
-	fd = open(fn, O_RDONLY);
-	if (fd < 0) err("reopening temp file");
-	page = checked_mmap(NULL, PS, PROT_READ, MAP_SHARED|flags, fd, 0);
-	recover(ndesc(nbuf, name, "fault"), page, MREAD_OK);
-	close(fd);
-	munmap_reserve(page, PS);
-
-	fd = open(fn, O_RDWR);
-	char buf[128];
-	/* the earlier close has eaten the error */
-	optionalerr("explicit read after poison", read(fd, buf, sizeof buf) < 0);
-	optionalerr("explicit write after poison", write(fd, "foobar", 6) < 0);
-	optionalerr("fsync expect error", fsync(fd) < 0);
-	close(fd);
-
-	/* should unlink return an error here? */
-	if (unlink(fn) < 0)
-		perror("unlink");
-}
-
-static void file_dirty(void)
-{
-	do_file_dirty(0, "file dirty");
-}
-
-static void file_dirty_mlocked(void)
-{
-	do_file_dirty(MAP_LOCKED, "file dirty mlocked");
-}
-
-/* TBD */
-static void file_hole(void)
-{
-	int fd = tempfd();
-	char *page;
-
-	ftruncate(fd, PS);
-	page = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
-	*page = 1;
-	testmem("hole file dirty", page, MREAD);
-	/* hole error reporting doesn't work in kernel currently, so optional */
-	optionalerr("hole fsync expect error", fsync(fd) < 0);
-	optionalerr("hole msync expect error", msync(page, PS, MS_SYNC) < 0);
-	close(fd);
-}
-
-static void nonlinear(void)
-{
-	int fd;
-	const int NPAGES = 10;
-	int i;
-	char *page;
-	char *tmp;
-
-	fd = tempfd();
-	tmp = xmalloc(PS);
-	for (i = 0; i < NPAGES; i++)  {
-		memset(tmp, i, PS);
-		write(fd, tmp, PS);
-	}
-	free(tmp);
-	page = checked_mmap(NULL, PS*NPAGES, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
-	int k = NPAGES - 1;
-	for (i = 0; i < NPAGES; i++, k--) {
-		if (remap_file_pages(page + i*PS, PS, 0, k, 0))
-			perror("remap_file_pages");
-	}
-	*page = 1;
-	testmem("rfp file dirty", page, MREAD);
-	expecterr("rfp fsync expect error", fsync(fd) < 0);
-	optionalerr("rfp msync expect error", msync(page, PS, MS_SYNC) < 0);
-	close(fd);
-}
-
-/*
- * These tests are currently too racy to be enabled.
- */
-
-/*
- * This is quite timing dependent. The sniper might hit the page
- * before it is dirtied. If that happens tweak the delay
- * (should auto tune)
- */
-enum {
-	DELAY_NS = 30,
-};
-
-volatile enum sstate { START, WAITING, SNIPE } sstate;
-
-void waitfor(enum sstate w, enum sstate s)
-{
-	sstate = w;
-	mb();
-	while (sstate != s)
-		cpu_relax();
-}
-
-struct poison_arg {
-	char *msg;
-	char *page;
-	enum rmode mode;
-};
-
-void *sniper(void *p)
-{
-	struct poison_arg *arg = p;
-
-	waitfor(START, WAITING);
-	nanosleep(&((struct timespec) { .tv_nsec = DELAY_NS }), NULL);
-	poison(arg->msg, arg->page, arg->mode);
-	return NULL;
-}
-
-int setup_sniper(struct poison_arg *arg)
-{
-	if (sysconf(_SC_NPROCESSORS_ONLN) < 2)  {
-		printf("%s: Need at least two CPUs. Not tested\n", arg->msg);
-		return -1;
-	}
-	sstate = START;
-	mb();
-	pthread_t thr;
-	if (pthread_create(&thr, NULL, sniper, arg) < 0)
-		err("pthread_create");
-	pthread_detach(thr);
-	return 0;
-}
-
-static void under_io_dirty(void)
-{
-	struct poison_arg arg;
-	int fd = tempfd();
-	char *page;
-
-	page = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE, fd, 0);
-
-	arg.page = page;
-	arg.msg  = "under io dirty";
-	arg.mode = MWRITE;
-	if (setup_sniper(&arg) < 0)
-		return;
-
-	write(fd, "xyz", 3);
-	waitfor(WAITING, WAITING);
-	expecterr("write under io", fsync(fd) < 0);
-	close(fd);
-}
-
-static void under_io_clean(void)
-{
-	struct poison_arg arg;
-	char fn[PATHBUFLEN];
-	int fd;
-	char *page;
-	char buf[10];
-
- 	fd = playfile(fn);
-	page = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE, fd, 0);
-	madvise(page, PS, MADV_DONTNEED);
-
-	arg.page = page;
-	arg.msg  = "under io clean";
-	arg.mode = MREAD_OK;
-	if (setup_sniper(&arg) < 0)
-		return;
-
-	waitfor(WAITING, WAITING);
-	// what is correct here?
-	if (pread(fd, buf, 10, 0) != 0)
-		perror("pread under io clean");
-	close(fd);
-}
-
-/*
- * semaphore get/put wrapper
- */
-int get_semaphore(int sem_id, struct sembuf *sembuffer)
-{
-	sembuffer->sem_num = 0;
-	sembuffer->sem_op  = -1;
-	sembuffer->sem_flg = SEM_UNDO;
-	return semop(sem_id, sembuffer, 1);
-}
-
-int put_semaphore(int sem_id, struct sembuf *sembuffer)
-{
-	sembuffer->sem_num = 0;
-	sembuffer->sem_op  = 1;
-	sembuffer->sem_flg = SEM_UNDO;
-	return semop(sem_id, sembuffer, 1);
-}
-
-/* memory sharing mode */
-enum shared_mode {
-	MMAP_SHARED = 0,
-	IPV_SHARED  = 1,
-};
-
-/*
- * testcase for shared pages, where
- *  if early_kill == 0, parent access the shared page hwpoisoned by child, and
- *  if early_kill == 1, parent will be killed by SIGBUS from child.
- * This testcase checks whether if a shared page is hwpoisoned by one process,
- * another process sharing the page will be killed expectedly.
- */
-static void do_shared(int shared_mode)
-{
-	int shm_id = -1, sem_id = -1, semaphore;
-	pid_t pid;
-	char *shared_page = NULL;
-	struct sembuf sembuffer;
-
-	if (shared_mode == MMAP_SHARED) {
-		shared_page = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE,
-				MAP_SHARED|MAP_ANONYMOUS|MAP_POPULATE, 0, 0);
-	} else if (shared_mode == IPV_SHARED) {
-		shm_id = shmget(IPC_PRIVATE, PS, 0666|IPC_CREAT);
-		if (shm_id == -1)
-			err("shmget");
-	} else {
-		printf("XXX: invalid shared_mode\n");
-		return;
-	}
-
-	if (early_kill) {
-		sem_id = semget(IPC_PRIVATE, 1, 0666|IPC_CREAT);
-		if (sem_id == -1) {
-			perror("semget");
-			goto cleanup;
-		}
-		semaphore = semctl(sem_id, 0, SETVAL, 1);
-		if (semaphore == -1) {
-			perror("semctl");
-			goto cleanup;
-		}
-		if (get_semaphore(sem_id, &sembuffer)) {
-			perror("get_semaphore");
-			goto cleanup;
-		}
-	}
-
-	pid = fork();
-	if (pid < 0) {
-		perror("fork");
-		goto cleanup;
-	}
-
-	if (shared_mode == IPV_SHARED) {
-		shared_page = shmat(shm_id, NULL, 0);
-		if (shared_page == (char *)-1) {
-			perror("shmat");
-			goto cleanup;
-		}
-	}
-
-	memset(shared_page, 'a', 3);
-
-	if (early_kill) {
-		struct sigaction sa = {
-			.sa_sigaction = sighandler,
-			.sa_flags = SA_SIGINFO
-		};
-		sigaction(SIGBUS, &sa, NULL);
-		expected_addr = shared_page;
-	}
-
-	if (pid) {
-		siginfo_t sig;
-
-		if (early_kill && sigsetjmp(early_recover_ctx, 1) == 0) {
-			if (put_semaphore(sem_id, &sembuffer))
-				err("get_semaphore");
-			/* waiting for SIGBUS from child */
-			sleep(10);
-			printf("XXX timeout: child process does not send signal\n");
-			failure++;
-			goto cleanup;
-		}
-		waitid(P_PID, pid, &sig, WEXITED);
-
-		/*
-		 * check child termination status
-		 * late kill       : child should exit
-		 * suicide version : child should be killed by signal
-		 * early kill      : child should be killed by signal
-		 */
-		if (!early_kill) {
-			struct sigaction sigact;
-			sigaction(SIGBUS, NULL, &sigact);
-
-			if (sigact.sa_handler == SIG_DFL) {/* suicide version */
-				if (sig.si_code != CLD_KILLED)
-					goto child_error;
-			} else { /* late kill */
-				if (sig.si_code != CLD_EXITED)
-					goto child_error;
-			}
-		} else { /* early kill */
-			if (sig.si_code != CLD_EXITED)
-				goto child_error;
-		}
-
-		if (!early_kill)
-			recover("ipv shared page (parent)",
-				shared_page, MWRITE);
-
-		if (shared_mode == IPV_SHARED && shmdt(shared_page) == -1) {
-			perror("shmdt");
-			goto cleanup;
-		}
-	}
-
-	if (!pid) {
-		failure = 0;
-
-		if (early_kill)
-			if (get_semaphore(sem_id, &sembuffer))
-				err("get_semaphore");
-		testmem("ipv shared page", shared_page, MWRITE);
-
-		if (shared_mode == IPV_SHARED && shmdt(shared_page) == -1)
-			err("shmdt");
-
-		fflush(stdout);
-		_exit(failure);
-	}
-
-cleanup:
-	if (shared_page) {
-		if (shared_mode == IPV_SHARED)
-			shmdt(shared_page);
-		else
-			munmap_reserve(shared_page, PS);
-	}
-	if (shm_id >= 0 && shmctl(shm_id, IPC_RMID, NULL) < 0)
-		err("shmctl IPC_RMID");
-	if (sem_id >= 0 && semctl(sem_id, 0, IPC_RMID) < 0)
-		err("semctl IPC_RMID");
-	return;
-
-child_error:
-	printf("XXX child process was terminated unexpectedly\n");
-	failure++;
-	goto cleanup;
-}
-
-static void mmap_shared(void)
-{
-	do_shared(MMAP_SHARED);
-}
-
-static void ipv_shared(void)
-{
-	do_shared(IPV_SHARED);
-}
-
-static void anonymous_hugepage(void)
-{
-	char *page;
-	/* Hugepage isn't supported. */
-	if (!HPS)
-		return;
-	test_hugepage = 1;
-	page = alloc_anonymous_hugepage(HPS, 1);
-	/* prefault */
-	page[0] = 'a';
-	testmem("anonymous hugepage", page, MWRITE);
-	free_anonymous_hugepage(page, HPS);
-	test_hugepage = 0;
-}
-
-static void file_backed_hugepage(void)
-{
-	char *page;
-	char buf[PATHBUFLEN];
-	int fd;
-	/* Hugepage isn't supported. */
-	if (!HPS)
-		return;
-	test_hugepage = 1;
-	snprintf(buf, PATHBUFLEN, "%s/test%d", hugetlbfsdir, tmpcount++);
-	page = alloc_filebacked_hugepage(buf, HPS, 0, &fd);
-	/* prefault */
-	page[0] = 'a';
-	testmem("file backed hugepage", page, MWRITE);
-	free_filebacked_hugepage(page, HPS, fd, buf);
-	test_hugepage = 0;
-}
-
-static void shm_hugepage(void)
-{
-	char *page;
-	/* Hugepage isn't supported. */
-	if (!HPS)
-		return;
-	test_hugepage = 1;
-	page = alloc_shm_hugepage(&tmpcount, HPS);
-	/* prefault */
-	page[0] = 'a';
-	testmem("shared memory hugepage", page, MWRITE);
-	free_shm_hugepage(tmpcount, page);
-	tmpcount++;
-	test_hugepage = 0;
-}
-
-struct testcase {
-	void (*f)(void);
-	char *name;
-	int survivable;
-} cases[] = {
-	{ dirty_anonymous, "dirty anonymous" },
-	{ dirty_anonymous_unmap, "dirty anonymous unmap" },
-	{ mlocked_anonymous, "mlocked anonymous" },
-	{ file_clean, "file clean", 1 },
-	{ file_dirty, "file dirty" },
-	{ file_hole, "file hole" },
-	{ file_clean_mlocked, "file clean mlocked", 1 },
-	{ file_dirty_mlocked, "file dirty mlocked"},
-	{ nonlinear, "nonlinear" },
-	{ mmap_shared, "mmap shared" },
-	{ ipv_shared, "ipv shared" },
-	{ anonymous_hugepage, "anonymous hugepage" },
-	{ file_backed_hugepage, "file backed hugepage" },
-	{ shm_hugepage, "shared memory hugepage" },
-	{},	/* dummy 1 for sniper */
-	{},	/* dummy 2 for sniper */
-	{}
-};
-
-struct testcase snipercases[] = {
-	{ under_io_dirty, "under io dirty" },
-	{ under_io_clean, "under io clean" },
-};
-
-void usage(void)
-{
-	fprintf(stderr, "Usage: tinjpage [--sniper]\n"
-			"Test hwpoison injection on pages in various states\n"
-			"--mce-inject    Use mce-inject for injection\n"
-			"--sniper  Enable racy sniper tests (likely broken)\n");
-	exit(1);
-}
-
-void handle_opts(char **av)
-{
-	while (*++av) {
-		if (!strcmp(*av, "--sniper")) {
-			struct testcase *t;
-			for (t = cases; t->f; t++)
-				;
-			*t++ = snipercases[0];
-			*t++ = snipercases[1];
-		}
-		else if (!strcmp(*av, "--mce-inject")) {
-			inject = inject_mce_inject;
-		} else
-			usage();
-	}
-}
-
-int main(int ac, char **av)
-{
-	if (av[1])
-		handle_opts(av);
-
-	PS = getpagesize();
-	if (hugetlbfs_root(hugetlbfsdir))
-		HPS = gethugepagesize();
-
-	/* don't kill me at poison time, but possibly at page fault time */
-	early_kill = 0;
-	system("sysctl -w vm.memory_failure_early_kill=0");
-
-	struct sigaction sa = {
-		.sa_sigaction = sighandler,
-		.sa_flags = SA_SIGINFO
-	};
-
-	struct testcase *t;
-	/* catch signals */
-	sigaction(SIGBUS, &sa, NULL);
-	for (t = cases; t->f; t++) {
-		printf("---- testing %s\n", t->name);
-		t->f();
-	}
-
-	/* suicide version */
-	for (t = cases; t->f; t++) {
-		printf("---- testing %s in child\n", t->name);
-		pid_t child = fork();
-		if (child == 0) {
-			signal(SIGBUS, SIG_DFL);
-			t->f();
-			if (t->survivable)
-				_exit(2);
-			write(1, t->name, strlen(t->name));
-			write(1, PAIR(" didn't kill itself?\n"));
-			_exit(1);
-		} else {
-			siginfo_t sig;
-			if (waitid(P_PID, child, &sig, WEXITED) < 0)
-				perror("waitid");
-			else {
-				if (t->survivable) {
-					if (sig.si_code != CLD_EXITED) {
-						printf("XXX: %s: child not survived\n", t->name);
-						failure++;
-					}
-				} else {
-					if (sig.si_code != CLD_KILLED || sig.si_status != SIGBUS) {
-						printf("XXX: %s: child not killed by SIGBUS\n", t->name);
-						failure++;
-					}
-				}
-			}
-		}
-	}
-
-	/* early kill version */
-	early_kill = 1;
-	system("sysctl -w vm.memory_failure_early_kill=1");
-
-	sigaction(SIGBUS, &sa, NULL);
-	for (t = cases; t->f; t++) {
-		printf("---- testing %s (early kill)\n", t->name);
-		t->f();
-	}
-
-	if (failure > 0) {
-		printf("FAILURE -- %d cases broken!\n", failure);
-		return 1;
-	}
-	printf("SUCCESS\n");
-	tst_exit();
-}
\ No newline at end of file
diff --git a/testcases/kernel/mce-test/tsrc/tkillpoison.c b/testcases/kernel/mce-test/tsrc/tkillpoison.c
deleted file mode 100644
index ce99429..0000000
--- a/testcases/kernel/mce-test/tsrc/tkillpoison.c
+++ /dev/null
@@ -1,21 +0,0 @@
-// kills itself using poison
-#define _GNU_SOURCE 1
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#define MADV_POISON 100
-
-int main(void)
-{
-	int PS = getpagesize();
-	char *ptr = mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_POPULATE, 0,0);;
-	printf("ptr = %p\n", ptr);
-	madvise(ptr, PS, MADV_POISON);
-	printf("faulting\n");
-	*ptr = 1;
-	printf("waiting\n");
-	sleep(100);
-	return 0;
-}
diff --git a/testcases/kernel/mce-test/tsrc/tprctl.c b/testcases/kernel/mce-test/tsrc/tprctl.c
deleted file mode 100644
index ad17472..0000000
--- a/testcases/kernel/mce-test/tsrc/tprctl.c
+++ /dev/null
@@ -1,96 +0,0 @@
-// test prctl per process setting
-#define _GNU_SOURCE 1
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/prctl.h>
-#include <setjmp.h>
-#include <signal.h>
-
-#define err(x) perror("FAILURE: " x), exit(1)
-#define fail(x) printf("FAILURE: " x "\n"), exit(1)
-#define mb() asm volatile("" ::: "memory")
-
-#define MADV_POISON 100
-
-/*
- * Set early/late kill mode for hwpoison memory corruption.
- * This influences when the process gets killed on a memory corruption.
- */
-#define PR_MCE_KILL     33
-# define PR_MCE_KILL_CLEAR   0
-# define PR_MCE_KILL_SET     1
-
-# define PR_MCE_KILL_LATE    0
-# define PR_MCE_KILL_EARLY   1
-# define PR_MCE_KILL_DEFAULT 2
-
-#define PR_MCE_KILL_GET 34
-
-sigjmp_buf recover_ctx;
-volatile int seq;
-
-void handler(int sig)
-{
-	siglongjmp(recover_ctx, 1);
-}
-
-void test(int early)
-{
-	int PS = getpagesize();
-	char *ptr = mmap(NULL, PS, PROT_READ|PROT_WRITE,
-			 MAP_PRIVATE|MAP_ANONYMOUS|MAP_POPULATE, 0,0);
-	if (ptr == (char *)-1L)
-		err("mmap");
-	signal(SIGBUS, handler);
-	printf("ptr = %p\n", ptr);
-	if (sigsetjmp(recover_ctx, 1) == 0) {
-		seq = 0;
-		printf("injection\n");
-		if (madvise(ptr, PS, MADV_POISON) < 0)
-			err("MADV_POISON");
-		/* early kill should kill here */
-		seq++;
-		mb();
-		printf("faulting\n");
-		/* late kill should kill here */
-		*ptr = 1;
-		printf("finished\n");
-	} else {
-		printf("recovered\n");
-		if (seq == 1 && early)
-			fail("early mode set, but no early kill");
-		if (seq == 0 && !early)
-			fail("late mode set, but early kill");
-	}
-}
-
-int main(void)
-{
-	int err;
-	err = prctl(PR_MCE_KILL_GET, 0, 0, 0, 0, 0);
-	if (err < 0)
-		err("PR_MCE_KILL_GET");
-	if (err != PR_MCE_KILL_DEFAULT)
-		fail("starting policy not default");
-	if (prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_LATE, 0, 0, 0) < 0)
-		err("PR_MCE_KILL_SET late");
-	test(0);
-	if (prctl(PR_MCE_KILL, PR_MCE_KILL_SET, PR_MCE_KILL_EARLY, 0, 0, 0) < 0)
-		err("PR_MCE_KILL_SET early");
-	test(1);
-	err = prctl(PR_MCE_KILL_GET, 0, 0, 0,0,0);
-	if (err < 0)
-		err("PR_MCE_KILL_GET");
-	if (err != PR_MCE_KILL_EARLY)
-		fail("get mode not early after setting");
-	if (prctl(PR_MCE_KILL, PR_MCE_KILL_CLEAR, 0, 0,0,0) < 0)
-		err("PR_MCE_KILL_CLEAR");
-	err = prctl(PR_MCE_KILL_GET, 0, 0, 0, 0, 0);
-	if (err < 0)
-		err("PR_MCE_KILL_GET");
-	if (err != PR_MCE_KILL_DEFAULT)
-		fail("ending policy not default");
-	return 0;
-}
diff --git a/testcases/kernel/mce-test/tsrc/tring.c b/testcases/kernel/mce-test/tsrc/tring.c
deleted file mode 100644
index 4440884..0000000
--- a/testcases/kernel/mce-test/tsrc/tring.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* Unit tester for ring buffer code in mce.c */
-#define DEFINE_PER_CPU(a,b) a b
-#define __get_cpu_var(x) x
-#define barrier() asm volatile("" ::: "memory")
-#define rmb() barrier()
-#define wmb() barrier()
-
-/*
- * Simple lockless ring to communicate PFNs from the exception handler with the
- * process context work function. This is vastly simplified because there's
- * only a single reader and a single writer.
- */
-#define MCE_RING_SIZE 16	/* we use one entry less */
-
-struct mce_ring {
-	unsigned short start;
-	unsigned short end;
-	unsigned long ring[MCE_RING_SIZE];
-};
-static DEFINE_PER_CPU(struct mce_ring, mce_ring);
-
-static int mce_ring_empty(void)
-{
-	struct mce_ring *r = &__get_cpu_var(mce_ring);
-
-	return r->start == r->end;
-}
-
-static int mce_ring_get(unsigned long *pfn)
-{
-	struct mce_ring *r = &__get_cpu_var(mce_ring);
-
-	if (r->start == r->end)
-		return 0;
-	*pfn = r->ring[r->start];
-	r->start = (r->start + 1) % MCE_RING_SIZE;
-	return 1;
-}
-
-static int mce_ring_add(unsigned long pfn)
-{
-	struct mce_ring *r = &__get_cpu_var(mce_ring);
-	unsigned next;
-
-	next = (r->end + 1) % MCE_RING_SIZE;
-	if (next == r->start)
-		return -1;
-	r->ring[r->end] = pfn;
-	wmb();
-	r->end = next;
-	return 0;
-}
-
-#include <stdio.h>
-#include <assert.h>
-#include <pthread.h>
-
-void *thread(void *arg)
-{
-	long i = 0;
-	for (;;) {
-		if (mce_ring_add(i) >= 0)
-			i++;
-	}
-}
-
-int main(void)
-{
-	long k;
-
-	pthread_t thr;
-	pthread_create(&thr, NULL, thread, NULL);
-
-	k = 0;
-	for (;;) {
-		while (!mce_ring_empty()) {
-			unsigned long pfn;
-			int r = mce_ring_get(&pfn);
-			assert(r != 0);
-			if (pfn != k)
-				printf("got %lu expected %lu delta %ld\n", pfn, k, k-pfn);
-			k++;
-		}
-	}
-
-	return 0;
-}
diff --git a/testcases/kernel/mce-test/tsrc/tsimpleinj.c b/testcases/kernel/mce-test/tsrc/tsimpleinj.c
deleted file mode 100644
index 386456c..0000000
--- a/testcases/kernel/mce-test/tsrc/tsimpleinj.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Test program for Linux memory error recovery.
- * Requires special injection support.
- *
- * This is a early primitive version of tinjpage.c,
- * but simpler to debug in some cases.
- */
-#define _GNU_SOURCE 1
-#include <sys/mman.h>
-#include <stdio.h>
-#include <signal.h>
-#include <unistd.h>
-#include <sys/fcntl.h>
-#include <stdlib.h>
-#include <setjmp.h>
-#include <errno.h>
-#include <string.h>
-
-#define MADV_POISON 100
-
-#define err(x) perror(x),exit(1)
-
-int count = 20;
-int failure = 0;
-int total_cases = 0;
-sigjmp_buf recover;
-int PS;
-
-void sighandler(int sig, siginfo_t *si, void *arg)
-{
-	printf("signal %d code %d addr %p\n", sig, si->si_code, si->si_addr);
-
-	if (--count == 0)
-		exit(1);
-
-	siglongjmp(recover, 1);
-}
-
-void testmem(char *msg, char *page, int write)
-{
-	printf("%s page %p\n", msg, page);
-	total_cases++;
-	if (sigsetjmp(recover,1) == 0) {
-		if (madvise(page, PS, MADV_POISON) != 0) {
-			failure++;
-			perror("madvise");
-		}
-		if (write)
-			*page = 2;
-		else
-			printf("%x\n", *(unsigned char *)page);
-	}
-	printf("recovered\n");
-}
-
-void expecterr(char *msg, int res)
-{
-	if (res == 0)
-		printf("no error on %s\n", msg);
-	else
-		perror(msg);
-}
-
-int tempfd(void)
-{
-	static int tmpcount;
-	int fd;
-	char buf[30];
-	snprintf(buf,30,"/tmp/test%d.XXXXXXXX",tmpcount++);
-	fd = mkstemp(buf);
-	if (fd >= 0)
-		unlink(buf);
-	return fd;
-}
-
-#define RANDOM_FILE "/etc/profile"
-
-int main(void)
-{
-	PS = getpagesize();
-	char *page;
-
-	struct sigaction sa = {
-		.sa_sigaction = sighandler,
-		.sa_flags = SA_SIGINFO
-	};
-	sigaction(SIGBUS, &sa, NULL);
-//	sigaction(SIGSEGV, &sa, NULL);
-
- 	page = mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_POPULATE, 0, 0);
-	testmem("dirty", page, 1);
-
-	page = mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_LOCKED, 0, 0);
-	testmem("mlocked", page, 1);
-
-	int fd = open(RANDOM_FILE, O_RDONLY);
-	if (fd < 0) err("open " RANDOM_FILE);
-	page = mmap(NULL, PS, PROT_READ, MAP_SHARED|MAP_POPULATE, fd, 0);
-	if (page == (char *)-1) err("mmap");
-	close(fd);
-	testmem("clean file", page, 0);
-
-	fd = tempfd();
-	if (fd < 0) err("open testfile");
-	char *tmp = malloc(PS);
-	if (!tmp) err("no enough memory");
-	memset(tmp, 0xff, PS);
-	write(fd, tmp, PS);
-	free(tmp);
-	page = mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
-	if (page == (char*)-1) err("mmap");
-	*page = 1;
-	testmem("file dirty", page, 0);
-	expecterr("msync expect error", msync(page, PS, MS_SYNC));
-	expecterr("fsync expect error", fsync(fd));
-	close(fd);
-
-	/* hole case still broken in the kernel -- doesn't report error */
-	fd = tempfd();
-	if (fd < 0) err("open testfile");
-	ftruncate(fd, PS);
-	page = mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
-	if (page == (char*)-1) err("mmap");
-	*page = 1;
-	testmem("hole file dirty", page, 0);
-	expecterr("hole msync expect error", msync(page, PS, MS_SYNC));
-	expecterr("hole fsync expect error", fsync(fd));
-	close(fd);
-
-#if 0
-	const int NPAGES = 10;
-	int i;
-	fd = tempfd();
-	if (fd < 0) err("open rfp testfile");
-	tmp = malloc(PS);
-	if (!tmp) exit(ENOMEM);
-	for (i = 0; i < NPAGES; i++)  {
-		memset(tmp, i, PS);
-		write(fd, tmp, PS);
-	}
-	free(tmp);
-	page = mmap(NULL, PS*NPAGES, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
-	if (page == (char*)-1) err("mmap");
-	int k = NPAGES - 1;
-	for (i = 0; i < NPAGES; i++, k--) {
-		if (remap_file_pages(page + i*PS, PS, 0, k, 0))
-			perror("remap_file_pages");
-	}
-	*page = 1;
-	testmem("rfp file dirty", page, 0);
-	expecterr("rfp msync expect error", msync(page, PS, MS_SYNC));
-	expecterr("rfp fsync expect error", fsync(fd));
-	close(fd);
-#endif
-
-	if (failure > 0) {
-		printf("FAILURE -- %d of %d cases broken!\n", failure, total_cases);
-		return 1;
-	}
-	printf("SUCCESS\n");
-
-	return 0;
-}
diff --git a/testcases/kernel/mce-test/tsrc/tsoft.c b/testcases/kernel/mce-test/tsrc/tsoft.c
deleted file mode 100644
index 5a01d41..0000000
--- a/testcases/kernel/mce-test/tsrc/tsoft.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Simplest soft offline testcase */
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <stdio.h>
-#include <unistd.h>
-
-#define err(x) perror(x), exit(1)
-
-#define MADV_SOFT_OFFLINE 101          /* soft offline page for testing */
-
-int PS;
-
-int main(void)
-{
-	PS = getpagesize();
-	char *map = mmap(NULL, PS,  PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, 0, 0);
-
-	if (map == (char *)-1L)
-		err("mmap");
-
-	*map = 1;
-
-	if (madvise(map, PS, MADV_SOFT_OFFLINE) < 0)
-		perror("madvise SOFT_OFFLINE");
-
-	*map = 2;
-
-	return 0;
-}
diff --git a/testcases/kernel/mce-test/tsrc/tsoftinj.c b/testcases/kernel/mce-test/tsrc/tsoftinj.c
deleted file mode 100644
index 401d7c6..0000000
--- a/testcases/kernel/mce-test/tsrc/tsoftinj.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Test soft page offline for process pages using madvise injector.
- * Requires special injection support in the kernel.
- *
- * Copyright 2009 Intel Corporation
- *
- * tsoftinj is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public
- * License as published by the Free Software Foundation; version
- * 2.
- *
- * tinjpage 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 find a copy of v2 of the GNU General Public License somewhere
- * on your Linux system; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Andi Kleen
- */
-#define _GNU_SOURCE 1
-#include <sys/mman.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/fcntl.h>
-#include <stdlib.h>
-#include <errno.h>
-#include "hugepage.h"
-
-#define MADV_SOFT_OFFLINE 101
-
-#define TMPDIR "./"
-
-int PS;
-int exitcode;
-char empty[4096];
-int corrupted;
-
-void *checked_mmap(void *addr, size_t length, int prot, int flags,
-                  int fd, off_t offset)
-{
-	void *p = mmap(addr, length, prot, flags, fd, offset);
-	if (p == (void *)-1L)
-		err("mmap");
-	return p;
-}
-
-unsigned meminfo(char *fmt)
-{
-	int found = 0;
-	FILE *f = fopen("/proc/meminfo", "r");
-	if (!f) err("open /proc/meminfo");
-	char *line = NULL;
-	size_t linelen = 0;
-	unsigned val = 0;
-	while (getline(&line, &linelen, f) > 0) {
-		if (sscanf(line, fmt, &val) == 1) {
-			found = 1;
-			break;
-		}
-	}
-	free(line);
-	fclose(f);
-	if (!found)  {
-		printf("cannot read HardwareCorruptedPages in meminfo\n");
-		exitcode = 1;
-	}
-	return val;
-}
-
-unsigned hardware_corrupted(void)
-{
-	return (meminfo("HardwareCorrupted: %u") * 1024) / PS;
-}
-
-char *ndesc(char *buf, char *a, char *b)
-{
-	snprintf(buf, 100, "%s %s", a, b);
-	return buf;
-}
-
-void offline(char *name, void *p)
-{
-	char buf[100];
-	if (madvise(p, PS, MADV_SOFT_OFFLINE) < 0)
-		err(ndesc(buf, name, "offline"));
-	corrupted++;
-}
-
-void disk_backed(char *name, int flags)
-{
-	char fn[100];
-	snprintf(fn, sizeof fn, TMPDIR "~test%u", getpid());
-	printf("shared, diskbacked\n");
-	int fd = open(fn, O_RDWR|O_CREAT|O_TRUNC, 0644);
-	if (fd < 0) err("open tmpfile");
-	write(fd, empty, sizeof empty);
-	char *p = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE,
-			MAP_SHARED|flags, fd, 0);
-	*(volatile int *)p = 1;
-	offline(ndesc(fn, "disk backed", name), p);
-	munmap(p, PS);
-}
-
-void anonymous(char *name, int flags)
-{
-	char buf[100];
-	char *p = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE,
-			MAP_PRIVATE|MAP_ANONYMOUS|flags, 0, 0);
-	printf("anonymous\n");
-	*(volatile int *)p = 1;
-	offline(ndesc(buf, "anonymous", name), p);
-	*(volatile int *)p = 1;
-	munmap(p, PS);
-}
-
-void shm_hugepage(char *name, int flags)
-{
-	int shmid = 0;
-	char buf[100];
-	char *p = alloc_shm_hugepage(&shmid, HPS);
-	if (!p)
-		errmsg("failed in alloc_shm_hugepage\n");
-	printf("shm hugepage\n");
-	*(volatile int *)p = 1;
-	offline(ndesc(buf, "shm hugepage", name), p);
-	*(volatile int *)p = 1;
-	free_shm_hugepage(shmid, p);
-}
-
-void anonymous_hugepage(char *name, int flags)
-{
-	char buf[100];
-	char *p = alloc_anonymous_hugepage(HPS, 1);
-	printf("anonymous hugepage\n");
-	*(volatile int *)p = 1;
-	offline(ndesc(buf, "anonymous hugepage", name), p);
-	*(volatile int *)p = 1;
-	free_anonymous_hugepage(p, HPS);
-}
-
-void filebacked_hugepage(char *name, int flags)
-{
-	int fd;
-	char path[100];
-	char fn[100];
-	snprintf(path, sizeof path, "%s/~test-hugepage%u",
-		 hugetlbfsdir, getpid());
-	char *p = alloc_filebacked_hugepage(path, HPS, 0, &fd);
-	printf("file backed hugepage\n");
-	*(volatile int *)p = 1;
-	offline(ndesc(fn, "file backed hugepage", name), p);
-	*(volatile int *)p = 1;
-	free_filebacked_hugepage(p, HPS, fd, path);
-}
-
-void check(unsigned *count, char *name, unsigned expected)
-{
-	unsigned count2 = hardware_corrupted();
-	unsigned diff = count2 - *count;
-	if (diff != expected) {
-		printf("%s: expected %d corrupted pages, got %u\n", name,
-			expected,
-			diff);
-		if (diff < expected)
-			exitcode = 1;
-	}
-	*count = count2;
-	corrupted = 0;
-}
-
-int main(void)
-{
-	PS = getpagesize();
-	HPS = gethugepagesize();
-
-	unsigned count = hardware_corrupted();
-	if (!hugetlbfs_root(hugetlbfsdir))
-		err("hugetlbfs_root");
-	anonymous("anonymous", 0);
-	check(&count, "anonymous", 1);
-	anonymous("anonymous mlock", MAP_LOCKED);
-	check(&count, "anonymous mlock", 1);
-	disk_backed("disk backed", 0);
-	check(&count, "disk backed", 1);
-	disk_backed("disk backed mlock", 0);
-	check(&count, "disk backed mlock", 1);
-	shm_hugepage("shm hugepage", 0);
-	check(&count, "shm hugepage", HPS / PS);
-	anonymous_hugepage("anonymous hugepage", 0);
-	check(&count, "anonymous hugepage", HPS / PS);
-	filebacked_hugepage("file backed hugepage", 0);
-	check(&count, "file backed hugepage", HPS / PS);
-	// add more test cases here
-
-	return exitcode;
-}
\ No newline at end of file
diff --git a/testcases/kernel/mce-test/tsrc/ttable.c b/testcases/kernel/mce-test/tsrc/ttable.c
deleted file mode 100644
index e5344d1..0000000
--- a/testcases/kernel/mce-test/tsrc/ttable.c
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * Print table of MCA status bit combinations with results in HTML.
- * Author: Andi Kleen
- */
-#define _GNU_SOURCE 1
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <string.h>
-#include <assert.h>
-#include <unistd.h>
-#include <errno.h>
-#define __KERNEL__ 1
-#include <asm/types.h>
-#include <asm/mce.h>
-
-#define ARRAY_SIZE(x) (sizeof(x)/sizeof(*(x)))
-
-typedef unsigned long long u64;
-
-#define MCI_STATUS_S	 (1ULL<<56)  /* Signaled machine check */
-#define MCI_STATUS_AR	 (1ULL<<55)  /* Action required */
-
-int tolerant = 1;
-int panic_on_oops = 0;
-int mce_ser = 1;
-
-#include "mce-severity.c"
-
-int disable_opt = 0;
-
-struct rname {
-	char *name;
-	unsigned color;
-	char *desc;
-} rnames[] = {
-#define R(x,col,d) [MCE_ ## x ## _SEVERITY] = { #x, col, d }
-	R(NO, 0xc0c0c0, "Ignored"),
-	R(KEEP, 0x800080, "Ignore. Keep for CMC"),
-	R(SOME, 0x808080, "Log & Clear"),
-	R(AO, 0xffff00, "Kill address owner"),
-	R(UC, 0x700000, "Kill or panic"),
-	R(AR, 0x00ff00, "Kill current context"),
-	R(PANIC, 0xff0000, "Shutdown"),
-#undef R
-};
-
-struct bit {
-	char *name;
-	unsigned offset;
-	u64 bit;
-} bits[] = {
-#define O(x) offsetof(struct mce, x)
-#define S(x) { #x, O(status), MCI_STATUS_ ## x }
-	{ "RIPV", O(mcgstatus), MCG_STATUS_RIPV },
-	{ "EIPV", O(mcgstatus), MCG_STATUS_EIPV },
-	{ "MCIP", O(mcgstatus), MCG_STATUS_MCIP },
-	S(EN),
-	S(VAL),
-	S(UC),
-	S(S),
-	S(AR),
-	S(PCC),
-	S(OVER),
-	{ "SCRB-ERR", O(status), 0xc0 },
-#undef S
-#undef O
-};
-
-struct mce basem;
-
-#define bit_for_each(i,v) for (i = 0; i < 64; i++) if ((v) & (1ULL << i))
-
-struct result {
-	int res;
-	unsigned dontcare;
-	char *msg;
-};
-
-void genstate(struct mce *m, unsigned num)
-{
-	int i;
-	*m = basem;
-
-	bit_for_each (i, num)
-		*(u64 *)((char *)m + bits[i].offset) |= bits[i].bit;
-}
-
-// find don't care bits
-// brute force version because andi is not clever enough to make the clever
-// version work. luckily the tables are small
-
-#define for_rr(start, i) for (i = start; i < num; i++) if (rr[i].res >= 0)
-#define mask_of(x) ((1U << (x))-1)
-
-static void disable(struct result *rr, int i, int src)
-{
-	//fprintf(stderr, "disabling %d from %d\n", i, src);
-	rr[i].res = -1;
-}
-
-// handle case: one bit set always the same outcome
-static void one_bit_all(struct result *rr, int num, int mask)
-{
-	int first, k;
-	if (mask >= num)
-		return;
-	first = mask;
-	for_rr (first, k) {
-		if (!(k & mask))
-			continue;
-		if (rr[k].res != rr[first].res)
-			return;
-	}
-	rr[first].dontcare = mask_of(ARRAY_SIZE(bits)) & ~mask;
-	for_rr (first + 1, k) {
-		if (k & mask)
-			disable(rr, k, k);
-	}
-}
-
-// check if toggling one bit gives the same outcome
-static void neighbour_same(struct result *rr, int num, int mask)
-{
-	int k, other;
-	for_rr (mask, k) {
-		if (!(k & mask) || (rr[k].dontcare & mask))
-			continue;
-		other = k ^ mask;
-		if (other >= num)
-			continue;
-		if (rr[other].res == rr[k].res && rr[other].msg == rr[k].msg) {
-			disable(rr, other, k);
-			rr[k].dontcare |= mask;
-		}
-	}
-}
-
-void optimizer(struct result *rr, int num)
-{
-	int i;
-
-	for (i = 1; i <= 1 << ARRAY_SIZE(bits); i <<= 1)
-		one_bit_all(rr, num, i);
-	for (i = 1; i <= 1 << ARRAY_SIZE(bits); i <<= 1)
-		neighbour_same(rr, num, i);
-}
-
-int bitcount(u64 v)
-{
-	int num = 0;
-	while (v) {
-		if (v & 1)
-			num++;
-		v >>= 1;
-	}
-	return num;
-}
-
-void table(char *title)
-{
-	struct mce m;
-	int i, w, num;
-
-	struct result *rr = calloc(sizeof(struct result), 1U << ARRAY_SIZE(bits));
-
-	num = 0;
-	for (i = 0; i < 1U << ARRAY_SIZE(bits); i++) {
-		genstate(&m, i);
-		rr[num].res = mce_severity(&m, tolerant, &rr[num].msg);
-		num++;
-	}
-
-	if (!disable_opt)
-		optimizer(rr, num);
-
-	printf("<p><table border=1>\n");
-	printf("<chaption>%s</chaption>\n", title);
-
-	printf("<tr>\n");
-	for (i = 0; i < ARRAY_SIZE(bits); i++) {
-		printf("<th>%s</th>", bits[i].name);
-	}
-	printf("<th>Result</th><th>Rule</th><th>Action</th>\n");
-	printf("</tr>\n");
-
-	for_rr (0, i) {
-		printf("<tr>");
-		for (w = 0; w < ARRAY_SIZE(bits); w++) {
-			char *p = "0";
-			char *col = "";
-			unsigned mask = 1U << w;
-
-			if (mask & rr[i].dontcare) {
-				p = "x";
-				col = " bgcolor=\"888888\"";
-			} else if (mask & i) {
-				if (bitcount(bits[w].bit) > 1)
-					asprintf(&p, "%llx", bits[w].bit);
-				else
-					p = "1";
- 				col = " bgcolor=\"ffffff\"";
-			}
-			printf("<td%s>%s</td>", col, p);
-		}
-		struct rname *rname = &rnames[rr[i].res];
-		if ((unsigned)rr[i].res >= ARRAY_SIZE(rnames))
-			rname = &((struct rname) { .name = "out of bounds", .color = 0xff00ff });
-		assert(rname->name != NULL);
-		printf("<td bgcolor=\"%06x\">%s</td>", rname->color, rname->name);
-		assert(rr[i].msg != NULL);
-		printf("<td>%s</td>", rr[i].msg);
-		printf("<td>%s</td>", rname->desc);
-		printf("</tr>\n");
-	}
-	printf("</table>\n");
-}
-
-void usage(void)
-{
-	fprintf(stderr, "ttable [-a]\n"
-			"-a don't print don't care bits, but all states\n");
-	exit(1);
-}
-
-int main(int ac, char **av)
-{
-	int opt;
-	while ((opt = getopt(ac, av, "a")) != -1) {
-		switch (opt) {
-		case 'a':
-			disable_opt = 1;
-			break;
-		default:
-			usage();
-		}
-	}
-
-	printf("<html><body>\n");
-	printf("<!-- Auto generated. Changes will be overwritten -->\n");
-	basem.ip = 1;
-	printf("<h1>Linux kernel machine check grading</h1>\n");
-	printf("Caveats: Only scrubber error AO MCACOD. Only applies to exceptions.\n");
-	mce_ser = 1;
-	basem.cs = 0;
-	table("With MCA recovery ring 0");
-	tolerant = 0;
-	table("With MCA recovery ring 0 tolerant = 0");
-	tolerant = 1;
-	basem.cs = 3;
-	table("With MCA recovery ring 3");
-	basem.cs = 0;
-	mce_ser = 0;
-	table("Without MCA recovery ring 0");
-	basem.cs = 3;
-	table("Without MCA recovery ring 3");
-	printf("</body></html>\n");
-	return 0;
-}
diff --git a/testcases/kernel/mce-test/tsrc/utils.h b/testcases/kernel/mce-test/tsrc/utils.h
deleted file mode 100644
index 8c8ab26..0000000
--- a/testcases/kernel/mce-test/tsrc/utils.h
+++ /dev/null
@@ -1 +0,0 @@
-#define err(x) perror(x), exit(1)
diff --git a/testcases/mce-test/tsrc/tinjpage.c b/testcases/mce-test/tsrc/tinjpage.c
deleted file mode 100644
index 031201a..0000000
--- a/testcases/mce-test/tsrc/tinjpage.c
+++ /dev/null
@@ -1,527 +0,0 @@
-/*
- * Test program for Linux poison memory error recovery.
- * This injects poison into various mapping cases and triggers the poison
- * handling.  Requires special injection support in the kernel.
- * Author: Andi Kleen
- */
-#define _GNU_SOURCE 1
-#include <stdio.h>
-#include <signal.h>
-#include <unistd.h>
-#include <sys/fcntl.h>
-#include <sys/wait.h>
-#include <sys/mman.h>
-#include <stdlib.h>
-#include <setjmp.h>
-#include <errno.h>
-#include <string.h>
-#include <time.h>
-#include <pthread.h>
-
-#ifndef MADV_POISON
-#define MADV_POISON 100
-#endif
-
-#define TMPDIR "./"
-#define PATHBUFLEN 100
-
-#define err(x) perror(x),exit(1)
-#define Perror(x) failure++, perror(x)
-#define PAIR(x) x, sizeof(x)-1
-#define mb() asm volatile("" ::: "memory")
-#if defined(__i386__) || defined(__x86_64__)
-#define cpu_relax() asm volatile("rep ; nop" ::: "memory")
-#else
-#define cpu_relax() mb()
-#endif
-
-int PS;
-int failure;
-int unexpected;
-int early_kill;
-
-void *checked_mmap(void *start, size_t length, int prot, int flags,
-                   int fd, off_t offset)
-{
-	void *map = mmap(start, length, prot, flags, fd, offset);
-	if (map == (void*)-1L)
-		err("mmap");
-	return map;
-}
-
-void munmap_reserve(void *page, int size)
-{
-	munmap(page, size);
-	mmap(page, size, PROT_NONE, MAP_PRIVATE|MAP_FIXED, 0, 0);
-}
-
-void *xmalloc(size_t s)
-{
-	void *p = malloc(s);
-	if (!p)
-		exit(ENOMEM);
-	return p;
-}
-
-int recovercount;
-sigjmp_buf recover_ctx;
-sigjmp_buf early_recover_ctx;
-void *expected_addr;
-
-void sighandler(int sig, siginfo_t *si, void *arg)
-{
-	if (si->si_addr != expected_addr) {
-		printf("XXX: Unexpected address in signal %p (expected %p)\n", si->si_addr,
-			expected_addr);
-		failure++;
-	}
-
-	printf("signal %d code %d addr %p\n", sig, si->si_code, si->si_addr);
-
-	if (--recovercount == 0) {
-		write(1, PAIR("I seem to be in a signal loop. bailing out.\n"));
-		exit(1);
-	}
-
-	if (si->si_code == 4)
-		siglongjmp(recover_ctx, 1);
-	else
-		siglongjmp(early_recover_ctx, 1);
-}
-
-enum rmode {
-	MREAD = 0,
-	MWRITE = 1,
-	MREAD_OK = 2,
-	MWRITE_OK = 3,
-	MNOTHING = -1,
-};
-
-void poison(char *msg, char *page, enum rmode mode)
-{
-	expected_addr = page;
-	recovercount = 5;
-
-	if (sigsetjmp(early_recover_ctx, 1) == 0) {
-
-		if (madvise(page, PS, MADV_POISON) != 0) {
-			if (errno == EINVAL) {
-				printf("Kernel doesn't support poison injection\n");
-				exit(0);
-			}
-			Perror("madvise");
-			return;
-		}
-
-		if (early_kill && (mode == MWRITE || mode == MREAD)) {
-			printf("XXX: %s: process is not early killed\n", msg);
-			failure++;
-		}
-
-		return;
-	}
-
-	if (early_kill) {
-		if (mode == MREAD_OK || mode == MWRITE_OK) {
-			printf("XXX: %s: killed\n", msg);
-			failure++;
-		} else
-			printf("recovered\n");
-	}
-}
-
-void recover(char *msg, char *page, enum rmode mode)
-{
-	expected_addr = page;
-	recovercount = 5;
-
-	if (sigsetjmp(recover_ctx, 1) == 0) {
-		switch (mode) {
-		case MWRITE:
-			printf("writing 2\n");
-			*page = 2;
-			break;
-		case MWRITE_OK:
-			printf("writing 4\n");
-			*page = 4;
-			return;
-		case MREAD:
-			printf("%x\n", *(unsigned char *)page);
-			break;
-		case MREAD_OK:
-			printf("%x\n", *(unsigned char *)page);
-			return;
-		case MNOTHING:
-			return;
-		}
-		/* signal or kill should have happened */
-		printf("XXX: %s: page not poisoned after injection\n", msg);
-		failure++;
-		return;
-	}
-	if (mode == MREAD_OK || mode == MWRITE_OK) {
-		printf("XXX: %s: killed\n", msg);
-		failure++;
-	} else
-		printf("recovered\n");
-}
-
-void testmem(char *msg, char *page, enum rmode mode)
-{
-	printf("%s page %p\n", msg, page);
-	poison(msg, page, mode);
-	recover(msg, page, mode);
-}
-
-void expecterr(char *msg, int err)
-{
-	if (err) {
-		printf("expected error %d on %s\n", errno, msg);
-	} else {
-		failure++;
-		printf("XXX: unexpected no error on %s\n", msg);
-	}
-}
-
-void optionalerr(char *msg, int err)
-{
-	if (err) {
-		printf("expected optional error %d on %s\n", errno, msg);
-	} else {
-		unexpected++;
-		printf("XXX: expected likely incorrect no error on %s\n", msg);
-	}
-}
-
-static int tmpcount;
-int tempfd(void)
-{
-	int fd;
-	char buf[PATHBUFLEN];
-	snprintf(buf, sizeof buf, TMPDIR "poison%d",tmpcount++);
-	fd = open(buf, O_CREAT|O_RDWR, 0600);
-	if (fd >= 0)
-		unlink(buf);
-	if (fd < 0)
-		err("opening temporary file in " TMPDIR);
-	return fd;
-}
-
-int playfile(char *buf)
-{
-	int fd;
-	if (buf[0] == 0)
-		snprintf(buf, PATHBUFLEN, TMPDIR "poison%d", tmpcount++);
-	fd = open(buf, O_CREAT|O_RDWR|O_TRUNC, 0600);
-	if (fd < 0)
-		err("opening temporary file in " TMPDIR);
-
-	const int NPAGES = 5;
-	char *tmp = xmalloc(PS * NPAGES);
-	int i;
-	for (i = 0; i < PS*NPAGES; i++)
-		tmp[i] = i;
-	write(fd, tmp, PS*NPAGES);
-
-	lseek(fd, 0, SEEK_SET);
-	return fd;
-}
-
-static void dirty_anonymous(void)
-{
-	char *page;
-	page = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_POPULATE, 0, 0);
-	testmem("dirty", page, MWRITE);
-}
-
-static void dirty_anonymous_unmap(void)
-{
-	char *page;
-	page = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_POPULATE, 0, 0);
-	testmem("dirty", page, MWRITE);
-	munmap_reserve(page, PS);
-}
-
-static void mlocked_anonymous(void)
-{
-	char *page;
-	page = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_LOCKED, 0, 0);
-	testmem("mlocked", page, MWRITE);
-}
-
-static void file_clean(void)
-{
-	char *page;
-	char fn[30];
-	snprintf(fn, 30, TMPDIR "test%d", tmpcount++);
-	int fd = open(fn, O_RDWR|O_TRUNC|O_CREAT);
-	if (fd < 0)
-		err("open temp file");
-	write(fd, fn, 4);
-	fsync(fd);
-	page = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
-	close(fd);
-	testmem("file clean", page, MREAD_OK);
-	printf("%x\n", *(unsigned char *)page); /* reread page from disk */
-	testmem("file clean", page, MWRITE_OK);
-}
-
-static void file_dirty(void)
-{
-	char *page;
-	char fn[PATHBUFLEN];
-	fn[0] = 0;
-	int fd = playfile(fn);
-
-	page = checked_mmap(NULL, PS, PROT_READ, MAP_SHARED|MAP_POPULATE, fd, 0);
-	testmem("dirty file initial", page, MREAD);
-	expecterr("msync expect error", msync(page, PS, MS_SYNC) < 0);
-	close(fd);
-	munmap_reserve(page, PS);
-
-	fd = open(fn, O_RDONLY);
-	if (fd < 0) err("reopening temp file");
-	page = checked_mmap(NULL, PS, PROT_READ, MAP_SHARED|MAP_POPULATE, fd, 0);
-	recover("dirty file populated", page, MREAD_OK);
-	close(fd);
-	munmap_reserve(page, PS);
-
-	fd = open(fn, O_RDONLY);
-	if (fd < 0) err("reopening temp file");
-	page = checked_mmap(NULL, PS, PROT_READ, MAP_SHARED, fd, 0);
-	recover("dirty file fault", page, MREAD_OK);
-	close(fd);
-	munmap_reserve(page, PS);
-
-	fd = open(fn, O_RDWR);
-	char buf[128];
-	expecterr("explicit read after poison", read(fd, buf, sizeof buf) < 0);
-	expecterr("explicit write after poison", write(fd, "foobar", 6) < 0);
-	optionalerr("fsync expect error", fsync(fd) < 0);
-	close(fd);
-
-	/* should unlink return an error here? */
-	if (unlink(fn) < 0)
-		perror("unlink");
-}
-
-/* TBD */
-static void file_hole(void)
-{
-	int fd = tempfd();
-	char *page;
-
-	ftruncate(fd, PS);
-	page = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
-	*page = 1;
-	testmem("hole file dirty", page, MREAD);
-	expecterr("hole fsync expect error", fsync(fd) < 0);
-	optionalerr("hole msync expect error", msync(page, PS, MS_SYNC) < 0);
-	close(fd);
-}
-
-static void nonlinear(void)
-{
-	int fd;
-	const int NPAGES = 10;
-	int i;
-	char *page;
-	char *tmp;
-
-	fd = tempfd();
-	tmp = xmalloc(PS);
-	for (i = 0; i < NPAGES; i++)  {
-		memset(tmp, i, PS);
-		write(fd, tmp, PS);
-	}
-	free(tmp);
-	page = checked_mmap(NULL, PS*NPAGES, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0);
-	int k = NPAGES - 1;
-	for (i = 0; i < NPAGES; i++, k--) {
-		if (remap_file_pages(page + i*PS, PS, 0, k, 0))
-			perror("remap_file_pages");
-	}
-	*page = 1;
-	testmem("rfp file dirty", page, MREAD);
-	expecterr("rfp fsync expect error", fsync(fd) < 0);
-	optionalerr("rfp msync expect error", msync(page, PS, MS_SYNC) < 0);
-	close(fd);
-}
-
-/*
- * This is quite timing dependent. The sniper might hit the page
- * before it is dirtied. If that happens tweak the delay
- * (should auto tune)
- */
-enum {
-	DELAY_NS = 30,
-};
-
-volatile enum sstate { START, WAITING, SNIPE } sstate;
-
-void waitfor (enum sstate w, enum sstate s)
-{
-	sstate = w;
-	mb();
-	while (sstate != s)
-		cpu_relax();
-}
-
-struct poison_arg {
-	char *msg;
-	char *page;
-	enum rmode mode;
-};
-
-void *sniper(void *p)
-{
-	struct poison_arg *arg = p;
-
-	waitfor (START, WAITING);
-	nanosleep(&((struct timespec) { .tv_nsec = DELAY_NS }), NULL);
-	poison(arg->msg, arg->page, arg->mode);
-	return NULL;
-}
-
-int setup_sniper(struct poison_arg *arg)
-{
-	if (sysconf(_SC_NPROCESSORS_ONLN) < 2)  {
-		printf("%s: Need at least two CPUs. Not tested\n", arg->msg);
-		return -1;
-	}
-	sstate = START;
-	mb();
-	pthread_t thr;
-	if (pthread_create(&thr, NULL, sniper, arg) < 0)
-		err("pthread_create");
-	pthread_detach(thr);
-	return 0;
-}
-
-static void under_io_dirty(void)
-{
-	struct poison_arg arg;
-	int fd = tempfd();
-	char *page;
-
-	page = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE, fd, 0);
-
-	arg.page = page;
-	arg.msg  = "under io dirty";
-	arg.mode = MWRITE;
-	if (setup_sniper(&arg) < 0)
-		return;
-
-	write(fd, "xyz", 3);
-	waitfor (WAITING, WAITING);
-	expecterr("write under io", fsync(fd) < 0);
-	close(fd);
-}
-
-static void under_io_clean(void)
-{
-	struct poison_arg arg;
-	char fn[PATHBUFLEN];
-	int fd;
-	char *page;
-	char buf[10];
-
- 	fd = playfile(fn);
-	page = checked_mmap(NULL, PS, PROT_READ|PROT_WRITE, MAP_SHARED|MAP_POPULATE, fd, 0);
-	madvise(page, PS, MADV_DONTNEED);
-
-	arg.page = page;
-	arg.msg  = "under io clean";
-	arg.mode = MREAD_OK;
-	if (setup_sniper(&arg) < 0)
-		return;
-
-	waitfor (WAITING, WAITING);
-	// what is correct here?
-	if (pread(fd, buf, 10, 0) != 0)
-		perror("pread under io clean");
-	close(fd);
-}
-
-struct testcase {
-	void (*f)(void);
-	char *name;
-	int survivable;
-} cases[] = {
-	{ dirty_anonymous, "dirty anonymous" },
-	{ dirty_anonymous_unmap, "dirty anonymous unmap" },
-	{ mlocked_anonymous, "mlocked anonymous" },
-	{ file_clean, "file clean", 1 },
-	{ file_dirty, "file dirty" },
-	{ file_hole, "file hole" },
-	{ nonlinear, "nonlinear" },
-	/* { under_io_dirty, "under io dirty" }, */
-	/* { under_io_clean, "under io clean" }, */
-	{}
-};
-
-int main(void)
-{
-	PS = getpagesize();
-
-	/* don't kill me at poison time, but possibly at page fault time */
-	early_kill = 0;
-	system("sysctl -w vm.memory_failure_early_kill=0");
-
-	struct sigaction sa = {
-		.sa_sigaction = sighandler,
-		.sa_flags = SA_SIGINFO
-	};
-
-	struct testcase *t;
-	/* catch signals */
-	sigaction(SIGBUS, &sa, NULL);
-	for (t = cases; t->f; t++)
-		t->f();
-
-	/* suicide version */
-	for (t = cases; t->f; t++) {
-		pid_t child = fork();
-		if (child == 0) {
-			signal(SIGBUS, SIG_DFL);
-			t->f();
-			if (t->survivable)
-				_exit(2);
-			write(1, t->name, strlen(t->name));
-			write(1, PAIR(" didn't kill itself?\n"));
-			_exit(1);
-		} else {
-			siginfo_t sig;
-			if (waitid(P_PID, child, &sig, WEXITED) < 0)
-				perror("waitid");
-			else {
-				if (t->survivable) {
-					if (sig.si_code != CLD_EXITED) {
-						printf("XXX: %s: child not survived\n", t->name);
-						failure++;
-					}
-				} else {
-					if (sig.si_code != CLD_KILLED || sig.si_status != SIGBUS) {
-						printf("XXX: %s: child not killed by SIGBUS\n", t->name);
-						failure++;
-					}
-				}
-			}
-		}
-	}
-
-	/* early kill version */
-	early_kill = 1;
-	system("sysctl -w vm.memory_failure_early_kill=1");
-
-	sigaction(SIGBUS, &sa, NULL);
-	for (t = cases; t->f; t++)
-		t->f();
-
-	if (failure > 0) {
-		printf("FAILURE -- %d cases broken!\n", failure);
-		return 1;
-	}
-	printf("SUCCESS\n");
-	return 0;
-}