diff mbox series

[v3,45/46] tests/Makefile.include: add [build|clean|check]-tcg targets

Message ID 20180424152405.10304-46-alex.bennee@linaro.org
State New
Headers show
Series fix building of tests/tcg | expand

Commit Message

Alex Bennée April 24, 2018, 3:24 p.m. UTC
This will ensure all linux-user targets build their guest test
programs and ensure check-tcg will run the respective tests.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

---
v2
  - use -include instead of complex macro stuff
  - also include TARGET_BASE_ARCH/Makefile
v3
  - add build-tcg, make check-tcg actually run tests
---
 tests/Makefile.include     | 26 ++++++++++++++++++++++-
 tests/tcg/Makefile.include | 43 ++++++++++++++++++++++----------------
 2 files changed, 50 insertions(+), 19 deletions(-)

-- 
2.17.0

Comments

Philippe Mathieu-Daudé April 24, 2018, 11:13 p.m. UTC | #1
Hi Alex,

On 04/24/2018 12:24 PM, Alex Bennée wrote:
> This will ensure all linux-user targets build their guest test

> programs and ensure check-tcg will run the respective tests.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---

> v2

>   - use -include instead of complex macro stuff

>   - also include TARGET_BASE_ARCH/Makefile

> v3

>   - add build-tcg, make check-tcg actually run tests

> ---

>  tests/Makefile.include     | 26 ++++++++++++++++++++++-

>  tests/tcg/Makefile.include | 43 ++++++++++++++++++++++----------------

>  2 files changed, 50 insertions(+), 19 deletions(-)

> 

> diff --git a/tests/Makefile.include b/tests/Makefile.include

> index 3d2f0458ab..310ccefdd9 100644

> --- a/tests/Makefile.include

> +++ b/tests/Makefile.include

> @@ -10,6 +10,7 @@ check-help:

>  	@echo " $(MAKE) check-speed          Run qobject speed tests"

>  	@echo " $(MAKE) check-qapi-schema    Run QAPI schema tests"

>  	@echo " $(MAKE) check-block          Run block tests"

> +	@echo " $(MAKE) check-tcg            Run TCG tests"

>  	@echo " $(MAKE) check-report.html    Generates an HTML test report"

>  	@echo " $(MAKE) check-clean          Clean the tests"

>  	@echo

> @@ -916,6 +917,30 @@ check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check

>  check-report.html: check-report.xml

>  	$(call quiet-command,gtester-report $< > $@,"GEN","$@")

>  

> +# Per guest TCG tests

> +

> +LINUX_USER_TARGETS=$(filter %-linux-user,$(TARGET_LIST))

> +BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS))

> +CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(LINUX_USER_TARGETS))

> +RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(LINUX_USER_TARGETS))

> +

> +build-tcg-tests-%:

> +	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" guest-tests,)

> +

> +run-tcg-tests-%: build-tcg-tests-%

> +	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" run-guest-tests,)

> +

> +clean-tcg-tests-%:

> +	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" clean-guest-tests,)

> +

> +.PHONY: build-tcg

> +build-tcg: $(BUILD_TCG_TARGET_RULES)

> +

> +.PHONY: check-tcg

> +check-tcg: $(RUN_TCG_TARGET_RULES)

> +

> +.PHONY: clean-tcg

> +clean-tcg: $(CLEAN_TCG_TARGET_RULES)

>  

>  # Other tests

>  

> @@ -958,7 +983,6 @@ check-speed: $(patsubst %,check-%, $(check-speed-y))

>  check-block: $(patsubst %,check-%, $(check-block-y))

>  check: check-qapi-schema check-unit check-qtest check-decodetree

>  check-clean:

> -	$(MAKE) -C tests/tcg clean

>  	rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)

>  	rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)) $(check-qtest-generic-y))

>  	rm -f tests/test-qapi-gen-timestamp

> diff --git a/tests/tcg/Makefile.include b/tests/tcg/Makefile.include

> index cb8bb36026..67e89ecb67 100644

> --- a/tests/tcg/Makefile.include

> +++ b/tests/tcg/Makefile.include

> @@ -8,19 +8,14 @@

>  # guest compiler or calling one of our docker images to do it for us.

>  #

>  

> -# The per ARCH makefile, if it exists holds extra information about

> -# useful docker images or alternative compiler flags. Include it if it

> -# exists

> +# The per ARCH makefile, if it exists, holds extra information about

> +# useful docker images or alternative compiler flags.

>  

> -ARCH_MAKEFILE=$(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include

> -CHECK_INCLUDE=$(wildcard $(ARCH_MAKEFILE))

> -

> -ifeq ($(ARCH_MAKEFILE),$(CHECK_INCLUDE))

> -include $(ARCH_MAKEFILE)

> -endif

> +-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include

> +-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include

>  

>  GUEST_BUILD=

> -

> +TCG_MAKE=$(SRC_PATH)/tests/tcg/Makefile

>  # Support installed Cross Compilers

>  

>  ifdef CROSS_CC_GUEST

> @@ -28,10 +23,10 @@ ifdef CROSS_CC_GUEST

>  .PHONY: cross-build-guest-tests

>  cross-build-guest-tests:

>  	$(call quiet-command, \

> -          (mkdir -p tests && cd tests && \

> -	   make -f $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(CROSS_CC_GUEST)), \

> -	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")

> -

> +	   (mkdir -p tests && cd tests && \

> +	    make -f $(TCG_MAKE) CC=$(CROSS_CC_GUEST) \

> +				EXTRA_CFLAGS=$(CROSS_CC_GUEST_CFLAGS)), \

> +	"CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")

>  

>  GUEST_BUILD=cross-build-guest-tests

>  

> @@ -54,9 +49,10 @@ DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE)

>  .PHONY: docker-build-guest-tests

>  docker-build-guest-tests: $(DOCKER_PREREQ)

