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

Running unit tests under root fails #3139

Open
viktormalik opened this issue Apr 25, 2024 · 0 comments
Open

Running unit tests under root fails #3139

viktormalik opened this issue Apr 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@viktormalik
Copy link
Contributor

Running unit tests under root fails the utils.file_exists_and_ownedby_root test:

# tests/bpftrace_test --gtest_filter="utils.file_exists_and_ownedby_root"
Note: Google Test filter = utils.file_exists_and_ownedby_root
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from utils
[ RUN      ] utils.file_exists_and_ownedby_root
/home/vmalik/src/bpf/bpftrace/tests/utils.cpp:375: Failure
Value of: file_exists_and_ownedby_root((tmpdir + file1).c_str())
  Actual: true
Expected: false
[  FAILED  ] utils.file_exists_and_ownedby_root (0 ms)
[----------] 1 test from utils (0 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (0 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] utils.file_exists_and_ownedby_root

 1 FAILED TEST

The reason is that the test expects files created by a non-root user.

I'm used to run all the tests under the root so that's how I discovered this problem. I'm not sure if that's the expected workflow, though.

@viktormalik viktormalik added the bug Something isn't working label Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant