aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/damon/debugfs_target_ids.sh
diff options
context:
space:
mode:
authorSeongJae Park <sj@kernel.org>2021-12-10 14:46:59 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2021-12-10 17:10:56 -0800
commit9ab3b0c8ef629f60ef25cb7634ad305315ae94d1 (patch)
tree3a342ee9b4c21218cd1556fa4689fd30dc659ca3 /tools/testing/selftests/damon/debugfs_target_ids.sh
parentselftests/damon: test debugfs file reads/writes with huge count (diff)
downloadlinux-dev-9ab3b0c8ef629f60ef25cb7634ad305315ae94d1.tar.xz
linux-dev-9ab3b0c8ef629f60ef25cb7634ad305315ae94d1.zip
selftests/damon: split test cases
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/20211201150440.1088-12-sj@kernel.org Signed-off-by: SeongJae Park <sj@kernel.org> Cc: Brendan Higgins <brendanhiggins@google.com> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rw-r--r--tools/testing/selftests/damon/debugfs_target_ids.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/testing/selftests/damon/debugfs_target_ids.sh b/tools/testing/selftests/damon/debugfs_target_ids.sh
new file mode 100644
index 000000000000..49aeabdb0aae
--- /dev/null
+++ b/tools/testing/selftests/damon/debugfs_target_ids.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+source _debugfs_common.sh
+
+# Test target_ids file
+# ====================
+
+file="$DBGFS/target_ids"
+orig_content=$(cat "$file")
+
+test_write_succ "$file" "1 2 3 4" "$orig_content" "valid input"
+test_write_succ "$file" "1 2 abc 4" "$orig_content" "still valid input"
+test_content "$file" "$orig_content" "1 2" "non-integer was there"
+test_write_succ "$file" "abc 2 3" "$orig_content" "the file allows wrong input"
+test_content "$file" "$orig_content" "" "wrong input written"
+test_write_succ "$file" "" "$orig_content" "empty input"
+test_content "$file" "$orig_content" "" "empty input written"
+echo "$orig_content" > "$file"