Skip to contentSkip to conversation

tests: Add check-block to "make check"

PATCH Applied Fam Zheng 2 participants 10 messages Jan 4, 2015 – Jan 12, 2015

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

v4 cover tests: Add check-block to "make check"

qemu-iotests contains useful tests that have a nice coverage of block layer code. Adding check-block (which calls tests/qemu-iotests-quick.sh) to "make check" is good for developers' self-testing.

v4: 06: Use CONFIG_LINUX instead of custom "uname" in tests/Makefile. (Peter)

v2: Take care of other platforms, basically by keeping them unchanged, and only
add "make check-block" to "make check" on Linux. (Peter)

Fam Zheng (7):
.gitignore: Ignore generated "common.env"
qemu-iotests: Remove 091 from quick group
qemu-iotests: Replace "/bin/true" with "true"
qemu-iotests: Add "_supported_os Linux" to 058
qemu-iotests: Speed up make check-block tests/Makefile: Add check-block to make check on Linux
qemu-iotests: Add supported os parameter for python tests

 .gitignore                       | 1 +
 tests/Makefile                   | 3 +++
 tests/qemu-iotests-quick.sh      | 2 +-
 tests/qemu-iotests/058           | 1 +
 tests/qemu-iotests/check         | 1 +
 tests/qemu-iotests/common.config | 2 +-
 tests/qemu-iotests/common.filter | 2 +-
 tests/qemu-iotests/common.rc     | 2 +-
 tests/qemu-iotests/group         | 2 +-
 tests/qemu-iotests/iotests.py    | 5 ++++-
 10 files changed, 15 insertions(+), 6 deletions(-)
Signature · 1 line
1.9.3
author
#1 lore raw

PATCH v4 1/7 .gitignore: Ignore generated "common.env"

---
 .gitignore | 1 +
 1 file changed, 1 insertion(+)
.gitignore +1 -0
index e32a584..090f974 100644
@@ -109,3 +109,4 @@ cscope.*
 tags
 TAGS
 *~
+/tests/qemu-iotests/common.env
Signature · 1 line
1.9.3
author
#2 lore raw

PATCH v4 2/7 qemu-iotests: Remove 091 from quick group

In reply to Fam Zheng

For the purpose of allowing running quick group on tmpfs.

---
 tests/qemu-iotests/group | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/group +1 -1
index a4742c6..08099b9 100644
@@ -97,7 +97,7 @@
 088 rw auto quick
 089 rw auto quick
 090 rw auto quick
-091 rw auto quick
+091 rw auto
 092 rw auto quick
 095 rw auto quick
 097 rw auto backing
Signature · 1 line
1.9.3
author
#3 lore raw

PATCH v4 3/7 qemu-iotests: Replace "/bin/true" with "true"

In reply to Fam Zheng

The former is not portable because on Mac OSX it is /usr/bin/true.

---
 tests/qemu-iotests/common.config | 2 +-
 tests/qemu-iotests/common.filter | 2 +-
 tests/qemu-iotests/common.rc     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
tests/qemu-iotests/common.config +1 -1
index 91a5ef6..a1973ad 100644
@@ -155,4 +155,4 @@ _readlink()
 }
 
 # make sure this script returns success
-/bin/true
+true
tests/qemu-iotests/common.filter +1 -1
index 6c14590..a2cb9fb 100644
@@ -223,4 +223,4 @@ _filter_qemu_img_map()
 }
 
 # make sure this script returns success
-/bin/true
+true
tests/qemu-iotests/common.rc +1 -1
index 3b14053..aa093d9 100644
@@ -490,4 +490,4 @@ _die()
 }
 
 # make sure this script returns success
-/bin/true
+true
Signature · 1 line
1.9.3
author
#4 lore raw

PATCH v4 4/7 qemu-iotests: Add "_supported_os Linux" to 058

In reply to Fam Zheng

Other cases have this, and this test is not portable as well, as we want to add "make check-block" to "make check", it shouldn't fail on Mac OS X.

---
 tests/qemu-iotests/058 | 1 +
 1 file changed, 1 insertion(+)
tests/qemu-iotests/058 +1 -0
index 2d5ca85..a60b34b 100755
@@ -87,6 +87,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _supported_fmt qcow2
 _supported_proto file
+_supported_os Linux
 _require_command QEMU_NBD
 
 # Use -f raw instead of -f $IMGFMT for the NBD connection
Signature · 1 line
1.9.3
author
#5 lore raw

PATCH v4 5/7 qemu-iotests: Speed up make check-block

In reply to Fam Zheng

Using /tmp, which is usually mounted as tmpfs, the quick group can be quicker.

On my laptop (Lenovo T430s with Fedora 20), this reduces the time from 50s to 30s.

---
 tests/qemu-iotests-quick.sh | 2 +-
 tests/qemu-iotests/check    | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
tests/qemu-iotests-quick.sh +1 -1
index 12af731..0e554bb 100755
@@ -3,6 +3,6 @@
 cd tests/qemu-iotests
 
 ret=0
