Skip to content

Commit

Permalink
tests: runtime: Fix ustack tests probing k:do_nanosleep
Browse files Browse the repository at this point in the history
k:do_nanosleep may not always have an associated userspace task.
Make tests more reliable by probing an existing userspace task.
  • Loading branch information
danobi committed Apr 4, 2024
1 parent 51a934a commit 9ef8cb4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tests/runtime/call
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,10 @@ TIMEOUT 5
AFTER ./testprogs/syscall nanosleep 1e8

NAME ustack
PROG k:do_nanosleep { printf("%s\n%s\n", ustack(), ustack(1)); exit(); }
PROG u:./testprogs/uprobe_loop:uprobeFunction1 { printf("%s\n%s\n", ustack(), ustack(1)); exit(); }
EXPECT Attaching 1 probe...
TIMEOUT 5
AFTER ./testprogs/syscall nanosleep 1e8
AFTER ./testprogs/uprobe_loop

NAME ustack_stack_mode_env_bpftrace
PROG u:./testprogs/uprobe_loop:uprobeFunction1 { printf("%s\n", ustack(1)); exit(); }
Expand Down
6 changes: 3 additions & 3 deletions tests/runtime/other
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,10 @@ TIMEOUT 5
AFTER ./testprogs/syscall nanosleep 1e8

NAME positional ustack
RUN {{BPFTRACE}} -e 'k:do_nanosleep { printf("SUCCESS %s\n%s\n", ustack(), ustack($1)); exit(); }' 1
EXPECT SUCCESS
RUN {{BPFTRACE}} -e 'u:./testprogs/uprobe_loop:uprobeFunction1 { printf("%s\n%s\n", ustack(), ustack($1)); exit(); }' 1
EXPECT_REGEX .*uprobeFunction1\+0\n\s+main\+\d+\n.*\n\n\n\s+uprobeFunction1\+0
TIMEOUT 5
AFTER ./testprogs/syscall nanosleep 1e8
AFTER ./testprogs/uprobe_loop

NAME lhist can be cleared
PROG BEGIN{ @[1] = lhist(3,0,10,1); clear(@); exit() }
Expand Down

0 comments on commit 9ef8cb4

Please sign in to comment.