diff mbox

[v2,3/3] Add 'make check-block'

Message ID 1331297197-4289-4-git-send-email-kwolf@redhat.com
State New
Headers show

Commit Message

Kevin Wolf March 9, 2012, 12:46 p.m. UTC
Runs the full qemu-iotests suite for various image formats.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/Makefile       |    6 +++++-
 tests/check-block.sh |   21 +++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletions(-)
 create mode 100755 tests/check-block.sh

Comments

Andreas Färber March 9, 2012, 1:26 p.m. UTC | #1
Am 09.03.2012 13:46, schrieb Kevin Wolf:
> Runs the full qemu-iotests suite for various image formats.
> 
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  tests/Makefile       |    6 +++++-
>  tests/check-block.sh |   21 +++++++++++++++++++++
>  2 files changed, 26 insertions(+), 1 deletions(-)
>  create mode 100755 tests/check-block.sh
> 
> diff --git a/tests/Makefile b/tests/Makefile
> index 571ad42..6b4f4aa 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -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:?

>  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

> diff --git a/tests/check-block.sh b/tests/check-block.sh
> new file mode 100755
> index 0000000..b9d9c6a
> --- /dev/null
> +++ b/tests/check-block.sh
> @@ -0,0 +1,21 @@
> +#!/bin/sh
[...]
Kevin Wolf March 9, 2012, 2:05 p.m. UTC | #2
Am 09.03.2012 14:26, schrieb Andreas Färber:
> Am 09.03.2012 13:46, schrieb Kevin Wolf:
>> Runs the full qemu-iotests suite for various image formats.
>>
>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>> ---
>>  tests/Makefile       |    6 +++++-
>>  tests/check-block.sh |   21 +++++++++++++++++++++
>>  2 files changed, 26 insertions(+), 1 deletions(-)
>>  create mode 100755 tests/check-block.sh
>>
>> diff --git a/tests/Makefile b/tests/Makefile
>> index 571ad42..6b4f4aa 100644
>> --- a/tests/Makefile
>> +++ b/tests/Makefile
>> @@ -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:?

Sure.

>>  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
Andreas Färber March 9, 2012, 2:12 p.m. UTC | #3
Am 09.03.2012 15:05, schrieb Kevin Wolf:
> Am 09.03.2012 14:26, schrieb Andreas Färber:
>> Am 09.03.2012 13:46, schrieb Kevin Wolf:
>>>  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?

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
diff mbox

Patch

diff --git a/tests/Makefile b/tests/Makefile
index 571ad42..6b4f4aa 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -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")
diff --git a/tests/check-block.sh b/tests/check-block.sh
new file mode 100755
index 0000000..b9d9c6a
--- /dev/null
+++ b/tests/check-block.sh
@@ -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