• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3# Software injection based test cases - panic cases: test cases are
4# triggered via the mce-inject tool, and they will trigger kernel panic.
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    get_severity_cov
33
34    case "$bcase" in
35	fatal*)
36	    soft_inject_get_mcelog
37	    ;;
38	*)
39	    echo '!!! Unknown case: $this_case !!!'
40    esac
41}
42
43verify()
44{
45    local removes="TSC TIME PROCESSOR"
46    local curr_cpu_panic=": Fatal machine check on current CPU"
47    local fatal_panic="Fatal Machine check"
48    local pcc_exp="Processor context corrupt"
49    case "$bcase" in
50	fatal|fatal_irq|fatal_over)
51	    removes="$removes RIP"
52	    soft_inject_verify_mcelog
53	    verify_klog $klog
54	    soft_inject_verify_panic "$fatal_panic"
55	    soft_inject_verify_exp "$pcc_exp"
56	    ;;
57	fatal_ripv|fatal_eipv|fatal_userspace)
58	    soft_inject_verify_mcelog
59	    verify_klog $klog
60	    soft_inject_verify_panic "$fatal_panic"
61	    soft_inject_verify_exp "$pcc_exp"
62	    ;;
63	fatal_no_en)
64	    removes="$removes RIP"
65	    soft_inject_verify_mcelog
66	    verify_klog $klog
67	    soft_inject_verify_panic "Machine check from unknown source"
68	    ;;
69	fatal_timeout)
70	    removes="$removes RIP"
71	    soft_inject_verify_mcelog
72	    verify_klog $klog
73	    soft_inject_verify_panic "$curr_cpu_panic"
74	    soft_inject_verify_timeout
75	    soft_inject_verify_exp "$pcc_exp"
76	    ;;
77	fatal_timeout_ripv)
78	    soft_inject_verify_mcelog
79	    verify_klog $klog
80	    soft_inject_verify_panic "$curr_cpu_panic"
81	    soft_inject_verify_timeout
82	    soft_inject_verify_exp "$pcc_exp"
83	    ;;
84	*)
85	    echo "!!! Unknown case: $this_case !!!"
86    esac
87}
88
89soft_inject_main "$@"
90