All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com,
	den@openvz.org, jsnow@redhat.com
Subject: Re: [PATCH v8 2/5] iotests: add testenv.py
Date: Mon, 25 Jan 2021 15:32:42 +0300	[thread overview]
Message-ID: <d219a99f-ca1c-6bb3-4723-fab27d96ce3c@virtuozzo.com> (raw)
In-Reply-To: <20210123210428.27220-3-vsementsov@virtuozzo.com>

24.01.2021 00:04, Vladimir Sementsov-Ogievskiy wrote:
> Add TestEnv class, which will handle test environment in a new python
> iotests running framework.
> 
> Don't add compat=1.1 for qcow2 IMGOPTS, as v3 is default anyway.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy<vsementsov@virtuozzo.com>
> ---
>   tests/qemu-iotests/testenv.py | 278 ++++++++++++++++++++++++++++++++++
>   1 file changed, 278 insertions(+)
>   create mode 100644 tests/qemu-iotests/testenv.py
> 
> diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py
> new file mode 100644
> index 0000000000..348af593e9

[..]

> +    def init_binaries(self):
> +        """Init binary path variables:
> +             PYTHON (for bash tests)
> +             QEMU_PROG, QEMU_IMG_PROG, QEMU_IO_PROG, QEMU_NBD_PROG, QSD_PROG
> +             SOCKET_SCM_HELPER
> +        """
> +        self.python = sys.executable
> +
> +        def root(*names):
> +            return os.path.join(self.build_root, *names)
> +
> +        arch = os.uname().machine
> +        if 'ppc64' in arch:
> +            arch = 'ppc64'
> +
> +        self.qemu_prog = os.getenv('QEMU_PROG', root(f'qemu-system-{arch}'))
> +        if not os.path.exists(self.qemu_prog):
> +            pattern = root('qemu-system-*')
> +            progs = glob.glob(pattern)
> +            if not progs:
> +                sys.exit(f"Not found any Qemu binary by pattern '{pattern}'")
> +            if len(progs) > 1:
> +                progs_list = ', '.join(progs)
> +                sys.exit(f"Several non '{arch}' qemu binaries found: "
> +                         f"{progs_list}, please set QEMU_PROG environment "
> +                         "variable")
> +            self.qemu_prog = progs[0]


squash-in:

diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py
index 348af593e9..1633510caf 100644
--- a/tests/qemu-iotests/testenv.py
+++ b/tests/qemu-iotests/testenv.py
@@ -129,14 +129,14 @@ class TestEnv(AbstractContextManager['TestEnv']):
          if not os.path.exists(self.qemu_prog):
              pattern = root('qemu-system-*')
              progs = glob.glob(pattern)
-            if not progs:
-                sys.exit(f"Not found any Qemu binary by pattern '{pattern}'")
-            if len(progs) > 1:
-                progs_list = ', '.join(progs)
-                sys.exit(f"Several non '{arch}' qemu binaries found: "
-                         f"{progs_list}, please set QEMU_PROG environment "
-                         "variable")
-            self.qemu_prog = progs[0]
+            found = False
+            for p in progs:
+                if os.access(p, os.X_OK):
+                    self.qemu_prog = p
+                    found = True
+            if not found:
+                sys.exit("Not found any Qemu executable binary by pattern "
+                         f"'{pattern}'")


-- 
Best regards,
Vladimir


  reply	other threads:[~2021-01-25 12:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-23 21:04 [PATCH v8 0/5] Rework iotests/check Vladimir Sementsov-Ogievskiy
2021-01-23 21:04 ` [PATCH v8 1/5] iotests: add findtests.py Vladimir Sementsov-Ogievskiy
2021-01-23 21:04 ` [PATCH v8 2/5] iotests: add testenv.py Vladimir Sementsov-Ogievskiy
2021-01-25 12:32   ` Vladimir Sementsov-Ogievskiy [this message]
2021-01-25 22:05   ` Kevin Wolf
2021-01-26  8:28     ` Vladimir Sementsov-Ogievskiy
2021-01-26  9:45       ` Kevin Wolf
2021-01-26 10:08         ` Vladimir Sementsov-Ogievskiy
2021-01-26 10:13           ` Kevin Wolf
2021-01-23 21:04 ` [PATCH v8 3/5] iotests: add testrunner.py Vladimir Sementsov-Ogievskiy
2021-01-23 21:04 ` [PATCH v8 4/5] iotests: rewrite check into python Vladimir Sementsov-Ogievskiy
2021-01-23 21:04 ` [PATCH v8 5/5] iotests: rename and move 169 and 199 tests Vladimir Sementsov-Ogievskiy
2021-01-25 16:08 ` [PATCH v8 0/5] Rework iotests/check Kevin Wolf
2021-01-25 16:23   ` Vladimir Sementsov-Ogievskiy
2021-01-25 16:36   ` Vladimir Sementsov-Ogievskiy
2021-01-25 16:50     ` Kevin Wolf

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=d219a99f-ca1c-6bb3-4723-fab27d96ce3c@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /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.