-./check -T -qcow2 -g quick || ret=1
+TEST_DIR=${TEST_DIR:-/tmp/qemu-iotests-quick-$$} ./check -T -qcow2 -g quick || ret=1
 
 exit $ret
tests/qemu-iotests/check +1 -0
index 8ca4011..baeae80 100755
@@ -238,6 +238,7 @@ QEMU_NBD      -- $QEMU_NBD
 IMGFMT        -- $FULL_IMGFMT_DETAILS
 IMGPROTO      -- $FULL_IMGPROTO_DETAILS
 PLATFORM      -- $FULL_HOST_DETAILS
+TEST_DIR      -- $TEST_DIR
 SOCKET_SCM_HELPER -- $SOCKET_SCM_HELPER
 
 EOF
Signature · 1 line
1.9.3
author
#6 lore raw

PATCH v4 6/7 tests/Makefile: Add check-block to make check on Linux

In reply to Fam Zheng

"make check-block" does nothing on other platforms, but still takes some time to enumerate all the tests. So let's only add it for Linux for now.

---
 tests/Makefile | 3 +++
 1 file changed, 3 insertions(+)
tests/Makefile +3 -0
index e4ddb6a..b3ee364 100644
@@ -467,6 +467,9 @@ check-qtest: $(patsubst %,check-qtest-%, $(QTEST_TARGETS))
 check-unit: $(patsubst %,check-%, $(check-unit-y))
 check-block: $(patsubst %,check-%, $(check-block-y))
 check: check-qapi-schema check-unit check-qtest
+ifeq ($(CONFIG_LINUX),y)
+check: check-block
+endif
 check-clean:
 	$(MAKE) -C tests/tcg clean
 	rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
Signature · 1 line
1.9.3
#7 lore raw

Re: [Qemu-devel] [PATCH v4 6/7] tests/Makefile: Add check-block to make check on Linux

Quoted 7 lines · Fam Zheng

"make check-block" does nothing on other platforms, but still takes some time to enumerate all the tests. So let's only add it for Linux for now.

---
 tests/Makefile | 3 +++
 1 file changed, 3 insertions(+)

Dropped from the block pull request because it fails on ARM hosts, as mentioned by Peter Maydell in my block pull request email thread.

Stefan

author
#8 lore raw

PATCH v4 7/7 qemu-iotests: Add supported os parameter for python tests

In reply to Fam Zheng

If I understand correctly, qemu-iotests never meant to be portable. We only support Linux for all the shell cases, but didn't specify it for python tests. Now add this and default all the python tests as Linux only. If we cares enough later, we can override the parameter in individual cases.

---
 tests/qemu-iotests/iotests.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
tests/qemu-iotests/iotests.py +4 -1
index f57f154..87002e0 100644
@@ -282,12 +282,15 @@ def notrun(reason):
     print '%s not run: %s' % (seq, reason)
     sys.exit(0)
 
-def main(supported_fmts=[]):
+def main(supported_fmts=[], supported_oses=['linux']):
     '''Run tests'''
 
     if supported_fmts and (imgfmt not in supported_fmts):
         notrun('not suitable for this image format: %s' % imgfmt)
 
+    if sys.platform not in supported_oses:
+        notrun('not suitable for this OS: %s' % sys.platform)
+
     # We need to filter out the time taken from the output so that qemu-iotest
     # can reliably diff the results against master output.
     import StringIO
Signature · 1 line
1.9.3
#9 lore raw
In reply to Fam Zheng
Quoted 19 lines · Fam Zheng

qemu-iotests contains useful tests that have a nice coverage of block layer code. Adding check-block (which calls tests/qemu-iotests-quick.sh) to "make check" is good for developers' self-testing.

v4: 06: Use CONFIG_LINUX instead of custom "uname" in tests/Makefile. (Peter)

v2: Take care of other platforms, basically by keeping them unchanged, and only
add "make check-block" to "make check" on Linux. (Peter)

Fam Zheng (7):
.gitignore: Ignore generated "common.env"
qemu-iotests: Remove 091 from quick group
qemu-iotests: Replace "/bin/true" with "true"
qemu-iotests: Add "_supported_os Linux" to 058
qemu-iotests: Speed up make check-block tests/Makefile: Add check-block to make check on Linux
qemu-iotests: Add supported os parameter for python tests

Quoted 16 lines
 .gitignore                       | 1 +
 tests/Makefile                   | 3 +++
 tests/qemu-iotests-quick.sh      | 2 +-
 tests/qemu-iotests/058           | 1 +
 tests/qemu-iotests/check         | 1 +
 tests/qemu-iotests/common.config | 2 +-
 tests/qemu-iotests/common.filter | 2 +-
 tests/qemu-iotests/common.rc     | 2 +-
 tests/qemu-iotests/group         | 2 +-
 tests/qemu-iotests/iotests.py    | 5 ++++-
 10 files changed, 15 insertions(+), 6 deletions(-)
Signature · 1 line
1.9.3

Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block

Stefan