Skip to content

Commit

Permalink
Adding path runtime test
Browse files Browse the repository at this point in the history
Adding path runtime test that checks on close being called
on file within './testprogs/syscall read' test prog.

Signed-off-by: Jiri Olsa <jolsa@redhat.com>
  • Loading branch information
olsajiri committed Sep 25, 2020
1 parent 24abe4b commit 1dd42a2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions tests/runtime/call
Original file line number Diff line number Diff line change
Expand Up @@ -235,3 +235,10 @@ NAME print_hist_with_large_top_arg
RUN bpftrace -e 'BEGIN { print("BEGIN"); @[1] = hist(10); @[2] = hist(20); @[3] = hist(30); print(@, 10); print("END"); clear(@); exit(); } '
EXPECT BEGIN\n@\[1\]:(.*\n)+@\[2\]:(.*\n)+@\[3\]:(.*\n)+END
TIMEOUT 1

NAME path
RUN bpftrace -ve 'kfunc:filp_close { $f = path(args->filp->f_path); if (!strncmp($f, "/tmp/bpftrace_runtime_test_syscall_gen_read_temp", 49)) { printf("OK\n"); exit(); } }'
EXPECT OK
REQUIRES_FEATURE dpath
TIMEOUT 5
AFTER ./testprogs/syscall read
2 changes: 1 addition & 1 deletion tests/runtime/engine/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def __read_test_struct(test, test_suite):
arch = [x.strip() for x in line.split("|")]
elif item_name == 'REQUIRES_FEATURE':
feature_requirement = {x.strip() for x in line.split(" ")}
unknown = feature_requirement - {"loop", "btf", "probe_read_kernel"}
unknown = feature_requirement - {"loop", "btf", "probe_read_kernel", "dpath"}
if len(unknown) > 0:
raise UnknownFieldError('%s is invalid for REQUIRES_FEATURE. Suite: %s' % (','.join(unknown), test_suite))
else:
Expand Down
1 change: 1 addition & 0 deletions tests/runtime/engine/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def __get_bpffeature():
bpffeature["loop"] = output.find("Loop support: yes") != -1
bpffeature["probe_read_kernel"] = output.find("probe_read_kernel: yes") != -1
bpffeature["btf"] = output.find("btf (depends on Build:libbpf): yes") != -1
bpffeature["dpath"] = output.find("dpath: yes") != -1
return bpffeature

@staticmethod
Expand Down

0 comments on commit 1dd42a2

Please sign in to comment.