Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3912673ybf; Tue, 3 Mar 2020 15:39:55 -0800 (PST) X-Google-Smtp-Source: ADFU+vtTUmAa5S3T1e+gGeOFBICy/tTzNsJAI/AHcf21jBuMIX4V9jgYNIpCu/VyLs1ul14DNu3y X-Received: by 2002:a9d:5e8a:: with SMTP id f10mr269828otl.143.1583278795795; Tue, 03 Mar 2020 15:39:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583278795; cv=none; d=google.com; s=arc-20160816; b=p98P7djPegj6H54XVDs+CXmC9vC8mJewjjR1Um7cavcC1A1SfKxz6bTjGyzejIXOFx LRswADqDXtT1zbDJGbo0VZaXIG76hmdOAyJ2SEWStHiHQgfr87SFFhB1rjuz9BOguMam GFc37hbsA+C++rvBN4j3947dUBItwdUF2/A1v2kuxv/lJmmtND9mGdk0Kqp4XVjdWvI1 LfG0iOMAgucCZsCkXZbX0IBWQ2swDFBJsWdtn9wfZ26MqoIH5Jc8Lw3Mb8kE75d6/qDY 4DNGSy2k6+U394hH1CsjQHjzwwwY0M1noEm7DgG6m5KKg6M8bFMxCiUlR/aw8QJ4Zhqr LqxQ== 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=d7zLB6hjW9SGbmqpAHO3IyKhlNWiLRjW+r1jdQTU+h8=; b=PsNjbn1u18iUekUNRgVmN7LSjsE3+w6/zC6Hesei8cMd9LgI4sJsd/HBhFrPrYc//v IpJKZ3JTZ2VXsBAZp5FIaLc9riGK/Xq+bQi+McqFdwAQBgMjXOBSLV+azK69sMxLntii aesdZCOQ8ErDjjcQgLD3aRlYdxUeAIoiV/IOWU4+0cwRi7vqRRgp1/ZiOy9QE0UAsu53 8ZSyc+8w6UNa/y4xA/dIR4GSox54yv8jN119k3KJwpXA6pfWehmzGsUu81UZBhbWARag M7nfEqAOqcanG/Z51L66fxQ6YWILN0uhllt3x0cNS4HejLN7XTQMih7Ji30E3KN1j17H ID3Q== 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 z9si81273otp.0.2020.03.03.15.39.44; Tue, 03 Mar 2020 15:39:55 -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 S1728635AbgCCXix (ORCPT + 99 others); Tue, 3 Mar 2020 18:38:53 -0500 Received: from mga05.intel.com ([192.55.52.43]:16253 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728373AbgCCXix (ORCPT ); Tue, 3 Mar 2020 18:38:53 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Mar 2020 15:38:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,511,1574150400"; d="scan'208";a="229117722" Received: from kwasilew-mobl.ger.corp.intel.com (HELO localhost) ([10.251.88.57]) by orsmga007.jf.intel.com with ESMTP; 03 Mar 2020 15:38:44 -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 v28 13/22] selftests/x86: Recurse into subdirectories Date: Wed, 4 Mar 2020 01:36:00 +0200 Message-Id: <20200303233609.713348-14-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200303233609.713348-1-jarkko.sakkinen@linux.intel.com> References: <20200303233609.713348-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.25.0