linux_dsm_epyc7002/tools/testing/selftests/zram/zram.sh
Shuah Khan (Samsung OSG) 685814466b selftests: zram: return Kselftest Skip code for skipped tests
When zram test is skipped because of unmet dependencies and/or
unsupported configuration, it exits with error which is treated as
a fail by the Kselftest framework. This leads to false negative result
even when the test could not be run.

Change it to return kselftest skip code when a test gets skipped to
clearly report that the test could not be run.

Kselftest framework SKIP code is 4 and the framework prints appropriate
messages to indicate that the test is skipped.

Signed-off-by: Shuah Khan (Samsung OSG) <shuah@kernel.org>
2018-06-18 09:11:09 -06:00

32 lines
600 B
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
TCID="zram.sh"
# Kselftest framework requirement - SKIP code is 4.
ksft_skip=4
. ./zram_lib.sh
run_zram () {
echo "--------------------"
echo "running zram tests"
echo "--------------------"
./zram01.sh
echo ""
./zram02.sh
}
check_prereqs
# check zram module exists
MODULE_PATH=/lib/modules/`uname -r`/kernel/drivers/block/zram/zram.ko
if [ -f $MODULE_PATH ]; then
run_zram
elif [ -b /dev/zram0 ]; then
run_zram
else
echo "$TCID : No zram.ko module or /dev/zram0 device file not found"
echo "$TCID : CONFIG_ZRAM is not set"
exit $ksft_skip
fi