Skip to contentSkip to conversation

make check: Add qemu-iotests subset

PATCH In review Kevin Wolf 4 participants 12 messages Mar 9, 2012 – Mar 12, 2012

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

v2 cover make check: Add qemu-iotests subset

Kevin Wolf (3):
qemu-iotests: Mark some tests as quick
make check: Add qemu-iotests subset
Add 'make check-block'

 tests/Makefile              |   11 ++++++++++-
 tests/check-block.sh        |   21 +++++++++++++++++++++
 tests/qemu-iotests-quick.sh |   17 +++++++++++++++++
 tests/qemu-iotests/group    |   24 ++++++++++++------------
 4 files changed, 60 insertions(+), 13 deletions(-)
 create mode 100755 tests/check-block.sh
 create mode 100755 tests/qemu-iotests-quick.sh
Signature · 1 line
1.7.6.5
author
#8 lore raw

PATCH v2 3/3 Add 'make check-block'

Runs the full qemu-iotests suite for various image formats.

---
 tests/Makefile       |    6 +++++-
 tests/check-block.sh |   21 +++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletions(-)
 create mode 100755 tests/check-block.sh
tests/Makefile +5 -1
index 571ad42..6b4f4aa 100644
@@ -47,6 +47,10 @@ test-qmp-commands: test-qmp-commands.o $(qobject-obj-y) $(qapi-obj-y) $(tools-ob
 
 $(SRC_PATH)/tests/qemu-iotests-quick.sh: qemu-img qemu-io
 
-.PHONY: check
+
+.PHONY: check check-block
 check: $(CHECKS)
 	$(call quiet-command, gtester $(CHECKS), "  CHECK")
+
+check-block:
+	$(call quiet-command, $(SRC_PATH)/tests/check-block.sh , "  CHECK")
tests/check-block.sh new file +21 -0
new file mode 100755
index 0000000..b9d9c6a
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+export QEMU_PROG="$(pwd)/x86_64-softmmu/qemu-system-x86_64"
+export QEMU_IMG_PROG="$(pwd)/qemu-img"
+export QEMU_IO_PROG="$(pwd)/qemu-io"
+
+if [ ! -x $QEMU_PROG ]; then
+    echo "'make check-block' requires qemu-system-x86_64"
+    exit 1
+fi
+
+cd $SRC_PATH/tests/qemu-iotests
+
+ret=0
+./check -T -nocache -raw || ret=1
+./check -T -nocache -qcow2 || ret=1
+./check -T -nocache -qed|| ret=1
+./check -T -nocache -vmdk|| ret=1
+./check -T -nocache -vpc || ret=1
+
+exit $ret
Signature · 1 line
1.7.6.5
author
#1 lore raw

PATCH v2 1/3 qemu-iotests: Mark some tests as quick

In reply to Kevin Wolf

This creates a new test group 'quick' for some test case that take at most a couple of seconds each, so that the group can be run during a quick 'make check'

---
 tests/qemu-iotests/group |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)
tests/qemu-iotests/group +12 -12
index fcf869d..b549f10 100644
@@ -8,32 +8,32 @@
 # test-group association ... one line per test
 #
 001 rw auto
-002 rw auto
+002 rw auto quick
 003 rw auto
-004 rw auto
+004 rw auto quick
 005 img auto
 006 img auto
 007 snapshot auto
 008 rw auto
 009 rw auto
 010 rw auto
-011 rw auto
-012 auto
+011 rw auto quick
+012 auto quick
 013 rw auto
 014 rw auto
 015 rw snapshot auto
-016 rw auto
-017 rw backing auto
+016 rw auto quick
+017 rw backing auto quick
 018 rw backing auto
-019 rw backing auto
-020 rw backing auto
+019 rw backing auto quick
+020 rw backing auto quick
 021 io auto
 022 rw snapshot auto
 023 rw auto
-024 rw backing auto
-025 rw auto
+024 rw backing auto quick
+025 rw auto quick
 026 rw blkdbg auto
-027 rw auto
+027 rw auto quick
 028 rw backing auto
-029 rw auto
+029 rw auto quick
 030 rw auto
Signature · 1 line
1.7.6.5
author
#2 lore raw

PATCH v2 2/3 make check: Add qemu-iotests subset

In reply to Kevin Wolf

Run the 'quick' group from qemu-iotests during 'make check'.

---
 tests/Makefile              |    5 +++++
 tests/qemu-iotests-quick.sh |   17 +++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
 create mode 100755 tests/qemu-iotests-quick.sh
tests/Makefile +5 -0
index 74b29dc..571ad42 100644
@@ -1,6 +1,9 @@
+export SRC_PATH
+
 CHECKS = check-qdict check-qfloat check-qint check-qstring check-qlist
 CHECKS += check-qjson test-qmp-output-visitor test-qmp-input-visitor
 CHECKS += test-string-input-visitor test-string-output-visitor test-coroutine
