Skip to content

Commit

Permalink
cet: add the kconfig check for kernel dependence check
Browse files Browse the repository at this point in the history
Signed-off-by: Pengfei Xu <[email protected]>
  • Loading branch information
xupengfe committed Apr 23, 2024
1 parent 74ab1a0 commit bb5c8af
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cet/tests
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file collects the CET(Control-flow Enforcement Technology) tests on
# Intel® Architecture-based platforms.
# @hw_dep: cpuid_check 7 0 0 0 c 7 @ HW cpuid could not support CET SHSTK
# @other_dep:
# @other_dep: general_test.sh -t kconfig -k "CONFIG_X86_USER_SHADOW_STACK=y"
# @other_warn: quick_test @ Glibc could not support CET

# User space SHSTK tests without SHSTK Glibc supported
Expand Down
2 changes: 1 addition & 1 deletion common/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ test_kconfig() {
local name="$2"

if [[ ! "$value" =~ [ymn] ]]; then
test_print_err "Invalid koption value!"
test_print_err "Invalid koption value:$value"
return 1
fi

Expand Down
61 changes: 61 additions & 0 deletions common/general_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash
###############################################################################
# SPDX-License-Identifier: GPL-2.0-only #
# Copyright (c) 2024 Intel Corporation. #
# For general check like KCONFIG, CPU family model stepping #
###############################################################################

# shellcheck source=/dev/null
cd "$(dirname "$0")" 2>/dev/null && source ../.env

usage() {
cat <<__EOF
usage: ./${0##*/} [-t TEST_TYPE][-k KCONFIG or keywrod][-p parm][-h]
-t Test type like KCONFIG, FMS
-k KCONFIG name like CONFIG_XXX or keyword
-p PARM like y, null
-h show This
__EOF
}

general_test() {
case $TYPE in
kconfig)
config_name=$(echo "$KEYWORD" | cut -d '=' -f1)
config_val=$(echo "$KEYWORD" | cut -d '=' -f2)
test_any_kconfig_match "$config_name" "$config_val"
;;
# family model stepping check
fms)
#TODO, will add the fms check function
;;
*)
die "Invalid TYPE:$TYPE"
;;
esac
}

while getopts :t:p:k:h arg; do
case $arg in
t)
TYPE=$OPTARG
;;
p)
# TODO, will add more function to use PARM
# PARM=$OPTARG
;;
k)
KEYWORD=$OPTARG
;;
h)
usage
exit 0
;;
*)
usage
die "Option -$OPTARG requires an argument."
;;
esac
done

general_test

0 comments on commit bb5c8af

Please sign in to comment.