-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add: ptrace_test executable This binary is intended to check availability of ptrace features. Signed-off-by: Alexandre Esse <[email protected]> * Add: ptrace test under new tracers unit This tracers unit got created because there is other possible tracers to be tested such as ftrace. Signed-off-by: Alexandre Esse <[email protected]> * Add: ftrace tracer test This test check running kernel config enabled ftrace. Signed-off-by: Alexandre Esse <[email protected]> * Add: tracefs file system test This test checks for tracefs file system availability. It should be used by ftrace. Signed-off-by: Alexandre Esse <[email protected]> * Add: resource for kernel config file This file might be absent for different reasons: - disabled in kernel configuration - stored in a different location than the default one here (/boot/config-*) Signed-off-by: Alexandre Esse <[email protected]> --------- Signed-off-by: Alexandre Esse <[email protected]>
- Loading branch information
Showing
6 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
alsa_test | ||
clocktest | ||
threaded_memtest | ||
ptrace_test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <sys/ptrace.h> | ||
#include <stdio.h> | ||
|
||
int main() { | ||
if (ptrace(PTRACE_TRACEME, 0, 1, 0) < 0) { | ||
// if ptrace() call return a negative value -> fail (or program is already beeing ptraced?) | ||
return 1; | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
id: tracers/ptrace | ||
plugin: shell | ||
command: | ||
if ptrace_test | ||
then | ||
echo "ptrace: supported" | ||
exit 0 | ||
else | ||
echo "ptrace: unsupported" | ||
exit 1 | ||
fi | ||
_summary: | ||
Tests the ptrace tracer availability | ||
_description: | ||
The test initiates tracing using the ptrace syscall with ptrace_test binary (c source code). | ||
|
||
id: tracers/ftrace | ||
plugin: shell | ||
command: | ||
if grep -q -e "^CONFIG_FTRACE=y" /boot/config-"$(uname -r)" | ||
then | ||
echo "ftrace: supported" | ||
exit 0 | ||
else | ||
echo "ftrace: unsupported" | ||
exit 1 | ||
fi | ||
_summary: | ||
Tests ftrace kernel tracing infrastructure is enable | ||
_description: | ||
Check if kernel configuration item CONFIG_FTRACE bool is set to 'y'. | ||
requires: | ||
kernel_config_file.detected == 'true' | ||
|
||
id: tracers/tracefs | ||
plugin: shell | ||
command: | ||
if mount | grep -q tracefs | ||
then | ||
echo "tracefs: supported" | ||
exit 0 | ||
else | ||
echo "ftracefs: unsupported" | ||
exit 1 | ||
fi | ||
_summary: | ||
Tests the tracefs file system availability | ||
_description: | ||
Check if the tracefs is mounted on a system using the mount command. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
id: kernel_config_file | ||
plugin: resource | ||
_summary: | ||
Kernel config file resource | ||
command: | ||
if [[ -f "/boot/config-$(uname -r)" ]] | ||
then | ||
echo "detected: true" | ||
else | ||
echo "detected: false" | ||
fi | ||
_description: Check existence of kernel config file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
id: tracers | ||
unit: test plan | ||
_name: Tracers tests | ||
_description: | ||
Tracers tests | ||
include: | ||
tracers/ftrace | ||
tracers/ptrace | ||
tracers/tracefs | ||
bootstrap_include: | ||
kernel_config_file |