>  	$(call quiet-command, \

> -          (mkdir -p tests && cd tests && \

> -	   make -f $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(DOCKER_COMPILE_CMD)), \

> -	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")

> +	  (mkdir -p tests && cd tests && \

> +	   make -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \

> +			       EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \

> +	"CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")


I'm not sure this is working as expected, for some reason "make
build-tcg-tests-aarch64-linux-user" try to use the debian-armel-cross image:

/build$ make build-tcg-tests-aarch64-linux-user V=1 -j1
make  BUILD_DIR=/build -C aarch64-linux-user V="1"
TARGET_DIR="aarch64-linux-user/" guest-tests
make[1]: Entering directory '/build/aarch64-linux-user'
/source/qemu/tests/docker/docker.py build qemu:debian9
/source/qemu/tests/docker/dockerfiles/debian9.docker   --add-current-user
[...]
/source/qemu/tests/docker/docker.py build qemu:debian-armel-cross
/source/qemu/tests/docker/dockerfiles/debian-armel-cross.docker
--add-current-user
[...]
(mkdir -p tests && cd tests && make -f /source/qemu/tests/tcg/Makefile
CC="/source/qemu/tests/docker/docker.py cc --user 1000 --cc
arm-linux-gnueabi-gcc -i qemu:debian-armel-cross -s /source/qemu -- "
EXTRA_CFLAGS=)
make[2]: Entering directory '/home/phil/build/aarch64-linux-user/tests'
/source/qemu/tests/docker/docker.py cc --user 1000 --cc
arm-linux-gnueabi-gcc -i qemu:debian-armel-cross -s /source/qemu --
-Wall -O0 -g -fno-strict-aliasing  /source/qemu/tests/tcg/aarch64/fcvt.c
-o fcvt  -static -lm
/source/qemu/tests/tcg/aarch64/fcvt.c: In function 'print_double_number':
/source/qemu/tests/tcg/aarch64/fcvt.c:37:42: warning: format '%lx'
expects argument of type 'long unsigned int', but argument 4 has type
'uint64_t {aka long long unsigned int}' [-Wformat=]
     printf("%02d DOUBLE: %02.20e / %#020lx  (%#x => %s)\n",
                                          ^
/source/qemu/tests/tcg/aarch64/fcvt.c: In function 'convert_single_to_half':
/source/qemu/tests/tcg/aarch64/fcvt.c:82:9: error: inconsistent operand
constraints in an 'asm'
         asm("fcvt %h0, %d1" : "=w" (output) : "x" (input));
         ^~~
/source/qemu/tests/tcg/aarch64/fcvt.c: In function 'main':
/source/qemu/tests/tcg/aarch64/fcvt.c:241:5: error: unknown register
name 'x1' in 'asm'
     asm("msr fpsr, x1\n\t"
     ^~~
make[2]: *** [/source/qemu/tests/tcg/Makefile:49: fcvt] Error 1
make[2]: Leaving directory '/home/phil/build/aarch64-linux-user/tests'
make[1]: *** [/source/qemu/tests/tcg/Makefile.include:51:
docker-build-guest-tests] Error 2
make[1]: Leaving directory '/home/phil/build/aarch64-linux-user'
make: *** [/source/qemu/tests/Makefile.include:928:
build-tcg-tests-aarch64-linux-user] Error 2

Note this:

Entering directory '/build/aarch64-linux-user'
[...]
docker.py build qemu:debian-armel-cross ...

I'm not sure this is related to this patch or the previous (44).

>  

>  GUEST_BUILD=docker-build-guest-tests

>  

> @@ -68,9 +64,20 @@ endif

>  

>  ifneq ($(GUEST_BUILD),)

>  guest-tests: $(GUEST_BUILD)

> +

> +run-guest-tests: guest-tests

> +	$(call quiet-command, \

> +	(cd tests && make -f $(TCG_MAKE) run), \

> +	"RUN-TESTS", "for $(TARGET_NAME)")

> +

>  else

>  guest-tests:

> -	$(call quiet-command, /bin/true, "CROSS-BUILD", "$(TARGET_NAME) guest-tests SKIPPED")

> +	$(call quiet-command, /bin/true, "CROSS-BUILD", \

> +		"$(TARGET_NAME) guest-tests SKIPPED")

> +

> +run-guest-tests:

> +	$(call quiet-command, /bin/true, "RUN-TESTS", \

> +		"for $(TARGET_NAME) SKIPPED")

>  endif

>  

>  # It doesn't mater if these don't exits

>
Philippe Mathieu-Daudé April 25, 2018, 3:18 a.m. UTC | #2
On 04/24/2018 12:24 PM, Alex Bennée wrote:
> This will ensure all linux-user targets build their guest test

> programs and ensure check-tcg will run the respective tests.

> 

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

> ---

> v2

>   - use -include instead of complex macro stuff

>   - also include TARGET_BASE_ARCH/Makefile

> v3

>   - add build-tcg, make check-tcg actually run tests

> ---

>  tests/Makefile.include     | 26 ++++++++++++++++++++++-

>  tests/tcg/Makefile.include | 43 ++++++++++++++++++++++----------------

>  2 files changed, 50 insertions(+), 19 deletions(-)

> 

> diff --git a/tests/Makefile.include b/tests/Makefile.include

> index 3d2f0458ab..310ccefdd9 100644

> --- a/tests/Makefile.include

> +++ b/tests/Makefile.include

> @@ -10,6 +10,7 @@ check-help:

>  	@echo " $(MAKE) check-speed          Run qobject speed tests"

>  	@echo " $(MAKE) check-qapi-schema    Run QAPI schema tests"

>  	@echo " $(MAKE) check-block          Run block tests"

> +	@echo " $(MAKE) check-tcg            Run TCG tests"

>  	@echo " $(MAKE) check-report.html    Generates an HTML test report"

>  	@echo " $(MAKE) check-clean          Clean the tests"

>  	@echo

> @@ -916,6 +917,30 @@ check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check

>  check-report.html: check-report.xml

>  	$(call quiet-command,gtester-report $< > $@,"GEN","$@")

>  

> +# Per guest TCG tests

> +

> +LINUX_USER_TARGETS=$(filter %-linux-user,$(TARGET_LIST))

> +BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS))

> +CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(LINUX_USER_TARGETS))

> +RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(LINUX_USER_TARGETS))

> +

> +build-tcg-tests-%:

> +	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" guest-tests,)

> +

> +run-tcg-tests-%: build-tcg-tests-%

> +	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" run-guest-tests,)

> +

> +clean-tcg-tests-%:

> +	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" clean-guest-tests,)

> +

> +.PHONY: build-tcg

> +build-tcg: $(BUILD_TCG_TARGET_RULES)

> +

> +.PHONY: check-tcg

> +check-tcg: $(RUN_TCG_TARGET_RULES)

> +

> +.PHONY: clean-tcg

> +clean-tcg: $(CLEAN_TCG_TARGET_RULES)

>  

>  # Other tests

>  

> @@ -958,7 +983,6 @@ check-speed: $(patsubst %,check-%, $(check-speed-y))

>  check-block: $(patsubst %,check-%, $(check-block-y))

>  check: check-qapi-schema check-unit check-qtest check-decodetree

>  check-clean:

> -	$(MAKE) -C tests/tcg clean

>  	rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)

>  	rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)) $(check-qtest-generic-y))

>  	rm -f tests/test-qapi-gen-timestamp

> diff --git a/tests/tcg/Makefile.include b/tests/tcg/Makefile.include

> index cb8bb36026..67e89ecb67 100644

> --- a/tests/tcg/Makefile.include

> +++ b/tests/tcg/Makefile.include

> @@ -8,19 +8,14 @@

>  # guest compiler or calling one of our docker images to do it for us.

>  #

>  

> -# The per ARCH makefile, if it exists holds extra information about

