Skip to content

Commit

Permalink
Add test trace for binary Ftrace parser unit tests
Browse files Browse the repository at this point in the history
This commit adds 3 new binary Ftrace test traces for unit tests. The
three added traces include a trace with a single event only, a trace
with an invalid header, and a empty trace.

Change-Id: I7c3d31417809437454475a699026676c23c5ae24
Signed-off-by: Hoang Thuan Pham <hoang.pham@calian.ca>
  • Loading branch information
hoangphamEclipse authored and MatthewKhouzam committed Jan 18, 2022
1 parent 1ce8c3d commit bdc5ba8
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
Expand Up @@ -29,8 +29,53 @@ public enum FtraceTestTrace {
* Kernel version: 5.2
* Trace length: 1s
* </pre>
* The file is obtained by running trace-cmd for the ls command: trace-cmd
* record -e all ls on a machine with 4 CPU cores.
*/
TEST_2_6_4_CPU("/2.6/trace_4cpu.dat", 2880, 1);
TEST_2_6_4_CPU("/2.6/trace_4cpu.dat", 2880, 1),

/**
* <pre>
* Trace Size: 6.4 MB
* Tracer: FTrace 2.6
* Event count: 1
* Kernel version: 5.2
* Trace length: 1s
* </pre>
* The file containing a single event to parse. For this file, I followed the
* example in the man pages for event_fd
* (https://man7.org/linux/man-pages/man2/eventfd.2.html). To obtain the trace,
* run trace-cmd while running the example with the flag -e sys_enter_eventfd2.
* This event should occur only once.
*/
TEST_2_6_SINGLE_EVENT("/2.6/trace_single_event.dat", 1, 1),

/**
* <pre>
* Trace Size: 7.9 MB
* Tracer: FTrace 2.6
* Event count: -
* Kernel version: 5.2
* Trace length: -
* </pre>
* An invalid ftrace with bad version header, generated using trace-cmd 2.8.
* Trace-cmd has bugs that cause bad header issue.
*/
TEST_2_6_INVALID("/2.6/trace_invalid.dat", 0, 0),

/**
* <pre>
* Trace Size: 7.1 MB
* Tracer: FTrace 2.6
* Event count: 0
* Kernel version: 5.2
* Trace length: 0s
* </pre>
* The file is obtained by running trace-cmd for the ls command: trace-cmd
* record -e sys_enter_eventfd2 ls. The ls command should be cause an
* sys_enter_eventfd2 to happen.
*/
TEST_2_6_EMPTY("/2.6/empty_trace.dat", 0, 0);

private final String fTraceName;
private final int fNbEvent;
Expand Down
Binary file added ftrace/src/main/resources/2.6/empty_trace.dat
Binary file not shown.
Binary file added ftrace/src/main/resources/2.6/trace_invalid.dat
Binary file not shown.
Binary file not shown.

0 comments on commit bdc5ba8

Please sign in to comment.