xref: /linux/tools/testing/selftests/damon/debugfs_empty_targets.sh (revision ef9226cd56b718c79184a3466d32984a51cb449c)
1#!/bin/bash
2# SPDX-License-Identifier: GPL-2.0
3
4source _debugfs_common.sh
5
6# Test empty targets case
7# =======================
8
9orig_target_ids=$(cat "$DBGFS/target_ids")
10echo "" > "$DBGFS/target_ids"
11
12if [ -f "$DBGFS/monitor_on_DEPRECATED" ]
13then
14	monitor_on_file="$DBGFS/monitor_on_DEPRECATED"
15else
16	monitor_on_file="$DBGFS/monitor_on"
17fi
18
19orig_monitor_on=$(cat "$monitor_on_file")
20test_write_fail "$monitor_on_file" "on" "orig_monitor_on" "empty target ids"
21echo "$orig_target_ids" > "$DBGFS/target_ids"
22