tracing: make ftrace tests to be extended
v3 cover tracing: make ftrace tests to be extended
For the purpose of extending these ftrace cases, We rewrite some of them to partition testcase into new structure.
- Reorganize the stress tests to ftrace general test, then that woule be easy to introduce new function/regression testcases in the next step.
- Adding two regression testcases as an example, We will roll out some more later.
- Enhance the ftrace-stress test coverage.
- Do some cleanup and bug fix work.
At last, test PASS all the new testcases on kernel-4.5.0.
Changes in V2 -> V3:
1. Fix bashism issue in ftrace_stress_test.sh.
2. ftrace_stress: remove the useless sleep in ftrace_stress_test.sh after wait.
3. ftrace_stress: remove useless ".test.sh" in some sub cases.
4. add ftrace_test_init to initiate test env and setup TST_CLEANUP=clean_up.
5. use tst_exit in ftrace_regression01 and ftrace_regression02, and remove the 'ignore' in tst_* usage.
6. simplify test_wait in ftrace_lib.sh.
7. cleanup the ';' in i=0 and j=0.
8. tst_random cleanup according to Cyril's advise.
Changes from V1:
1. Use ltp lib api.
2. Fix bashism issues.
3. ftrace_regression_test: make the two sub tests as two independent tests.
4. ftrace_stress: Wait for pid after execing a killing of sub test.
5. ftrace_stress: Fix tracing_cpumask test for case nr_cpu > 32.
6. ftrace_stress: Fix set_ftrace_filter test for module filter.
7. ftrace_stress: Fix small issue for trace_options test.
Chunyu Hu (6):
ftrace_stress: skip unsupported tests and early cleanup
ftrace_stress: keep the name of testscipt in sync with tracing file testcases/lib: Add tst_random decmical integer generator
ftrace_stress: update the trace_options test
ftrace_stress: add two new tests for ftrace_filter and
tracing_cpu_mask
ftrace_stress: cleanup and use ltp API
Li Wang (3):
tracing: reorganize ftrace-stress tests to general tests tracing/ftrace: add new case for ftrace userstacktrace tracing/ftrace: add a new case for signal_generate
doc/test-writing-guidelines.txt | 12 + runtest/tracing | 2 + .../kernel/tracing/ftrace_stress_test/Makefile | 7 - .../ftrace_stress/ftrace_buffer_size.sh | 45 ---- .../ftrace_stress/ftrace_current_tracer.sh | 34 --- .../ftrace_stress/ftrace_ftrace_enabled.sh | 39 ---- .../ftrace_stress/ftrace_profile_enabled.sh | 50 ----- .../ftrace_stress/ftrace_set_event.sh | 44 ---- .../ftrace_stress/ftrace_set_ftrace_pid.sh | 49 ----- .../ftrace_stress/ftrace_stack_max_size.sh | 39 ---- .../ftrace_stress/ftrace_stack_trace.sh | 46 ---- .../ftrace_stress/ftrace_trace.sh | 27 --- .../ftrace_stress/ftrace_trace_clock.sh | 46 ---- .../ftrace_stress/ftrace_trace_options.sh | 42 ---- .../ftrace_stress/ftrace_trace_pipe.sh | 52 ----- .../ftrace_stress/ftrace_trace_stat.sh | 45 ---- .../ftrace_stress/ftrace_tracing_enabled.sh | 39 ---- .../ftrace_stress/ftrace_tracing_max_latency.sh | 38 ---- .../ftrace_stress/ftrace_tracing_on.sh | 39 ---- .../ftrace_stress_test/ftrace_stress_test.sh | 243 --------------------- testcases/kernel/tracing/ftrace_test/Makefile | 7 + testcases/kernel/tracing/ftrace_test/ftrace_lib.sh | 183 ++++++++++++++++ .../tracing/ftrace_test/ftrace_regression01.sh | 85 +++++++ .../tracing/ftrace_test/ftrace_regression02.sh | 66 ++++++ .../ftrace_stress/ftrace_buffer_size_kb.sh | 45 ++++ .../ftrace_stress/ftrace_current_tracer.sh | 32 +++ .../ftrace_stress/ftrace_ftrace_enabled.sh | 38 ++++ .../ftrace_function_profile_enabled.sh | 38 ++++ .../ftrace_test/ftrace_stress/ftrace_set_event.sh | 46 ++++ .../ftrace_stress/ftrace_set_ftrace_filter.sh | 119 ++++++++++ .../ftrace_stress/ftrace_set_ftrace_pid.sh | 37 ++++ .../ftrace_stress/ftrace_stack_max_size.sh | 27 +++ .../ftrace_stress/ftrace_stack_trace.sh | 35 +++ .../ftrace_test/ftrace_stress/ftrace_trace.sh | 25 +++ .../ftrace_stress/ftrace_trace_clock.sh | 46 ++++ .../ftrace_stress/ftrace_trace_options.sh | 58 +++++ .../ftrace_test/ftrace_stress/ftrace_trace_pipe.sh | 45 ++++ .../ftrace_test/ftrace_stress/ftrace_trace_stat.sh | 45 ++++ .../ftrace_stress/ftrace_tracing_cpumask.sh | 91 ++++++++ .../ftrace_stress/ftrace_tracing_enabled.sh | 38 ++++ .../ftrace_stress/ftrace_tracing_max_latency.sh | 27 +++ .../ftrace_test/ftrace_stress/ftrace_tracing_on.sh | 38 ++++ .../tracing/ftrace_test/ftrace_stress_test.sh | 122 +++++++++++ testcases/lib/.gitignore | 1 + testcases/lib/Makefile | 4 +- testcases/lib/tst_random.c | 93 ++++++++ 46 files changed, 1403 insertions(+), 926 deletions(-) delete mode 100644 testcases/kernel/tracing/ftrace_stress_test/Makefile delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_buffer_size.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_current_tracer.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_ftrace_enabled.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_profile_enabled.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_set_event.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_set_ftrace_pid.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_stack_max_size.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_stack_trace.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_trace.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_trace_clock.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_trace_options.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_trace_pipe.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_trace_stat.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_tracing_enabled.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_tracing_max_latency.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_tracing_on.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress_test.sh create mode 100644 testcases/kernel/tracing/ftrace_test/Makefile create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_lib.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_regression01.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_regression02.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_buffer_size_kb.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_current_tracer.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_ftrace_enabled.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_function_profile_enabled.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_event.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_ftrace_filter.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_ftrace_pid.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_stack_max_size.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_stack_trace.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_clock.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_options.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_pipe.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_stat.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_cpumask.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_enabled.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_max_latency.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_on.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress_test.sh create mode 100644 testcases/lib/tst_random.c
Signature · 1 line
1.8.3.1
PATCH v3 1/9 tracing: reorganize ftrace-stress tests to general tests
From: Li Wang <[email protected]>
This commit is just preparing for the upcoming patch set. So do rename work, not changing anything of the content.
Changs:
- renamed: ftrace_stress_test/ --> ftrace_test/
- extracted: ftrace_stress_test.sh --> ftrace_lib.sh
- modified: ftrace_stress_test.sh
--- .../kernel/tracing/ftrace_stress_test/Makefile | 7 - .../ftrace_stress/ftrace_buffer_size.sh | 45 ---- .../ftrace_stress/ftrace_current_tracer.sh | 34 --- .../ftrace_stress/ftrace_ftrace_enabled.sh | 39 ---- .../ftrace_stress/ftrace_profile_enabled.sh | 50 ----- .../ftrace_stress/ftrace_set_event.sh | 44 ---- .../ftrace_stress/ftrace_set_ftrace_pid.sh | 49 ----- .../ftrace_stress/ftrace_stack_max_size.sh | 39 ---- .../ftrace_stress/ftrace_stack_trace.sh | 46 ---- .../ftrace_stress/ftrace_trace.sh | 27 --- .../ftrace_stress/ftrace_trace_clock.sh | 46 ---- .../ftrace_stress/ftrace_trace_options.sh | 42 ---- .../ftrace_stress/ftrace_trace_pipe.sh | 52 ----- .../ftrace_stress/ftrace_trace_stat.sh | 45 ---- .../ftrace_stress/ftrace_tracing_enabled.sh | 39 ---- .../ftrace_stress/ftrace_tracing_max_latency.sh | 38 ---- .../ftrace_stress/ftrace_tracing_on.sh | 39 ---- .../ftrace_stress_test/ftrace_stress_test.sh | 243 --------------------- testcases/kernel/tracing/ftrace_test/Makefile | 7 + testcases/kernel/tracing/ftrace_test/ftrace_lib.sh | 156 +++++++++++++ .../ftrace_stress/ftrace_buffer_size.sh | 45 ++++ .../ftrace_stress/ftrace_current_tracer.sh | 34 +++ .../ftrace_stress/ftrace_ftrace_enabled.sh | 39 ++++ .../ftrace_stress/ftrace_profile_enabled.sh | 50 +++++ .../ftrace_test/ftrace_stress/ftrace_set_event.sh | 44 ++++ .../ftrace_stress/ftrace_set_ftrace_pid.sh | 49 +++++ .../ftrace_stress/ftrace_stack_max_size.sh | 39 ++++ .../ftrace_stress/ftrace_stack_trace.sh | 46 ++++ .../ftrace_test/ftrace_stress/ftrace_trace.sh | 27 +++ .../ftrace_stress/ftrace_trace_clock.sh | 46 ++++ .../ftrace_stress/ftrace_trace_options.sh | 42 ++++ .../ftrace_test/ftrace_stress/ftrace_trace_pipe.sh | 52 +++++ .../ftrace_test/ftrace_stress/ftrace_trace_stat.sh | 45 ++++ .../ftrace_stress/ftrace_tracing_enabled.sh | 39 ++++ .../ftrace_stress/ftrace_tracing_max_latency.sh | 38 ++++ .../ftrace_test/ftrace_stress/ftrace_tracing_on.sh | 39 ++++ .../tracing/ftrace_test/ftrace_stress_test.sh | 123 +++++++++++ 37 files changed, 960 insertions(+), 924 deletions(-) delete mode 100644 testcases/kernel/tracing/ftrace_stress_test/Makefile delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_buffer_size.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_current_tracer.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_ftrace_enabled.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_profile_enabled.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_set_event.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_set_ftrace_pid.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_stack_max_size.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_stack_trace.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_trace.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_trace_clock.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_trace_options.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_trace_pipe.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_trace_stat.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_tracing_enabled.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_tracing_max_latency.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_tracing_on.sh delete mode 100755 testcases/kernel/tracing/ftrace_stress_test/ftrace_stress_test.sh create mode 100644 testcases/kernel/tracing/ftrace_test/Makefile create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_lib.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_buffer_size.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_current_tracer.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_ftrace_enabled.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_profile_enabled.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_event.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_ftrace_pid.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_stack_max_size.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_stack_trace.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_clock.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_options.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_pipe.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_stat.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_enabled.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_max_latency.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_on.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress_test.sh
testcases/kernel/tracing/ftrace_stress_test/Makefile deleted +0 -7
@@ -1,7 +0,0 @@ -top_srcdir ?= ../../../.. - -include $(top_srcdir)/include/mk/testcases.mk - -INSTALL_TARGETS := *.sh ftrace_stress/* - -include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_buffer_size.sh deleted +0 -45
45 lines not on this page · raw message
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_current_tracer.sh deleted +0 -34
@@ -1,34 +0,0 @@ -#! /bin/sh - -############################################################################### -# # -# Copyright (c) 2010 FUJITSU LIMITED # -# # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; either version 2 of the License, or (at your option) # -# any later version. # -# # -# Author: Li Zefan <[email protected]> # -# # -############################################################################### - -LOOP=200 - -for ((; ;)) -{ - for ((i = 0; i < $LOOP; i++)) - { - for tracer in `cat "$TRACING_PATH"/available_tracers` - do - if [ "$tracer" = mmiotrace ]; then - continue - fi - - echo $tracer > "$TRACING_PATH"/current_tracer 2> /dev/null - done - } - - sleep 1 -} -
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_ftrace_enabled.sh deleted +0 -39
@@ -1,39 +0,0 @@ -#! /bin/sh - -############################################################################### -# # -# Copyright (c) 2010 FUJITSU LIMITED # -# # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; either version 2 of the License, or (at your option) # -# any later version. # -# # -# Author: Li Zefan <[email protected]> # -# # -############################################################################### - -MAX_LOOP=1500 -count=0 - -for ((; ;)) -{ - count=$(( $count + 1 )) - - for ((i = 0; i < $MAX_LOOP; i++)) - { - echo 0 > /proc/sys/kernel/ftrace_enabled - echo 1 > /proc/sys/kernel/ftrace_enabled - } - - enable=$(( $count % 3 )) - - if [ $enable -eq 0 ]; then - echo 1 > /proc/sys/kernel/ftrace_enabled - else - echo 0 > /proc/sys/kernel/ftrace_enabled - fi - - sleep 1 -} -
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_profile_enabled.sh deleted +0 -50
50 lines not on this page · raw message
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_set_event.sh deleted +0 -44
44 lines not on this page · raw message
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_set_ftrace_pid.sh deleted +0 -49
49 lines not on this page · raw message
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_stack_max_size.sh deleted +0 -39
@@ -1,39 +0,0 @@ -#! /bin/sh - -############################################################################### -# # -# Copyright (c) 2010 FUJITSU LIMITED # -# # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; either version 2 of the License, or (at your option) # -# any later version. # -# # -# Author: Li Zefan <[email protected]> # -# # -############################################################################### - -MAX_STACK_SIZE=8192 - -if [ ! -e /proc/sys/kernel/stack_tracer_enabled ]; then - should_skip=1 -else - should_skip=0 -fi - -for ((; ;)) -{ - if [ $should_skip -eq 1 ]; then - sleep 2 - continue - fi - - for ((i = 0; i < $MAX_STACK_SIZE; i += 70)) - { - echo $i > "$TRACING_PATH"/stack_max_size - cat "$TRACING_PATH"/stack_max_size > /dev/null - } - - sleep 1 -} -
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_stack_trace.sh deleted +0 -46
46 lines not on this page · raw message
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_trace.sh deleted +0 -27
@@ -1,27 +0,0 @@ -#! /bin/sh - -############################################################################### -# # -# Copyright (c) 2010 FUJITSU LIMITED # -# # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; either version 2 of the License, or (at your option) # -# any later version. # -# # -# Author: Li Zefan <[email protected]> # -# # -############################################################################### - -LOOP=200 - -for ((; ;)) -{ - for ((i = 0; i < $LOOP; i++)) - { - cat "$TRACING_PATH"/trace > /dev/null - } - - sleep 1 -} -
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_trace_clock.sh deleted +0 -46
46 lines not on this page · raw message
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_trace_options.sh deleted +0 -42
42 lines not on this page · raw message
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_trace_pipe.sh deleted +0 -52
52 lines not on this page · raw message
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_trace_stat.sh deleted +0 -45
45 lines not on this page · raw message
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_tracing_enabled.sh deleted +0 -39
@@ -1,39 +0,0 @@ -#! /bin/sh - -############################################################################### -# # -# Copyright (c) 2010 FUJITSU LIMITED # -# # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; either version 2 of the License, or (at your option) # -# any later version. # -# # -# Author: Li Zefan <[email protected]> # -# # -############################################################################### - -MAX_LOOP=1500 -count=0 - -for ((; ;)) -{ - count=$(( $count + 1 )) - - for ((i = 0; i < $MAX_LOOP; i++)) - { - echo 0 > "$TRACING_PATH"/tracing_enabled - echo 1 > "$TRACING_PATH"/tracing_enabled - } - - enable=$(( $count % 3 )) - - if [ $enable -eq 0 ]; then - echo 0 > "$TRACING_PATH"/tracing_enabled - else - echo 1 > "$TRACING_PATH"/tracing_enabled - fi - - sleep 1 -} -
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_tracing_max_latency.sh deleted +0 -38
@@ -1,38 +0,0 @@ -#! /bin/sh - -############################################################################### -# # -# Copyright (c) 2010 FUJITSU LIMITED # -# # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; either version 2 of the License, or (at your option) # -# any later version. # -# # -# Author: Li Zefan <[email protected]> # -# # -############################################################################### - -MAX_LATENCY=100000 - -if [ ! -e "$TRACING_PATH"/tracing_max_latency ]; then - should_skip=1 -else - should_skip=0 -fi - -for ((; ;)) -{ - if [ $should_skip -eq 1 ]; then - sleep 2 - continue - fi - - for ((i = 0; i < $MAX_LATENCY; i += 400)) - { - echo $i > "$TRACING_PATH"/tracing_max_latency - } - - sleep 1 -} -
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress/ftrace_tracing_on.sh deleted +0 -39
@@ -1,39 +0,0 @@ -#! /bin/sh - -############################################################################### -# # -# Copyright (c) 2010 FUJITSU LIMITED # -# # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; either version 2 of the License, or (at your option) # -# any later version. # -# # -# Author: Li Zefan <[email protected]> # -# # -############################################################################### - -MAX_LOOP=1500 -count=0 - -for ((; ;)) -{ - count=$(( $count + 1 )) - - for ((i = 0; i < $MAX_LOOP; i++)) - { - echo 0 > "$TRACING_PATH"/tracing_on - echo 1 > "$TRACING_PATH"/tracing_on - } - - enable=$(( $count % 3 )) - - if [ $enable -eq 0 ]; then - echo 0 > "$TRACING_PATH"/tracing_on - else - echo 1 > "$TRACING_PATH"/tracing_on - fi - - sleep 1 -} -
testcases/kernel/tracing/ftrace_stress_test/ftrace_stress_test.sh deleted +0 -243
243 lines not on this page · raw message
testcases/kernel/tracing/ftrace_test/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +top_srcdir ?= ../../../.. + +include $(top_srcdir)/include/mk/testcases.mk + +INSTALL_TARGETS := *.sh ftrace_stress/* + +include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/kernel/tracing/ftrace_test/ftrace_lib.sh new file +156 -0
156 lines not on this page · raw message
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_buffer_size.sh new file +45 -0
45 lines not on this page · raw message
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_current_tracer.sh new file +34 -0
@@ -0,0 +1,34 @@ +#! /bin/sh + +############################################################################### +# # +# Copyright (c) 2010 FUJITSU LIMITED # +# # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; either version 2 of the License, or (at your option) # +# any later version. # +# # +# Author: Li Zefan <[email protected]> # +# # +############################################################################### + +LOOP=200 + +for ((; ;)) +{ + for ((i = 0; i < $LOOP; i++)) + { + for tracer in `cat "$TRACING_PATH"/available_tracers` + do + if [ "$tracer" = mmiotrace ]; then + continue + fi + + echo $tracer > "$TRACING_PATH"/current_tracer 2> /dev/null + done + } + + sleep 1 +} +
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_ftrace_enabled.sh new file +39 -0
@@ -0,0 +1,39 @@ +#! /bin/sh + +############################################################################### +# # +# Copyright (c) 2010 FUJITSU LIMITED # +# # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; either version 2 of the License, or (at your option) # +# any later version. # +# # +# Author: Li Zefan <[email protected]> # +# # +############################################################################### + +MAX_LOOP=1500 +count=0 + +for ((; ;)) +{ + count=$(( $count + 1 )) + + for ((i = 0; i < $MAX_LOOP; i++)) + { + echo 0 > /proc/sys/kernel/ftrace_enabled + echo 1 > /proc/sys/kernel/ftrace_enabled + } + + enable=$(( $count % 3 )) + + if [ $enable -eq 0 ]; then + echo 1 > /proc/sys/kernel/ftrace_enabled + else + echo 0 > /proc/sys/kernel/ftrace_enabled + fi + + sleep 1 +} +
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_profile_enabled.sh new file +50 -0
50 lines not on this page · raw message
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_event.sh new file +44 -0
44 lines not on this page · raw message
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_ftrace_pid.sh new file +49 -0
49 lines not on this page · raw message
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_stack_max_size.sh new file +39 -0
@@ -0,0 +1,39 @@ +#! /bin/sh + +############################################################################### +# # +# Copyright (c) 2010 FUJITSU LIMITED # +# # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; either version 2 of the License, or (at your option) # +# any later version. # +# # +# Author: Li Zefan <[email protected]> # +# # +############################################################################### + +MAX_STACK_SIZE=8192 + +if [ ! -e /proc/sys/kernel/stack_tracer_enabled ]; then + should_skip=1 +else + should_skip=0 +fi + +for ((; ;)) +{ + if [ $should_skip -eq 1 ]; then + sleep 2 + continue + fi + + for ((i = 0; i < $MAX_STACK_SIZE; i += 70)) + { + echo $i > "$TRACING_PATH"/stack_max_size + cat "$TRACING_PATH"/stack_max_size > /dev/null + } + + sleep 1 +} +
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_stack_trace.sh new file +46 -0
46 lines not on this page · raw message
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace.sh new file +27 -0
@@ -0,0 +1,27 @@ +#! /bin/sh + +############################################################################### +# # +# Copyright (c) 2010 FUJITSU LIMITED # +# # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; either version 2 of the License, or (at your option) # +# any later version. # +# # +# Author: Li Zefan <[email protected]> # +# # +############################################################################### + +LOOP=200 + +for ((; ;)) +{ + for ((i = 0; i < $LOOP; i++)) + { + cat "$TRACING_PATH"/trace > /dev/null + } + + sleep 1 +} +
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_clock.sh new file +46 -0
46 lines not on this page · raw message
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_options.sh new file +42 -0
42 lines not on this page · raw message
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_pipe.sh new file +52 -0
52 lines not on this page · raw message
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_stat.sh new file +45 -0
45 lines not on this page · raw message
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_enabled.sh new file +39 -0
@@ -0,0 +1,39 @@ +#! /bin/sh + +############################################################################### +# # +# Copyright (c) 2010 FUJITSU LIMITED # +# # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; either version 2 of the License, or (at your option) # +# any later version. # +# # +# Author: Li Zefan <[email protected]> # +# # +############################################################################### + +MAX_LOOP=1500 +count=0 + +for ((; ;)) +{ + count=$(( $count + 1 )) + + for ((i = 0; i < $MAX_LOOP; i++)) + { + echo 0 > "$TRACING_PATH"/tracing_enabled + echo 1 > "$TRACING_PATH"/tracing_enabled + } + + enable=$(( $count % 3 )) + + if [ $enable -eq 0 ]; then + echo 0 > "$TRACING_PATH"/tracing_enabled + else + echo 1 > "$TRACING_PATH"/tracing_enabled + fi + + sleep 1 +} +
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_max_latency.sh new file +38 -0
@@ -0,0 +1,38 @@ +#! /bin/sh + +############################################################################### +# # +# Copyright (c) 2010 FUJITSU LIMITED # +# # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; either version 2 of the License, or (at your option) # +# any later version. # +# # +# Author: Li Zefan <[email protected]> # +# # +############################################################################### + +MAX_LATENCY=100000 + +if [ ! -e "$TRACING_PATH"/tracing_max_latency ]; then + should_skip=1 +else + should_skip=0 +fi + +for ((; ;)) +{ + if [ $should_skip -eq 1 ]; then + sleep 2 + continue + fi + + for ((i = 0; i < $MAX_LATENCY; i += 400)) + { + echo $i > "$TRACING_PATH"/tracing_max_latency + } + + sleep 1 +} +
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_on.sh new file +39 -0
@@ -0,0 +1,39 @@ +#! /bin/sh + +############################################################################### +# # +# Copyright (c) 2010 FUJITSU LIMITED # +# # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; either version 2 of the License, or (at your option) # +# any later version. # +# # +# Author: Li Zefan <[email protected]> # +# # +############################################################################### + +MAX_LOOP=1500 +count=0 + +for ((; ;)) +{ + count=$(( $count + 1 )) + + for ((i = 0; i < $MAX_LOOP; i++)) + { + echo 0 > "$TRACING_PATH"/tracing_on + echo 1 > "$TRACING_PATH"/tracing_on + } + + enable=$(( $count % 3 )) + + if [ $enable -eq 0 ]; then + echo 0 > "$TRACING_PATH"/tracing_on + else + echo 1 > "$TRACING_PATH"/tracing_on + fi + + sleep 1 +} +
testcases/kernel/tracing/ftrace_test/ftrace_stress_test.sh new file +123 -0
123 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 2/9 tracing/ftrace: add new case for ftrace userstacktrace
From: Li Wang <[email protected]>
This case is the reproducer of ftrace userstacktrace bug.
BUG: unable to handle kernel paging request at 00000000417683c0
IP: [<ffffffff8105c834>] update_curr+0x124/0x1e0
PGD 41a796067 PUD 0
Thread overran stack, or stack corrupted
Oops: 0000 [#1] SMP
last sysfs file: /sys/devices/system/cpu/cpu15/cache/index2/shared_cpu_mapThe bug was fixed by:
1dbd195 (tracing: Fix preempt count leak)
--- runtest/tracing | 1 + .../tracing/ftrace_test/ftrace_regression01.sh | 86 ++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_regression01.sh
runtest/tracing +1 -0
@@ -1,2 +1,3 @@ #DESCRIPTION:Tracing testing +ftrace_regression01 ftrace_regression01.sh ftrace-stress-test ftrace_stress_test.sh 90
testcases/kernel/tracing/ftrace_test/ftrace_regression01.sh new file +86 -0
86 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 3/9 tracing/ftrace: add a new case for signal_generate
From: Li Wang <[email protected]>
PURPOSE: check signal:signal_generate gives 2 more fields: grp res
This testcase is writing for signal events change:
6c303d3 tracing: let trace_signal_generate() report more info... 163566f tracing: send_sigqueue() needs trace_signal_generate() too
--- runtest/tracing | 1 + .../tracing/ftrace_test/ftrace_regression02.sh | 67 ++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_regression02.sh
runtest/tracing +1 -0
@@ -1,3 +1,4 @@ #DESCRIPTION:Tracing testing ftrace_regression01 ftrace_regression01.sh +ftrace_regression02 ftrace_regression02.sh ftrace-stress-test ftrace_stress_test.sh 90
testcases/kernel/tracing/ftrace_test/ftrace_regression02.sh new file +67 -0
67 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 4/9 ftrace_stress: skip unsupported tests and early cleanup
Checking if it's supported before lanuching a test script. This action is through verifying the matched file in ftrace tracing direcrotry.
At the same time, transform the hard coded pids to the test_targets string and make it easier to be controlled.
With this modification, the outdated tracing_enabled issue can be skiped on newer kernels.
V2:
fix the bashism code style.
use ltp lib.
V3:
1 fix white space issue in test_kill.
2 fix another ${!var} bashism.
3 remove the unneened sleep 2.
4 move clean_up() out from test_kill.
5 Also an early cleanup ftrace_lib.sh after the reorg,
add a ftrace_test_init in ftrace_lib.sh, and move the save_old_setting in it, which will be called at test bebin.
6 remove the 'ignored' after tst_resm.
--- testcases/kernel/tracing/ftrace_test/ftrace_lib.sh | 110 +++++++++-------- .../tracing/ftrace_test/ftrace_regression01.sh | 5 +- .../tracing/ftrace_test/ftrace_regression02.sh | 7 +- .../ftrace_test/ftrace_stress/ftrace_set_event.sh | 5 +- .../ftrace_stress/ftrace_set_ftrace_pid.sh | 11 -- .../ftrace_stress/ftrace_stack_max_size.sh | 11 -- .../ftrace_stress/ftrace_stack_trace.sh | 12 -- .../ftrace_stress/ftrace_tracing_max_latency.sh | 12 -- .../tracing/ftrace_test/ftrace_stress_test.sh | 137 ++++++++++----------- 9 files changed, 138 insertions(+), 172 deletions(-)
testcases/kernel/tracing/ftrace_test/ftrace_lib.sh +62 -48
@@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/sh ########################################################################### ## ##
@@ -21,16 +21,40 @@ ## ## ########################################################################### -cd $LTPROOT/testcases/bin +. test.sh -export TPATH="$PWD" -export DEBUGFS_PATH="$PWD/debugfs" -export TRACING_PATH="$PWD/debugfs/tracing" -export FPATH="$TPATH/ftrace_function" -export RPATH="$TPATH/ftrace_regression" -export SPATH="$TPATH/ftrace_stress" +ftrace_test_init() +{ + export TPATH="$PWD" + export SPATH="$TPATH/ftrace_stress" + + if grep -q debugfs /proc/mounts; then + export DEBUGFS_PATH=/sys/kernel/debug/ + export TRACING_PATH="$DEBUGFS_PATH/tracing" + debugfs_def_mounted=1 + else + tst_tmpdir + export DEBUGFS_PATH="$PWD/debugfs" + export TRACING_PATH="$PWD/debugfs/tracing" + mkdir $DEBUGFS_PATH + mount -t debugfs xxx $DEBUGFS_PATH + fi -. test.sh + cd $LTPROOT/testcases/bin + + TST_CLEANUP=clean_up + + trap clean_up_exit INT + + tst_require_root + + # Check to see tracing feature is supported or not + if [ ! -d $TRACING_PATH ]; then + tst_brkm TCONF "Tracing is not supported. Skip the test..." + fi + + save_old_setting +} test_interval=$1
@@ -40,9 +64,12 @@ save_old_setting() old_trace_options=( `cat trace_options` ) old_tracing_on=`cat tracing_on` - old_tracing_enabled=`cat tracing_enabled` old_buffer_size=`cat buffer_size_kb` + if [ -e tracing_enabled ]; then + old_tracing_enabled=`cat tracing_enabled` + fi + if [ -e stack_max_size ]; then old_stack_tracer_enabled=`cat /proc/sys/kernel/stack_tracer_enabled` fi
@@ -55,11 +82,17 @@ save_old_setting() old_profile_enabled=`cat function_profile_enabled` fi + setting_saved=1 + cd - > /dev/null } restore_old_setting() { + if [ ! "$setting_saved" = 1 ]; then + return + fi + cd $TRACING_PATH echo nop > current_tracer
@@ -85,7 +118,10 @@ restore_old_setting() echo $old_buffer_size > buffer_size_kb echo $old_tracing_on > tracing_on - echo $old_tracing_enabled > tracing_enabled + + if [ -e tracing_enabled ];then + echo $old_tracing_enabled > tracing_enabled + fi for option in $old_trace_options do
@@ -97,20 +133,28 @@ restore_old_setting() cd - > /dev/null } +clean_up_mount() +{ + if [ ! "$debugfs_def_mounted" = "1" ]; then + umount $DEBUGFS_PATH + rmdir $DEBUGFS_PATH + fi +} + clean_up() { restore_old_setting - - umount $DEBUGFS_PATH - rmdir $DEBUGFS_PATH + clean_up_mount } clean_up_exit() { - clean_up + restore_old_setting + clean_up_mount exit 1 } + test_begin() { start_time=`date +%s`
@@ -118,39 +162,9 @@ test_begin() test_wait() { - for ((; ;)) - { - sleep 2 - - cur_time=`date +%s` - elapsed=$(( $cur_time - $start_time )) - - # run the test for $test_interval secs - if [ $elapsed -ge $test_interval ]; then - break - fi - } + # run the test for $test_interval secs + tst_sleep ${test_interval}s } -trap clean_up_exit INT - -tst_require_root - -# Don't run the test on kernels older than 2.6.34, otherwise -# it can crash the system if the kernel is not latest-stable -tst_kvercmp 2 6 34 -if [ $? -eq 0 ]; then - tst_brkm TCONF ignored "The test should be run in kernels >= 2.6.34. Skip the test..." - exit 0 -fi - -mkdir $DEBUGFS_PATH -mount -t debugfs xxx $DEBUGFS_PATH +ftrace_test_init -# Check to see tracing feature is supported or not -if [ ! -d $TRACING_PATH ]; then - tst_brkm TCONF ignored "Tracing is not supported. Skip the test..." - umount $DEBUGFS_PATH - rmdir $DEBUGFS_PATH - exit 0 -fi
testcases/kernel/tracing/ftrace_test/ftrace_regression01.sh +2 -3
@@ -79,8 +79,7 @@ ftrace_userstacktrace_test() } #--------Test Start-------------- -save_old_setting - ftrace_userstacktrace_test -clean_up +tst_exit +
testcases/kernel/tracing/ftrace_test/ftrace_regression02.sh +3 -4
@@ -57,11 +57,10 @@ ftrace_signal_test() #-----Test Start-------- tst_kvercmp 3 2 0 if [ $? -eq 0 ]; then - tst_brkm TCONF ignored "The test should be run in kernels >= 3.2.0 Skip the test..." + tst_brkm TCONF "The test should be run in kernels >= 3.2.0 Skip the test..." fi -save_old_setting - ftrace_signal_test -clean_up +tst_exit +
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_event.sh +4 -1
@@ -36,9 +36,12 @@ for ((; ;)) for event in `cat $TRACING_PATH/available_events`; do + # ftrace event sys is special, skip it + if echo "$event" | grep "ftrace:*"; then + continue + fi echo $event >> "$TRACING_PATH"/set_event done sleep 1 } -
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_ftrace_pid.sh +0 -11
@@ -15,19 +15,9 @@ LOOP=300 -if [ ! -e "$TRACING_PATH"/set_ftrace_pid ]; then - should_skip=1 -else - should_skip=0 -fi for ((; ; )) { - if [ $should_skip -eq 1 ]; then - sleep 2 - continue - fi - for ((j = 0; j < $LOOP; j++)) { for ((k = 1; k <= NR_PIDS; k++))
@@ -46,4 +36,3 @@ for ((; ; )) sleep 1 } -
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_stack_max_size.sh +0 -11
@@ -15,19 +15,8 @@ MAX_STACK_SIZE=8192 -if [ ! -e /proc/sys/kernel/stack_tracer_enabled ]; then - should_skip=1 -else - should_skip=0 -fi - for ((; ;)) { - if [ $should_skip -eq 1 ]; then - sleep 2 - continue - fi - for ((i = 0; i < $MAX_STACK_SIZE; i += 70)) { echo $i > "$TRACING_PATH"/stack_max_size
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_stack_trace.sh +0 -12
@@ -15,19 +15,8 @@ LOOP=400 -if [ ! -e /proc/sys/kernel/stack_tracer_enabled ]; then - should_skip=1 -else - should_skip=0 -fi - for ((; ;)) { - if [ $should_skip -eq 1 ]; then - sleep 2 - continue - fi - for ((i = 0; i < $LOOP; i++)) { cat "$TRACING_PATH"/stack_trace > /dev/null
@@ -43,4 +32,3 @@ for ((; ;)) sleep 1 } -
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_max_latency.sh +0 -12
@@ -15,19 +15,8 @@ MAX_LATENCY=100000 -if [ ! -e "$TRACING_PATH"/tracing_max_latency ]; then - should_skip=1 -else - should_skip=0 -fi - for ((; ;)) { - if [ $should_skip -eq 1 ]; then - sleep 2 - continue - fi - for ((i = 0; i < $MAX_LATENCY; i += 400)) { echo $i > "$TRACING_PATH"/tracing_max_latency
@@ -35,4 +24,3 @@ for ((; ;)) sleep 1 } -
testcases/kernel/tracing/ftrace_test/ftrace_stress_test.sh +67 -70
167 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 5/9 ftrace_stress: keep the name of testscipt in sync with tracing file
The test scripts under ftrace_stress/ are all named after the tracing file with a 'ftrace_' prefix, except the ftrace_buffer_size.sh and ftrace_profile_enabled.sh. Here just rename them.
--- .../ftrace_stress/ftrace_buffer_size.sh | 45 ------------------- .../ftrace_stress/ftrace_buffer_size_kb.sh | 45 +++++++++++++++++++ .../ftrace_function_profile_enabled.sh | 50 ++++++++++++++++++++++ .../ftrace_stress/ftrace_profile_enabled.sh | 50 ---------------------- 4 files changed, 95 insertions(+), 95 deletions(-) delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_buffer_size.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_buffer_size_kb.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_function_profile_enabled.sh delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_profile_enabled.sh
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_buffer_size.sh deleted +0 -45
@@ -1,45 +0,0 @@ -#! /bin/sh - -############################################################################### -# # -# Copyright (c) 2010 FUJITSU LIMITED # -# # -# This program is free software; you can redistribute it and/or modify it # -# under the terms of the GNU General Public License as published by the Free # -# Software Foundation; either version 2 of the License, or (at your option) # -# any later version. # -# # -# Author: Li Zefan <[email protected]> # -# # -############################################################################### - -LOOP=200 - -# Use up to 10% of free memory -free_mem=`cat /proc/meminfo | grep '^MemFree' | awk '{ print $2 }'` -cpus=`tst_ncpus` - -step=$(( $free_mem / 10 / $LOOP / $cpus )) - -if [ $step -eq 0 ]; then - step=1 - LOOP=50 -fi - -for ((; ;)) -{ - new_size=1 - for ((i = 0; i < $LOOP; i++)) - { - echo $new_size > "$TRACING_PATH"/buffer_size_kb - new_size=$(( $new_size + $step )) - } - - for ((i = 0; i < $LOOP; i++)) - { - new_size=$(( $new_size - $step )) - echo $new_size > "$TRACING_PATH"/buffer_size_kb - } - - sleep 1 -}
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_buffer_size_kb.sh new file +45 -0
45 lines not on this page · raw message
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_function_profile_enabled.sh new file +50 -0
50 lines not on this page · raw message
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_profile_enabled.sh deleted +0 -50
50 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 6/9 testcases/lib: Add tst_random decmical integer generator
It parse the input range and get one decimical integer in the range. Tests can use it to determin a random action.
+ documentation in the test-writing-guidelines
--- doc/test-writing-guidelines.txt | 12 ++++++ testcases/lib/.gitignore | 1 + testcases/lib/Makefile | 4 +- testcases/lib/tst_random.c | 93 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 108 insertions(+), 2 deletions(-) create mode 100644 testcases/lib/tst_random.c
doc/test-writing-guidelines.txt +12 -0
@@ -1203,6 +1203,18 @@ that can sleep for defined amount of seconds, milliseconds or microseconds. tst_sleep 100ms ------------------------------------------------------------------------------- +tst_random ++++++++++ + +There may be test such as ftrace_test using random integer to determin the test action. +here includes 'tst_random' to support it, avoid the `date+%N` action. + +[source,sh] +------------------------------------------------------------------------------- +# get random integer between 0 and 1000 (include 0 and 1000) +tst_random 0 1000 +------------------------------------------------------------------------------- + ROD and ROD_SILENT ++++++++++++++++++
testcases/lib/.gitignore +1 -0
@@ -1 +1,2 @@ tst_sleep +tst_random
testcases/lib/Makefile +2 -2
@@ -24,8 +24,8 @@ top_srcdir ?= ../.. include $(top_srcdir)/include/mk/env_pre.mk -INSTALL_TARGETS := *.sh tst_sleep +INSTALL_TARGETS := *.sh tst_sleep tst_random -MAKE_TARGETS := tst_sleep +MAKE_TARGETS := tst_sleep tst_random include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/lib/tst_random.c new file +93 -0
93 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v3 7/9 ftrace_stress: update the trace_options test
The ftrace_trace_options.sh is using hard coced trace options, including the outdated 'branch', so let's get the trace_options dynamicly from the trace_options file.
V2:
Use tst_random.
Fix bashism code style.
Use ltp lib.
Check the existence before setting.
V3:
Remove the unneeded code comment.
use tst_random directly.
--- .../ftrace_stress/ftrace_trace_options.sh | 58 ++++++++++++++-------- 1 file changed, 37 insertions(+), 21 deletions(-)
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_options.sh +37 -21
@@ -13,30 +13,46 @@ # # ############################################################################### -LOOP=200 - -trace_options=(print-parent sym-offset sym-addr verbose raw hex bin block trace_printk ftrace_preempt branch annotate userstacktrace sym-userobj printk-msg-only context-info latency-format sleep-time graph-time) +. test.sh -NR_TRACE_OPTIONS=19 - -for ((; ; )) -{ - for ((j = 0; j < $LOOP; j++)) - { - num=`date +%N` - num=`printf 1%s $num` +LOOP=200 - for ((i = 0; i < $NR_TRACE_OPTIONS; i++)) - { - n=$(( ( $num >> $i ) % 2 )) +while true; do + j=0; + while [ $j -lt $LOOP ]; do + trace_options="$(ls $TRACING_PATH/options/)" + # enable the nop_test_refuse can cause an + # 'write error: Invalid argument'. So don't test it. + trace_options="$(echo $trace_options | sed 's/test_nop_refuse//')" + nr_trace_options=$(echo "${trace_options}" | wc -w) + + option_index=$(tst_random 1 $nr_trace_options) + option=$(echo "$trace_options" | awk "{print \$$option_index}") + i=0 + while [ $i -lt $nr_trace_options ]; do + n=$(tst_random 0 1) + opt_f="$TRACING_PATH"/options/$option + ret_val=0 if [ $n -eq 0 ]; then - echo 0 > "$TRACING_PATH"/options/${trace_options[$i]} + operation="setup" else - echo 1 > "$TRACING_PATH"/options/${trace_options[$i]} + operation="clear" + fi + # On old kernel, some trace option dirs + # won't be made if the option has nothing + # to do with the current tracer. But on newer + # kernel(4.4-rc1), all option dirs will be made. + # So here check it to avoid 'Permision denied' + if [ -f $opt_f ]; then + echo $n > $opt_f + ret_val=$? fi - } - } - - sleep 1 -} + if [ $ret_val -ne 0 ]; then + tst_resm TFAIL "$0: $operation trace option $option failed" + fi + i=$((i + 1)) + done + j=$((j + 1)) + done +done
Signature · 1 line
1.8.3.1
PATCH v3 8/9 ftrace_stress: add two new tests for ftrace_filter and tracing_cpu_mask
V3:
Fix code comment.
Remove the ';' in 'i=0's
Use tst_random directly
simplify the reset of set_ftrace_filter
V2:
Use tst_random to get random integer.
Fix bashism code.
Simplify the get of cpu mask, make it work with nr_cpu > 32. Update the set_ftrace_filter, use awk instead sed.small fix moddule filter. Use ltp lib.
V1:
add ftrace_tracing_cpumask.sh.
add ftrace_set_ftrace_filter.sh.
--- testcases/kernel/tracing/ftrace_test/ftrace_lib.sh | 13 +++ .../ftrace_stress/ftrace_set_ftrace_filter.sh | 119 +++++++++++++++++++++ .../ftrace_stress/ftrace_tracing_cpumask.sh | 91 ++++++++++++++++ .../tracing/ftrace_test/ftrace_stress_test.sh | 3 +- 4 files changed, 225 insertions(+), 1 deletion(-) create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_ftrace_filter.sh create mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_cpumask.sh
testcases/kernel/tracing/ftrace_test/ftrace_lib.sh +13 -0
@@ -65,6 +65,11 @@ save_old_setting() old_trace_options=( `cat trace_options` ) old_tracing_on=`cat tracing_on` old_buffer_size=`cat buffer_size_kb` + old_tracing_cpumask=`cat tracing_cpumask` + + if [ -e tracing_cpumask ]; then + old_tracing_cpumask=`cat tracing_cpumask` + fi if [ -e tracing_enabled ]; then old_tracing_enabled=`cat tracing_enabled`
@@ -99,6 +104,10 @@ restore_old_setting() echo 0 > events/enable echo 0 > tracing_max_latency 2> /dev/null + if [ -e tracing_cpumask ]; then + echo $old_tracing_cpumask > tracing_cpumask + fi + if [ -e trace_clock ]; then echo local > trace_clock fi
@@ -130,6 +139,10 @@ restore_old_setting() echo > trace + if [ -f set_ftrace_filter ]; then + echo > set_ftrace_filter + fi + cd - > /dev/null }
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_ftrace_filter.sh new file +119 -0
119 lines not on this page · raw message
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_cpumask.sh new file +91 -0
91 lines not on this page · raw message
testcases/kernel/tracing/ftrace_test/ftrace_stress_test.sh +2 -1
@@ -31,7 +31,8 @@ test_targets=" \ trace_pipe current_tracer ftrace_enabled function_profile_enabled \ set_event set_ftrace_pid stack_max_size stack_trace trace trace_clock \ trace_options trace_stat tracing_enabled tracing_max_latency \ -tracing_on function_profile_enabled buffer_size_kb" +tracing_on function_profile_enabled buffer_size_kb tracing_cpumask \ +set_ftrace_filter" get_skip_targets() {
Signature · 1 line
1.8.3.1
PATCH v3 9/9 ftrace_stress: cleanup and use ltp API
V2:
1. fix the bashism code style.
2. Use ltp API.
V3:
1. Remove all the tail ';' in 'i=0;' and 'j=0;'
2. ftrace_buffer_size_kb.sh
remove the '. test.sh' in tests that don't use it.
3. ftrace_trace_clock.sh
remove the TRACING_PATH var.
4. ftrace_trace_pipe.sh
remove '. test.sh'.
remove the ftrace_sleep, use tst_sleep instead.
5. ftrace_trace_stat.sh
use tst_random directly.
--- .../ftrace_stress/ftrace_buffer_size_kb.sh | 20 +++++++------- .../ftrace_stress/ftrace_current_tracer.sh | 14 +++++----- .../ftrace_stress/ftrace_ftrace_enabled.sh | 13 +++++---- .../ftrace_function_profile_enabled.sh | 24 +++++------------ .../ftrace_test/ftrace_stress/ftrace_set_event.sh | 25 +++++++++-------- .../ftrace_stress/ftrace_set_ftrace_pid.sh | 21 +++++++-------- .../ftrace_stress/ftrace_stack_max_size.sh | 13 +++++---- .../ftrace_stress/ftrace_stack_trace.sh | 19 ++++++------- .../ftrace_test/ftrace_stress/ftrace_trace.sh | 14 +++++----- .../ftrace_stress/ftrace_trace_clock.sh | 22 +++++++-------- .../ftrace_stress/ftrace_trace_options.sh | 2 +- .../ftrace_test/ftrace_stress/ftrace_trace_pipe.sh | 31 +++++++++------------- .../ftrace_test/ftrace_stress/ftrace_trace_stat.sh | 18 ++++++------- .../ftrace_stress/ftrace_tracing_enabled.sh | 13 +++++---- .../ftrace_stress/ftrace_tracing_max_latency.sh | 13 ++++----- .../ftrace_test/ftrace_stress/ftrace_tracing_on.sh | 13 +++++---- 16 files changed, 124 insertions(+), 151 deletions(-)
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_buffer_size_kb.sh +10 -10
@@ -26,20 +26,20 @@ if [ $step -eq 0 ]; then LOOP=50 fi -for ((; ;)) -{ +while true; do new_size=1 - for ((i = 0; i < $LOOP; i++)) - { + i=0 + while [ $i -lt $LOOP ]; do echo $new_size > "$TRACING_PATH"/buffer_size_kb new_size=$(( $new_size + $step )) - } + i=$((i + 1)) + done - for ((i = 0; i < $LOOP; i++)) - { + i=0 + while [ $i -lt $LOOP ]; do new_size=$(( $new_size - $step )) echo $new_size > "$TRACING_PATH"/buffer_size_kb - } - + i=$((i + 1)) + done sleep 1 -} +done
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_current_tracer.sh +6 -8
@@ -15,10 +15,9 @@ LOOP=200 -for ((; ;)) -{ - for ((i = 0; i < $LOOP; i++)) - { +while true; do + i=0 + while [ $i -lt $LOOP ]; do for tracer in `cat "$TRACING_PATH"/available_tracers` do if [ "$tracer" = mmiotrace ]; then
@@ -27,8 +26,7 @@ for ((; ;)) echo $tracer > "$TRACING_PATH"/current_tracer 2> /dev/null done - } - + i=$((i + 1)) + done sleep 1 -} - +done
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_ftrace_enabled.sh +6 -7
@@ -16,15 +16,14 @@ MAX_LOOP=1500 count=0 -for ((; ;)) -{ +while true; do count=$(( $count + 1 )) - - for ((i = 0; i < $MAX_LOOP; i++)) - { + i=0 + while [ $i -lt $MAX_LOOP ]; do echo 0 > /proc/sys/kernel/ftrace_enabled echo 1 > /proc/sys/kernel/ftrace_enabled - } + i=$((i + 1)) + done enable=$(( $count % 3 ))
@@ -35,5 +34,5 @@ for ((; ;)) fi sleep 1 -} +done
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_function_profile_enabled.sh +6 -18
@@ -16,26 +16,15 @@ MAX_LOOP=1500 count=0 -if [ ! -e "$TRACING_PATH"/function_profile_enabled ]; then - should_skip=1 -else - should_skip=0 -fi - -for ((; ;)) -{ - if [ $should_skip -eq 1 ]; then - sleep 2 - continue - fi +while true; do count=$(( $count + 1 )) - - for ((i = 0; i < $MAX_LOOP; i++)) - { + i=0 + while [ $i -lt $MAX_LOOP ]; do echo 0 > "$TRACING_PATH"/function_profile_enabled 2> /dev/null echo 1 > "$TRACING_PATH"/function_profile_enabled 2> /dev/null - } + i=$((i + 1)) + done enable=$(( $count % 3 ))
@@ -46,5 +35,4 @@ for ((; ;)) fi sleep 1 -} - +done
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_event.sh +12 -13
@@ -13,29 +13,28 @@ # # ############################################################################### -for ((; ;)) -{ - for ((i = 0; i < 100; i++)) - { +while true; do + i=0 + while [ $i -lt 100 ]; do echo 1 > "$TRACING_PATH"/events/enable echo 0 > "$TRACING_PATH"/events/enable - } + i=$((i + 1)) + done - for dir in `ls $TRACING_PATH/events/` - do + for dir in `ls $TRACING_PATH/events/`; do if [ ! -d $dir -o "$dir" = ftrace ]; then continue; fi - for ((i = 0; i < 20; i++)) - { + i=0 + while [ $i -lt 20 ]; do echo 1 > "$TRACING_PATH"/events/$dir/enable echo 0 > "$TRACING_PATH"/events/$dir/enable - } + i=$((i + 1)) + done done - for event in `cat $TRACING_PATH/available_events`; - do + for event in `cat $TRACING_PATH/available_events`; do # ftrace event sys is special, skip it if echo "$event" | grep "ftrace:*"; then continue
@@ -44,4 +43,4 @@ for ((; ;)) done sleep 1 -} +done
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_ftrace_pid.sh +10 -11
@@ -15,16 +15,15 @@ LOOP=300 - -for ((; ; )) -{ - for ((j = 0; j < $LOOP; j++)) - { - for ((k = 1; k <= NR_PIDS; k++)) - { +while true; do + j=0 + while [ $j -lt $LOOP ]; do + k=1 + while [ $k -le $NR_PIDS ]; do str="\$pid$k" eval echo $str >> "$TRACING_PATH"/set_ftrace_pid - } + k=$((k + 1)) + done if ! echo > "$TRACING_PATH"/set_ftrace_pid >/dev/null 2>&1; then if ! echo -1 > "$TRACING_PATH"/set_ftrace_pid >/dev/null 2>&1; then
@@ -32,7 +31,7 @@ for ((; ; )) exit 1 fi fi - } - + j=$((j + 1)) + done sleep 1 -} +done
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_stack_max_size.sh +6 -7
@@ -15,14 +15,13 @@ MAX_STACK_SIZE=8192 -for ((; ;)) -{ - for ((i = 0; i < $MAX_STACK_SIZE; i += 70)) - { +while true; do + i=0 + while [ $i -lt $MAX_STACK_SIZE ]; do echo $i > "$TRACING_PATH"/stack_max_size cat "$TRACING_PATH"/stack_max_size > /dev/null - } - + i=$((i + 1)) + done sleep 1 -} +done
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_stack_trace.sh +10 -9
@@ -15,20 +15,21 @@ LOOP=400 -for ((; ;)) -{ - for ((i = 0; i < $LOOP; i++)) - { +while true; do + i=0 + while [ $i -lt $LOOP ]; do cat "$TRACING_PATH"/stack_trace > /dev/null - } + i=$((i + 1)) + done sleep 1 - for ((i = 0; i < $LOOP; i++)) - { + i=0 + while [ $i -lt $LOOP ]; do echo 0 > /proc/sys/kernel/stack_tracer_enabled echo 1 > /proc/sys/kernel/stack_tracer_enabled - } + i=$((i + 1)) + done sleep 1 -} +done
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace.sh +6 -8
@@ -15,13 +15,11 @@ LOOP=200 -for ((; ;)) -{ - for ((i = 0; i < $LOOP; i++)) - { +i=0; +while true; do + while [ $i -lt $LOOP ]; do cat "$TRACING_PATH"/trace > /dev/null - } - + i=$((i + 1)) + done sleep 1 -} - +done
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_clock.sh +11 -11
@@ -24,23 +24,23 @@ else old_kernel=0 fi -for ((; ;)) -{ - if [ $old_kernel -eq 1 ]; - then - for ((i = 0; i < $LOOP; i++)) - { +while true; do + i=0 + if [ $old_kernel -eq 1 ]; then + while [ $i -lt $LOOP ]; do echo 1 > "$TRACING_PATH"/options/global-clock echo 0 > "$TRACING_PATH"/options/global-clock - } + i=$((i + 1)) + done else - for ((i = 0; i < $LOOP; i++)) - { + while [ $i -lt $LOOP ]; do echo local > "$TRACING_PATH"/trace_clock echo global > "$TRACING_PATH"/trace_clock - } + i=$((i + 1)) + done + fi sleep 1 -} +done
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_options.sh +1 -1
@@ -18,7 +18,7 @@ LOOP=200 while true; do - j=0; + j=0 while [ $j -lt $LOOP ]; do trace_options="$(ls $TRACING_PATH/options/)" # enable the nop_test_refuse can cause an
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_pipe.sh +12 -19
@@ -13,15 +13,6 @@ # # ############################################################################### -ftrace_sleep() -{ - # usleep is not a standard command? - usleep 200000 2> /dev/null - if [ $? -ne 0 ]; then - sleep 1 - fi -} - kill_this_pid() { /bin/kill -SIGKILL $this_pid
@@ -33,20 +24,22 @@ trap kill_this_pid SIGUSR1 LOOP=20 -for ((; ;)) -{ - for ((i = 0; i < $LOOP; i++)) - { +while true; do + i=0 + while [ $i -lt $LOOP ]; do cat "$TRACING_PATH"/trace_pipe > /dev/null & - this_pid=$! - ftrace_sleep + + tst_sleep 200000us + /bin/kill -SIGINT $this_pid wait $this_pid + this_pid=0 - ftrace_sleep - } - sleep 2 -} + tst_sleep 200000us + i=$((i + 1)) + done + sleep 2 +done
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_stat.sh +9 -9
@@ -16,6 +16,7 @@ LOOP=200 should_skip=0 +nr_cpus=`tst_ncpus` if [ ! -e "$TRACING_PATH"/function_profile_enabled ]; then should_skip=1
@@ -28,18 +29,17 @@ if [ $? -eq 0 ]; then should_skip=1 fi -for ((; ;)) -{ +while true; do if [ $should_skip -eq 1 ]; then sleep 2 continue fi - - for ((i = 0; i < $LOOP; i++)) - { - cat "$TRACING_PATH"/trace_stat/function0 > /dev/null 2>&1 - } + cpu=$(tst_random 0 $((nr_cpus - 1))) + i=0; + while [ $i -lt $LOOP ]; do + cat "$TRACING_PATH"/trace_stat/function${cpu} > /dev/null 2>&1 + i=$((i + 1)) + done sleep 1 -} - +done
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_enabled.sh +6 -7
@@ -16,15 +16,14 @@ MAX_LOOP=1500 count=0 -for ((; ;)) -{ +while true; do count=$(( $count + 1 )) - - for ((i = 0; i < $MAX_LOOP; i++)) - { + i=0 + while [ $i -lt $MAX_LOOP ]; do echo 0 > "$TRACING_PATH"/tracing_enabled echo 1 > "$TRACING_PATH"/tracing_enabled - } + i=$((i + 1)) + done enable=$(( $count % 3 ))
@@ -35,5 +34,5 @@ for ((; ;)) fi sleep 1 -} +done
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_max_latency.sh +7 -6
@@ -15,12 +15,13 @@ MAX_LATENCY=100000 -for ((; ;)) -{ - for ((i = 0; i < $MAX_LATENCY; i += 400)) - { +while true; do + i=0 + while [ $i -lt $MAX_LATENCY ]; do echo $i > "$TRACING_PATH"/tracing_max_latency - } + i=$((i + 400)) + done sleep 1 -} + +done
testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_on.sh +6 -7
@@ -16,15 +16,14 @@ MAX_LOOP=1500 count=0 -for ((; ;)) -{ +while true; do count=$(( $count + 1 )) - - for ((i = 0; i < $MAX_LOOP; i++)) - { + i=0 + while [ $i -lt $MAX_LOOP ]; do echo 0 > "$TRACING_PATH"/tracing_on echo 1 > "$TRACING_PATH"/tracing_on - } + i=$((i + 1)) + done enable=$(( $count % 3 ))
@@ -35,5 +34,5 @@ for ((; ;)) fi sleep 1 -} +done
Signature · 1 line
1.8.3.1