mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-31 06:14:39 +01:00
Currently, the single test program, debugfs.sh, contains all test cases for DAMON. When one of the cases fails, finding which case is failed from the test log is not so easy, and all remaining tests will be skipped. To improve the situation, this commit splits the single program into small test programs having their own names. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: SeongJae Park <[email protected]> Cc: Brendan Higgins <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
53 lines
911 B
Bash
53 lines
911 B
Bash
#!/bin/bash
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
test_write_result() {
|
|
file=$1
|
|
content=$2
|
|
orig_content=$3
|
|
expect_reason=$4
|
|
expected=$5
|
|
|
|
echo "$content" > "$file"
|
|
if [ $? -ne "$expected" ]
|
|
then
|
|
echo "writing $content to $file doesn't return $expected"
|
|
echo "expected because: $expect_reason"
|
|
echo "$orig_content" > "$file"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
test_write_succ() {
|
|
test_write_result "$1" "$2" "$3" "$4" 0
|
|
}
|
|
|
|
test_write_fail() {
|
|
test_write_result "$1" "$2" "$3" "$4" 1
|
|
}
|
|
|
|
test_content() {
|
|
file=$1
|
|
orig_content=$2
|
|
expected=$3
|
|
expect_reason=$4
|
|
|
|
content=$(cat "$file")
|
|
if [ "$content" != "$expected" ]
|
|
then
|
|
echo "reading $file expected $expected but $content"
|
|
echo "expected because: $expect_reason"
|
|
echo "$orig_content" > "$file"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
source ./_chk_dependency.sh
|
|
|
|
damon_onoff="$DBGFS/monitor_on"
|
|
if [ $(cat "$damon_onoff") = "on" ]
|
|
then
|
|
echo "monitoring is on"
|
|
exit $ksft_skip
|
|
fi
|