]>
Commit | Line | Data |
---|---|---|
8bd1369b JFG |
1 | #!/bin/sh |
2 | # SPDX-License-Identifier: GPL-2.0 | |
3 | # description: test for the preemptirqsoff tracer | |
4 | ||
5 | MOD=preemptirq_delay_test | |
6 | ||
7 | fail() { | |
8 | reset_tracer | |
9 | rmmod $MOD || true | |
10 | exit_fail | |
11 | } | |
12 | ||
13 | unsup() { #msg | |
14 | reset_tracer | |
15 | rmmod $MOD || true | |
16 | echo $1 | |
17 | exit_unsupported | |
18 | } | |
19 | ||
adb57164 PHL |
20 | unres() { #msg |
21 | reset_tracer | |
22 | rmmod $MOD || true | |
23 | echo $1 | |
24 | exit_unresolved | |
25 | } | |
26 | ||
27 | modprobe $MOD || unres "$MOD module not available" | |
8bd1369b JFG |
28 | rmmod $MOD |
29 | ||
30 | grep -q "preemptoff" available_tracers || unsup "preemptoff tracer not enabled" | |
31 | grep -q "irqsoff" available_tracers || unsup "irqsoff tracer not enabled" | |
32 | ||
33 | reset_tracer | |
34 | ||
35 | # Simulate preemptoff section for half a second couple of times | |
36 | echo preemptoff > current_tracer | |
37 | sleep 1 | |
38 | modprobe $MOD test_mode=preempt delay=500000 || fail | |
39 | rmmod $MOD || fail | |
40 | modprobe $MOD test_mode=preempt delay=500000 || fail | |
41 | rmmod $MOD || fail | |
42 | modprobe $MOD test_mode=preempt delay=500000 || fail | |
43 | rmmod $MOD || fail | |
44 | ||
45 | cat trace | |
46 | ||
47 | # Confirm which tracer | |
48 | grep -q "tracer: preemptoff" trace || fail | |
49 | ||
50 | # Check the end of the section | |
51 | egrep -q "5.....us : <stack trace>" trace || fail | |
52 | ||
53 | # Check for 500ms of latency | |
54 | egrep -q "latency: 5..... us" trace || fail | |
55 | ||
56 | reset_tracer | |
57 | ||
58 | # Simulate irqsoff section for half a second couple of times | |
59 | echo irqsoff > current_tracer | |
60 | sleep 1 | |
61 | modprobe $MOD test_mode=irq delay=500000 || fail | |
62 | rmmod $MOD || fail | |
63 | modprobe $MOD test_mode=irq delay=500000 || fail | |
64 | rmmod $MOD || fail | |
65 | modprobe $MOD test_mode=irq delay=500000 || fail | |
66 | rmmod $MOD || fail | |
67 | ||
68 | cat trace | |
69 | ||
70 | # Confirm which tracer | |
71 | grep -q "tracer: irqsoff" trace || fail | |
72 | ||
73 | # Check the end of the section | |
74 | egrep -q "5.....us : <stack trace>" trace || fail | |
75 | ||
76 | # Check for 500ms of latency | |
77 | egrep -q "latency: 5..... us" trace || fail | |
78 | ||
79 | reset_tracer | |
80 | exit 0 |