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