xref: /linux/tools/testing/selftests/damon/debugfs_target_ids.sh (revision c5dbf04160005e07e8ca7232a7faa77ab1547ae0)
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3
4source _debugfs_common.sh
5
6# Test target_ids file
7# ====================
8
9file="$DBGFS/target_ids"
10orig_content=$(cat "$file")
11
12test_write_succ "$file" "1 2 3 4" "$orig_content" "valid input"
13test_write_succ "$file" "1 2 abc 4" "$orig_content" "still valid input"
14test_content "$file" "$orig_content" "1 2" "non-integer was there"
15test_write_succ "$file" "abc 2 3" "$orig_content" "the file allows wrong input"
16test_content "$file" "$orig_content" "" "wrong input written"
17test_write_succ "$file" "" "$orig_content" "empty input"
18test_content "$file" "$orig_content" "" "empty input written"
19echo "$orig_content" > "$file"
20