> -# useful docker images or alternative compiler flags. Include it if it

> -# exists

> +# The per ARCH makefile, if it exists, holds extra information about

> +# useful docker images or alternative compiler flags.

>  

> -ARCH_MAKEFILE=$(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include

> -CHECK_INCLUDE=$(wildcard $(ARCH_MAKEFILE))

> -

> -ifeq ($(ARCH_MAKEFILE),$(CHECK_INCLUDE))

> -include $(ARCH_MAKEFILE)

> -endif

> +-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include

> +-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include

>  

>  GUEST_BUILD=

> -

> +TCG_MAKE=$(SRC_PATH)/tests/tcg/Makefile

>  # Support installed Cross Compilers

>  

>  ifdef CROSS_CC_GUEST

> @@ -28,10 +23,10 @@ ifdef CROSS_CC_GUEST

>  .PHONY: cross-build-guest-tests

>  cross-build-guest-tests:

>  	$(call quiet-command, \

> -          (mkdir -p tests && cd tests && \

> -	   make -f $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(CROSS_CC_GUEST)), \

> -	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")

> -

> +	   (mkdir -p tests && cd tests && \

> +	    make -f $(TCG_MAKE) CC=$(CROSS_CC_GUEST) \

> +				EXTRA_CFLAGS=$(CROSS_CC_GUEST_CFLAGS)), \

> +	"CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")

>  

>  GUEST_BUILD=cross-build-guest-tests

>  

> @@ -54,9 +49,10 @@ DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE)

>  .PHONY: docker-build-guest-tests

>  docker-build-guest-tests: $(DOCKER_PREREQ)

>  	$(call quiet-command, \

> -          (mkdir -p tests && cd tests && \

> -	   make -f $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(DOCKER_COMPILE_CMD)), \

> -	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")

> +	  (mkdir -p tests && cd tests && \

> +	   make -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \

> +			       EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \

> +	"CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")

>  

>  GUEST_BUILD=docker-build-guest-tests

>  

> @@ -68,9 +64,20 @@ endif

>  

>  ifneq ($(GUEST_BUILD),)

>  guest-tests: $(GUEST_BUILD)

> +

> +run-guest-tests: guest-tests

> +	$(call quiet-command, \

> +	(cd tests && make -f $(TCG_MAKE) run), \

> +	"RUN-TESTS", "for $(TARGET_NAME)")

> +

>  else

>  guest-tests:

> -	$(call quiet-command, /bin/true, "CROSS-BUILD", "$(TARGET_NAME) guest-tests SKIPPED")

> +	$(call quiet-command, /bin/true, "CROSS-BUILD", \

> +		"$(TARGET_NAME) guest-tests SKIPPED")

> +

> +run-guest-tests:

> +	$(call quiet-command, /bin/true, "RUN-TESTS", \

> +		"for $(TARGET_NAME) SKIPPED")

>  endif

>  

>  # It doesn't mater if these don't exits


I forgot I switched to this default:

$ alias make
alias make='make -j$(nproc) -l$(bc<<<"scale=2;$(nproc)*.94")'

with which this script is very unhappy :)

$ make -j4 check-tcg
  BUILD   debian9
  BUILD   debian-sid
  BUILD   debian9
  BUILD   debian9
^CTraceback (most recent call last):
  File "/source/qemu/tests/docker/docker.py", line 456, in <module>
    sys.exit(main())
  File "/source/qemu/tests/docker/docker.py", line 453, in main
    return args.cmdobj.run(args, argv)
  File "/source/qemu/tests/docker/docker.py", line 326, in run
Traceback (most recent call last):
  File "/source/qemu/tests/docker/docker.py", line 456, in <module>
    extra_files_cksum=cksum)
  File "/source/qemu/tests/docker/docker.py", line 209, in build_image
    sys.exit(main())
  File "/source/qemu/tests/docker/docker.py", line 453, in main
Traceback (most recent call last):
  File "/source/qemu/tests/docker/docker.py", line 456, in <module>
    return args.cmdobj.run(args, argv)
  File "/source/qemu/tests/docker/docker.py", line 326, in run
Traceback (most recent call last):
    sys.exit(main())
  File "/source/qemu/tests/docker/docker.py", line 456, in <module>
    sys.exit(main())
  File "/source/qemu/tests/docker/docker.py", line 453, in main
    return args.cmdobj.run(args, argv)
  File "/source/qemu/tests/docker/docker.py", line 326, in run
    extra_files_cksum=cksum)
  File "/source/qemu/tests/docker/docker.py", line 209, in build_image
    quiet=quiet)
  File "/source/qemu/tests/docker/docker.py", line 147, in _do_check
    return subprocess.check_call(self._command + cmd, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 185, in check_call
        extra_files_cksum=cksum)
  File "/source/qemu/tests/docker/docker.py", line 209, in build_image
    quiet=quiet)
  File "/source/qemu/tests/docker/docker.py", line 147, in _do_check
quiet=quiet)
      File "/source/qemu/tests/docker/docker.py", line 147, in _do_check
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 172, in call
    return subprocess.check_call(self._command + cmd, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 185, in check_call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 1099, in wait
      File "/source/qemu/tests/docker/docker.py", line 453, in main
retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 172, in call
    return args.cmdobj.run(args, argv)
  File "/source/qemu/tests/docker/docker.py", line 326, in run
    extra_files_cksum=cksum)
  File "/source/qemu/tests/docker/docker.py", line 209, in build_image
        quiet=quiet)
  File "/source/qemu/tests/docker/docker.py", line 147, in _do_check
