Skip to content
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

Create temp directories for all tests in kprobes #255

Merged
merged 1 commit into from
Jul 28, 2022
Merged

Conversation

tpapagian
Copy link
Member

Before that tests that fail to create a new directory (i.e. already exists) just skipped.

FIXES: #238

Signed-off-by: Anastasios Papagiannis [email protected]

FIXES: #238

Signed-off-by: Anastasios Papagiannis <[email protected]>
@tpapagian tpapagian requested a review from a team as a code owner July 21, 2022 10:00
@tpapagian tpapagian requested a review from willfindlay July 21, 2022 10:00
Copy link
Contributor

@willfindlay willfindlay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one minor nit from me.

kpChecker := ec.NewProcessKprobeChecker().
WithFunctionName(sm.Full("__x64_sys_openat")).
WithArgs(ec.NewKprobeArgumentListMatcher().
WithOperator(lc.Ordered).
WithValues(
ec.NewKprobeArgumentChecker().WithIntArg(-100),
ec.NewKprobeArgumentChecker().WithStringArg(sm.Full(mountPath+"/testfile")),
ec.NewKprobeArgumentChecker().WithStringArg(sm.Full(filepath.Join(dir, "testfile"))),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will fail if someone passes a non-absolute path here. I would suggested using a suffix matcher here, possibly stripping the leading periods if they exist.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! So this will fail in the case where we use getOpenatChecker() in a testcase where we don't use the correct path in __x64_sys_openat. I propose to just be aware of that (i.e. add a comment/issue) when we add new tests.

I believe that we need more work to make that generic enough to handle all cases in __x64_sys_openat. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documenting the limitation is a fine approach IMO.

@jrfastab jrfastab merged commit 7cadc51 into main Jul 28, 2022
@jrfastab jrfastab deleted the pr/apapag/tmp_dirs branch July 28, 2022 23:36
@jrfastab
Copy link
Contributor

@tpapagian follow up with some documentation per review where appropriate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tracing tests: Mkdir failed: mkdir /tmp2: file exists
4 participants