+CHECKS += $(SRC_PATH)/tests/qemu-iotests-quick.sh
 
 check-qint.o check-qstring.o check-qdict.o check-qlist.o check-qfloat.o check-qjson.o test-coroutine.o: $(GENERATED_HEADERS)
 
@@ -42,6 +45,8 @@ test-qmp-input-visitor: test-qmp-input-visitor.o $(qobject-obj-y) $(qapi-obj-y)
 test-qmp-commands.o: $(addprefix $(qapi-dir)/, test-qapi-types.c test-qapi-types.h test-qapi-visit.c test-qapi-visit.h test-qmp-marshal.c test-qmp-commands.h) $(qapi-obj-y)
 test-qmp-commands: test-qmp-commands.o $(qobject-obj-y) $(qapi-obj-y) $(tools-obj-y) $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o $(qapi-dir)/test-qmp-marshal.o module.o
 
+$(SRC_PATH)/tests/qemu-iotests-quick.sh: qemu-img qemu-io
+
 .PHONY: check
 check: $(CHECKS)
 	$(call quiet-command, gtester $(CHECKS), "  CHECK")
tests/qemu-iotests-quick.sh new file +17 -0
new file mode 100755
index 0000000..cf90de0
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# We don't know which of the system emulator binaries there is (or if there is
+# any at all), so the 'quick' group doesn't contain any tests that require
+# running qemu proper. Assign a fake binary name so that qemu-iotests doesn't
+# complain about the missing binary.
+export QEMU_PROG="this_should_be_unused"
+
+export QEMU_IMG_PROG="$(pwd)/qemu-img"
+export QEMU_IO_PROG="$(pwd)/qemu-io"
+
+cd $SRC_PATH/tests/qemu-iotests
+
+ret=0
+./check -T -nocache -qcow2 -g quick || ret=1
+
+exit $ret
Signature · 1 line
1.7.6.5
#3 lore raw
Quoted 14 lines · Kevin Wolf

Run the 'quick' group from qemu-iotests during 'make check'.

---
 tests/Makefile              |    5 +++++ tests/qemu-iotests-quick.sh |   17 +++++++++++++++++

 2 files changed, 22 insertions(+), 0 deletions(-)

 create mode 100755 tests/qemu-iotests-quick.sh

tests/Makefile +0 -0
index 74b29dc..571ad42 100644

tests/Makefile line 1

Quoted 1 line
tests/Makefile +1 -0
@@ -1,6 +1,9 @@
+export SRC_PATH

I'm not sure I like this. Could we avoid this with:

cd $(dirname "$0")/tests/qemu-iotests

instead of using SRC_PATH in qemu-iotests-quick.sh?

#9 lore raw

Re: [Qemu-devel] [PATCH v2 3/3] Add 'make check-block'

In reply to Kevin Wolf

Am 09.03.2012 13:46, schrieb Kevin Wolf:

Quoted 14 lines

Runs the full qemu-iotests suite for various image formats.

---
 tests/Makefile       |    6 +++++-
 tests/check-block.sh |   21 +++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletions(-)
 create mode 100755 tests/check-block.sh
tests/Makefile +0 -0
index 571ad42..6b4f4aa 100644

