From patchwork Mon Oct 14 10:49:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 11188397 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 568EA14DB for ; Mon, 14 Oct 2019 11:49:22 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 227EF207FF for ; Mon, 14 Oct 2019 11:49:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FwSIXiWv" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 227EF207FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJyqn-0005bl-6H for patchwork-qemu-devel@patchwork.kernel.org; Mon, 14 Oct 2019 07:49:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46935) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iJyCH-0008FD-CZ for qemu-devel@nongnu.org; Mon, 14 Oct 2019 07:07:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iJyCF-0007od-QZ for qemu-devel@nongnu.org; Mon, 14 Oct 2019 07:07:29 -0400 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:36614) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iJyCF-0007ne-JY for qemu-devel@nongnu.org; Mon, 14 Oct 2019 07:07:27 -0400 Received: by mail-wr1-x433.google.com with SMTP id y19so19225909wrd.3 for ; Mon, 14 Oct 2019 04:07:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KpM3SyJDkKhcUHIVLFnItn5R6+AXIYS7UFfmeyEbac8=; b=FwSIXiWvVyQXV3tamVT+RpTc7tE0bBsHri7uBVqqmLoCewIeqP+Ou7C4gwYIjnTS8M liPqcIHDajnEfNa+9vQ0PsyFM/OyckztfqB4DfbxEXMurPy8TIfwNUimu35RzYWGlPtJ BkdSGx3Z3beXamcCCYwWiKbCwc0fVxKBCtBMdWNT90mNbsPGRpieuxh/tmym24ttcqBk osJnT/HHFA1azlp0kzmDRL7hRciGvHokgUADRExU1aRrbneFUF+Bm0VrhnNPxEm6TsBY Rl/S3G9Fg3iZ8tqPnur29k74iG0l60N2OODczgMP30szumALwbjO6zlcS0PUCuwTolJH /I0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KpM3SyJDkKhcUHIVLFnItn5R6+AXIYS7UFfmeyEbac8=; b=fyhIuM42O8cT6+Z9nUsE2b1G4nTh6P9Ej+mOUw2X+S/PAGQyjp11SGTuRL472kTYdM +hBtATzek+rEmmWRXbj2l4B3/8EvwrvlHozDdDOoFaTHRfBrGq1W21skaFT0aTofzQUk 5iqss3rFvjt9MDtnF6uvZzCsDnzBDwkhECVA7OFiKhfboQ3OOZpQ7ljXv/0LOAYSuDng agdxgZ59+dEKGPDPtWBx+nHb2MaXpevDL0N6eNQBo5J7fJezOdUfdmIPVy2/H+X7Mt5s 5wor2/zVKnW1tlXH6HEeADK3B2Lgb858g753r8j8NbSuSb7LGBpEYGkZRV7OUXomKO6T 68yw== X-Gm-Message-State: APjAAAUE6MSa3zCg20bgOThZ8sjsdzzcYvTXMCVhZ8GpI0Wq9cMqthYO 9Lv0bbfY26czRhs222aYQSIIgQ== X-Google-Smtp-Source: APXvYqyvHUc/aKs1fh2rDWLa727EcxfsK7kAYDwv+W1o1azDnrnZ0b0pyoY6t8V6nFoxuyDOEf/JEw== X-Received: by 2002:adf:ee4f:: with SMTP id w15mr6582038wro.378.1571051246196; Mon, 14 Oct 2019 04:07:26 -0700 (PDT) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id r27sm52393613wrc.55.2019.10.14.04.06.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2019 04:07:25 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id C50081FFCF; Mon, 14 Oct 2019 11:49:58 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Subject: [PATCH v5 44/55] tests/tcg: enable plugin testing Date: Mon, 14 Oct 2019 11:49:37 +0100 Message-Id: <20191014104948.4291-45-alex.bennee@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191014104948.4291-1-alex.bennee@linaro.org> References: <20191014104948.4291-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::433 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , robert.foley@futurewei.com, peter.puhov@futurewei.com, aaron@os.amperecomputing.com, cota@braap.org, "open list:ARM TCG CPUs" , =?utf-8?q?Philippe_Mathieu-?= =?utf-8?q?Daud=C3=A9?= Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" If CONFIG_PLUGINS is enabled then lets enable testing for all our TCG targets. This is a simple smoke test that ensure we don't crash or otherwise barf out by running each plugin against each test. There is a minor knock on effect for additional runners which need specialised QEMU_OPTS which will also need to declare a plugin version of the runner. If this gets onerous we might need to add another helper. Checking the results of the plugins is left for a later exercise. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- v5 - fix for the latest changes to check-tcg - extend timeout for plugin tests - add special runner for semihosting with plugin - fix naming of test in call output - add special plugin aware runners for semihosting --- tests/Makefile.include | 11 ++++++++- tests/tcg/Makefile.target | 35 +++++++++++++++++++++++++++ tests/tcg/aarch64/Makefile.target | 6 +++++ tests/tcg/arm/Makefile.softmmu-target | 1 + tests/tcg/arm/Makefile.target | 6 +++++ 5 files changed, 58 insertions(+), 1 deletion(-) diff --git a/tests/Makefile.include b/tests/Makefile.include index 3543451ed3..646a704e65 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -1052,6 +1052,15 @@ check-softfloat: "SKIPPED for non-TCG builds") endif +# Plugins +ifeq ($(CONFIG_PLUGIN),y) +.PHONY: plugins +plugins: + $(call quiet-command,\ + $(MAKE) $(SUBDIR_MAKEFLAGS) -C tests/plugin V="$(V)", \ + "BUILD", "plugins") +endif + # Per guest TCG tests BUILD_TCG_TARGET_RULES=$(patsubst %,build-tcg-tests-%, $(TARGET_DIRS)) @@ -1062,7 +1071,7 @@ RUN_TCG_TARGET_RULES=$(patsubst %,run-tcg-tests-%, $(TARGET_DIRS)) $(foreach PROBE_TARGET,$(TARGET_DIRS), \ $(eval -include $(SRC_PATH)/tests/tcg/Makefile.prereqs)) -build-tcg-tests-%: +build-tcg-tests-%: $(if $(CONFIG_PLUGIN),plugins) $(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) \ -f $(SRC_PATH)/tests/tcg/Makefile.qemu \ SRC_PATH=$(SRC_PATH) \ diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index 9664613002..d25fc64300 100644 --- a/tests/tcg/Makefile.target +++ b/tests/tcg/Makefile.target @@ -123,11 +123,38 @@ all: $(TESTS) $(EXTRA_TESTS) # RUN_TESTS=$(patsubst %,run-%, $(TESTS)) + +# If plugins exist also include those in the tests +ifeq ($(CONFIG_PLUGIN),y) +PLUGIN_DIR=../../plugin +VPATH+=$(PLUGIN_DIR) +PLUGINS=$(notdir $(wildcard $(PLUGIN_DIR)/*.so)) + +# We need to ensure expand the run-plugin-TEST-with-PLUGIN +# pre-requistes manually here as we can't use stems to handle it. We +# also add some special helpers the run-plugin- rules can use bellow. + +$(foreach p,$(PLUGINS), \ + $(foreach t,$(TESTS),\ + $(eval run-plugin-$(t)-with-$(p): $t $p) \ + $(eval run-plugin-$(t)-with-$(p): TIMEOUT=30) \ + $(eval RUN_TESTS+=run-plugin-$(t)-with-$(p)))) +endif + +strip-plugin = $(wordlist 1, 1, $(subst -with-, ,$1)) +extract-plugin = $(wordlist 2, 2, $(subst -with-, ,$1)) + RUN_TESTS+=$(EXTRA_RUNS) ifdef CONFIG_USER_ONLY run-%: % $(call run-test, $<, $(QEMU) $(QEMU_OPTS) $<, "$< on $(TARGET_NAME)") + +run-plugin-%: + $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ + -plugin $(PLUGIN_DIR)/$(call extract-plugin,$@) \ + $(call strip-plugin,$<), \ + "$* on $(TARGET_NAME)") else run-%: % $(call run-test, $<, \ @@ -135,6 +162,14 @@ run-%: % -chardev file$(COMMA)path=$<.out$(COMMA)id=output \ $(QEMU_OPTS) $<, \ "$< on $(TARGET_NAME)") + +run-plugin-%: + $(call run-test, $@, \ + $(QEMU) -monitor none -display none \ + -chardev file$(COMMA)path=$@.out$(COMMA)id=output \ + -plugin $(PLUGIN_DIR)/$(call extract-plugin,$@) \ + $(QEMU_OPTS) $(call strip-plugin,$<), \ + "$* on $(TARGET_NAME)") endif gdb-%: % diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target index 509f1afa93..96d2321045 100644 --- a/tests/tcg/aarch64/Makefile.target +++ b/tests/tcg/aarch64/Makefile.target @@ -26,4 +26,10 @@ AARCH64_TESTS += semihosting run-semihosting: semihosting $(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)") +run-plugin-semihosting-with-%: + $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ + -plugin $(PLUGIN_DIR)/$(call extract-plugin,$@) \ + $(call strip-plugin,$<) 2> $<.err, \ + "$< on $(TARGET_NAME) with $*") + TESTS += $(AARCH64_TESTS) diff --git a/tests/tcg/arm/Makefile.softmmu-target b/tests/tcg/arm/Makefile.softmmu-target index 231e9a57b4..3fe237ba39 100644 --- a/tests/tcg/arm/Makefile.softmmu-target +++ b/tests/tcg/arm/Makefile.softmmu-target @@ -23,3 +23,4 @@ LDFLAGS+=-nostdlib -N -static test-armv6m-undef: EXTRA_CFLAGS+=-mcpu=cortex-m0 run-test-armv6m-undef: QEMU_OPTS+=-semihosting -M microbit -kernel +run-plugin-test-armv6m-undef-%: QEMU_OPTS+=-semihosting -M microbit -kernel diff --git a/tests/tcg/arm/Makefile.target b/tests/tcg/arm/Makefile.target index 3ddff85240..0765f37ff0 100644 --- a/tests/tcg/arm/Makefile.target +++ b/tests/tcg/arm/Makefile.target @@ -34,6 +34,12 @@ ARM_TESTS += semihosting run-semihosting: semihosting $(call run-test,$<,$(QEMU) $< 2> $<.err, "$< on $(TARGET_NAME)") +run-plugin-semihosting-with-%: + $(call run-test, $@, $(QEMU) $(QEMU_OPTS) \ + -plugin $(PLUGIN_DIR)/$(call extract-plugin,$@) \ + $(call strip-plugin,$<) 2> $<.err, \ + "$< on $(TARGET_NAME) with $*") + TESTS += $(ARM_TESTS) # On ARM Linux only supports 4k pages