Skip to content

Commit

Permalink
Test for parallel map accessing
Browse files Browse the repository at this point in the history
Signed-off-by: maokelong <chenjinglong1@huawei.com>
  • Loading branch information
maokelong committed May 25, 2023
1 parent 6a9bbf3 commit 3468590
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
15 changes: 5 additions & 10 deletions tests/runtime/basic
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,6 @@ REQUIRES_FEATURE btf
REQUIRES_FEATURE kfunc
TIMEOUT 1

NAME it lists rawtracepoints
RUN {{BPFTRACE}} -l | grep rawtracepoint
EXPECT rawtracepoint
TIMEOUT 1

NAME it lists kfunc params
RUN {{BPFTRACE}} -lv "kfunc:*"
EXPECT [ ]+[a-zA-Z_\*\s]+
Expand Down Expand Up @@ -119,11 +114,6 @@ EXPECT hardware:
EXPECT software:
TIMEOUT 1

NAME it lists rawtracepoint with regex filter
RUN {{BPFTRACE}} -l "rawtracepoint:*"
EXPECT rawtracepoint:
TIMEOUT 1

NAME errors on invalid character in search expression
RUN {{BPFTRACE}} -l '\n'
EXPECT ERROR: invalid character
Expand Down Expand Up @@ -196,6 +186,11 @@ PROG BEGIN { @x = 10; printf("%d", @x++); printf(" %d", ++@x); printf(" %d", @x-
EXPECT 10 12 12 10
TIMEOUT 1

NAME parallel map access
RUN {{BPFTRACE}} runtime/scripts/parallel_map_access.bt
EXPECT SUCCESS
TIMEOUT 2

NAME increment/decrement variable
PROG BEGIN { $x = 10; printf("%d", $x++); printf(" %d", ++$x); printf(" %d", $x--); printf(" %d\n", --$x); exit(); }
EXPECT 10 12 12 10
Expand Down
17 changes: 17 additions & 0 deletions tests/runtime/scripts/parallel_map_access.bt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
i:us:1 {
@data[rand % 100] = count();
if (rand % 5 == 0) {
delete(@data[rand % 10]);
}
}

i:ms:1 {
clear(@data);
print(@data);
zero(@data);
}

i:s:1 {
print("SUCCESS");
exit();
}

0 comments on commit 3468590

Please sign in to comment.