• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3# Software injection based test cases: test cases are triggered via
4# the mce-inject tool.
5#
6# Copyright (C) 2008, Intel Corp.
7#   Author: Huang Ying <ying.huang@intel.com>
8#
9# This file is released under the GPLv2.
10#
11
12. $ROOT/lib/functions.sh
13. $ROOT/lib/dirs.sh
14. $ROOT/lib/mce.sh
15. $ROOT/lib/soft-inject.sh
16
17enumerate()
18{
19    soft_inject_enumerate
20}
21
22trigger()
23{
24    reset_severity_cov
25    soft_inject_trigger
26}
27
28get_result()
29{
30    soft_inject_get_klog
31    get_gcov arch/x86/kernel/cpu/mcheck/mce.c
32    soft_inject_get_mcelog
33    get_severity_cov
34}
35
36verify()
37{
38    local mce_panic
39    local removes="TSC TIME PROCESSOR"
40    local pcc_exp="Processor context corrupt"
41    local knoripv_exp="In kernel and no restart IP"
42    local no_mcip_exp="MCIP not set in MCA handler"
43    local no_eripv_exp="Neither restart nor error IP"
44    local over_exp="Overflowed uncorrected"
45    local fatal_panic=": Fatal Machine check"
46    local curr_cpu_panic=": Fatal machine check on current CPU"
47    local unknown_src_panic=": Machine check from unknown source"
48    case "$bcase" in
49	fatal_severity)
50	    removes="$removes RIP"
51	    soft_inject_verify_mcelog
52	    verify_klog $klog
53	    soft_inject_verify_panic "$fatal_panic"
54	    soft_inject_verify_exp "$pcc_exp"
55	    ;;
56	uncorrected)
57	    soft_inject_verify_mcelog
58	    verify_klog $klog
59	    soft_inject_verify_panic "$fatal_panic"
60	    soft_inject_verify_exp "$knoripv_exp"
61	    ;;
62	uncorrected_timeout*)
63	    soft_inject_verify_mcelog
64	    verify_klog $klog
65	    soft_inject_verify_panic "$curr_cpu_panic"
66	    soft_inject_verify_timeout
67	    soft_inject_verify_exp "$knoripv_exp"
68	    ;;
69	uc_no_mcip)
70	    removes="$removes RIP"
71	    soft_inject_verify_mcelog
72	    verify_klog $klog
73	    soft_inject_verify_panic "$fatal_panic"
74	    soft_inject_verify_exp "$no_mcip_exp"
75	    ;;
76	uc_no_mcip_timeout)
77	    removes="$removes RIP"
78	    soft_inject_verify_mcelog
79	    verify_klog $klog
80	    soft_inject_verify_panic "$curr_cpu_panic"
81	    soft_inject_verify_exp "$no_mcip_exp"
82	    soft_inject_verify_timeout
83	    ;;
84	uc_no_eripv)
85	    removes="$removes RIP"
86	    soft_inject_verify_mcelog
87	    verify_klog $klog
88	    soft_inject_verify_panic "$fatal_panic"
89	    soft_inject_verify_exp "$no_eripv_exp"
90	    ;;
91	uc_no_eripv_timeout)
92	    removes="$removes RIP"
93	    soft_inject_verify_mcelog
94	    verify_klog $klog
95	    soft_inject_verify_panic "$curr_cpu_panic"
96	    soft_inject_verify_exp "$no_eripv_exp"
97	    soft_inject_verify_timeout
98	    ;;
99	unknown)
100	    verify_klog $klog
101	    soft_inject_verify_panic "$unknown_src_panic"
102	    ;;
103	*)
104	    echo "!!! Unknown case: $this_case !!!"
105    esac
106}
107
108soft_inject_main "$@"
109