All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - tests: skip running tests for non root user
Date: Tue,  7 Jun 2022 15:15:57 +0000 (GMT)	[thread overview]
Message-ID: <20220607151557.80B6738133EC@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=2bea95764e7322f491c58fae2ec456ab7d60af95
Commit:        2bea95764e7322f491c58fae2ec456ab7d60af95
Parent:        4a498512077b4fe5cf6b806a91228bd23e513123
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Mon May 30 18:41:16 2022 +0200
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
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(+)

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) {


                 reply	other threads:[~2022-06-07 15:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220607151557.80B6738133EC@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.