Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3029014ybv; Sun, 9 Feb 2020 13:28:05 -0800 (PST) X-Google-Smtp-Source: APXvYqx8In+2qCI2a2ovcf7UzJ7ucc2WoGdPK90yO+uwdpkGIWh4g+9dH7BaTUTLuCGZ6AA8Wcuk X-Received: by 2002:a9d:7487:: with SMTP id t7mr8121455otk.267.1581283685031; Sun, 09 Feb 2020 13:28:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581283685; cv=none; d=google.com; s=arc-20160816; b=WQmy8OC5tyWmWr1ZuaG1xXXZlfbtNsjBN8jko+H19swrbpkZERtMMRCBck0xXSwW5V TWr+W+SyTaoUCcZ/YHJu69INw5mac/qRkMf0s0B65v23qK7lFTKZ7FlHycmQnGPT8EHS ZECyOk897yyR+nVWxtKEZyufHBW/CtddIWpDQMZVxOAeUDZTJlTYtcE3HE52J5KiKP97 q2dtS5qNE3K0lzzTSr8ReUEmL2PwUTLMSucxH8xHfx3RBkKr7NctZHephN0ay6wzJ6rM Xt8tWB3z1qKKafFS5M+GU+c2Qq9zy6TjCPWy+6yZqtD5qKJxSgEq25+Nqoywdu4t+Vsx 2VGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=zkStRPb+QdIUykGXiUvWnSHSY0QghtUJyJJah3nMPPE=; b=DAW7i5INOqqp7a/KimpAFtG69QDdfsj+ZF8gqI5rNEqX/OiTCdvXTsrl4t2yO3yYas oW2FkOWZq4tX90sXIuFdGSFNQiVNj91Vp+fVJK4vc9BDV54SHUAy6Hhh4ACv5ECY5QUY QlOos7S8qIxt0sxE3fFG98y4SZ1n1mcpKmAxiWfQt3ANPru5HlWbIUuPSQtdOGlJqfIO XudUlxIqoEHgLLRPClzGrV7tCBaiYPEd9M4TE6Sw0G/c/V/DNaqHVXIC59xA3wX2RpaI muQaLhI6obAIQn/sMkFI9t4FuRv/SNqrtYvCVBq7bXzb8Qq17viZIeljxfgQB0JtTDM/ OxNA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8si3568732otg.309.2020.02.09.13.27.53; Sun, 09 Feb 2020 13:28:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728093AbgBIV1Y (ORCPT + 99 others); Sun, 9 Feb 2020 16:27:24 -0500 Received: from mga11.intel.com ([192.55.52.93]:54556 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727798AbgBIV1Y (ORCPT ); Sun, 9 Feb 2020 16:27:24 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Feb 2020 13:27:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,422,1574150400"; d="scan'208";a="405398839" Received: from jradtke-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.22.75]) by orsmga005.jf.intel.com with ESMTP; 09 Feb 2020 13:27:18 -0800 From: Jarkko Sakkinen To: linux-kernel@vger.kernel.org, x86@kernel.org, linux-sgx@vger.kernel.org Cc: akpm@linux-foundation.org, dave.hansen@intel.com, sean.j.christopherson@intel.com, nhorman@redhat.com, npmccallum@redhat.com, haitao.huang@intel.com, andriy.shevchenko@linux.intel.com, tglx@linutronix.de, kai.svahn@intel.com, bp@alien8.de, josh@joshtriplett.org, luto@kernel.org, kai.huang@intel.com, rientjes@google.com, cedric.xing@intel.com, puiterwijk@redhat.com, Jarkko Sakkinen Subject: [PATCH v26 11/22] selftests/x86: Recurse into subdirectories Date: Sun, 9 Feb 2020 23:25:58 +0200 Message-Id: <20200209212609.7928-12-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200209212609.7928-1-jarkko.sakkinen@linux.intel.com> References: <20200209212609.7928-1-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Recurse into a list of subdirectories defined by SUBDIRS when running x86 selftests. Override run_tests, install, emit_tests and clean targets to implement this behaviour. A possible alternative would be to add "x86/sgx" to TARGETS. However, this would be problematic because detecting 64-bit build would have to duplicated. The implementation is derived from the makefiles of powerpc and sparc64 selftests. Signed-off-by: Jarkko Sakkinen --- tools/testing/selftests/x86/Makefile | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile index 5d49bfec1e9a..dee6dadeba61 100644 --- a/tools/testing/selftests/x86/Makefile +++ b/tools/testing/selftests/x86/Makefile @@ -10,6 +10,8 @@ CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32) CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c) CAN_BUILD_WITH_NOPIE := $(shell ./check_cc.sh $(CC) trivial_program.c -no-pie) +SUBDIRS := sgx + TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt test_mremap_vdso \ check_initial_reg_state sigreturn iopl ioperm \ protection_keys test_vdso test_vsyscall mov_ss_trap \ @@ -59,6 +61,48 @@ endif ifeq ($(CAN_BUILD_X86_64),1) all: all_64 + @for DIR in $(SUBDIRS); do \ + BUILD_TARGET=$(OUTPUT)/$$DIR; \ + mkdir $$BUILD_TARGET -p; \ + make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \ + done + +DEFAULT_RUN_TESTS := $(RUN_TESTS) +override define RUN_TESTS + $(DEFAULT_RUN_TESTS) + @for TARGET in $(SUBDIRS); do \ + BUILD_TARGET=$(OUTPUT)/$$TARGET; \ + $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests; \ + done; +endef + +DEFAULT_INSTALL_RULE := $(INSTALL_RULE) +override define INSTALL_RULE + $(DEFAULT_INSTALL_RULE) + @for TARGET in $(SUBDIRS); do \ + BUILD_TARGET=$(OUTPUT)/$$TARGET; \ + $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install; \ + done; +endef + +DEFAULT_EMIT_TESTS := $(EMIT_TESTS) +override define EMIT_TESTS + $(DEFAULT_EMIT_TESTS) + @for TARGET in $(SUBDIRS); do \ + BUILD_TARGET=$(OUTPUT)/$$TARGET; \ + $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests; \ + done; +endef + +DEFAULT_CLEAN := $(CLEAN) +override define CLEAN + $(DEFAULT_CLEAN) + @for TARGET in $(SUBDIRS); do \ + BUILD_TARGET=$(OUTPUT)/$$TARGET; \ + $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \ + done; +endef + TEST_PROGS += $(BINARIES_64) EXTRA_CFLAGS += -DCAN_BUILD_64 $(foreach t,$(TARGETS_C_64BIT_ALL),$(eval $(call gen-target-rule-64,$(t)))) -- 2.20.1