From: Gautam Date: Sat, 25 Jun 2022 19:52:45 +0000 (+0530) Subject: kselftests/damon: add support for cases where debugfs cannot be read X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=43fe0cc46b6206b25f0f13bb249f0078441ae15a;p=linux.git kselftests/damon: add support for cases where debugfs cannot be read The kernel is in lockdown mode when secureboot is enabled and hence debugfs cannot be used. Add support for this and other general cases where debugfs cannot be read and communicate the same to the user before running tests. Signed-off-by: Gautam Reviewed-by: SeongJae Park Signed-off-by: Shuah Khan --- diff --git a/tools/testing/selftests/damon/_chk_dependency.sh b/tools/testing/selftests/damon/_chk_dependency.sh index 0189db81550be..0328ac0b5a5ed 100644 --- a/tools/testing/selftests/damon/_chk_dependency.sh +++ b/tools/testing/selftests/damon/_chk_dependency.sh @@ -26,3 +26,13 @@ do exit 1 fi done + +permission_error="Operation not permitted" +for f in attrs target_ids monitor_on +do + status=$( cat "$DBGFS/$f" 2>&1 ) + if [ "${status#*$permission_error}" != "$status" ]; then + echo "Permission for reading $DBGFS/$f denied; maybe secureboot enabled?" + exit $ksft_skip + fi +done