Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3608508ybg; Mon, 28 Oct 2019 15:51:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkvyypY2dDcaOvVQRWQWcXhiLoIKMPGFK4EkvBlXwzs3TkfxQbkaxIoOsR8wcx2tj86EYK X-Received: by 2002:a17:906:48c5:: with SMTP id d5mr269098ejt.167.1572303090915; Mon, 28 Oct 2019 15:51:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572303090; cv=none; d=google.com; s=arc-20160816; b=PU4nl0qF/zQm102zI2lTO3U9wlmfOKrz97hw3bv/TxLfJ0iR49kadfq6b3iLuTYNXz /rDgKQit7z5ZUh+je9m12Izts9Hak74e5Laq/QYfUzveGgL23BWoCLV85CAMSvmOjZmq JlRwRg2m1zBGv9Mp824T8olN9m7k2jGEbxKqUF1zAl/ijHFDKdfHDANtj6UDzSZfGpqA d2Hf2i6qL8CrdZk6PltzjdDAvtebsnvXa53FzT8jZwp9mePDRz5Z5pQjpBqEHApZ9/9w x+9A00JnQgFuUJ1i1LfcjtAazMOohKf3RYf9ls8InJ8IC0Bx2FoPA4XqlnveO95FtASz 2zfg== 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=I8Rrf3jIeP8VCMPoupMD1ukWFsahgdt5se7ewVSgZk9vqEbbgEiIqeYM4LZfJAerFG Pm2bcW3xXyoS1Xoj/V0EHY2LLB7yzMYt1gKhOjrL4Y9NbUnE4St/fC6hNZEexazHR7AL nuTMA2rEmw6FrY19T8vomlh0D80v+oANlM5ACyY7/+K88eqlpU1bowbgUlmgluHjABqR xutf8uPvV4elfC3x3ZmNv5qAfYXW4s8jrHNMVc/PaSn6XKGkabAzNxgRwDPMWEryr+r+ yAxxHsI9Nla+DSPnlYHtkoWsmJvIQXew8DhfkmdQE67doWjDVEUcIkGkMbcZKDbUvkzM HDcQ== 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 ay24si7117575ejb.30.2019.10.28.15.51.04; Mon, 28 Oct 2019 15:51:30 -0700 (PDT) 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 S2389381AbfJ1VFo (ORCPT + 99 others); Mon, 28 Oct 2019 17:05:44 -0400 Received: from mga01.intel.com ([192.55.52.88]:42838 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728898AbfJ1VFo (ORCPT ); Mon, 28 Oct 2019 17:05:44 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Oct 2019 14:05:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,241,1569308400"; d="scan'208";a="224759817" Received: from shrehore-mobl1.ti.intel.com (HELO localhost) ([10.251.82.5]) by fmsmga004.fm.intel.com with ESMTP; 28 Oct 2019 14:05:36 -0700 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, serge.ayoun@intel.com, shay.katz-zamir@intel.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 v23 13/24] selftests/x86: Recurse into subdirectories Date: Mon, 28 Oct 2019 23:03:13 +0200 Message-Id: <20191028210324.12475-14-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191028210324.12475-1-jarkko.sakkinen@linux.intel.com> References: <20191028210324.12475-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