mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	ftracetest: Add basic event tracing test cases
This patch adds basic event tracing tests like enable/disable with top-level, subsystem-level and individual event files. # ./ftracetest === Ftrace unit tests === [1] Basic trace file check [PASS] [2] Basic trace clock test [PASS] [3] Basic event tracing check [PASS] [4] Basic test for tracers [PASS] [5] event tracing - enable/disable with top level files [PASS] [6] event tracing - enable/disable with subsystem level files [PASS] [7] event tracing - enable/disable with event level files [PASS] [8] ftrace - function graph filters [PASS] [9] ftrace - function profiler with function tracing [PASS] [10] ftrace - function graph filters with stack tracer [PASS] [11] Kretprobe dynamic event with arguments [PASS] [12] Kprobe dynamic event - busy event check [PASS] [13] Kprobe dynamic event with arguments [PASS] [14] Kprobe dynamic event - adding and removing [PASS] # of passed: 14 # of failed: 0 # of unresolved: 0 # of untested: 0 # of unsupported: 0 # of xfailed: 0 # of undefined(test bug): 0 Link: http://lkml.kernel.org/r/1415239470-28705-3-git-send-email-namhyung@kernel.org Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
		
							parent
							
								
									ce1ac64b93
								
							
						
					
					
						commit
						815b18ea66
					
				
					 4 changed files with 158 additions and 0 deletions
				
			
		
							
								
								
									
										5
									
								
								tools/testing/selftests/ftrace/test.d/00basic/basic4.tc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								tools/testing/selftests/ftrace/test.d/00basic/basic4.tc
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					# description: Basic event tracing check
 | 
				
			||||||
 | 
					test -f available_events -a -f set_event -a -d events
 | 
				
			||||||
 | 
					# check scheduler events are available
 | 
				
			||||||
 | 
					grep -q sched available_events && exit 0 || exit -1
 | 
				
			||||||
							
								
								
									
										53
									
								
								tools/testing/selftests/ftrace/test.d/event/event-enable.tc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										53
									
								
								tools/testing/selftests/ftrace/test.d/event/event-enable.tc
									
									
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,53 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					# description: event tracing - enable/disable with event level files
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					do_reset() {
 | 
				
			||||||
 | 
					    echo > set_event
 | 
				
			||||||
 | 
					    clear_trace
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fail() { #msg
 | 
				
			||||||
 | 
					    do_reset
 | 
				
			||||||
 | 
					    echo $1
 | 
				
			||||||
 | 
					    exit -1
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ ! -f set_event -o ! -d events/sched ]; then
 | 
				
			||||||
 | 
					    echo "event tracing is not supported"
 | 
				
			||||||
 | 
					    exit_unsupported
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					reset_tracer
 | 
				
			||||||
 | 
					do_reset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo 'sched:sched_switch' > set_event
 | 
				
			||||||
 | 
					usleep 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					count=`cat trace | grep sched_switch | wc -l`
 | 
				
			||||||
 | 
					if [ $count -eq 0 ]; then
 | 
				
			||||||
 | 
					    fail "sched_switch events are not recorded"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					do_reset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo 1 > events/sched/sched_switch/enable
 | 
				
			||||||
 | 
					usleep 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					count=`cat trace | grep sched_switch | wc -l`
 | 
				
			||||||
 | 
					if [ $count -eq 0 ]; then
 | 
				
			||||||
 | 
					    fail "sched_switch events are not recorded"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					do_reset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo 0 > events/sched/sched_switch/enable
 | 
				
			||||||
 | 
					usleep 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					count=`cat trace | grep sched_switch | wc -l`
 | 
				
			||||||
 | 
					if [ $count -ne 0 ]; then
 | 
				
			||||||
 | 
					    fail "sched_switch events should not be recorded"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					do_reset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					exit 0
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,53 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					# description: event tracing - enable/disable with subsystem level files
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					do_reset() {
 | 
				
			||||||
 | 
					    echo > set_event
 | 
				
			||||||
 | 
					    clear_trace
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fail() { #msg
 | 
				
			||||||
 | 
					    do_reset
 | 
				
			||||||
 | 
					    echo $1
 | 
				
			||||||
 | 
					    exit -1
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ ! -f set_event -o ! -d events/sched ]; then
 | 
				
			||||||
 | 
					    echo "event tracing is not supported"
 | 
				
			||||||
 | 
					    exit_unsupported
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					reset_tracer
 | 
				
			||||||
 | 
					do_reset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo 'sched:*' > set_event
 | 
				
			||||||
 | 
					usleep 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
 | 
				
			||||||
 | 
					if [ $count -lt 3 ]; then
 | 
				
			||||||
 | 
					    fail "at least fork, exec and exit events should be recorded"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					do_reset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo 1 > events/sched/enable
 | 
				
			||||||
 | 
					usleep 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
 | 
				
			||||||
 | 
					if [ $count -lt 3 ]; then
 | 
				
			||||||
 | 
					    fail "at least fork, exec and exit events should be recorded"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					do_reset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo 0 > events/sched/enable
 | 
				
			||||||
 | 
					usleep 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					count=`cat trace | grep -v ^# | awk '{ print $5 }' | sort -u | wc -l`
 | 
				
			||||||
 | 
					if [ $count -ne 0 ]; then
 | 
				
			||||||
 | 
					    fail "any of scheduler events should not be recorded"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					do_reset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					exit 0
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,47 @@
 | 
				
			||||||
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					# description: event tracing - enable/disable with top level files
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					do_reset() {
 | 
				
			||||||
 | 
					    echo > set_event
 | 
				
			||||||
 | 
					    clear_trace
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					fail() { #msg
 | 
				
			||||||
 | 
					    do_reset
 | 
				
			||||||
 | 
					    echo $1
 | 
				
			||||||
 | 
					    exit -1
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ ! -f available_events -o ! -f set_event -o ! -d events ]; then
 | 
				
			||||||
 | 
					    echo "event tracing is not supported"
 | 
				
			||||||
 | 
					    exit_unsupported
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					reset_tracer
 | 
				
			||||||
 | 
					do_reset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo '*:*' > set_event
 | 
				
			||||||
 | 
					count=`cat trace | grep -v ^# | wc -l`
 | 
				
			||||||
 | 
					if [ $count -eq 0 ]; then
 | 
				
			||||||
 | 
					    fail "none of events are recorded"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					do_reset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo 1 > events/enable
 | 
				
			||||||
 | 
					count=`cat trace | grep -v ^# | wc -l`
 | 
				
			||||||
 | 
					if [ $count -eq 0 ]; then
 | 
				
			||||||
 | 
					    fail "none of events are recorded"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					do_reset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo 0 > events/enable
 | 
				
			||||||
 | 
					count=`cat trace | grep -v ^# | wc -l`
 | 
				
			||||||
 | 
					if [ $count -ne 0 ]; then
 | 
				
			||||||
 | 
					    fail "any of events should not be recorded"
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					do_reset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					exit 0
 | 
				
			||||||
		Loading…
	
		Reference in a new issue