return Popen(*popenargs, **kwargs).wait()
        return subprocess.check_call(self._command + cmd, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 185, in check_call
  File "/usr/lib/python2.7/subprocess.py", line 1099, in wait
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 172, in call
pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/lib/python2.7/subprocess.py", line 125, in _eintr_retry_call
    return func(*args)
KeyboardInterrupt
    pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/lib/python2.7/subprocess.py", line 125, in _eintr_retry_call
    return func(*args)
KeyboardInterrupt
return subprocess.check_call(self._command + cmd, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 185, in check_call
        return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 1099, in wait
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 172, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/usr/lib/python2.7/subprocess.py", line 1099, in wait
    pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/lib/python2.7/subprocess.py", line 125, in _eintr_retry_call
    return func(*args)
KeyboardInterruptpid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)

  File "/usr/lib/python2.7/subprocess.py", line 125, in _eintr_retry_call
    return func(*args)
KeyboardInterrupt
^[[AError in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/source/qemu/tests/docker/docker.py", line 174, in _kill_instances
    return self._do_kill_instances(True)
  File "/source/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances
    resp = self._output(["inspect", i])
  File "/source/qemu/tests/docker/docker.py", line 179, in _output
    **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['docker', 'inspect', '9fc7dac8cd07']'
returned non-zero exit status 1
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/source/qemu/tests/docker/docker.py", line 174, in _kill_instances
    return self._do_kill_instances(True)
  File "/source/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances
    resp = self._output(["inspect", i])
  File "/source/qemu/tests/docker/docker.py", line 179, in _output
    **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['docker', 'inspect',
'9fc7dac8cd07']' returned non-zero exit status 1
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/source/qemu/tests/docker/docker.py", line 174, in _kill_instances
    return self._do_kill_instances(True)
  File "/source/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances
    resp = self._output(["inspect", i])
  File "/source/qemu/tests/docker/docker.py", line 179, in _output
    **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['docker', 'inspect', '9fc7dac8cd07']'
returned non-zero exit status 1
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/source/qemu/tests/docker/docker.py", line 174, in _kill_instances
    return self._do_kill_instances(True)
  File "/source/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances
    resp = self._output(["inspect", i])
  File "/source/qemu/tests/docker/docker.py", line 179, in _output
    **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['docker', 'inspect',
'9fc7dac8cd07']' returned non-zero exit status 1
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/source/qemu/tests/docker/docker.py", line 174, in _kill_instances
    return self._do_kill_instances(True)
  File "/source/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances
    resp = self._output(["inspect", i])
  File "/source/qemu/tests/docker/docker.py", line 179, in _output
    **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
make[1]: *** [/source/qemu/tests/docker/Makefile.include:39:
docker-image-debian9] Interrupt
CalledProcessError: Command '['docker', 'inspect', '9fc7dac8cd07']'
returned non-zero exit status 1
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/source/qemu/tests/docker/docker.py", line 174, in _kill_instances
    return self._do_kill_instances(True)
  File "/source/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances
    resp = self._output(["inspect", i])
  File "/source/qemu/tests/docker/docker.py", line 179, in _output
    **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['docker', 'inspect',
'9fc7dac8cd07']' returned non-zero exit status 1
make: *** [/source/qemu/tests/Makefile.include:928:
build-tcg-tests-aarch64_be-linux-user] Interrupt
make[1]: *** [/source/qemu/tests/docker/Makefile.include:39:
docker-image-debian9] Interrupt
make: *** [/source/qemu/tests/Makefile.include:928:
build-tcg-tests-aarch64-linux-user] Interrupt
make[1]: *** [/source/qemu/tests/docker/Makefile.include:39:
docker-image-debian9] Interrupt
make: *** [/source/qemu/tests/Makefile.include:928:
build-tcg-tests-arm-linux-user] Interrupt
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/source/qemu/tests/docker/docker.py", line 174, in _kill_instances
    return self._do_kill_instances(True)
  File "/source/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances
    resp = self._output(["inspect", i])
  File "/source/qemu/tests/docker/docker.py", line 179, in _output
    **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['docker', 'inspect', '9fc7dac8cd07']'
returned non-zero exit status 1
Error in sys.exitfunc:
Traceback (most recent call last):
  File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File "/source/qemu/tests/docker/docker.py", line 174, in _kill_instances
    return self._do_kill_instances(True)
  File "/source/qemu/tests/docker/docker.py", line 154, in
_do_kill_instances
    resp = self._output(["inspect", i])
  File "/source/qemu/tests/docker/docker.py", line 179, in _output
    **kwargs)
  File "/usr/lib/python2.7/subprocess.py", line 223, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['docker', 'inspect',
'9fc7dac8cd07']' returned non-zero exit status 1
make[1]: *** [/source/qemu/tests/docker/Makefile.include:39:
docker-image-debian-sid] Interrupt
make: *** [/source/qemu/tests/Makefile.include:928:
build-tcg-tests-alpha-linux-user] Interrupt
Philippe Mathieu-Daudé April 25, 2018, 2:15 p.m. UTC | #3
On 04/24/2018 08:13 PM, Philippe Mathieu-Daudé wrote:
> On 04/24/2018 12:24 PM, Alex Bennée wrote:

>> This will ensure all linux-user targets build their guest test

>> programs and ensure check-tcg will run the respective tests.

>>

>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

>> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>> ---

>> v2

>>   - use -include instead of complex macro stuff

>>   - also include TARGET_BASE_ARCH/Makefile

>> v3

>>   - add build-tcg, make check-tcg actually run tests

>> ---

>>  tests/Makefile.include     | 26 ++++++++++++++++++++++-

>>  tests/tcg/Makefile.include | 43 ++++++++++++++++++++++----------------

>>  2 files changed, 50 insertions(+), 19 deletions(-)

>>

>> diff --git a/tests/Makefile.include b/tests/Makefile.include

>> index 3d2f0458ab..310ccefdd9 100644

>> --- a/tests/Makefile.include

>> +++ b/tests/Makefile.include

>> @@ -10,6 +10,7 @@ check-help:

>>  	@echo " $(MAKE) check-speed          Run qobject speed tests"

>>  	@echo " $(MAKE) check-qapi-schema    Run QAPI schema tests"

>>  	@echo " $(MAKE) check-block          Run block tests"

>> +	@echo " $(MAKE) check-tcg            Run TCG tests"

>>  	@echo " $(MAKE) check-report.html    Generates an HTML test report"

>>  	@echo " $(MAKE) check-clean          Clean the tests"

>>  	@echo

>> @@ -916,6 +917,30 @@ check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check

>>  check-report.html: check-report.xml

>>  	$(call quiet-command,gtester-report $< > $@,"GEN","$@")

>>  

>> +# Per guest TCG tests

>> +

>> +LINUX_USER_TARGETS=$(filter %-linux-user,$(TARGET_LIST))

>> +BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS))

>> +CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(LINUX_USER_TARGETS))

>> +RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(LINUX_USER_TARGETS))

>> +

>> +build-tcg-tests-%:

>> +	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" guest-tests,)

>> +

>> +run-tcg-tests-%: build-tcg-tests-%

>> +	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" run-guest-tests,)

>> +

>> +clean-tcg-tests-%:

>> +	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" clean-guest-tests,)

>> +

>> +.PHONY: build-tcg

>> +build-tcg: $(BUILD_TCG_TARGET_RULES)

>> +

>> +.PHONY: check-tcg

>> +check-tcg: $(RUN_TCG_TARGET_RULES)

>> +

>> +.PHONY: clean-tcg

>> +clean-tcg: $(CLEAN_TCG_TARGET_RULES)

>>  

>>  # Other tests

>>  

>> @@ -958,7 +983,6 @@ check-speed: $(patsubst %,check-%, $(check-speed-y))

>>  check-block: $(patsubst %,check-%, $(check-block-y))

>>  check: check-qapi-schema check-unit check-qtest check-decodetree

>>  check-clean:

>> -	$(MAKE) -C tests/tcg clean

>>  	rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)

>>  	rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)) $(check-qtest-generic-y))

>>  	rm -f tests/test-qapi-gen-timestamp

>> diff --git a/tests/tcg/Makefile.include b/tests/tcg/Makefile.include

>> index cb8bb36026..67e89ecb67 100644

>> --- a/tests/tcg/Makefile.include

>> +++ b/tests/tcg/Makefile.include

>> @@ -8,19 +8,14 @@

>>  # guest compiler or calling one of our docker images to do it for us.

>>  #

>>  

>> -# The per ARCH makefile, if it exists holds extra information about

>> -# useful docker images or alternative compiler flags. Include it if it

>> -# exists

>> +# The per ARCH makefile, if it exists, holds extra information about

>> +# useful docker images or alternative compiler flags.

>>  

>> -ARCH_MAKEFILE=$(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include

>> -CHECK_INCLUDE=$(wildcard $(ARCH_MAKEFILE))

>> -

>> -ifeq ($(ARCH_MAKEFILE),$(CHECK_INCLUDE))

>> -include $(ARCH_MAKEFILE)

>> -endif

>> +-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include

>> +-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include

>>  

>>  GUEST_BUILD=

>> -

>> +TCG_MAKE=$(SRC_PATH)/tests/tcg/Makefile

>>  # Support installed Cross Compilers

>>  

>>  ifdef CROSS_CC_GUEST

>> @@ -28,10 +23,10 @@ ifdef CROSS_CC_GUEST

>>  .PHONY: cross-build-guest-tests

>>  cross-build-guest-tests:

>>  	$(call quiet-command, \

>> -          (mkdir -p tests && cd tests && \

>> -	   make -f $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(CROSS_CC_GUEST)), \

>> -	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")

>> -

>> +	   (mkdir -p tests && cd tests && \

>> +	    make -f $(TCG_MAKE) CC=$(CROSS_CC_GUEST) \

>> +				EXTRA_CFLAGS=$(CROSS_CC_GUEST_CFLAGS)), \

>> +	"CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")

>>  

>>  GUEST_BUILD=cross-build-guest-tests

>>  

>> @@ -54,9 +49,10 @@ DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE)

>>  .PHONY: docker-build-guest-tests

>>  docker-build-guest-tests: $(DOCKER_PREREQ)

>>  	$(call quiet-command, \

>> -          (mkdir -p tests && cd tests && \

>> -	   make -f $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(DOCKER_COMPILE_CMD)), \

>> -	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")

>> +	  (mkdir -p tests && cd tests && \

>> +	   make -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \

>> +			       EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \

>> +	"CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")

> 

> I'm not sure this is working as expected, for some reason "make

> build-tcg-tests-aarch64-linux-user" try to use the debian-armel-cross image:

> 

> /build$ make build-tcg-tests-aarch64-linux-user V=1 -j1

> make  BUILD_DIR=/build -C aarch64-linux-user V="1"

> TARGET_DIR="aarch64-linux-user/" guest-tests

> make[1]: Entering directory '/build/aarch64-linux-user'

> /source/qemu/tests/docker/docker.py build qemu:debian9

> /source/qemu/tests/docker/dockerfiles/debian9.docker   --add-current-user

> [...]

> /source/qemu/tests/docker/docker.py build qemu:debian-armel-cross

> /source/qemu/tests/docker/dockerfiles/debian-armel-cross.docker

> --add-current-user

> [...]

> (mkdir -p tests && cd tests && make -f /source/qemu/tests/tcg/Makefile

> CC="/source/qemu/tests/docker/docker.py cc --user 1000 --cc

> arm-linux-gnueabi-gcc -i qemu:debian-armel-cross -s /source/qemu -- "

> EXTRA_CFLAGS=)

> make[2]: Entering directory '/home/phil/build/aarch64-linux-user/tests'

> /source/qemu/tests/docker/docker.py cc --user 1000 --cc

> arm-linux-gnueabi-gcc -i qemu:debian-armel-cross -s /source/qemu --

> -Wall -O0 -g -fno-strict-aliasing  /source/qemu/tests/tcg/aarch64/fcvt.c

> -o fcvt  -static -lm

> /source/qemu/tests/tcg/aarch64/fcvt.c: In function 'print_double_number':

> /source/qemu/tests/tcg/aarch64/fcvt.c:37:42: warning: format '%lx'

> expects argument of type 'long unsigned int', but argument 4 has type

> 'uint64_t {aka long long unsigned int}' [-Wformat=]

>      printf("%02d DOUBLE: %02.20e / %#020lx  (%#x => %s)\n",

>                                           ^

> /source/qemu/tests/tcg/aarch64/fcvt.c: In function 'convert_single_to_half':

> /source/qemu/tests/tcg/aarch64/fcvt.c:82:9: error: inconsistent operand

> constraints in an 'asm'

>          asm("fcvt %h0, %d1" : "=w" (output) : "x" (input));

>          ^~~

> /source/qemu/tests/tcg/aarch64/fcvt.c: In function 'main':

> /source/qemu/tests/tcg/aarch64/fcvt.c:241:5: error: unknown register

> name 'x1' in 'asm'

>      asm("msr fpsr, x1\n\t"

>      ^~~

> make[2]: *** [/source/qemu/tests/tcg/Makefile:49: fcvt] Error 1

> make[2]: Leaving directory '/home/phil/build/aarch64-linux-user/tests'

> make[1]: *** [/source/qemu/tests/tcg/Makefile.include:51:

> docker-build-guest-tests] Error 2

> make[1]: Leaving directory '/home/phil/build/aarch64-linux-user'

> make: *** [/source/qemu/tests/Makefile.include:928:

> build-tcg-tests-aarch64-linux-user] Error 2

> 

> Note this:

> 

> Entering directory '/build/aarch64-linux-user'

> [...]

> docker.py build qemu:debian-armel-cross ...

> 

> I'm not sure this is related to this patch or the previous (44).


This is due to the missing tests/tcg/aarch64/Makefile.include in patch
28/46.

>>  

>>  GUEST_BUILD=docker-build-guest-tests

>>  

>> @@ -68,9 +64,20 @@ endif

>>  

>>  ifneq ($(GUEST_BUILD),)

>>  guest-tests: $(GUEST_BUILD)

>> +

>> +run-guest-tests: guest-tests

>> +	$(call quiet-command, \

>> +	(cd tests && make -f $(TCG_MAKE) run), \

>> +	"RUN-TESTS", "for $(TARGET_NAME)")

>> +

>>  else

>>  guest-tests:

>> -	$(call quiet-command, /bin/true, "CROSS-BUILD", "$(TARGET_NAME) guest-tests SKIPPED")

>> +	$(call quiet-command, /bin/true, "CROSS-BUILD", \

>> +		"$(TARGET_NAME) guest-tests SKIPPED")

>> +

>> +run-guest-tests:

>> +	$(call quiet-command, /bin/true, "RUN-TESTS", \

>> +		"for $(TARGET_NAME) SKIPPED")

>>  endif

>>  

>>  # It doesn't mater if these don't exits

>>


There is still some rule missing:

$ make -j1 run-tcg-tests-sh4-linux-user  -k
  BUILD   debian-sid
  BUILD   debian-sh4-cross
  CROSS-BUILD sh4 guest-tests with docker qemu:debian-sh4-cross
  BUILD   debian-sid
  BUILD   debian-sh4-cross
  CROSS-BUILD sh4 guest-tests with docker qemu:debian-sh4-cross
  RUN-TESTS for sh4
  TEST    test-mmap (default) on sh4
/bin/sh: 1: ../qemu-sh4: not found
make[2]: *** [/source/qemu/tests/tcg/multiarch/Makefile.target:26:
run-test-mmap] Error 127
  TEST    sha1 on sh4
/bin/sh: 1: ../qemu-sh4: not found
make[2]: *** [/source/qemu/tests/tcg/Makefile:64: run-sha1] Error 127
  BROKEN TEST linux-test SKIPPED on sh4
  TEST    testthread on sh4
/bin/sh: 1: ../qemu-sh4: not found
make[2]: *** [/source/qemu/tests/tcg/Makefile:64: run-testthread] Error 127
make[2]: Target 'run' not remade because of errors.
make[1]: *** [/source/qemu/tests/tcg/Makefile.include:69:
run-guest-tests] Error 2
make: *** [/source/qemu/tests/Makefile.include:931:
run-tcg-tests-sh4-linux-user] Error 2

Works with:

$ make -j1 subdir-sh4-linux-user run-tcg-tests-sh4-linux-user
Alex Bennée April 25, 2018, 3:40 p.m. UTC | #4
Philippe Mathieu-Daudé <f4bug@amsat.org> writes:

> On 04/24/2018 08:13 PM, Philippe Mathieu-Daudé wrote:

>> On 04/24/2018 12:24 PM, Alex Bennée wrote:

>>> This will ensure all linux-user targets build their guest test

>>> programs and ensure check-tcg will run the respective tests.

>>>

>>> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

>>> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>>> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

>>> ---

>>> v2

>>>   - use -include instead of complex macro stuff

>>>   - also include TARGET_BASE_ARCH/Makefile

>>> v3

>>>   - add build-tcg, make check-tcg actually run tests

>>> ---

>>>  tests/Makefile.include     | 26 ++++++++++++++++++++++-

>>>  tests/tcg/Makefile.include | 43 ++++++++++++++++++++++----------------

>>>  2 files changed, 50 insertions(+), 19 deletions(-)

>>>

>>> diff --git a/tests/Makefile.include b/tests/Makefile.include

>>> index 3d2f0458ab..310ccefdd9 100644

>>> --- a/tests/Makefile.include

>>> +++ b/tests/Makefile.include

>>> @@ -10,6 +10,7 @@ check-help:

>>>  	@echo " $(MAKE) check-speed          Run qobject speed tests"

>>>  	@echo " $(MAKE) check-qapi-schema    Run QAPI schema tests"

>>>  	@echo " $(MAKE) check-block          Run block tests"

>>> +	@echo " $(MAKE) check-tcg            Run TCG tests"

>>>  	@echo " $(MAKE) check-report.html    Generates an HTML test report"

>>>  	@echo " $(MAKE) check-clean          Clean the tests"

>>>  	@echo

>>> @@ -916,6 +917,30 @@ check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check

>>>  check-report.html: check-report.xml

>>>  	$(call quiet-command,gtester-report $< > $@,"GEN","$@")

>>>

>>> +# Per guest TCG tests

>>> +

>>> +LINUX_USER_TARGETS=$(filter %-linux-user,$(TARGET_LIST))

>>> +BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS))

>>> +CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(LINUX_USER_TARGETS))

>>> +RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(LINUX_USER_TARGETS))

>>> +

>>> +build-tcg-tests-%:

>>> +	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" guest-tests,)

>>> +

>>> +run-tcg-tests-%: build-tcg-tests-%

>>> +	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" run-guest-tests,)

>>> +

>>> +clean-tcg-tests-%:

>>> +	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" clean-guest-tests,)

>>> +

>>> +.PHONY: build-tcg

>>> +build-tcg: $(BUILD_TCG_TARGET_RULES)

>>> +

>>> +.PHONY: check-tcg

>>> +check-tcg: $(RUN_TCG_TARGET_RULES)

>>> +

>>> +.PHONY: clean-tcg

>>> +clean-tcg: $(CLEAN_TCG_TARGET_RULES)

>>>

>>>  # Other tests

>>>

>>> @@ -958,7 +983,6 @@ check-speed: $(patsubst %,check-%, $(check-speed-y))

>>>  check-block: $(patsubst %,check-%, $(check-block-y))

>>>  check: check-qapi-schema check-unit check-qtest check-decodetree

>>>  check-clean:

>>> -	$(MAKE) -C tests/tcg clean

>>>  	rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)

>>>  	rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)) $(check-qtest-generic-y))

>>>  	rm -f tests/test-qapi-gen-timestamp

>>> diff --git a/tests/tcg/Makefile.include b/tests/tcg/Makefile.include

>>> index cb8bb36026..67e89ecb67 100644

>>> --- a/tests/tcg/Makefile.include

>>> +++ b/tests/tcg/Makefile.include

>>> @@ -8,19 +8,14 @@

>>>  # guest compiler or calling one of our docker images to do it for us.

>>>  #

>>>

>>> -# The per ARCH makefile, if it exists holds extra information about

>>> -# useful docker images or alternative compiler flags. Include it if it

>>> -# exists

>>> +# The per ARCH makefile, if it exists, holds extra information about

>>> +# useful docker images or alternative compiler flags.

>>>

>>> -ARCH_MAKEFILE=$(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include

>>> -CHECK_INCLUDE=$(wildcard $(ARCH_MAKEFILE))

>>> -

>>> -ifeq ($(ARCH_MAKEFILE),$(CHECK_INCLUDE))

>>> -include $(ARCH_MAKEFILE)

>>> -endif

>>> +-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include

>>> +-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include

>>>

>>>  GUEST_BUILD=

>>> -

>>> +TCG_MAKE=$(SRC_PATH)/tests/tcg/Makefile

>>>  # Support installed Cross Compilers

>>>

>>>  ifdef CROSS_CC_GUEST

>>> @@ -28,10 +23,10 @@ ifdef CROSS_CC_GUEST

>>>  .PHONY: cross-build-guest-tests

>>>  cross-build-guest-tests:

>>>  	$(call quiet-command, \

>>> -          (mkdir -p tests && cd tests && \

>>> -	   make -f $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(CROSS_CC_GUEST)), \

>>> -	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")

>>> -

>>> +	   (mkdir -p tests && cd tests && \

>>> +	    make -f $(TCG_MAKE) CC=$(CROSS_CC_GUEST) \

>>> +				EXTRA_CFLAGS=$(CROSS_CC_GUEST_CFLAGS)), \

>>> +	"CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")

>>>

>>>  GUEST_BUILD=cross-build-guest-tests

>>>

>>> @@ -54,9 +49,10 @@ DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE)

