-
Notifications
You must be signed in to change notification settings - Fork 393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: added verifier tests #3433
base: main
Are you sure you want to change the base?
Conversation
322a008
to
c0669ba
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi, looks great, left some comments, please add some info to the changelog, like details about the functionality (way we did it before and now) and difference in the new output, thanks
/^;/ { if (in_func) { print " " $0; in_func=0; } } | ||
/^verification time/ { verify_lines=3 } | ||
/^/ { if (verify_lines) { verify_lines -= 1; print " " $0 } }' < "$OUT" | ||
rm "$OUT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure we could easily do this output, nor I'm sure we really need that.. I just don't see it in new code, so would be great to have some comment about that (like in changelog)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added comment in changelog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added comment in changelog
@AshishNaware aah I meant commit changelog (not PR) so we have the info in the git log, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. 👍
9c77db3
to
eba1d72
Compare
'make verify' target now runs go tests to test object files instead of running verifier script. * invoke make verify to run the tests. * run tests in debug mode: DEBUG=1 make verify * run tests on specific directory with .o files: TETRAGONDIR=<path_to_dir> make verify * Note: unlike old script, these tests do not provide these metrics: verification time, stack depth, processed insns, max_state_per_insn, total_states, peak_states,mark_read Signed-off-by: Ashish Naware <ashishnaware3@gmail.com>
eba1d72
to
8f78a54
Compare
✅ Deploy Preview for tetragon ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
I am not able to add any labels to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left few more comments, but otherwise lgtm, thanks
@@ -277,7 +278,7 @@ bpf-test: | |||
|
|||
.PHONY: verify | |||
verify: tetragon-bpf ## Verify BPF programs. | |||
sudo contrib/verify/verify.sh bpf/objs | |||
sudo DEBUG=${DEBUG} TETRAGONDIR=${TETRAGONDIR} $(shell which go) test contrib/verify/verify_test.go -v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use $(GO)
@@ -19,6 +19,7 @@ GO_TEST_TIMEOUT ?= 20m | |||
E2E_TEST_TIMEOUT ?= 20m | |||
BUILD_PKG_DIR ?= $(shell pwd)/build/$(TARGET_ARCH) | |||
VERSION ?= $(shell git describe --tags --always --exclude '*/*') | |||
TETRAGONDIR ?= $(CURDIR)/bpf/objs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need for TETRAGONDIR
variable, please use $(CURDIR)/bpf/objs
directly
require.NoError(t, err, "failed to load resources into the kernel") | ||
|
||
collection.Close() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra line
collection.Close() | ||
|
||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra line
Fixes
#229 replace verifier.sh with a go verifier test that uses cilium/ebpf
Description
This change adds go tests using cilium/ebpf library as an alternative to verifier script. The test closely mimics all the actions of verifier.sh.
-d
flag produces more verbose output than the earlier script.Changelog
release-note
make verify
target now invokes go tests to test object files instead of running verifier script. Below is the sample usagesuccessful execution:
Test fails for the invalid file with error message:
use debug flag to get verbose output
To provide specific object directory
Note:
unlike old script, this test does not provide below metrics
verification time,
stack depth,
processed insns,
max_states_per_insn,
total_states,
peak_states,
mark_read