summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/verification/test.d/rv_wwnr_printk.tc
blob: 5a59432b1d9331aeb109f625cfc3d6fb5e674f46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# description: Test wwnr monitor with printk reactor
# requires: available_reactors wwnr:monitor printk:reactor stress-ng:program

load() { # returns true if there was a reaction
	local lines_before num
	num=$((($(nproc) + 1) / 2))
	lines_before=$(dmesg | wc -l)
	stress-ng --cpu-sched "$num" --timer "$num" -t 5 -q
	dmesg | tail -n $((lines_before + 1)) | grep -q "rv: monitor wwnr does not allow event"
}

echo 1 > monitors/wwnr/enable
echo printk > monitors/wwnr/reactors

load

echo 0 > monitoring_on
! load
echo 1 > monitoring_on

load

echo 0 > reacting_on
! load
echo 1 > reacting_on

echo nop > monitors/wwnr/reactors
echo 0 > monitors/wwnr/enable