Linux Test Project
 help / color / mirror / Atom feed
From: Alexander Egorenkov <egorenar@linux.ibm.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/2] lib/tst_virt: fix detection when systemd-detect-virt returns 1
Date: Fri,  6 Nov 2020 14:06:23 +0100	[thread overview]
Message-ID: <20201106130624.454614-2-egorenar@linux.ibm.com> (raw)
In-Reply-To: <20201106130624.454614-1-egorenar@linux.ibm.com>

From: Alexander Egorenkov <Alexander.Egorenkov@ibm.com>

When systemd-detect-virt detects no virtualization environment,
it returns 1 as exit code. This leads to tst_is_virt not doing any
fallback tests.

The problem can be reproduced inside a IBM System Z LPAR virtualization
environment.

Signed-off-by: Alexander Egorenkov <egorenar@linux.ibm.com>
---
 lib/tst_virt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/tst_virt.c b/lib/tst_virt.c
index 53d33e69c..914a08d96 100644
--- a/lib/tst_virt.c
+++ b/lib/tst_virt.c
@@ -109,9 +109,9 @@ int tst_is_virt(int virt_type)
 {
 	int ret = try_systemd_detect_virt();
 
-	if (ret >= 0) {
+	if (ret > 0) {
 		if (virt_type == VIRT_ANY)
-			return ret != 0;
+			return 1;
 		else
 			return ret == virt_type;
 	}
-- 
2.26.2


  reply	other threads:[~2020-11-06 13:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-06 13:06 [LTP] [PATCH 0/2] lib/tst_virt: support IBM/Z LPAR and z/VM virtualization environments Alexander Egorenkov
2020-11-06 13:06 ` Alexander Egorenkov [this message]
2020-11-09 14:31   ` [LTP] [PATCH 1/2] lib/tst_virt: fix detection when systemd-detect-virt returns 1 Cyril Hrubis
2020-11-06 13:06 ` [LTP] [PATCH 2/2] lib/tst_virt: support IBM/Z LPAR and z/VM virtualization environments Alexander Egorenkov
2020-11-09 14:42   ` Cyril Hrubis

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=20201106130624.454614-2-egorenar@linux.ibm.com \
    --to=egorenar@linux.ibm.com \
    --cc=ltp@lists.linux.it \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox