Patchwork [v2,2/3] make check: Add qemu-iotests subset

login
register
mail settings
Submitter Kevin Wolf
Date March 9, 2012, 12:46 p.m.
Message ID <1331297197-4289-3-git-send-email-kwolf@redhat.com>
Download mbox | patch
Permalink /patch/145713/
State New
Headers show

Comments

Kevin Wolf - March 9, 2012, 12:46 p.m.
Run the 'quick' group from qemu-iotests during 'make check'.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/Makefile              |    5 +++++
 tests/qemu-iotests-quick.sh |   17 +++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
 create mode 100755 tests/qemu-iotests-quick.sh
Stefan Hajnoczi - March 9, 2012, 1:20 p.m.
On Fri, Mar 9, 2012 at 12:46 PM, Kevin Wolf <kwolf@redhat.com> wrote:
> Run the 'quick' group from qemu-iotests during 'make check'.
>
> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
> ---
>  tests/Makefile              |    5 +++++
>  tests/qemu-iotests-quick.sh |   17 +++++++++++++++++
>  2 files changed, 22 insertions(+), 0 deletions(-)
>  create mode 100755 tests/qemu-iotests-quick.sh
>
> diff --git a/tests/Makefile b/tests/Makefile
> index 74b29dc..571ad42 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -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?
Kevin Wolf - March 9, 2012, 2:09 p.m.
Am 09.03.2012 14:20, schrieb Stefan Hajnoczi:
> On Fri, Mar 9, 2012 at 12:46 PM, Kevin Wolf <kwolf@redhat.com> wrote:
>> Run the 'quick' group from qemu-iotests during 'make check'.
>>
>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>> ---
>>  tests/Makefile              |    5 +++++
>>  tests/qemu-iotests-quick.sh |   17 +++++++++++++++++
>>  2 files changed, 22 insertions(+), 0 deletions(-)
>>  create mode 100755 tests/qemu-iotests-quick.sh
>>
>> diff --git a/tests/Makefile b/tests/Makefile
>> index 74b29dc..571ad42 100644
>> --- a/tests/Makefile
>> +++ b/tests/Makefile
>> @@ -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?

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

Kevin
Stefan Hajnoczi - March 9, 2012, 3:44 p.m.
On Fri, Mar 9, 2012 at 2:09 PM, Kevin Wolf <kwolf@redhat.com> wrote:
> Am 09.03.2012 14:20, schrieb Stefan Hajnoczi:
>> On Fri, Mar 9, 2012 at 12:46 PM, Kevin Wolf <kwolf@redhat.com> wrote:
>>> Run the 'quick' group from qemu-iotests during 'make check'.
>>>
>>> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
>>> ---
>>>  tests/Makefile              |    5 +++++
>>>  tests/qemu-iotests-quick.sh |   17 +++++++++++++++++
>>>  2 files changed, 22 insertions(+), 0 deletions(-)
>>>  create mode 100755 tests/qemu-iotests-quick.sh
>>>
>>> diff --git a/tests/Makefile b/tests/Makefile
>>> index 74b29dc..571ad42 100644
>>> --- a/tests/Makefile
>>> +++ b/tests/Makefile
>>> @@ -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?
>
> 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
Anthony Liguori - March 9, 2012, 7:31 p.m.
On 03/09/2012 06:46 AM, Kevin Wolf wrote:
> Run the 'quick' group from qemu-iotests during 'make check'.
>
> Signed-off-by: Kevin Wolf<kwolf@redhat.com>
> ---
>   tests/Makefile              |    5 +++++
>   tests/qemu-iotests-quick.sh |   17 +++++++++++++++++
>   2 files changed, 22 insertions(+), 0 deletions(-)
>   create mode 100755 tests/qemu-iotests-quick.sh
>
> diff --git a/tests/Makefile b/tests/Makefile
> index 74b29dc..571ad42 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -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

>
>   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")
> diff --git a/tests/qemu-iotests-quick.sh b/tests/qemu-iotests-quick.sh
> new file mode 100755
> index 0000000..cf90de0
> --- /dev/null
> +++ b/tests/qemu-iotests-quick.sh
> @@ -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
Kevin Wolf - March 12, 2012, 8:34 a.m.
Am 09.03.2012 20:31, schrieb Anthony Liguori:
> On 03/09/2012 06:46 AM, Kevin Wolf wrote:
>> Run the 'quick' group from qemu-iotests during 'make check'.
>>
>> Signed-off-by: Kevin Wolf<kwolf@redhat.com>
>> ---
>>   tests/Makefile              |    5 +++++
>>   tests/qemu-iotests-quick.sh |   17 +++++++++++++++++
>>   2 files changed, 22 insertions(+), 0 deletions(-)
>>   create mode 100755 tests/qemu-iotests-quick.sh
>>
>> diff --git a/tests/Makefile b/tests/Makefile
>> index 74b29dc..571ad42 100644
>> --- a/tests/Makefile
>> +++ b/tests/Makefile
>> @@ -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.

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

Patch

diff --git a/tests/Makefile b/tests/Makefile
index 74b29dc..571ad42 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -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")
diff --git a/tests/qemu-iotests-quick.sh b/tests/qemu-iotests-quick.sh
new file mode 100755
index 0000000..cf90de0
--- /dev/null
+++ b/tests/qemu-iotests-quick.sh
@@ -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