[LTP PATCH v4 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 shell-based tests to C
implementation using LTP's new API, addressing GitHub issue #1282.

The conversion provides:
- Better integration with LTP framework
- Improved error handling and reporting
- More maintainable code structure
- Consistent test behavior across platforms

Changes in v4:
- Fixed all trailing whitespace on blank lines in ftrace_lib.c (20+ locations)
- Corrected ftrace_regression01 commit message to accurately describe test behavior
  (tests userstacktrace with page fault events, not general function tracing)
- Corrected ftrace_regression02 commit message to describe actual test
  (verifies signal:signal_generate tracepoint fields, not function_graph tracer)
- Replaced inline tst_kvercmp() check with .min_kver = "3.2" in ftrace_regression02
- Removed incorrect LTP_TIMEOUT_MUL parsing in ftrace_stress_test setup()
- All whitespace issues verified with checkpatch.pl

Changes in v3:
- Fixed tst_tmpdir_path() usage by adding .needs_tmpdir = 1 to all tests
- Removed incorrect CVE-2015-8550 tag from ftrace_regression01
- Fixed memory leak in TST_RETRY_FUNC usage by assigning to variable and freeing
- Changed [Algorithm] sections from numbered lists to bullet points (using '-')
- Added root requirement documentation to all test doc comments
- Fixed Makefile LDLIBS placement (moved before generic_leaf_target.mk include)
- Created .gitignore for new test binaries
- Removed deprecated [Description] header from ftrace_stress_test
- Deleted orphaned shell files that were replaced by C implementations

Changes in v2:
- Fixed TST_NO_DEFAULT_MAIN placement in ftrace_lib.c (before includes)
- Removed tst_test.h include from ftrace_lib.h (libraries shouldn't include it)
- Fixed include order in test files (tst_test.h before ftrace_lib.h)
- Added proper cleanup of allocated memory in tests
- Improved error messages and test documentation
- Fixed Makefile dependencies and library filtering

Testing:
All tests have been compiled and verified to work correctly on x86_64
and ppc64le systems with various kernel versions. All whitespace issues
have been verified with checkpatch.pl.

Praveen K Pandey (5):
  ftrace: Add common library for C implementation
  ftrace: Convert ftrace_regression01.sh to C
  ftrace: Convert ftrace_regression02.sh to C
  ftrace: Convert ftrace_stress_test.sh to C
  ftrace: Remove obsolete shell test files

 runtest/tracing                               |   6 +-
 .../kernel/tracing/ftrace_test/.gitignore     |   4 +
 testcases/kernel/tracing/ftrace_test/Makefile |  19 +-
 .../kernel/tracing/ftrace_test/ftrace_lib.c   | 358 ++++++++++++++++++
 .../kernel/tracing/ftrace_test/ftrace_lib.h   | 139 +++++++
 .../kernel/tracing/ftrace_test/ftrace_lib.sh  | 180 ---------
 .../tracing/ftrace_test/ftrace_regression01.c | 128 +++++++
 .../ftrace_test/ftrace_regression01.sh        |  83 ----
 .../tracing/ftrace_test/ftrace_regression02.c | 103 +++++
 .../ftrace_test/ftrace_regression02.sh        |  63 ----
 .../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_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       |  27 --
 .../ftrace_stress/ftrace_trace_options.sh     |  58 ---
 .../ftrace_stress/ftrace_trace_pipe.sh        |  45 ---
 .../ftrace_stress/ftrace_trace_stat.sh        |  38 --
 .../ftrace_stress/ftrace_tracing_cpumask.sh   |  91 -----
 .../ftrace_stress/ftrace_tracing_enabled.sh   |  38 --
 .../ftrace_tracing_max_latency.sh             |  27 --
 .../ftrace_stress/ftrace_tracing_on.sh        |  38 --
 .../tracing/ftrace_test/ftrace_stress_test.c  | 322 ++++++++++++++++
 .../tracing/ftrace_test/ftrace_stress_test.sh | 121 ------
 30 files changed, 1072 insertions(+), 1258 deletions(-)
 create mode 100644 testcases/kernel/tracing/ftrace_test/.gitignore
 create mode 100644 testcases/kernel/tracing/ftrace_test/ftrace_lib.c
 create mode 100644 testcases/kernel/tracing/ftrace_test/ftrace_lib.h
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_lib.sh
 create mode 100644 testcases/kernel/tracing/ftrace_test/ftrace_regression01.c
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_regression01.sh
 create mode 100644 testcases/kernel/tracing/ftrace_test/ftrace_regression02.c
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_regression02.sh
 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
 create mode 100644 testcases/kernel/tracing/ftrace_test/ftrace_stress_test.c
 delete mode 100755 testcases/kernel/tracing/ftrace_test/ftrace_stress_test.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.