Home | History | Annotate | Download | only in preemptirq
      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 
     20 modprobe $MOD || unsup "$MOD module not available"
     21 rmmod $MOD
     22 
     23 grep -q "preemptoff" available_tracers || unsup "preemptoff tracer not enabled"
     24 grep -q "irqsoff" available_tracers || unsup "irqsoff tracer not enabled"
     25 
     26 reset_tracer
     27 
     28 # Simulate preemptoff section for half a second couple of times
     29 echo preemptoff > current_tracer
     30 sleep 1
     31 modprobe $MOD test_mode=preempt delay=500000 || fail
     32 rmmod $MOD || fail
     33 modprobe $MOD test_mode=preempt delay=500000 || fail
     34 rmmod $MOD || fail
     35 modprobe $MOD test_mode=preempt delay=500000 || fail
     36 rmmod $MOD || fail
     37 
     38 cat trace
     39 
     40 # Confirm which tracer
     41 grep -q "tracer: preemptoff" trace || fail
     42 
     43 # Check the end of the section
     44 egrep -q "5.....us : <stack trace>" trace || fail
     45 
     46 # Check for 500ms of latency
     47 egrep -q "latency: 5..... us" trace || fail
     48 
     49 reset_tracer
     50 
     51 # Simulate irqsoff section for half a second couple of times
     52 echo irqsoff > current_tracer
     53 sleep 1
     54 modprobe $MOD test_mode=irq delay=500000 || fail
     55 rmmod $MOD || fail
     56 modprobe $MOD test_mode=irq delay=500000 || fail
     57 rmmod $MOD || fail
     58 modprobe $MOD test_mode=irq delay=500000 || fail
     59 rmmod $MOD || fail
     60 
     61 cat trace
     62 
     63 # Confirm which tracer
     64 grep -q "tracer: irqsoff" trace || fail
     65 
     66 # Check the end of the section
     67 egrep -q "5.....us : <stack trace>" trace || fail
     68 
     69 # Check for 500ms of latency
     70 egrep -q "latency: 5..... us" trace || fail
     71 
     72 reset_tracer
     73 exit 0
     74