>>>  .PHONY: docker-build-guest-tests

>>>  docker-build-guest-tests: $(DOCKER_PREREQ)

>>>  	$(call quiet-command, \

>>> -          (mkdir -p tests && cd tests && \

>>> -	   make -f $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(DOCKER_COMPILE_CMD)), \

>>> -	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")

>>> +	  (mkdir -p tests && cd tests && \

>>> +	   make -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \

>>> +			       EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \

>>> +	"CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")

>>

>> I'm not sure this is working as expected, for some reason "make

>> build-tcg-tests-aarch64-linux-user" try to use the debian-armel-cross image:

>>

>> /build$ make build-tcg-tests-aarch64-linux-user V=1 -j1

>> make  BUILD_DIR=/build -C aarch64-linux-user V="1"

>> TARGET_DIR="aarch64-linux-user/" guest-tests

>> make[1]: Entering directory '/build/aarch64-linux-user'

>> /source/qemu/tests/docker/docker.py build qemu:debian9

>> /source/qemu/tests/docker/dockerfiles/debian9.docker   --add-current-user

>> [...]

>> /source/qemu/tests/docker/docker.py build qemu:debian-armel-cross

>> /source/qemu/tests/docker/dockerfiles/debian-armel-cross.docker

>> --add-current-user

>> [...]

>> (mkdir -p tests && cd tests && make -f /source/qemu/tests/tcg/Makefile

>> CC="/source/qemu/tests/docker/docker.py cc --user 1000 --cc

>> arm-linux-gnueabi-gcc -i qemu:debian-armel-cross -s /source/qemu -- "

>> EXTRA_CFLAGS=)

>> make[2]: Entering directory '/home/phil/build/aarch64-linux-user/tests'

>> /source/qemu/tests/docker/docker.py cc --user 1000 --cc

>> arm-linux-gnueabi-gcc -i qemu:debian-armel-cross -s /source/qemu --

>> -Wall -O0 -g -fno-strict-aliasing  /source/qemu/tests/tcg/aarch64/fcvt.c

>> -o fcvt  -static -lm

>> /source/qemu/tests/tcg/aarch64/fcvt.c: In function 'print_double_number':

>> /source/qemu/tests/tcg/aarch64/fcvt.c:37:42: warning: format '%lx'

>> expects argument of type 'long unsigned int', but argument 4 has type

>> 'uint64_t {aka long long unsigned int}' [-Wformat=]

>>      printf("%02d DOUBLE: %02.20e / %#020lx  (%#x => %s)\n",

>>                                           ^

>> /source/qemu/tests/tcg/aarch64/fcvt.c: In function 'convert_single_to_half':

>> /source/qemu/tests/tcg/aarch64/fcvt.c:82:9: error: inconsistent operand

>> constraints in an 'asm'

>>          asm("fcvt %h0, %d1" : "=w" (output) : "x" (input));

>>          ^~~

>> /source/qemu/tests/tcg/aarch64/fcvt.c: In function 'main':

>> /source/qemu/tests/tcg/aarch64/fcvt.c:241:5: error: unknown register

>> name 'x1' in 'asm'

>>      asm("msr fpsr, x1\n\t"

>>      ^~~

>> make[2]: *** [/source/qemu/tests/tcg/Makefile:49: fcvt] Error 1

>> make[2]: Leaving directory '/home/phil/build/aarch64-linux-user/tests'

>> make[1]: *** [/source/qemu/tests/tcg/Makefile.include:51:

>> docker-build-guest-tests] Error 2

>> make[1]: Leaving directory '/home/phil/build/aarch64-linux-user'

>> make: *** [/source/qemu/tests/Makefile.include:928:

>> build-tcg-tests-aarch64-linux-user] Error 2

>>

>> Note this:

>>

>> Entering directory '/build/aarch64-linux-user'

>> [...]

>> docker.py build qemu:debian-armel-cross ...

>>

>> I'm not sure this is related to this patch or the previous (44).

>

> This is due to the missing tests/tcg/aarch64/Makefile.include in patch

> 28/46.

>

>>>

>>>  GUEST_BUILD=docker-build-guest-tests

>>>

>>> @@ -68,9 +64,20 @@ endif

>>>

>>>  ifneq ($(GUEST_BUILD),)

>>>  guest-tests: $(GUEST_BUILD)

>>> +

>>> +run-guest-tests: guest-tests

>>> +	$(call quiet-command, \

>>> +	(cd tests && make -f $(TCG_MAKE) run), \

>>> +	"RUN-TESTS", "for $(TARGET_NAME)")

>>> +

>>>  else

>>>  guest-tests:

>>> -	$(call quiet-command, /bin/true, "CROSS-BUILD", "$(TARGET_NAME) guest-tests SKIPPED")

>>> +	$(call quiet-command, /bin/true, "CROSS-BUILD", \

>>> +		"$(TARGET_NAME) guest-tests SKIPPED")

>>> +

>>> +run-guest-tests:

>>> +	$(call quiet-command, /bin/true, "RUN-TESTS", \

>>> +		"for $(TARGET_NAME) SKIPPED")

>>>  endif

>>>

>>>  # It doesn't mater if these don't exits

>>>

>

> There is still some rule missing:

>

> $ make -j1 run-tcg-tests-sh4-linux-user  -k

>   BUILD   debian-sid

>   BUILD   debian-sh4-cross

>   CROSS-BUILD sh4 guest-tests with docker qemu:debian-sh4-cross

>   BUILD   debian-sid

>   BUILD   debian-sh4-cross

>   CROSS-BUILD sh4 guest-tests with docker qemu:debian-sh4-cross

>   RUN-TESTS for sh4

>   TEST    test-mmap (default) on sh4

> /bin/sh: 1: ../qemu-sh4: not found

> make[2]: *** [/source/qemu/tests/tcg/multiarch/Makefile.target:26:

> run-test-mmap] Error 127

>   TEST    sha1 on sh4

> /bin/sh: 1: ../qemu-sh4: not found

> make[2]: *** [/source/qemu/tests/tcg/Makefile:64: run-sha1] Error 127

>   BROKEN TEST linux-test SKIPPED on sh4

>   TEST    testthread on sh4

> /bin/sh: 1: ../qemu-sh4: not found

> make[2]: *** [/source/qemu/tests/tcg/Makefile:64: run-testthread] Error 127

> make[2]: Target 'run' not remade because of errors.

> make[1]: *** [/source/qemu/tests/tcg/Makefile.include:69:

> run-guest-tests] Error 2

> make: *** [/source/qemu/tests/Makefile.include:931:

> run-tcg-tests-sh4-linux-user] Error 2

>

> Works with:

>

> $ make -j1 subdir-sh4-linux-user run-tcg-tests-sh4-linux-user


I've added:

run-guest-tests: guest-tests qemu-$(TARGET_NAME)
	$(call quiet-command, \
	(cd tests && make -f $(TCG_MAKE) run), \
	"RUN-TESTS", "for $(TARGET_NAME)")

to tests/tcg/Makefile.include


--
Alex Bennée
diff mbox series

Patch

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 3d2f0458ab..310ccefdd9 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -10,6 +10,7 @@  check-help:
 	@echo " $(MAKE) check-speed          Run qobject speed tests"
 	@echo " $(MAKE) check-qapi-schema    Run QAPI schema tests"
 	@echo " $(MAKE) check-block          Run block tests"
+	@echo " $(MAKE) check-tcg            Run TCG tests"
 	@echo " $(MAKE) check-report.html    Generates an HTML test report"
 	@echo " $(MAKE) check-clean          Clean the tests"
 	@echo
@@ -916,6 +917,30 @@  check-report.xml: $(patsubst %,check-report-qtest-%.xml, $(QTEST_TARGETS)) check
 check-report.html: check-report.xml
 	$(call quiet-command,gtester-report $< > $@,"GEN","$@")
 
+# Per guest TCG tests
+
+LINUX_USER_TARGETS=$(filter %-linux-user,$(TARGET_LIST))
+BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(LINUX_USER_TARGETS))
+CLEAN_TCG_TARGET_RULES=$(patsubst %,clean-tcg-tests-%, $(LINUX_USER_TARGETS))
+RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(LINUX_USER_TARGETS))
+
+build-tcg-tests-%:
+	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" guest-tests,)
+
+run-tcg-tests-%: build-tcg-tests-%
+	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" run-guest-tests,)
+
+clean-tcg-tests-%:
+	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" clean-guest-tests,)
+
+.PHONY: build-tcg
+build-tcg: $(BUILD_TCG_TARGET_RULES)
+
+.PHONY: check-tcg
+check-tcg: $(RUN_TCG_TARGET_RULES)
+
+.PHONY: clean-tcg
+clean-tcg: $(CLEAN_TCG_TARGET_RULES)
 
 # Other tests
 
@@ -958,7 +983,6 @@  check-speed: $(patsubst %,check-%, $(check-speed-y))
 check-block: $(patsubst %,check-%, $(check-block-y))
 check: check-qapi-schema check-unit check-qtest check-decodetree
 check-clean:
-	$(MAKE) -C tests/tcg clean
 	rm -rf $(check-unit-y) tests/*.o $(QEMU_IOTESTS_HELPERS-y)
 	rm -rf $(sort $(foreach target,$(SYSEMU_TARGET_LIST), $(check-qtest-$(target)-y)) $(check-qtest-generic-y))
 	rm -f tests/test-qapi-gen-timestamp
diff --git a/tests/tcg/Makefile.include b/tests/tcg/Makefile.include
index cb8bb36026..67e89ecb67 100644
--- a/tests/tcg/Makefile.include
+++ b/tests/tcg/Makefile.include
@@ -8,19 +8,14 @@ 
 # guest compiler or calling one of our docker images to do it for us.
 #
 
-# The per ARCH makefile, if it exists holds extra information about
-# useful docker images or alternative compiler flags. Include it if it
-# exists
+# The per ARCH makefile, if it exists, holds extra information about
+# useful docker images or alternative compiler flags.
 
-ARCH_MAKEFILE=$(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include
-CHECK_INCLUDE=$(wildcard $(ARCH_MAKEFILE))
-
-ifeq ($(ARCH_MAKEFILE),$(CHECK_INCLUDE))
-include $(ARCH_MAKEFILE)
-endif
+-include $(SRC_PATH)/tests/tcg/$(TARGET_BASE_ARCH)/Makefile.include
+-include $(SRC_PATH)/tests/tcg/$(TARGET_NAME)/Makefile.include
 
 GUEST_BUILD=
-
+TCG_MAKE=$(SRC_PATH)/tests/tcg/Makefile
 # Support installed Cross Compilers
 
 ifdef CROSS_CC_GUEST
@@ -28,10 +23,10 @@  ifdef CROSS_CC_GUEST
 .PHONY: cross-build-guest-tests
 cross-build-guest-tests:
 	$(call quiet-command, \
-          (mkdir -p tests && cd tests && \
-	   make -f $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(CROSS_CC_GUEST)), \
-	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")
-
+	   (mkdir -p tests && cd tests && \
+	    make -f $(TCG_MAKE) CC=$(CROSS_CC_GUEST) \
+				EXTRA_CFLAGS=$(CROSS_CC_GUEST_CFLAGS)), \
+	"CROSS-BUILD","$(TARGET_NAME) guest-tests with $(CROSS_CC_GUEST)")
 
 GUEST_BUILD=cross-build-guest-tests
 
@@ -54,9 +49,10 @@  DOCKER_PREREQ=docker-image-$(DOCKER_IMAGE)
 .PHONY: docker-build-guest-tests
 docker-build-guest-tests: $(DOCKER_PREREQ)
 	$(call quiet-command, \
-          (mkdir -p tests && cd tests && \
-	   make -f $(SRC_PATH)/tests/tcg/Makefile ARCH=$(TARGET_NAME) CC=$(DOCKER_COMPILE_CMD)), \
-	  "CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")
+	  (mkdir -p tests && cd tests && \
+	   make -f $(TCG_MAKE) CC=$(DOCKER_COMPILE_CMD) \
+			       EXTRA_CFLAGS=$(DOCKER_CROSS_COMPILER_CFLAGS)), \
+	"CROSS-BUILD","$(TARGET_NAME) guest-tests with docker qemu:$(DOCKER_IMAGE)")
 
 GUEST_BUILD=docker-build-guest-tests
 
@@ -68,9 +64,20 @@  endif
 
 ifneq ($(GUEST_BUILD),)
 guest-tests: $(GUEST_BUILD)
+
+run-guest-tests: guest-tests
+	$(call quiet-command, \
+	(cd tests && make -f $(TCG_MAKE) run), \
+	"RUN-TESTS", "for $(TARGET_NAME)")
+
 else
 guest-tests:
-	$(call quiet-command, /bin/true, "CROSS-BUILD", "$(TARGET_NAME) guest-tests SKIPPED")
+	$(call quiet-command, /bin/true, "CROSS-BUILD", \
+		"$(TARGET_NAME) guest-tests SKIPPED")
+
+run-guest-tests:
+	$(call quiet-command, /bin/true, "RUN-TESTS", \
+		"for $(TARGET_NAME) SKIPPED")
 endif
 
 # It doesn't mater if these don't exits