From 0ca20076a89c30d59b46bda05e6f281c6fd249fc Mon Sep 17 00:00:00 2001 From: "Lai, Yi1" Date: Tue, 20 Aug 2024 13:16:55 +0800 Subject: [PATCH] ras: introduce ras feature into lkvs Introduce RAS (Reliability, Availability, and Serviceability) into lkvs. Add several error injection test cases. Signed-off-by: Lai, Yi1 --- BM/ras/Makefile | 20 ++++++++++ BM/ras/ras_test.sh | 91 ++++++++++++++++++++++++++++++++++++++++++++++ BM/ras/tests | 12 ++++++ 3 files changed, 123 insertions(+) create mode 100644 BM/ras/Makefile create mode 100755 BM/ras/ras_test.sh create mode 100644 BM/ras/tests diff --git a/BM/ras/Makefile b/BM/ras/Makefile new file mode 100644 index 0000000..3216cb7 --- /dev/null +++ b/BM/ras/Makefile @@ -0,0 +1,20 @@ +SUBDIRS := mce-test + +.PHONY: all +all: $(SUBDIRS) + +.PHONY: $(SUBDIRS) +$(SUBDIRS): + $(MAKE) -C $@ + +.PHONY: install +install: + for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir install; \ + done + +.PHONY: clean +clean: + for dir in $(SUBDIRS); do \ + $(MAKE) -C $$dir clean; \ + done \ No newline at end of file diff --git a/BM/ras/ras_test.sh b/BM/ras/ras_test.sh new file mode 100755 index 0000000..8199259 --- /dev/null +++ b/BM/ras/ras_test.sh @@ -0,0 +1,91 @@ +#!/bin/bash +# SPDX-License-Identifier: GPL-2.0-only +# Copyright (c) 2024 Intel Corporation +# Author: Yi Lai +# @Desc Test script to verify Intel RAS functionality + +# Prerequisite +if ! rpm -q screen &> /dev/null; then + echo "screen is not installed. Installing now..." + sudo yum install -y screen +fi + +cd "$(dirname "$0")" 2>/dev/null || exit 1 +source ../.env + +usage() { + cat <<__EOF + usage: ./${0##*/} [-t TESTCASE_ID] [-H] + -t TEST CASE ID + -H show this +__EOF +} + +ras_check_result() { + local testcase=$1 + + if [ $? -eq 0 ]; then + test_print_trc "${testcase} Test PASS" + else + die "${testcase} Test FAIL" + fi +} + +ras_test() { + case $TEST_SCENARIO in + apei-inj) + cd mce-test/cases/function/apei-inj/ + sh runtest.sh + ;; + core_recovery_ifu) + cd mce-test/cases/function/core_recovery/ + sh runtest_ifu.sh + ;; + core_recovery_dcu) + cd mce-test/cases/function/core_recovery/ + sh runtest_dcu.sh + ;; + edac) + cd mce-test/cases/function/edac/ + sh runtest.sh + ;; + einj-ext) + cd mce-test/cases/function/einj-ext/ + sh runtest.sh + ;; + emca-inj) + cd mce-test/cases/function/emca-inj/ + sh runtest.sh + ;; + erst-inject) + cd mce-test/cases/function/erst-inject/ + sh runtest.sh + ;; + pfa) + cd mce-test/cases/function/pfa/ + sh runtest.sh + ;; + esac + ras_check_result $TEST_SCENARIO +} + +while getopts :t:H arg; do + case $arg in + t) + TEST_SCENARIO=$OPTARG + ;; + H) + usage && exit 0 + ;; + \?) + usage + die "Invalid Option -$OPTARG" + ;; + :) + usage + die "Option -$OPTARG requires an argument." + ;; + esac +done + +ras_test diff --git a/BM/ras/tests b/BM/ras/tests new file mode 100644 index 0000000..c6a910b --- /dev/null +++ b/BM/ras/tests @@ -0,0 +1,12 @@ +# This file collects Intel RAS/MCE testcases which can run against +# IntelĀ® Architecture-based platforms. +# @other_dep: general_test.sh -t module -p einj @ No module einj + +ras_test.sh -t apei-inj +ras_test.sh -t core_recovery_ifu +ras_test.sh -t core_recovery_dcu +ras_test.sh -t edac +ras_test.sh -t einj-ext +ras_test.sh -t emca-inj +ras_test.sh -t erst-inject +ras_test.sh -t pfa