Skip to contentSkip to conversation

tests/Makefile.include: export PYTHON for check-block.sh

PATCH Applied Vladimir Sementsov-Ogievskiy 3 participants 5 messages Jan 29, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tests/Makefile.include: export PYTHON for check-block.sh

check-block.sh called by make check-block rely on PYTHON variable being set.

Fixes f203080bbd9f9e5b31041b1f2afcd6040c5aaec5

---

Hi! As Peter reported, build fails on platforms where python3 is not /usr/bin/python3.. This patch should help. At least it works for me if I move /usr/bin/python3 to another location and configure it with --python=. And doesn't work without the patch.
Don't know how the thing seemed to work for me before :\

 tests/Makefile.include | 1 +
 1 file changed, 1 insertion(+)
tests/Makefile.include +1 -0
index 3a0524ce74..ceaf3f0d6e 100644
@@ -138,6 +138,7 @@ check:
 ifeq ($(CONFIG_TOOLS)$(CONFIG_POSIX),yy)
 QEMU_IOTESTS_HELPERS-$(CONFIG_LINUX) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
 check: check-block
+export PYTHON
 check-block: $(SRC_PATH)/tests/check-block.sh qemu-img$(EXESUF) \
 		qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \
 		$(filter qemu-system-%, $(ninja-targets))
Signature · 1 line
2.29.2
#1 lore raw
Quoted 22 lines · Vladimir Sementsov-Ogievskiy

check-block.sh called by make check-block rely on PYTHON variable being set.

Fixes f203080bbd9f9e5b31041b1f2afcd6040c5aaec5

---

Hi! As Peter reported, build fails on platforms where python3 is not /usr/bin/python3.. This patch should help. At least it works for me if I move /usr/bin/python3 to another location and configure it with --python=. And doesn't work without the patch.
Don't know how the thing seemed to work for me before :\

  tests/Makefile.include | 1 +
  1 file changed, 1 insertion(+)
tests/Makefile.include +0 -0
index 3a0524ce74..ceaf3f0d6e 100644

tests/Makefile.include check: · line 144

Quoted 7 lines
tests/Makefile.include +1 -0
@@ -138,6 +138,7 @@ check:
  ifeq ($(CONFIG_TOOLS)$(CONFIG_POSIX),yy)
  QEMU_IOTESTS_HELPERS-$(CONFIG_LINUX) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
  check: check-block
+export PYTHON
  check-block: $(SRC_PATH)/tests/check-block.sh qemu-img$(EXESUF) \
  		qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \
  		$(filter qemu-system-%, $(ninja-targets))

That makes the iotests starting again when running the NetBSD tests ("make vm-build-netbsd"), but then some of the iotests are failing now, e.g.:

040.out.bad renamed from home/qemu/qemu-test.N2qe9i/src/tests/qemu-iotests/040.out +1 -5
@@ -1,5 +1 @@
-.................................................................
-----------------------------------------------------------------------
-Ran 65 tests
-
-OK
+env: python3: No such file or directory

... so looks like this was not the complete fix yet?

Thomas

#2 lore raw
Quoted 43 lines · Thomas Huth
Quoted 23 lines · Vladimir Sementsov-Ogievskiy

check-block.sh called by make check-block rely on PYTHON variable being set.

Fixes f203080bbd9f9e5b31041b1f2afcd6040c5aaec5

---

Hi! As Peter reported, build fails on platforms where python3 is not /usr/bin/python3.. This patch should help. At least it works for me if I move /usr/bin/python3 to another location and configure it with --python=. And doesn't work without the patch.
Don't know how the thing seemed to work for me before :\

  tests/Makefile.include | 1 +

  1 file changed, 1 insertion(+)
tests/Makefile.include +0 -0
index 3a0524ce74..ceaf3f0d6e 100644
@@ -138,6 +138,7 @@ check:
   ifeq ($(CONFIG_TOOLS)$(CONFIG_POSIX),yy)
   QEMU_IOTESTS_HELPERS-$(CONFIG_LINUX) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
Quoted 6 lines

  check: check-block
+export PYTHON
  check-block: $(SRC_PATH)/tests/check-block.sh qemu-img$(EXESUF) \
          qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \
          $(filter qemu-system-%, $(ninja-targets))

That makes the iotests starting again when running the NetBSD tests ("make vm-build-netbsd"), but then some of the iotests are failing now, e.g.:

040.out.bad renamed from home/qemu/qemu-test.N2qe9i/src/tests/qemu-iotests/040.out +1 -5
@@ -1,5 +1 @@
-.................................................................
-----------------------------------------------------------------------
-Ran 65 tests
-
-OK
+env: python3: No such file or directory
Quoted 4 lines

... so looks like this was not the complete fix yet?

 Thomas

Right, thanks.

Aha, we also need:

tests/qemu-iotests/testrunner.py +1 -1
index a581be6a29..24b3fba115 100644
@@ -248,7 +248,7 @@ class TestRunner(ContextManager['TestRunner']):
 
         with f_test.open(encoding="utf-8") as f:
             try:
-                if f.readline() == '#!/usr/bin/env python3':
+                if f.readline().rstrip() == '#!/usr/bin/env python3':
                     args.insert(0, self.env.python)
             except UnicodeDecodeError:  # binary test? for future.
                 pass

will send as a separate patch.

Signature · 2 lines
Best regards,
Vladimir
Tested-by on v1 1/1
#3 lore raw
In reply to Vladimir Sementsov-Ogievskiy
Quoted 22 lines · Vladimir Sementsov-Ogievskiy

check-block.sh called by make check-block rely on PYTHON variable being set.

Fixes f203080bbd9f9e5b31041b1f2afcd6040c5aaec5

---

Hi! As Peter reported, build fails on platforms where python3 is not /usr/bin/python3.. This patch should help. At least it works for me if I move /usr/bin/python3 to another location and configure it with --python=. And doesn't work without the patch.
Don't know how the thing seemed to work for me before :\

  tests/Makefile.include | 1 +
  1 file changed, 1 insertion(+)
tests/Makefile.include +0 -0
index 3a0524ce74..ceaf3f0d6e 100644

tests/Makefile.include check: · line 144

Quoted 7 lines
tests/Makefile.include +1 -0
@@ -138,6 +138,7 @@ check:
  ifeq ($(CONFIG_TOOLS)$(CONFIG_POSIX),yy)
  QEMU_IOTESTS_HELPERS-$(CONFIG_LINUX) = tests/qemu-iotests/socket_scm_helper$(EXESUF)
  check: check-block
+export PYTHON
  check-block: $(SRC_PATH)/tests/check-block.sh qemu-img$(EXESUF) \
  		qemu-io$(EXESUF) qemu-nbd$(EXESUF) $(QEMU_IOTESTS_HELPERS-y) \
  		$(filter qemu-system-%, $(ninja-targets))