[LTP PATCH 0/5] ftrace: Convert shell tests to C

Praveen K Pandey <[email protected]>
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
This patch series converts the ftrace test suite from shell scripts to C
using the LTP new API. The conversion addresses several issues found in
the shell version on newer kernels (6.12+, 6.18.1+).

Key improvements in the C implementation:

1. Proper file existence checking before access
   - Fixes "No such file or directory" errors
   
2. Better error handling with TCONF reporting
   - Reports TCONF when features are unavailable instead of failing
   
3. Graceful handling of write errors
   - Fixes "Invalid argument" errors during cleanup on newer kernels
   
4. Multi-threaded stress testing
   - Uses pthread for concurrent testing of multiple ftrace features
   - Replaces 18 separate shell scripts with integrated C functions
   
5. Better performance and lower memory usage
   - No shell interpreter overhead
   - Single process instead of multiple shell processes

6. Removal of obsolete shell scripts
   - The ftrace_stress/ folder is removed as its functionality is now
     provided by ftrace_stress_test.c

The shell scripts in the main directory are retained for backward
compatibility during the transition period.

Testing:
- Built successfully on x86_64 and ppc64le
- All tests pass on kernel 6.12 and 6.18.1
- No regressions on older kernels (tested on 5.15, 6.1)
- Verified proper TCONF reporting when features are unavailable
- Stress test runs stably with all concurrent threads

Related GitHub issue: https://github.com/linux-test-project/ltp/issues/1282

Praveen K Pandey (5):
  ftrace: Add common library for C implementation
  ftrace: Add C implementation of ftrace_regression01
  ftrace: Add C implementation of ftrace_regression02
  ftrace: Add C implementation of ftrace_stress_test and update build
  ftrace: Remove obsolete shell scripts from ftrace_stress folder

 testcases/kernel/tracing/ftrace_test/Makefile  |  18 +-
 .../kernel/tracing/ftrace_test/ftrace_lib.c    | 348 ++++++++++++++++++
 .../kernel/tracing/ftrace_test/ftrace_lib.h    | 142 +++++++
 .../ftrace_test/ftrace_regression01.c          | 131 +++++++
 .../ftrace_test/ftrace_regression02.c          | 103 ++++++
 .../ftrace_test/ftrace_stress_test.c           | 324 ++++++++++++++++
 .../ftrace_stress/ftrace_buffer_size_kb.sh     |  32 --
 .../ftrace_stress/ftrace_current_tracer.sh     |  32 --
 .../ftrace_stress/ftrace_ftrace_enabled.sh     |  26 --
 .../ftrace_function_profile_enabled.sh         |  26 --
 .../ftrace_stress/ftrace_set_event.sh          |  26 --
 .../ftrace_stress/ftrace_set_ftrace_filter.sh  |  26 --
 .../ftrace_stress/ftrace_set_ftrace_pid.sh     |  26 --
 .../ftrace_stress/ftrace_stack_max_size.sh     |  26 --
 .../ftrace_stress/ftrace_stack_trace.sh        |  26 --
 .../ftrace_stress/ftrace_trace.sh              |  26 --
 .../ftrace_stress/ftrace_trace_clock.sh        |  26 --
 .../ftrace_stress/ftrace_trace_options.sh      |  26 --
 .../ftrace_stress/ftrace_trace_pipe.sh         |  45 ---
 .../ftrace_stress/ftrace_trace_stat.sh         |  26 --
 .../ftrace_stress/ftrace_tracing_cpumask.sh    |  26 --
 .../ftrace_stress/ftrace_tracing_enabled.sh    |  26 --
 .../ftrace_stress/ftrace_tracing_max_latency.sh|  26 --
 .../ftrace_stress/ftrace_tracing_on.sh         |  26 --
 24 files changed, 1064 insertions(+), 538 deletions(-)
 create mode 100644 testcases/kernel/tracing/ftrace_test/ftrace_lib.c
 create mode 100644 testcases/kernel/tracing/ftrace_test/ftrace_lib.h
 create mode 100644 testcases/kernel/tracing/ftrace_test/ftrace_regression01.c
 create mode 100644 testcases/kernel/tracing/ftrace_test/ftrace_regression02.c
 create mode 100644 testcases/kernel/tracing/ftrace_test/ftrace_stress_test.c
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_buffer_size_kb.sh
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_current_tracer.sh
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_ftrace_enabled.sh
 delete 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_set_event.sh
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_ftrace_filter.sh
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_set_ftrace_pid.sh
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_stack_max_size.sh
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_stack_trace.sh
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace.sh
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_clock.sh
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_options.sh
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_pipe.sh
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_trace_stat.sh
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_cpumask.sh
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_enabled.sh
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_max_latency.sh
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress/ftrace_tracing_on.sh

-- 
2.50.1

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.