From 77fbf9296805c683cfd97035a8b967d4c3ba7c58 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 7 Nov 2023 12:11:08 -0800 Subject: [PATCH] Add t_trigger_set helper Add a helper to arm or disarm a trigger with a value argument. Signed-off-by: Zach Brown --- tests/funcs/fs.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/funcs/fs.sh b/tests/funcs/fs.sh index b4442252..080b5c5f 100644 --- a/tests/funcs/fs.sh +++ b/tests/funcs/fs.sh @@ -265,6 +265,15 @@ t_trigger_get() { cat "$(t_trigger_path "$nr")/$which" } +t_trigger_set() { + local which="$1" + local nr="$2" + local val="$3" + local path=$(t_trigger_path "$nr") + + echo "$val" > "$path/$which" +} + t_trigger_show() { local which="$1" local string="$2" @@ -276,9 +285,8 @@ t_trigger_show() { t_trigger_arm_silent() { local which="$1" local nr="$2" - local path=$(t_trigger_path "$nr") - echo 1 > "$path/$which" + t_trigger_set "$which" "$nr" 1 } t_trigger_arm() {