diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2022-05-30 18:41:16 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2022-06-07 17:14:09 +0200 |
commit | 2bea95764e7322f491c58fae2ec456ab7d60af95 (patch) | |
tree | bfec8eb898681de1fde53683a00cd96279c692f8 | |
parent | 4a498512077b4fe5cf6b806a91228bd23e513123 (diff) | |
download | lvm2-2bea95764e7322f491c58fae2ec456ab7d60af95.tar.gz |
tests: skip running tests for non root user
Testing needs 'root' privileges.
Only 'make run-unit-test' can work without them.
-rw-r--r-- | test/lib/runner.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/lib/runner.cpp b/test/lib/runner.cpp index d00aa457c..d522228a0 100644 --- a/test/lib/runner.cpp +++ b/test/lib/runner.cpp @@ -29,6 +29,12 @@ int main(int argc, const char **argv) { + + if (getuid() != 0) { + std::cout << "Skipping tests, root is required, current UID: " << getuid() << "\n"; + return 0; + } + try { return brick::shelltest::run( argc, argv, "LVM_TEST_FLAVOUR" ); } catch (std::exception const& e) { |