2014-04-26 20:40:34 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# kpatch integration test framework
|
|
|
|
#
|
|
|
|
# Copyright (C) 2014 Josh Poimboeuf <jpoimboe@redhat.com>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA,
|
|
|
|
# 02110-1301, USA.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# This is a basic integration test framework for kpatch, which tests building,
|
|
|
|
# loading, and unloading patches, as well as any other related custom tests.
|
|
|
|
#
|
|
|
|
# This script looks for test input files in the current directory. It expects
|
|
|
|
# certain file naming conventions:
|
|
|
|
#
|
|
|
|
# - foo.patch: patch that should build successfully
|
|
|
|
#
|
|
|
|
# - bar-FAIL.patch: patch that should fail to build
|
|
|
|
#
|
|
|
|
# - foo-LOADED.test: executable which tests whether the foo.patch module is
|
|
|
|
# loaded. It will be used to test that loading/unloading the patch module
|
|
|
|
# works as expected.
|
|
|
|
#
|
|
|
|
# Any other *.test files will be executed after all the patch modules have been
|
|
|
|
# built from the *.patch files. They can be used for more custom tests above
|
|
|
|
# and beyond the simple loading and unloading tests.
|
|
|
|
|
2017-01-09 16:12:28 +00:00
|
|
|
shopt -s nullglob
|
|
|
|
|
2020-06-03 09:10:19 +00:00
|
|
|
# shellcheck disable=SC2046
|
2020-06-03 09:02:59 +00:00
|
|
|
SCRIPTDIR=$(readlink -f $(dirname $(type -p "$0")))
|
|
|
|
ROOTDIR=$(readlink -f "$SCRIPTDIR/../..")
|
2014-04-26 20:40:34 +00:00
|
|
|
KPATCH="sudo $ROOTDIR/kpatch/kpatch"
|
2015-10-23 21:56:08 +00:00
|
|
|
unset CCACHE_HASHDIR
|
2014-04-26 20:40:34 +00:00
|
|
|
KPATCHBUILD="$ROOTDIR"/kpatch-build/kpatch-build
|
|
|
|
ERROR=0
|
|
|
|
LOG=test.log
|
2020-05-20 12:54:41 +00:00
|
|
|
DYNDEBUG_CONTROL=/sys/kernel/debug/dynamic_debug/control
|
2020-06-30 07:17:30 +00:00
|
|
|
DYNDEBUG_ENABLED=1
|
2021-05-25 00:34:24 +00:00
|
|
|
ARCHVERSION="$(uname -r)"
|
2020-06-03 08:07:10 +00:00
|
|
|
rm -f ./*.log
|
2014-04-26 20:40:34 +00:00
|
|
|
|
2016-12-07 20:05:41 +00:00
|
|
|
PATCHDIR="${PATCHDIR:-$PWD}"
|
|
|
|
declare -a PATCH_LIST
|
|
|
|
declare -a TEST_LIST
|
|
|
|
|
2014-04-26 20:40:34 +00:00
|
|
|
usage() {
|
2016-12-07 20:05:41 +00:00
|
|
|
echo "usage: $0 [options] [patch1 ... patchN]" >&2
|
|
|
|
echo " patchN Pathnames of patches to test" >&2
|
2014-04-26 20:40:34 +00:00
|
|
|
echo " -h, --help Show this help message" >&2
|
2014-05-27 13:34:21 +00:00
|
|
|
echo " -c, --cached Don't rebuild patch modules" >&2
|
2016-12-05 15:18:43 +00:00
|
|
|
echo " -d, --directory Patch directory" >&2
|
2018-08-10 14:53:58 +00:00
|
|
|
echo " -q, --quick Test combined patch and -FAIL patches only" >&2
|
2020-07-13 20:11:30 +00:00
|
|
|
echo " --system-kpatch-tools Use kpatch tools installed in the system" >&2
|
|
|
|
echo " --kpatch-build-opts Additional options to pass to kpatch-build" >&2
|
2014-04-26 20:40:34 +00:00
|
|
|
}
|
|
|
|
|
2020-07-13 20:11:30 +00:00
|
|
|
options=$(getopt -o hcd:q -l "help,cached,directory,quick,system-kpatch-tools,kpatch-build-opts:" -- "$@") || exit 1
|
2014-04-26 20:40:34 +00:00
|
|
|
|
|
|
|
eval set -- "$options"
|
|
|
|
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
|
case "$1" in
|
|
|
|
-h|--help)
|
|
|
|
usage
|
|
|
|
exit 0
|
|
|
|
;;
|
2014-05-27 13:34:21 +00:00
|
|
|
-c|--cached)
|
2014-04-26 20:40:34 +00:00
|
|
|
SKIPBUILD=1
|
|
|
|
;;
|
2016-12-05 15:18:43 +00:00
|
|
|
-d|--directory)
|
|
|
|
PATCHDIR="$2"
|
|
|
|
shift
|
|
|
|
;;
|
2014-05-27 13:34:21 +00:00
|
|
|
-q|--quick)
|
|
|
|
QUICK=1
|
|
|
|
;;
|
2020-07-13 20:11:30 +00:00
|
|
|
--system-kpatch-tools)
|
|
|
|
KPATCH="sudo kpatch"
|
|
|
|
KPATCHBUILD="kpatch-build"
|
|
|
|
;;
|
|
|
|
--kpatch-build-opts)
|
|
|
|
KPATCHBUILD_OPTS=$2
|
|
|
|
shift
|
|
|
|
;;
|
2016-12-07 20:05:41 +00:00
|
|
|
*)
|
|
|
|
[[ "$1" = "--" ]] && shift && continue
|
|
|
|
PATCH_LIST+=("$1")
|
|
|
|
;;
|
2014-04-26 20:40:34 +00:00
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
2016-12-07 20:05:41 +00:00
|
|
|
if [[ ${#PATCH_LIST[@]} = 0 ]]; then
|
2020-06-03 09:02:59 +00:00
|
|
|
PATCH_LIST=("$PATCHDIR"/*.patch)
|
|
|
|
TEST_LIST=("$PATCHDIR"/*.test)
|
2017-01-09 16:12:28 +00:00
|
|
|
if [[ ${#PATCH_LIST[@]} = 0 ]]; then
|
|
|
|
echo "No patches found!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-12-07 20:05:41 +00:00
|
|
|
else
|
|
|
|
for file in "${PATCH_LIST[@]}"; do
|
|
|
|
prefix=${file%%.patch}
|
|
|
|
[[ -e "$prefix-FAIL.test" ]] && TEST_LIST+=("$prefix-FAIL.test")
|
|
|
|
[[ -e "$prefix-LOADED.test" ]] && TEST_LIST+=("$prefix-LOADED.test")
|
|
|
|
done
|
|
|
|
fi
|
2014-04-26 20:40:34 +00:00
|
|
|
|
|
|
|
error() {
|
2020-06-03 07:51:13 +00:00
|
|
|
echo "ERROR: $*" |tee -a $LOG >&2
|
2014-04-26 20:40:34 +00:00
|
|
|
ERROR=$((ERROR + 1))
|
|
|
|
}
|
|
|
|
|
2014-05-05 22:07:13 +00:00
|
|
|
log() {
|
|
|
|
echo "$@" |tee -a $LOG
|
|
|
|
}
|
|
|
|
|
2014-05-05 19:07:22 +00:00
|
|
|
unload_all() {
|
2019-10-05 15:02:53 +00:00
|
|
|
$KPATCH unload --all
|
2014-05-05 19:07:22 +00:00
|
|
|
}
|
|
|
|
|
2014-04-26 20:40:34 +00:00
|
|
|
build_module() {
|
|
|
|
file=$1
|
2020-06-03 09:02:59 +00:00
|
|
|
prefix=$(basename "${file%%.patch}")
|
2018-06-01 13:46:22 +00:00
|
|
|
modname="test-$prefix"
|
|
|
|
module="${modname}.ko"
|
2014-04-26 20:40:34 +00:00
|
|
|
|
2014-09-15 13:20:43 +00:00
|
|
|
if [[ $prefix =~ -FAIL ]]; then
|
2014-04-26 20:40:34 +00:00
|
|
|
shouldfail=1
|
|
|
|
else
|
|
|
|
shouldfail=0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $SKIPBUILD -eq 1 ]]; then
|
2014-05-05 20:14:16 +00:00
|
|
|
skip=0
|
2014-04-26 20:40:34 +00:00
|
|
|
[[ $shouldfail -eq 1 ]] && skip=1
|
|
|
|
[[ -e $module ]] && skip=1
|
2014-05-05 22:07:13 +00:00
|
|
|
[[ $skip -eq 1 ]] && log "skipping build: $prefix" && return
|
2014-04-26 20:40:34 +00:00
|
|
|
fi
|
|
|
|
|
2014-05-05 22:07:13 +00:00
|
|
|
log "build: $prefix"
|
2014-04-26 20:40:34 +00:00
|
|
|
|
2020-07-13 20:11:30 +00:00
|
|
|
# shellcheck disable=SC2086
|
|
|
|
# KPATCHBUILD_OPTS may contain several space-separated options,
|
|
|
|
# it should remain without quotes.
|
|
|
|
if ! $KPATCHBUILD $KPATCHBUILD_OPTS -n "$modname" "$file" >> $LOG 2>&1; then
|
2018-08-10 14:47:01 +00:00
|
|
|
if [[ $shouldfail -eq 0 ]]; then
|
|
|
|
error "$prefix: build failed"
|
2020-06-03 09:02:59 +00:00
|
|
|
cp "$HOME/.kpatch/build.log" "$prefix.log"
|
2018-08-10 14:47:01 +00:00
|
|
|
fi
|
2014-04-26 20:40:34 +00:00
|
|
|
else
|
|
|
|
[[ $shouldfail -eq 1 ]] && error "$prefix: build succeeded when it should have failed"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
run_load_test() {
|
|
|
|
file=$1
|
2020-06-03 09:02:59 +00:00
|
|
|
prefix=$(basename "${file%%.patch}")
|
2018-06-01 13:46:22 +00:00
|
|
|
modname="test-$prefix"
|
|
|
|
module="${modname}.ko"
|
2020-06-03 09:02:59 +00:00
|
|
|
testprog=$(dirname "$1")/"$prefix-LOADED.test"
|
2014-04-26 20:40:34 +00:00
|
|
|
|
2014-09-15 13:20:43 +00:00
|
|
|
[[ $prefix =~ -FAIL ]] && return
|
2014-04-26 20:40:34 +00:00
|
|
|
|
|
|
|
if [[ ! -e $module ]]; then
|
2014-05-15 21:11:47 +00:00
|
|
|
log "can't find $module, skipping"
|
2014-04-26 20:40:34 +00:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2014-05-15 21:11:47 +00:00
|
|
|
if [[ -e $testprog ]]; then
|
|
|
|
log "load test: $prefix"
|
|
|
|
else
|
|
|
|
log "load test: $prefix (no test prog)"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2016-12-05 15:18:43 +00:00
|
|
|
if [[ -e $testprog ]] && $testprog >> $LOG 2>&1; then
|
2015-10-29 22:21:54 +00:00
|
|
|
error "$prefix: $testprog succeeded before kpatch load"
|
2014-04-28 18:32:00 +00:00
|
|
|
return
|
2014-04-26 20:40:34 +00:00
|
|
|
fi
|
|
|
|
|
2020-06-03 09:02:59 +00:00
|
|
|
if ! $KPATCH load "$module" >> $LOG 2>&1; then
|
2015-10-29 22:21:54 +00:00
|
|
|
error "$prefix: kpatch load failed"
|
2014-05-05 19:07:22 +00:00
|
|
|
return
|
2014-04-26 20:40:34 +00:00
|
|
|
fi
|
|
|
|
|
2016-12-05 15:18:43 +00:00
|
|
|
if [[ -e $testprog ]] && ! $testprog >> $LOG 2>&1; then
|
2015-10-29 22:21:54 +00:00
|
|
|
error "$prefix: $testprog failed after kpatch load"
|
|
|
|
fi
|
|
|
|
|
2020-06-03 09:02:59 +00:00
|
|
|
if ! $KPATCH unload "$module" >> $LOG 2>&1; then
|
2014-04-26 20:40:34 +00:00
|
|
|
error "$prefix: kpatch unload failed"
|
2014-04-28 18:32:00 +00:00
|
|
|
return
|
2014-04-26 20:40:34 +00:00
|
|
|
fi
|
|
|
|
|
2016-12-05 15:18:43 +00:00
|
|
|
if [[ -e $testprog ]] && $testprog >> $LOG 2>&1; then
|
2014-04-26 20:40:34 +00:00
|
|
|
error "$prefix: $testprog succeeded after kpatch unload"
|
2014-05-05 19:07:22 +00:00
|
|
|
return
|
|
|
|
fi
|
2014-04-26 20:40:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
run_custom_test() {
|
|
|
|
testprog=$1
|
2020-06-03 09:02:59 +00:00
|
|
|
prefix=$(basename "${testprog%%.test}")
|
2014-04-26 20:40:34 +00:00
|
|
|
|
|
|
|
[[ $testprog = *-LOADED.test ]] && return
|
|
|
|
|
2014-05-05 22:07:13 +00:00
|
|
|
log "custom test: $prefix"
|
2014-04-26 20:40:34 +00:00
|
|
|
|
2016-12-05 15:18:43 +00:00
|
|
|
if ! $testprog >> $LOG 2>&1; then
|
2014-04-26 20:40:34 +00:00
|
|
|
error "$prefix: test failed"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-05-27 13:34:21 +00:00
|
|
|
build_combined_module() {
|
|
|
|
|
2018-06-01 13:46:22 +00:00
|
|
|
if [[ $SKIPBUILD -eq 1 ]] && [[ -e test-COMBINED.ko ]]; then
|
2014-05-27 13:34:21 +00:00
|
|
|
log "skipping build: combined"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2016-12-07 20:05:41 +00:00
|
|
|
declare -a COMBINED_LIST
|
|
|
|
for file in "${PATCH_LIST[@]}"; do
|
|
|
|
[[ $file =~ -FAIL ]] && log "combine: skipping $file" && continue
|
2020-06-03 09:02:59 +00:00
|
|
|
COMBINED_LIST+=("$file")
|
2016-12-07 20:05:41 +00:00
|
|
|
done
|
|
|
|
if [[ ${#COMBINED_LIST[@]} -le 1 ]]; then
|
|
|
|
log "skipping build: combined (only ${#PATCH_LIST[@]} patch(es))"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2014-05-27 13:34:21 +00:00
|
|
|
log "build: combined module"
|
|
|
|
|
2020-07-13 20:11:30 +00:00
|
|
|
# shellcheck disable=SC2086
|
|
|
|
if ! $KPATCHBUILD $KPATCHBUILD_OPTS -n test-COMBINED "${COMBINED_LIST[@]}" >> $LOG 2>&1; then
|
2014-05-27 13:34:21 +00:00
|
|
|
error "combined build failed"
|
2020-06-03 09:02:59 +00:00
|
|
|
cp "$HOME/.kpatch/build.log" combined.log
|
2014-05-27 13:34:21 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
run_combined_test() {
|
2018-06-01 13:46:22 +00:00
|
|
|
if [[ ! -e test-COMBINED.ko ]]; then
|
|
|
|
log "can't find test-COMBINED.ko, skipping"
|
2014-05-27 13:34:21 +00:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
log "load test: combined module"
|
|
|
|
|
2015-10-29 22:21:54 +00:00
|
|
|
unload_all
|
|
|
|
|
2016-12-07 20:05:41 +00:00
|
|
|
for testprog in "${TEST_LIST[@]}"; do
|
2015-10-29 22:21:54 +00:00
|
|
|
[[ $testprog != *-LOADED.test ]] && continue
|
2016-12-05 15:18:43 +00:00
|
|
|
if $testprog >> $LOG 2>&1; then
|
2015-10-29 22:21:54 +00:00
|
|
|
error "combined: $testprog succeeded before kpatch load"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2018-06-01 13:46:22 +00:00
|
|
|
if ! $KPATCH load test-COMBINED.ko >> $LOG 2>&1; then
|
2015-10-29 22:21:54 +00:00
|
|
|
error "combined: kpatch load failed"
|
2014-05-27 13:34:21 +00:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2016-12-07 20:05:41 +00:00
|
|
|
for testprog in "${TEST_LIST[@]}"; do
|
2014-05-27 13:34:21 +00:00
|
|
|
[[ $testprog != *-LOADED.test ]] && continue
|
2020-06-03 09:02:59 +00:00
|
|
|
[ -e "${testprog/-LOADED.test/.patch.disabled}" ] && continue
|
2016-12-05 15:18:43 +00:00
|
|
|
if ! $testprog >> $LOG 2>&1; then
|
2015-10-29 22:21:54 +00:00
|
|
|
error "combined: $testprog failed after kpatch load"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2018-06-01 13:46:22 +00:00
|
|
|
if ! $KPATCH unload test-COMBINED.ko >> $LOG 2>&1; then
|
2015-10-29 22:21:54 +00:00
|
|
|
error "combined: kpatch unload failed"
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2016-12-07 20:05:41 +00:00
|
|
|
for testprog in "${TEST_LIST[@]}"; do
|
2015-10-29 22:21:54 +00:00
|
|
|
[[ $testprog != *-LOADED.test ]] && continue
|
2016-12-05 15:18:43 +00:00
|
|
|
if $testprog >> $LOG 2>&1; then
|
2015-10-29 22:21:54 +00:00
|
|
|
error "combined: $testprog succeeded after kpatch unload"
|
|
|
|
return
|
2014-05-27 13:34:21 +00:00
|
|
|
fi
|
|
|
|
done
|
2015-10-29 22:21:54 +00:00
|
|
|
|
2014-05-27 13:34:21 +00:00
|
|
|
}
|
|
|
|
|
2020-07-30 18:11:36 +00:00
|
|
|
# save existing dmesg so we can detect new content
|
|
|
|
save_dmesg() {
|
|
|
|
SAVED_DMESG="$(dmesg | tail -n1)"
|
|
|
|
}
|
|
|
|
|
|
|
|
# new dmesg entries since our saved entry
|
|
|
|
new_dmesg() {
|
|
|
|
if ! dmesg | awk -v last="$SAVED_DMESG" 'p; $0 == last{p=1} END {exit !p}'; then
|
|
|
|
error "dmesg overflow, try increasing kernel log buffer size"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-05-25 00:34:24 +00:00
|
|
|
kernel_version_gte() {
|
|
|
|
[ "${ARCHVERSION//-*/}" = "$(echo -e "${ARCHVERSION//-*}\\n$1" | sort -rV | head -n1)" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
support_klp_replace()
|
|
|
|
{
|
|
|
|
if kernel_is_rhel; then
|
|
|
|
rhel_kernel_version_gte 4.18.0-193.el8
|
|
|
|
else
|
|
|
|
kernel_version_gte 5.1.0
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
kernel_is_rhel() {
|
|
|
|
[[ "$ARCHVERSION" =~ \.el[789] ]]
|
|
|
|
}
|
|
|
|
|
|
|
|
rhel_kernel_version_gte() {
|
|
|
|
[ "${ARCHVERSION}" = "$(echo -e "${ARCHVERSION}\\n$1" | sort -rV | head -n1)" ]
|
|
|
|
}
|
|
|
|
|
2020-06-30 07:17:30 +00:00
|
|
|
# shellcheck disable=SC1091
|
|
|
|
source /etc/os-release
|
|
|
|
if [[ "${ID}" == "rhel" && "${VERSION_ID%%.*}" == "7" && "${VERSION_ID##*.}" -le "6" ]]; then
|
|
|
|
DYNDEBUG_ENABLED=0
|
|
|
|
echo "Dynamic debug is not supported on '${PRETTY_NAME}', disabling."
|
|
|
|
fi
|
|
|
|
|
2021-05-25 00:34:24 +00:00
|
|
|
if ! support_klp_replace ; then
|
|
|
|
KPATCHBUILD_OPTS="$KPATCHBUILD_OPTS -R"
|
|
|
|
echo "KLP replace is not supported on '${PRETTY_NAME}', disabling."
|
|
|
|
fi
|
|
|
|
|
2018-08-10 14:53:58 +00:00
|
|
|
for file in "${PATCH_LIST[@]}"; do
|
2020-06-03 09:02:59 +00:00
|
|
|
if [[ $QUICK != 1 || "$file" =~ -FAIL ]]; then
|
|
|
|
build_module "$file"
|
2018-08-10 14:53:58 +00:00
|
|
|
fi
|
|
|
|
done
|
2014-05-27 13:34:21 +00:00
|
|
|
|
|
|
|
build_combined_module
|
2014-04-26 20:40:34 +00:00
|
|
|
|
2014-05-05 19:07:22 +00:00
|
|
|
unload_all
|
|
|
|
|
2020-07-30 18:11:36 +00:00
|
|
|
save_dmesg
|
2020-07-30 18:11:36 +00:00
|
|
|
|
2020-06-30 07:17:30 +00:00
|
|
|
if [ "${DYNDEBUG_ENABLED}" == "1" ]; then
|
2021-11-02 04:05:57 +00:00
|
|
|
prev_dyndebug=$(sudo sh -c "grep klp_try_switch_task ${DYNDEBUG_CONTROL}" | awk '{print $3;}')
|
|
|
|
sudo sh -c "echo 'func klp_try_switch_task +p' > ${DYNDEBUG_CONTROL} 2>/dev/null"
|
2020-06-30 07:17:30 +00:00
|
|
|
fi
|
2020-05-20 12:54:41 +00:00
|
|
|
|
2014-05-27 13:34:21 +00:00
|
|
|
if [[ $QUICK != 1 ]]; then
|
2016-12-07 20:05:41 +00:00
|
|
|
for file in "${PATCH_LIST[@]}"; do
|
2020-06-03 09:02:59 +00:00
|
|
|
run_load_test "$file"
|
2014-05-27 13:34:21 +00:00
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
run_combined_test
|
|
|
|
|
|
|
|
if [[ $QUICK != 1 ]]; then
|
2016-12-07 20:05:41 +00:00
|
|
|
for testprog in "${TEST_LIST[@]}"; do
|
2018-12-10 14:54:37 +00:00
|
|
|
if [[ ! $testprog =~ -FAIL ]]; then
|
|
|
|
unload_all
|
2020-06-03 09:02:59 +00:00
|
|
|
run_custom_test "$testprog"
|
2018-12-10 14:54:37 +00:00
|
|
|
fi
|
2014-05-27 13:34:21 +00:00
|
|
|
done
|
|
|
|
fi
|
2014-04-26 20:40:34 +00:00
|
|
|
|
|
|
|
|
2014-05-05 19:07:22 +00:00
|
|
|
unload_all
|
|
|
|
|
2020-06-30 07:17:30 +00:00
|
|
|
if [ "${DYNDEBUG_ENABLED}" == "1" ]; then
|
2021-11-02 04:05:57 +00:00
|
|
|
sudo sh -c "echo \"func klp_try_switch_task ${prev_dyndebug}\" > ${DYNDEBUG_CONTROL} 2>/dev/null"
|
2020-06-30 07:17:30 +00:00
|
|
|
fi
|
2020-05-20 12:54:41 +00:00
|
|
|
|
2020-07-30 18:11:36 +00:00
|
|
|
if new_dmesg | grep -q "Call Trace"; then
|
|
|
|
new_dmesg > dmesg.log
|
2019-01-14 11:20:43 +00:00
|
|
|
error "kernel error detected in printk buffer"
|
|
|
|
fi
|
2014-06-27 18:19:08 +00:00
|
|
|
|
2014-05-20 19:33:17 +00:00
|
|
|
if [[ $ERROR -gt 0 ]]; then
|
|
|
|
log "$ERROR errors encountered"
|
|
|
|
echo "see test.log for more information"
|
|
|
|
else
|
|
|
|
log "SUCCESS"
|
|
|
|
fi
|
2014-04-26 20:40:34 +00:00
|
|
|
|
|
|
|
exit $ERROR
|