main - tests: skip running tests for non root user
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2bea95764e7322f491c58fae2ec456ab7d60af95 Commit: 2bea95764e7322f491c58fae2ec456ab7d60af95 Parent: 4a498512077b4fe5cf6b806a91228bd23e513123 Author: Zdenek Kabelac <[email protected]> AuthorDate: Mon May 30 18:41:16 2022 +0200 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Tue Jun 7 17:14:09 2022 +0200
tests: skip running tests for non root user
Testing needs 'root' privileges.
Only 'make run-unit-test' can work without them.
--- test/lib/runner.cpp | 6 ++++++ 1 file changed, 6 insertions(+)
test/lib/runner.cpp +6 -0
@@ -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) {