Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bpftrace
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bpftrace
Commits
395d1146
Commit
395d1146
authored
Jan 02, 2019
by
Matheus Marchini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] run runtime tests on CI
parent
dbfb93c8
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
5 deletions
+26
-5
docker/build.sh
docker/build.sh
+5
-1
tests/CMakeLists.txt
tests/CMakeLists.txt
+5
-1
tests/main.py
tests/main.py
+3
-0
tests/runtime/call
tests/runtime/call
+7
-1
tests/runtime/probe
tests/runtime/probe
+6
-2
No files found.
docker/build.sh
View file @
395d1146
#!/bin/bash
set
-e
set
-e
STATIC_LINKING
=
${
STATIC_LINKING
:-
OFF
}
STATIC_LINKING
=
${
STATIC_LINKING
:-
OFF
}
...
@@ -10,5 +12,7 @@ shift 2
...
@@ -10,5 +12,7 @@ shift 2
make
"
$@
"
make
"
$@
"
if
[
$RUN_TESTS
=
1
]
;
then
if
[
$RUN_TESTS
=
1
]
;
then
./tests/bpftrace_test
$TEST_ARGS
set
+e
./tests/bpftrace_test
$TEST_ARGS
;
make runtime-tests
;
fi
fi
tests/CMakeLists.txt
View file @
395d1146
...
@@ -75,5 +75,9 @@ configure_file(runtime-tests.sh runtime-tests.sh COPYONLY)
...
@@ -75,5 +75,9 @@ configure_file(runtime-tests.sh runtime-tests.sh COPYONLY)
configure_file
(
main.py main.py COPYONLY
)
configure_file
(
main.py main.py COPYONLY
)
configure_file
(
parser.py parser.py COPYONLY
)
configure_file
(
parser.py parser.py COPYONLY
)
configure_file
(
utils.py utils.py COPYONLY
)
configure_file
(
utils.py utils.py COPYONLY
)
file
(
COPY runtime DESTINATION
${
CMAKE_CURRENT_BINARY_DIR
}
)
file
(
GLOB runtime_tests runtime/*
)
foreach
(
runtime_test
${
runtime_tests
}
)
configure_file
(
${
runtime_test
}
${
CMAKE_CURRENT_BINARY_DIR
}
/runtime COPYONLY
)
endforeach
()
add_custom_target
(
runtime-tests COMMAND ./runtime-tests.sh
)
add_custom_target
(
runtime-tests COMMAND ./runtime-tests.sh
)
add_test
(
NAME runtime_test COMMAND ./runtime-tests.sh
)
tests/main.py
View file @
395d1146
...
@@ -30,6 +30,9 @@ def main():
...
@@ -30,6 +30,9 @@ def main():
print
(
str
(
total_tests
)
+
' tests [fail '
+
str
(
total_fail
)
+
']'
)
print
(
str
(
total_tests
)
+
' tests [fail '
+
str
(
total_fail
)
+
']'
)
print
(
'Done in '
+
str
(
timedelta
(
seconds
=
elapsed
))
)
print
(
'Done in '
+
str
(
timedelta
(
seconds
=
elapsed
))
)
if
total_fail
>
0
:
exit
(
1
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
main
()
main
()
tests/runtime/call
View file @
395d1146
...
@@ -24,7 +24,8 @@ EXPECT A
...
@@ -24,7 +24,8 @@ EXPECT A
TIMEOUT 5
TIMEOUT 5
NAME str
NAME str
RUN bpftrace -e 'i:ms:1 { system("echo 10"); } k:sys_execve { printf("P: %s\n", str(arg0)); exit();}'
RUN bpftrace -e 'k:sys_execve { printf("P: %s\n", str(arg0)); exit();}'
BEFORE sleep 1s && /bin/sh -c 'exit 0' &
EXPECT P: /bin/sh
EXPECT P: /bin/sh
TIMEOUT 5
TIMEOUT 5
...
@@ -54,6 +55,7 @@ NAME avg
...
@@ -54,6 +55,7 @@ NAME avg
RUN bpftrace -e 'kprobe:vfs_read { @bytes[comm] = avg(arg2); exit();}'
RUN bpftrace -e 'kprobe:vfs_read { @bytes[comm] = avg(arg2); exit();}'
EXPECT @.*\[.*\]\:\s[0-9]*
EXPECT @.*\[.*\]\:\s[0-9]*
TIMEOUT 5
TIMEOUT 5
BEFORE sleep 1 && sleep 1 &
NAME min
NAME min
RUN bpftrace -e 'kprobe:vfs_read { @bytes[comm] = min(arg2); exit();}'
RUN bpftrace -e 'kprobe:vfs_read { @bytes[comm] = min(arg2); exit();}'
...
@@ -64,19 +66,23 @@ BEFORE sleep 1 && sleep 1 &
...
@@ -64,19 +66,23 @@ BEFORE sleep 1 && sleep 1 &
NAME max
NAME max
RUN bpftrace -e 'kprobe:vfs_read { @bytes[comm] = max(arg2); exit();}'
RUN bpftrace -e 'kprobe:vfs_read { @bytes[comm] = max(arg2); exit();}'
EXPECT @.*\[.*\]\:\s[0-9]*
EXPECT @.*\[.*\]\:\s[0-9]*
BEFORE sleep 1 && sleep 1 &
TIMEOUT 5
TIMEOUT 5
NAME stats
NAME stats
RUN bpftrace -e 'kprobe:vfs_read { @bytes[comm] = stats(arg2); exit();}'
RUN bpftrace -e 'kprobe:vfs_read { @bytes[comm] = stats(arg2); exit();}'
EXPECT @.*\[.*\]\:\scount\s[0-9]*\,\saverage\s[0-9]*\,\stotal\s[0-9]*
EXPECT @.*\[.*\]\:\scount\s[0-9]*\,\saverage\s[0-9]*\,\stotal\s[0-9]*
TIMEOUT 5
TIMEOUT 5
BEFORE sleep 1 && sleep 1 &
NAME hist
NAME hist
RUN bpftrace -e 'kretprobe:vfs_read { @bytes = hist(retval); exit();}'
RUN bpftrace -e 'kretprobe:vfs_read { @bytes = hist(retval); exit();}'
EXPECT @bytes:\s\n\n\[.*\,\s.*\]?\)?\s
EXPECT @bytes:\s\n\n\[.*\,\s.*\]?\)?\s
BEFORE sleep 1 && sleep 1 &
TIMEOUT 5
TIMEOUT 5
NAME lhist
NAME lhist
RUN bpftrace -e 'kretprobe:vfs_read { @bytes = lhist(retval, 0, 10000, 1000); exit()}'
RUN bpftrace -e 'kretprobe:vfs_read { @bytes = lhist(retval, 0, 10000, 1000); exit()}'
EXPECT @bytes:\s\n\n\(?\[?.*
EXPECT @bytes:\s\n\n\(?\[?.*
TIMEOUT 5
TIMEOUT 5
BEFORE sleep 1 && sleep 1 &
tests/runtime/probe
View file @
395d1146
...
@@ -48,11 +48,13 @@ BEFORE (sleep 1; /bin/bash -c echo) &
...
@@ -48,11 +48,13 @@ BEFORE (sleep 1; /bin/bash -c echo) &
NAME tracepoint
NAME tracepoint
RUN bpftrace -e 'tracepoint:syscalls:sys_exit_nanosleep { printf("SUCCESS '$test' %d\n", gid); exit(); }'
RUN bpftrace -e 'tracepoint:syscalls:sys_exit_nanosleep { printf("SUCCESS '$test' %d\n", gid); exit(); }'
EXPECT SUCCESS tracepoint [0-9][0-9]*
EXPECT SUCCESS tracepoint [0-9][0-9]*
BEFORE sleep 1 && sleep 1 &
TIMEOUT 5
TIMEOUT 5
NAME tracepoint_short_name
NAME tracepoint_short_name
RUN bpftrace -e 't:syscalls:sys_exit_nanosleep { printf("SUCCESS '$test' %d\n", gid); exit(); }'
RUN bpftrace -e 't:syscalls:sys_exit_nanosleep { printf("SUCCESS '$test' %d\n", gid); exit(); }'
EXPECT SUCCESS tracepoint_short_name [0-9][0-9]*
EXPECT SUCCESS tracepoint_short_name [0-9][0-9]*
BEFORE sleep 1 && sleep 1 &
TIMEOUT 5
TIMEOUT 5
NAME profile
NAME profile
...
@@ -76,12 +78,14 @@ EXPECT @syscalls\:\s[0-9]*
...
@@ -76,12 +78,14 @@ EXPECT @syscalls\:\s[0-9]*
TIMEOUT 5
TIMEOUT 5
NAME software
NAME software
RUN bpftrace -e 'software:faults:100 { @[comm] = count(); exit();}'
RUN bpftrace -e 'software:faults:1 { @[comm] = count(); exit();}'
BEFORE sleep 2 && sleep 1 &
EXPECT @\[.*\]\:\s[0-9]*
EXPECT @\[.*\]\:\s[0-9]*
TIMEOUT 5
TIMEOUT 5
NAME hardware
NAME hardware
RUN bpftrace -e 'hardware:cache-misses:1000000 { @[pid] = count(); exit(); }'
RUN bpftrace -e 'hardware:cache-misses:10 { @[pid] = count(); exit(); }'
BEFORE sleep 2 && sleep 1 &
EXPECT @\[.*\]\:\s[0-9]*
EXPECT @\[.*\]\:\s[0-9]*
TIMEOUT 5
TIMEOUT 5
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment