Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp8704603ybc; Fri, 29 Nov 2019 15:18:21 -0800 (PST) X-Google-Smtp-Source: APXvYqxph+0PHh0emBNvk2wvNfRqg8MZ0km/NBnSYLQ6x8di6qCCTkclF7g15L7u1ropLcve3gQ5 X-Received: by 2002:a17:906:da1d:: with SMTP id fi29mr8145318ejb.205.1575069501163; Fri, 29 Nov 2019 15:18:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575069501; cv=none; d=google.com; s=arc-20160816; b=M9FwYxiHhFkgiPJYeSxoxhT//lrZahXcZ9gRe6av+vqv9yJ+ZxX+05O5ksCwWzy+Uk xG4BbBSCHexGjKsIUbV3++kcjwV6Mgc3CIcvv4J1OIiv77BRvQyL2FFmgFU8+Sv4XebX jWMtEqs9rVNeoRp6XM7hxyvFdaW00+6wgD8pO/JM9Yk/lx1lQswWi/pT8CaTDeoNpVTd +C6/rnPVYJyz0SjXBQ7OYT4eVgQA8FcdRRswqy5xzVUbQ8pKcJrZmU7P1eJTD7ZZ1Hii MGtQs1QPCJidZHtf9AU06+S1wgQ5M2bzSVPh1660JOUxM10ruxM72JZLvl5rXZRkd66B YwdA== 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=Kw91wCbYopTG6ClI0/lIxk5lop4/SQw703FMhjY4r+IV22s4d9GHSf+lU2vcJ9PJVg falzdlT+ohCDxVt40UvqcNYDNapZ18r11zKWKi901MQz9PQ13cmoeumgDLO+TPPcx6YY 5IThvTD1MC0g3qWOhbWFhvf3pQeVumpOdFkPkJWOibETS6+XP9aWiCYYl+fYj/uBhq49 yvo1baf47eVwTKAfBWD1Vk+nt7LEi/8Pwy/+zG9cP3r0QJqWbuE8XFn+vhDW2b0KPC1Z uyiuQBB4TFCFcPlUXVHFGKN+N+eoYyDGaBayxSrSXxd2iCDxHWG4DXruaNMbzYWS+cl5 LNqg== 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 cb26si18489447edb.106.2019.11.29.15.17.58; Fri, 29 Nov 2019 15:18:21 -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 S1727332AbfK2XQP (ORCPT + 99 others); Fri, 29 Nov 2019 18:16:15 -0500 Received: from mga07.intel.com ([134.134.136.100]:7085 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727073AbfK2XQP (ORCPT ); Fri, 29 Nov 2019 18:16:15 -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 orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Nov 2019 15:16:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,259,1571727600"; d="scan'208";a="384194180" Received: from gamanzi-mobl4.ger.corp.intel.com (HELO localhost) ([10.252.3.126]) by orsmga005.jf.intel.com with ESMTP; 29 Nov 2019 15:16:04 -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, 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 v24 13/24] selftests/x86: Recurse into subdirectories Date: Sat, 30 Nov 2019 01:13:15 +0200 Message-Id: <20191129231326.18076-14-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191129231326.18076-1-jarkko.sakkinen@linux.intel.com> References: <20191129231326.18076-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