tests/Makefile test-qmp-commands: test-qmp-commands.o $(qobject-obj-y) $(qapi-obj-y) $(tools-ob · line 51

Quoted 6 lines
tests/Makefile +2 -1
@@ -47,6 +47,10 @@ test-qmp-commands: test-qmp-commands.o $(qobject-obj-y) $(qapi-obj-y) $(tools-ob
 
 $(SRC_PATH)/tests/qemu-iotests-quick.sh: qemu-img qemu-io
 
-.PHONY: check
+
+.PHONY: check check-block

Minor nit: Since you already add a second empty line before .PHONY, care to also add one before check: analog to check-block:?

tests/Makefile test-qmp-commands: test-qmp-commands.o $(qobject-obj-y) $(qapi-obj-y) $(tools-ob · line 56

Quoted 5 lines
tests/Makefile +3 -0
 check: $(CHECKS)
 	$(call quiet-command, gtester $(CHECKS), "  CHECK")
+
+check-block:
+	$(call quiet-command, $(SRC_PATH)/tests/check-block.sh , "  CHECK")

Please use $(SHELL) here.

Andreas

Quoted 7 lines
tests/check-block.sh new file +1 -0
new file mode 100755
index 0000000..b9d9c6a
@@ -0,0 +1,21 @@
+#!/bin/sh

[...]

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
author
#10 lore raw

Re: [Qemu-devel] [PATCH v2 3/3] Add 'make check-block'

Am 09.03.2012 14:26, schrieb Andreas Färber:

Quoted 16 lines

Am 09.03.2012 13:46, schrieb Kevin Wolf:

Quoted 15 lines

Runs the full qemu-iotests suite for various image formats.

---
 tests/Makefile       |    6 +++++-
 tests/check-block.sh |   21 +++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletions(-)
 create mode 100755 tests/check-block.sh
tests/Makefile +0 -0
index 571ad42..6b4f4aa 100644
@@ -47,6 +47,10 @@ test-qmp-commands: test-qmp-commands.o $(qobject-obj-y) $(qapi-obj-y) $(tools-ob
 
Quoted 8 lines

tests/Makefile test-qmp-commands: test-qmp-commands.o $(qobject-obj-y) $(qapi-obj-y) $(tools-ob · line 51

Quoted 5 lines
tests/Makefile +2 -1
 $(SRC_PATH)/tests/qemu-iotests-quick.sh: qemu-img qemu-io
 
-.PHONY: check
+
+.PHONY: check check-block

Minor nit: Since you already add a second empty line before .PHONY, care to also add one before check: analog to check-block:?

Sure.

Quoted 7 lines

tests/Makefile test-qmp-commands: test-qmp-commands.o $(qobject-obj-y) $(qapi-obj-y) $(tools-ob · line 56

Quoted 5 lines
tests/Makefile +3 -0
 check: $(CHECKS)
 	$(call quiet-command, gtester $(CHECKS), "  CHECK")
+
+check-block:
+	$(call quiet-command, $(SRC_PATH)/tests/check-block.sh , "  CHECK")

Please use $(SHELL) here.

Ok, I can do that. But what's the difference?

Kevin

author
#4 lore raw
In reply to Stefan Hajnoczi

Am 09.03.2012 14:20, schrieb Stefan Hajnoczi:

Quoted 19 lines · Kevin Wolf
Quoted 14 lines

Run the 'quick' group from qemu-iotests during 'make check'.

---
 tests/Makefile              |    5 +++++
 tests/qemu-iotests-quick.sh |   17 +++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
 create mode 100755 tests/qemu-iotests-quick.sh
tests/Makefile +0 -0
index 74b29dc..571ad42 100644

tests/Makefile line 1

Quoted 1 line
tests/Makefile +1 -0
@@ -1,6 +1,9 @@
+export SRC_PATH

I'm not sure I like this. Could we avoid this with:

Quoted 3 lines

cd $(dirname "$0")/tests/qemu-iotests

instead of using SRC_PATH in qemu-iotests-quick.sh?

Do you really like this better? To me it doesn't feel cleaner.

Kevin

#11 lore raw

Re: [Qemu-devel] [PATCH v2 3/3] Add 'make check-block'

In reply to Kevin Wolf

Am 09.03.2012 15:05, schrieb Kevin Wolf:

Quoted 11 lines

Am 09.03.2012 14:26, schrieb Andreas Färber:

Quoted 8 lines

Am 09.03.2012 13:46, schrieb Kevin Wolf:

tests/Makefile test-qmp-commands: test-qmp-commands.o $(qobject-obj-y) $(qapi-obj-y) $(tools-ob · line 56

Quoted 5 lines

check: $(CHECKS)

tests/Makefile +3 -0
 	$(call quiet-command, gtester $(CHECKS), "  CHECK")
+
+check-block:
+	$(call quiet-command, $(SRC_PATH)/tests/check-block.sh , "  CHECK")

Please use $(SHELL) here.

Ok, I can do that. But what's the difference?

The difference is that /bin/sh can be dash or some non-POSIX-compliant shell. There's an open bug about Solaris 10 needing some oddly named shell instead of /bin/sh, for instance. By executing ./check-block.sh via shebang, a shell different from the one the user has explicitly used for configure gets used. There's an example of $(SHELL) use in ../Makefile.

An alternative would be inlining your script into the Makefile.

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#5 lore raw
In reply to Kevin Wolf
Quoted 20 lines · Kevin Wolf

Am 09.03.2012 14:20, schrieb Stefan Hajnoczi:

Quoted 19 lines · Kevin Wolf
Quoted 14 lines

Run the 'quick' group from qemu-iotests during 'make check'.

---
 tests/Makefile              |    5 +++++ tests/qemu-iotests-quick.sh |   17 +++++++++++++++++

 2 files changed, 22 insertions(+), 0 deletions(-)

 create mode 100755 tests/qemu-iotests-quick.sh

tests/Makefile +0 -0
index 74b29dc..571ad42 100644

tests/Makefile line 1

Quoted 1 line
tests/Makefile +1 -0
@@ -1,6 +1,9 @@
+export SRC_PATH

I'm not sure I like this.  Could we avoid this with:

Quoted 5 lines
Quoted 3 lines

cd $(dirname "$0")/tests/qemu-iotests

instead of using SRC_PATH in qemu-iotests-quick.sh?

Do you really like this better? To me it doesn't feel cleaner.

It makes qemu-iotests-quick.sh self-contained instead of relying on a magic environment variable. That's why I like it better.

But it's not critical :).

Stefan

#6 lore raw
In reply to Kevin Wolf
Quoted 14 lines · Kevin Wolf

Run the 'quick' group from qemu-iotests during 'make check'.

---
  tests/Makefile              |    5 +++++
  tests/qemu-iotests-quick.sh |   17 +++++++++++++++++
  2 files changed, 22 insertions(+), 0 deletions(-)

create mode 100755 tests/qemu-iotests-quick.sh

tests/Makefile +0 -0
index 74b29dc..571ad42 100644

tests/Makefile line 6

Quoted 6 lines
tests/Makefile +3 -0
@@ -1,6 +1,9 @@
+export SRC_PATH
+
  CHECKS = check-qdict check-qfloat check-qint check-qstring check-qlist
  CHECKS += check-qjson test-qmp-output-visitor test-qmp-input-visitor
  CHECKS += test-string-input-visitor test-string-output-visitor test-coroutine
+CHECKS += $(SRC_PATH)/tests/qemu-iotests-quick.sh

Not to suggest that we don't start here, but I think we should look into how to make qemu-iotest use gtester in the near future.

That will allow the qemu-iotest to be part of the make check-report output and will provide an easy way for other tools (like autotest) to run these tests.

Regards,

Anthony Liguori

Quoted 35 lines
tests/Makefile +2 -0
  check-qint.o check-qstring.o check-qdict.o check-qlist.o check-qfloat.o check-qjson.o test-coroutine.o: $(GENERATED_HEADERS)
 
@@ -42,6 +45,8 @@ test-qmp-input-visitor: test-qmp-input-visitor.o $(qobject-obj-y) $(qapi-obj-y)
  test-qmp-commands.o: $(addprefix $(qapi-dir)/, test-qapi-types.c test-qapi-types.h test-qapi-visit.c test-qapi-visit.h test-qmp-marshal.c test-qmp-commands.h) $(qapi-obj-y)
  test-qmp-commands: test-qmp-commands.o $(qobject-obj-y) $(qapi-obj-y) $(tools-obj-y) $(qapi-dir)/test-qapi-visit.o $(qapi-dir)/test-qapi-types.o $(qapi-dir)/test-qmp-marshal.o module.o
 
+$(SRC_PATH)/tests/qemu-iotests-quick.sh: qemu-img qemu-io
+
  .PHONY: check
  check: $(CHECKS)
  	$(call quiet-command, gtester $(CHECKS), "  CHECK")
tests/qemu-iotests-quick.sh new file +17 -0
new file mode 100755
index 0000000..cf90de0
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# We don't know which of the system emulator binaries there is (or if there is
+# any at all), so the 'quick' group doesn't contain any tests that require
+# running qemu proper. Assign a fake binary name so that qemu-iotests doesn't
+# complain about the missing binary.
+export QEMU_PROG="this_should_be_unused"
+
+export QEMU_IMG_PROG="$(pwd)/qemu-img"
+export QEMU_IO_PROG="$(pwd)/qemu-io"
+
+cd $SRC_PATH/tests/qemu-iotests
+
+ret=0
+./check -T -nocache -qcow2 -g quick || ret=1
+
+exit $ret
author
#7 lore raw

Am 09.03.2012 20:31, schrieb Anthony Liguori:

Quoted 25 lines · Kevin Wolf
Quoted 14 lines

Run the 'quick' group from qemu-iotests during 'make check'.

---
  tests/Makefile              |    5 +++++
  tests/qemu-iotests-quick.sh |   17 +++++++++++++++++
  2 files changed, 22 insertions(+), 0 deletions(-)

create mode 100755 tests/qemu-iotests-quick.sh

tests/Makefile +0 -0
index 74b29dc..571ad42 100644

tests/Makefile line 6

Quoted 6 lines
tests/Makefile +3 -0
@@ -1,6 +1,9 @@
+export SRC_PATH
+
  CHECKS = check-qdict check-qfloat check-qint check-qstring check-qlist
  CHECKS += check-qjson test-qmp-output-visitor test-qmp-input-visitor
  CHECKS += test-string-input-visitor test-string-output-visitor test-coroutine
+CHECKS += $(SRC_PATH)/tests/qemu-iotests-quick.sh

Not to suggest that we don't start here, but I think we should look into how to make qemu-iotest use gtester in the near future.

Quoted 2 lines

That will allow the qemu-iotest to be part of the make check-report output and will provide an easy way for other tools (like autotest) to run these tests.

Yes, we need to figure out how to integrate shell scripts with gtester. If we can't, we need to rethink gtester as our framework and put something more flexible on top.

Kevin