From patchwork Fri May 22 08:19:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yauheni Kaliuta X-Patchwork-Id: 1296029 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: incoming-bpf@patchwork.ozlabs.org Delivered-To: patchwork-incoming-bpf@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=bpf-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Lb7uTVjl; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49Szsv1sG6z9sPF for ; Fri, 22 May 2020 18:19:15 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728797AbgEVITO (ORCPT ); Fri, 22 May 2020 04:19:14 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:25347 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728152AbgEVITN (ORCPT ); Fri, 22 May 2020 04:19:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590135551; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bYItK5CphmcSmmPRWZXhTvYRsembRtzlhRv0nVlDWKA=; b=Lb7uTVjlgNWgn4d/Bv8lOMVyvEeeeMz780cGkCJV6UyGz0e1wXZkMH1TFLBKGH0cjZkpbW ThKlur4FRBoWxs19ZJ9wnmVAkZ3bwf8uom+dMgVera2nuz8iCtAkBBhYC2l72w7vse2+9c ir/+0+LM/gqMpJkOA7g7hHABS7P5aH8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-5-rdcuYkcwMrOQerwDPsO_7A-1; Fri, 22 May 2020 04:19:07 -0400 X-MC-Unique: rdcuYkcwMrOQerwDPsO_7A-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 901E3107ACCD; Fri, 22 May 2020 08:19:06 +0000 (UTC) Received: from astarta.redhat.com (ovpn-112-212.ams2.redhat.com [10.36.112.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B0EDF19167; Fri, 22 May 2020 08:19:04 +0000 (UTC) From: Yauheni Kaliuta To: bpf@vger.kernel.org Cc: Jiri Benc , Jiri Olsa , Andrii Nakryiko , Daniel Borkmann Subject: [PATCH] selftests/bpf: split -extras target to -static and -gen Date: Fri, 22 May 2020 11:19:01 +0300 Message-Id: <20200522081901.238516-1-yauheni.kaliuta@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org There is difference in depoying static and generated extra resource files between in/out of tree build and flavors: - in case of unflavored out-of-tree build static files are not available and must be copied as well as both static and generated files for flavored build. So split the rules and variables. The name TRUNNER_EXTRA_GEN_FILES is chosen in analogy to TEST_GEN_* variants. Signed-off-by: Yauheni Kaliuta --- tools/testing/selftests/bpf/Makefile | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 26497d8869ea..c80c06272759 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -363,12 +363,28 @@ $(TRUNNER_EXTRA_OBJS): $(TRUNNER_OUTPUT)/%.o: \ $$(call msg,EXT-OBJ,$(TRUNNER_BINARY),$$@) $$(CC) $$(CFLAGS) -c $$< $$(LDLIBS) -o $$@ -# only copy extra resources if in flavored build -$(TRUNNER_BINARY)-extras: $(TRUNNER_EXTRA_FILES) | $(TRUNNER_OUTPUT) -ifneq ($2,) +# copy extra resources when needed. +# Static files for both out of tree and flavored (so, not current dir). +# Generated files for flavored only. +$(TRUNNER_BINARY)-extras: $(TRUNNER_BINARY)-extras-static \ + $(TRUNNER_BINARY)-extras-gen + +$(TRUNNER_BINARY)-extras-static: $(TRUNNER_EXTRA_FILES) | $(TRUNNER_OUTPUT) +ifneq ($(CURDIR)),$(realpath $(TRUNNER_OUTPUT))) $$(call msg,EXT-COPY,$(TRUNNER_BINARY),$(TRUNNER_EXTRA_FILES)) +ifneq ($(TRUNNER_EXTRA_FILES),) cp -a $$^ $(TRUNNER_OUTPUT)/ endif +endif + +$(TRUNNER_BINARY)-extras-gen: $(addprefix $(OUTPUT)/,$(TRUNNER_EXTRA_GEN_FILES)) \ + | $(TRUNNER_OUTPUT) +ifneq ($2,) + $$(call msg,EXT-COPY,$(TRUNNER_BINARY),$(TRUNNER_EXTRA_GEN_FILES)) +ifneq ($(TRUNNER_EXTRA_GEN_FILES),) + cp -a $$^ $(TRUNNER_OUTPUT)/ +endif +endif $(OUTPUT)/$(TRUNNER_BINARY): $(TRUNNER_TEST_OBJS) \ $(TRUNNER_EXTRA_OBJS) $$(BPFOBJ) \ @@ -384,7 +400,8 @@ TRUNNER_BPF_PROGS_DIR := progs TRUNNER_EXTRA_SOURCES := test_progs.c cgroup_helpers.c trace_helpers.c \ network_helpers.c testing_helpers.c \ flow_dissector_load.h -TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read $(BTF_C_FILES) +TRUNNER_EXTRA_FILES := $(BTF_C_FILES) +TRUNNER_EXTRA_GEN_FILES := urandom_read TRUNNER_BPF_BUILD_RULE := CLANG_BPF_BUILD_RULE TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(CLANG_CFLAGS) TRUNNER_BPF_LDFLAGS := -mattr=+alu32 @@ -408,6 +425,7 @@ TRUNNER_TESTS_DIR := map_tests TRUNNER_BPF_PROGS_DIR := progs TRUNNER_EXTRA_SOURCES := test_maps.c TRUNNER_EXTRA_FILES := +TRUNNER_EXTRA_GEN_FILES := TRUNNER_BPF_BUILD_RULE := $$(error no BPF objects should be built) TRUNNER_BPF_CFLAGS := TRUNNER_BPF_LDFLAGS :=