From patchwork Fri May 22 04:13:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yauheni Kaliuta X-Patchwork-Id: 1295932 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=VfLhr86j; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49StQD11Xqz9sSW for ; Fri, 22 May 2020 14:13:24 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727901AbgEVENX (ORCPT ); Fri, 22 May 2020 00:13:23 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:59537 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727809AbgEVENX (ORCPT ); Fri, 22 May 2020 00:13:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590120802; 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=aQATS343UrFgDgS2zqiZoNp9hEOUjo/m3Yr8XAj0GQE=; b=VfLhr86jjU8N0FI6+TV70NF9USvvlKtwhCmg5OtvimMJuxGFZtkZZMEr37t0H2t0o4+E7R +a+PzWRK7r0pGa/I1MtGUSqvMLoSzb7z+qr4qUOTLlJFFEN/NjOJPcIGZistnHS4TI4l+D j+H8E34I9POM/NfjBYf/FfogUs5kgBw= 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-100-F1Fudic5Mm2EVvzd2s_U6w-1; Fri, 22 May 2020 00:13:17 -0400 X-MC-Unique: F1Fudic5Mm2EVvzd2s_U6w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 15CE1107ACCD; Fri, 22 May 2020 04:13:16 +0000 (UTC) Received: from astarta.redhat.com (ovpn-112-74.ams2.redhat.com [10.36.112.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 79C565D9C9; Fri, 22 May 2020 04:13:14 +0000 (UTC) From: Yauheni Kaliuta To: bpf@vger.kernel.org Cc: Jiri Benc , Jiri Olsa , Andrii Nakryiko , Daniel Borkmann Subject: [PATCH 1/8] selftests/bpf: remove test_align from Makefile Date: Fri, 22 May 2020 07:13:03 +0300 Message-Id: <20200522041310.233185-2-yauheni.kaliuta@redhat.com> In-Reply-To: <20200522041310.233185-1-yauheni.kaliuta@redhat.com> References: <20200522041310.233185-1-yauheni.kaliuta@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org test_align has been moved under test_progs. Fixes: 3b09d27cc93d ("selftests/bpf: Move test_align under test_progs") Signed-off-by: Yauheni Kaliuta Acked-by: Andrii Nakryiko --- tools/testing/selftests/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index e716e931d0c9..09700db35c2d 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -30,7 +30,7 @@ LDLIBS += -lcap -lelf -lz -lrt -lpthread # Order correspond to 'make run_tests' order TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map test_progs \ - test_align test_verifier_log test_dev_cgroup test_tcpbpf_user \ + test_verifier_log test_dev_cgroup test_tcpbpf_user \ test_sock test_btf test_sockmap get_cgroup_id_user test_socket_cookie \ test_cgroup_storage \ test_netcnt test_tcpnotify_user test_sock_fields test_sysctl \ From patchwork Fri May 22 04:13:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yauheni Kaliuta X-Patchwork-Id: 1295934 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=gzdPFT9Y; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49StQF440Xz9sT1 for ; Fri, 22 May 2020 14:13:25 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727855AbgEVENY (ORCPT ); Fri, 22 May 2020 00:13:24 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:42094 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727809AbgEVENY (ORCPT ); Fri, 22 May 2020 00:13:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590120803; 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=tji7WPFNFTY8HvN0hdb7X6vbE18lCPYkuP1ROCt8rXU=; b=gzdPFT9YN/jWJCzzyckia92mi7Zn306+R2ScMY1ReG2QHcG7ezcw6hYkklNrVes1B0Ay2k KU7Wl78aSJvKsm5v10I4Q3IG3pTBoZOZJJOYAFN75EjZTNmMMzkon9f3ljTtlAy4uLhoDI IfiFa8aRJRA8/pwngzq6S7Dg9M2BFn0= 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-236-wdiCbQxHPYudeSc4zKxUCA-1; Fri, 22 May 2020 00:13:18 -0400 X-MC-Unique: wdiCbQxHPYudeSc4zKxUCA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E172C1009600; Fri, 22 May 2020 04:13:17 +0000 (UTC) Received: from astarta.redhat.com (ovpn-112-74.ams2.redhat.com [10.36.112.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 72E9A5D9C9; Fri, 22 May 2020 04:13:16 +0000 (UTC) From: Yauheni Kaliuta To: bpf@vger.kernel.org Cc: Jiri Benc , Jiri Olsa , Andrii Nakryiko , Daniel Borkmann Subject: [PATCH 2/8] selftests/bpf: build bench.o for any $(OUTPUT) Date: Fri, 22 May 2020 07:13:04 +0300 Message-Id: <20200522041310.233185-3-yauheni.kaliuta@redhat.com> In-Reply-To: <20200522041310.233185-1-yauheni.kaliuta@redhat.com> References: <20200522041310.233185-1-yauheni.kaliuta@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org bench.o is produced by implicit rule only if it's built in the same directory where bench.c is located. If OUTPUT points somewhere else, build fails. Make an explicit rule for it (factor out common part). Add bench.c as a dependency to make it source for CC. Signed-off-by: Yauheni Kaliuta --- tools/testing/selftests/bpf/Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 09700db35c2d..f0b7d41ed6dd 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -243,6 +243,11 @@ define GCC_BPF_BUILD_RULE $(BPF_GCC) $3 $4 -O2 -c $1 -o $2 endef +define COMPILE_C_RULE + $(call msg,CC,,$@) + $(CC) $(CFLAGS) -c $(filter %.c,$^) $(LDLIBS) -o $@ +endef + SKEL_BLACKLIST := btf__% test_pinning_invalid.c test_sk_assign.c # Set up extra TRUNNER_XXX "temporary" variables in the environment (relies on @@ -409,11 +414,11 @@ $(OUTPUT)/test_cpp: test_cpp.cpp $(OUTPUT)/test_core_extern.skel.h $(BPFOBJ) # Benchmark runner $(OUTPUT)/bench_%.o: benchs/bench_%.c bench.h - $(call msg,CC,,$@) - $(CC) $(CFLAGS) -c $(filter %.c,$^) $(LDLIBS) -o $@ + $(COMPILE_C_RULE) $(OUTPUT)/bench_rename.o: $(OUTPUT)/test_overhead.skel.h $(OUTPUT)/bench_trigger.o: $(OUTPUT)/trigger_bench.skel.h -$(OUTPUT)/bench.o: bench.h testing_helpers.h +$(OUTPUT)/bench.o: bench.c bench.h testing_helpers.h + $(COMPILE_C_RULE) $(OUTPUT)/bench: LDLIBS += -lm $(OUTPUT)/bench: $(OUTPUT)/bench.o $(OUTPUT)/testing_helpers.o \ $(OUTPUT)/bench_count.o \ From patchwork Fri May 22 04:13:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yauheni Kaliuta X-Patchwork-Id: 1295933 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=W/mD7emO; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49StQF0ntQz9sSW for ; Fri, 22 May 2020 14:13:25 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727906AbgEVENY (ORCPT ); Fri, 22 May 2020 00:13:24 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:25928 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727855AbgEVENY (ORCPT ); Fri, 22 May 2020 00:13:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590120803; 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=NVaBHuBZiPMio5n6+cHf34Z5EOFYq+BTGPO3x/dfqR8=; b=W/mD7emORxK1XJ3DIaibR3fZjzIMsgtWshaIBolwVAUeRF93WbAjKCZhkuEypsznlY/3Ku 9wSlXwm9ZY34MHNPZlgHayNLry4EIYY11+IjQ4lxGaUNwK+xwk3eYUln6tK8ykh3jJCS+o Wn03+jBa/BN9QWfQt38BAe5Ws6TVM9s= 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-17-WPlgWLLTNqiScosK6isK7Q-1; Fri, 22 May 2020 00:13:20 -0400 X-MC-Unique: WPlgWLLTNqiScosK6isK7Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BABBD835B8B; Fri, 22 May 2020 04:13:19 +0000 (UTC) Received: from astarta.redhat.com (ovpn-112-74.ams2.redhat.com [10.36.112.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4CBF65D9C9; Fri, 22 May 2020 04:13:18 +0000 (UTC) From: Yauheni Kaliuta To: bpf@vger.kernel.org Cc: Jiri Benc , Jiri Olsa , Andrii Nakryiko , Daniel Borkmann Subject: [PATCH 3/8] selftests/bpf: install btf .c files Date: Fri, 22 May 2020 07:13:05 +0300 Message-Id: <20200522041310.233185-4-yauheni.kaliuta@redhat.com> In-Reply-To: <20200522041310.233185-1-yauheni.kaliuta@redhat.com> References: <20200522041310.233185-1-yauheni.kaliuta@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Some .c files used by test_progs to check btf and they are missing from installation after commit 74b5a5968fe8 ("selftests/bpf: Replace test_progs and test_maps w/ general rule"). Take them back. Reuse BTF_C_FILES for TRUNNER_EXTRA_FILES. Fixes: 74b5a5968fe8 ("selftests/bpf: Replace test_progs and test_maps w/ general rule") Signed-off-by: Yauheni Kaliuta Acked-by: Andrii Nakryiko --- tools/testing/selftests/bpf/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index f0b7d41ed6dd..19091dbc8ca4 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -46,6 +46,9 @@ TEST_GEN_FILES = TEST_FILES = test_lwt_ip_encap.o \ test_tc_edt.o +BTF_C_FILES = $(wildcard progs/btf_dump_test_case_*.c) +TEST_FILES += $(BTF_C_FILES) + # Order correspond to 'make run_tests' order TEST_PROGS := test_kmod.sh \ test_xdp_redirect.sh \ @@ -362,8 +365,7 @@ 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 \ - $(wildcard progs/btf_dump_test_case_*.c) +TRUNNER_EXTRA_FILES := $(OUTPUT)/urandom_read $(BTF_C_FILES) TRUNNER_BPF_BUILD_RULE := CLANG_BPF_BUILD_RULE TRUNNER_BPF_CFLAGS := $(BPF_CFLAGS) $(CLANG_CFLAGS) TRUNNER_BPF_LDFLAGS := -mattr=+alu32 From patchwork Fri May 22 04:13:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yauheni Kaliuta X-Patchwork-Id: 1295936 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=VWgtIAsi; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49StQN2mXdz9sT1 for ; Fri, 22 May 2020 14:13:32 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727809AbgEVENc (ORCPT ); Fri, 22 May 2020 00:13:32 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:39799 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727914AbgEVENb (ORCPT ); Fri, 22 May 2020 00:13:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590120810; 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=us9Z3GIkI4cfKum+7ndNy2o1Apdj6w4EtN4Y1Uj+Bi4=; b=VWgtIAsiL6zFHr09rSLHPza4LoB4Ky1QBXdeO5Y0DXq53+a+HrGjEGZpfnOcdiFnoLXCsn 0Usizz+YV/Ca5AXRQ3OfGF3+4ULKVRXUUaq8QVv9bZSQ9W/V7oEGV8kznNsCZdhnRy1sEm ZMTw3Htyxkyaf983VSLAhYdajlqSn8U= 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-177-gS7mXSPyPYCGUWY8d72x5Q-1; Fri, 22 May 2020 00:13:26 -0400 X-MC-Unique: gS7mXSPyPYCGUWY8d72x5Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C6F648014D4; Fri, 22 May 2020 04:13:25 +0000 (UTC) Received: from astarta.redhat.com (ovpn-112-74.ams2.redhat.com [10.36.112.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 264A65D9C9; Fri, 22 May 2020 04:13:19 +0000 (UTC) From: Yauheni Kaliuta To: bpf@vger.kernel.org Cc: Jiri Benc , Jiri Olsa , Andrii Nakryiko , Daniel Borkmann Subject: [PATCH 4/8] selftests/bpf: fix object files installation Date: Fri, 22 May 2020 07:13:06 +0300 Message-Id: <20200522041310.233185-5-yauheni.kaliuta@redhat.com> In-Reply-To: <20200522041310.233185-1-yauheni.kaliuta@redhat.com> References: <20200522041310.233185-1-yauheni.kaliuta@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org There are problems with bpf test programs object files: 1) some of them are build for flavored test runner and should be installed in the subdirectory; 2) it's possible that the same file mentioned several times (added for every different unflavored test runner); 3) some generated files are not treated properly. Fix 1) by adding subdirectory to the list. rsync -a in the install target will handle it. Fix 2) by filtering the list. Performance should not matter for such amount of files. Fix 3) by use proper (TEST_GEN_FILES) variable for the list. Fixes: 309b81f0fdc4 ("selftests/bpf: Install generated test progs") Fixes: e47a179997ce ("bpf, testing: Add missing object file to TEST_FILES") Signed-off-by: Yauheni Kaliuta --- tools/testing/selftests/bpf/Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 19091dbc8ca4..1ba3d72c3261 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -42,8 +42,7 @@ ifneq ($(BPF_GCC),) TEST_GEN_PROGS += test_progs-bpf_gcc endif -TEST_GEN_FILES = -TEST_FILES = test_lwt_ip_encap.o \ +TEST_GEN_FILES = test_lwt_ip_encap.o \ test_tc_edt.o BTF_C_FILES = $(wildcard progs/btf_dump_test_case_*.c) @@ -273,7 +272,11 @@ TRUNNER_BPF_OBJS := $$(patsubst %.c,$$(TRUNNER_OUTPUT)/%.o, $$(TRUNNER_BPF_SRCS) TRUNNER_BPF_SKELS := $$(patsubst %.c,$$(TRUNNER_OUTPUT)/%.skel.h, \ $$(filter-out $(SKEL_BLACKLIST), \ $$(TRUNNER_BPF_SRCS))) -TEST_GEN_FILES += $$(TRUNNER_BPF_OBJS) + +TO_ADD := $(if $2,$$(TRUNNER_OUTPUT),$$(TRUNNER_BPF_OBJS)) +$$(foreach i,$$(TO_ADD),\ + $$(eval \ + TEST_GEN_FILES += $$(if $$(filter $$i,$$(TEST_GEN_FILES)),,$$i))) # Evaluate rules now with extra TRUNNER_XXX variables above already defined $$(eval $$(call DEFINE_TEST_RUNNER_RULES,$1,$2)) From patchwork Fri May 22 04:13:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yauheni Kaliuta X-Patchwork-Id: 1295935 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=c6DUVT6k; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49StQM75Gwz9sSW for ; Fri, 22 May 2020 14:13:31 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727924AbgEVENb (ORCPT ); Fri, 22 May 2020 00:13:31 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:37493 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727809AbgEVENb (ORCPT ); Fri, 22 May 2020 00:13:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590120810; 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=u49He7mJeWJjiEdyUax5g8nLZYWZmudbu/H3Tbw4Blk=; b=c6DUVT6khTtiNVjklgwSTDJhM8WuUqU5xClUyH8ab/PpcQpOedp/N07vubGrJdBWkXStel cFYtCC1IxZdPpfM6j2hEbh/B34eZNI5dStegdY7+dlC2mdi3hel9X4T1olZtDqT9xbGQaW L7JL4VaSX+P5x2rmlGGHDzUhPCgTX9Q= 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-341-7_16xKkwPem1yCkA9UW5lw-1; Fri, 22 May 2020 00:13:28 -0400 X-MC-Unique: 7_16xKkwPem1yCkA9UW5lw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A0417107ACCD; Fri, 22 May 2020 04:13:27 +0000 (UTC) Received: from astarta.redhat.com (ovpn-112-74.ams2.redhat.com [10.36.112.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 308CC5D9C9; Fri, 22 May 2020 04:13:25 +0000 (UTC) From: Yauheni Kaliuta To: bpf@vger.kernel.org Cc: Jiri Benc , Jiri Olsa , Andrii Nakryiko , Daniel Borkmann Subject: [PATCH 5/8] selftests/bpf: add output dir to include list Date: Fri, 22 May 2020 07:13:07 +0300 Message-Id: <20200522041310.233185-6-yauheni.kaliuta@redhat.com> In-Reply-To: <20200522041310.233185-1-yauheni.kaliuta@redhat.com> References: <20200522041310.233185-1-yauheni.kaliuta@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Some headers (skel) are generated in the output directory and used for build (test_cpp.cpp), so add it to the list (as well as CURDIR) otherwise out of tree build is broken. Signed-off-by: Yauheni Kaliuta --- tools/testing/selftests/bpf/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 1ba3d72c3261..efab82151ce2 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -22,7 +22,8 @@ LLVM_OBJCOPY ?= llvm-objcopy BPF_GCC ?= $(shell command -v bpf-gcc;) SAN_CFLAGS ?= CFLAGS += -g -rdynamic -Wall -O2 $(GENFLAGS) $(SAN_CFLAGS) \ - -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR) \ + -I$(CURDIR) -I$(abspath $(OUTPUT)) \ + -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR) \ -I$(TOOLSINCDIR) -I$(APIDIR) \ -Dbpf_prog_load=bpf_prog_test_load \ -Dbpf_load_program=bpf_test_load_program From patchwork Fri May 22 04:13:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yauheni Kaliuta X-Patchwork-Id: 1295937 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=R3QOBlrJ; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49StQQ1xRhz9sSW for ; Fri, 22 May 2020 14:13:34 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727942AbgEVENd (ORCPT ); Fri, 22 May 2020 00:13:33 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:52372 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727914AbgEVENd (ORCPT ); Fri, 22 May 2020 00:13:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590120812; 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=K9F4YBOs3UoMHmIPiFBgNRfM0D6Q+BBFbkC/xaHnj1w=; b=R3QOBlrJ02iqXN4/h3DfDlsCF6OZaLBdrx5YksCxHX4bl0dtIiriLQQOey3n2YEIRPXCBi RDNcRygFC9rGZQkODDi2+dRcNHRN86PHMkfPRx0i+srITeNolIPYahL11g/F3FhUGYwZWj 7VvEbQ5H3TUeOZjcQcgoEoNPxPBgYdQ= 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-470-VBNGVs6qNIWz1NWmXp1Rkg-1; Fri, 22 May 2020 00:13:30 -0400 X-MC-Unique: VBNGVs6qNIWz1NWmXp1Rkg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7834E80183C; Fri, 22 May 2020 04:13:29 +0000 (UTC) Received: from astarta.redhat.com (ovpn-112-74.ams2.redhat.com [10.36.112.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0A1865D9C9; Fri, 22 May 2020 04:13:27 +0000 (UTC) From: Yauheni Kaliuta To: bpf@vger.kernel.org Cc: Jiri Benc , Jiri Olsa , Andrii Nakryiko , Daniel Borkmann Subject: [PATCH 6/8] selftests/bpf: fix urandom_read installation Date: Fri, 22 May 2020 07:13:08 +0300 Message-Id: <20200522041310.233185-7-yauheni.kaliuta@redhat.com> In-Reply-To: <20200522041310.233185-1-yauheni.kaliuta@redhat.com> References: <20200522041310.233185-1-yauheni.kaliuta@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org selftests/lib.mk does not prepend TEST_CUSTOM_PROGS with OUTPUT (vs TEST_GEN_PROGS, TEST_GEN_PROGS_EXTENDED, TEST_GEN_FILES). So do it in the bpf Makefile. Otherwise make install fails to install it on out of tree build. Signed-off-by: Yauheni Kaliuta Acked-by: Andrii Nakryiko --- tools/testing/selftests/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index efab82151ce2..31598ca2d396 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -82,7 +82,7 @@ TEST_GEN_PROGS_EXTENDED = test_sock_addr test_skb_cgroup_id_user \ flow_dissector_load test_flow_dissector test_tcp_check_syncookie_user \ test_lirc_mode2_user xdping test_cpp runqslower bench -TEST_CUSTOM_PROGS = urandom_read +TEST_CUSTOM_PROGS = $(OUTPUT)/urandom_read # Emit succinct information message describing current building step # $1 - generic step name (e.g., CC, LINK, etc); From patchwork Fri May 22 04:13:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yauheni Kaliuta X-Patchwork-Id: 1295938 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=TJwW65hn; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49StQT0pF0z9sT1 for ; Fri, 22 May 2020 14:13:37 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727954AbgEVENg (ORCPT ); Fri, 22 May 2020 00:13:36 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:56211 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727914AbgEVENg (ORCPT ); Fri, 22 May 2020 00:13:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590120815; 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=ukD9GJtgzhlNNgb5v6+LpXzvgMP/t/gfajF7CIE4k40=; b=TJwW65hn8AVmZj3eUnQsGRuP1AOo0FUELQwfu/+oW8FSF7P4bYnP+fYEtVFnqcNPk/0hRk eD3LyS+oArGnUS3soHpOWsit8X/nJM0Q7upaaj+TXT7cTX46L0yc8EDTgydQpqTPee8CD+ E0bLuRd7+XQiX9903gEVjv3TiH5cBOA= 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-403-cGiz8Vi2MR6nJw61DUzU3A-1; Fri, 22 May 2020 00:13:32 -0400 X-MC-Unique: cGiz8Vi2MR6nJw61DUzU3A-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 527AD460; Fri, 22 May 2020 04:13:31 +0000 (UTC) Received: from astarta.redhat.com (ovpn-112-74.ams2.redhat.com [10.36.112.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D90FF5D9C9; Fri, 22 May 2020 04:13:29 +0000 (UTC) From: Yauheni Kaliuta To: bpf@vger.kernel.org Cc: Jiri Benc , Jiri Olsa , Andrii Nakryiko , Daniel Borkmann Subject: [PATCH 7/8] selftests/bpf: fix test.h placing for out of tree build Date: Fri, 22 May 2020 07:13:09 +0300 Message-Id: <20200522041310.233185-8-yauheni.kaliuta@redhat.com> In-Reply-To: <20200522041310.233185-1-yauheni.kaliuta@redhat.com> References: <20200522041310.233185-1-yauheni.kaliuta@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Flavors of test.h are generated in tree even for out of tree build. Use OUTPUT directory for that. It requires rules to make sure the directories exist. Split EXTRA_CLEAN generation since existance of test.h files depends of dynamic makefile generation. Signed-off-by: Yauheni Kaliuta --- tools/testing/selftests/bpf/Makefile | 38 +++++++++++++++++++++------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 31598ca2d396..bade24e29a1a 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -83,6 +83,7 @@ TEST_GEN_PROGS_EXTENDED = test_sock_addr test_skb_cgroup_id_user \ test_lirc_mode2_user xdping test_cpp runqslower bench TEST_CUSTOM_PROGS = $(OUTPUT)/urandom_read +EXTRA_CLEAN += $(TEST_CUSTOM_PROGS) # Emit succinct information message describing current building step # $1 - generic step name (e.g., CC, LINK, etc); @@ -267,7 +268,7 @@ TRUNNER_TEST_OBJS := $$(patsubst %.c,$$(TRUNNER_OUTPUT)/%.test.o, \ TRUNNER_EXTRA_OBJS := $$(patsubst %.c,$$(TRUNNER_OUTPUT)/%.o, \ $$(filter %.c,$(TRUNNER_EXTRA_SOURCES))) TRUNNER_EXTRA_HDRS := $$(filter %.h,$(TRUNNER_EXTRA_SOURCES)) -TRUNNER_TESTS_HDR := $(TRUNNER_TESTS_DIR)/tests.h +TRUNNER_TESTS_HDR := $(OUTPUT)/$(TRUNNER_TESTS_DIR)/tests.h TRUNNER_BPF_SRCS := $$(notdir $$(wildcard $(TRUNNER_BPF_PROGS_DIR)/*.c)) TRUNNER_BPF_OBJS := $$(patsubst %.c,$$(TRUNNER_OUTPUT)/%.o, $$(TRUNNER_BPF_SRCS)) TRUNNER_BPF_SKELS := $$(patsubst %.c,$$(TRUNNER_OUTPUT)/%.skel.h, \ @@ -295,6 +296,11 @@ $(TRUNNER_OUTPUT)-dir := y $(TRUNNER_OUTPUT): $$(call msg,MKDIR,,$$@) mkdir -p $$@ + +ifneq ($2,) +EXTRA_CLEAN +=$(TRUNNER_OUTPUT) +endif + endif # ensure we set up BPF objects generation rule just once for a given @@ -320,13 +326,19 @@ endif # ensure we set up tests.h header generation rule just once ifeq ($($(TRUNNER_TESTS_DIR)-tests-hdr),) $(TRUNNER_TESTS_DIR)-tests-hdr := y -$(TRUNNER_TESTS_HDR): $(TRUNNER_TESTS_DIR)/*.c +$(TRUNNER_TESTS_HDR): $(TRUNNER_TESTS_DIR)/*.c | $(dir $(TRUNNER_TESTS_HDR)) $$(call msg,TEST-HDR,$(TRUNNER_BINARY),$$@) $$(shell ( cd $(TRUNNER_TESTS_DIR); \ echo '/* Generated header, do not edit */'; \ ls *.c 2> /dev/null | \ sed -e 's@\([^\.]*\)\.c@DEFINE_TEST(\1)@'; \ ) > $$@) + +EXTRA_CLEAN += $(TRUNNER_TESTS_HDR) + +$(dir $(TRUNNER_TESTS_HDR)): + $$(call msg,MKDIR,,$$@) + mkdir -p $$@ endif # compile individual test files @@ -402,14 +414,23 @@ $(eval $(call DEFINE_TEST_RUNNER,test_maps)) # It is much simpler than test_maps/test_progs and sufficiently different from # them (e.g., test.h is using completely pattern), that it's worth just # explicitly defining all the rules explicitly. -verifier/tests.h: verifier/*.c +$(OUTPUT)/verifier/tests.h: verifier/*.c | $(OUTPUT)/verifier $(shell ( cd verifier/; \ echo '/* Generated header, do not edit */'; \ echo '#ifdef FILL_ARRAY'; \ ls *.c 2> /dev/null | sed -e 's@\(.*\)@#include \"\1\"@'; \ echo '#endif' \ - ) > verifier/tests.h) -$(OUTPUT)/test_verifier: test_verifier.c verifier/tests.h $(BPFOBJ) | $(OUTPUT) + ) > $@) + +EXTRA_CLEAN += $(OUTPUT)/verifier/tests.h + +$(OUTPUT)/verifier: + $(call msg,MKDIR,,$@) + mkdir -p $@ + +$(OUTPUT)/test_verifier: CFLAGS += -I$(abspath verifier) +$(OUTPUT)/test_verifier: test_verifier.c $(OUTPUT)/verifier/tests.h $(BPFOBJ) \ + | $(OUTPUT) $(call msg,BINARY,,$@) $(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@ @@ -433,7 +454,6 @@ $(OUTPUT)/bench: $(OUTPUT)/bench.o $(OUTPUT)/testing_helpers.o \ $(call msg,BINARY,,$@) $(CC) $(LDFLAGS) -o $@ $(filter %.a %.o,$^) $(LDLIBS) -EXTRA_CLEAN := $(TEST_CUSTOM_PROGS) $(SCRATCH_DIR) \ - prog_tests/tests.h map_tests/tests.h verifier/tests.h \ - feature \ - $(addprefix $(OUTPUT)/,*.o *.skel.h no_alu32 bpf_gcc) +EXTRA_CLEAN += $(SCRATCH_DIR) \ + feature \ + $(addprefix $(OUTPUT)/,*.o *.skel.h) From patchwork Fri May 22 04:13:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yauheni Kaliuta X-Patchwork-Id: 1295939 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=V3hf6ZYy; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 49StQc2yssz9sSW for ; Fri, 22 May 2020 14:13:44 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726449AbgEVENo (ORCPT ); Fri, 22 May 2020 00:13:44 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:32332 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726338AbgEVENn (ORCPT ); Fri, 22 May 2020 00:13:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590120822; 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=7cH40HAWZ/3Qx3sDVnVqBbfj0xwcDt+Jaa0AZ6Vk1J8=; b=V3hf6ZYyRqhDOK45XCeHHdkJU9m3gzvVZ4OfrKKGBbpfS81Gs4QMSDyTKqUUtmOFcHCOFA 3H/CJKHMrRHpv3T73nRFygzDN8vlXDNEwMFNuM0gPRbcDz7PGmfiahLycuYP1ojIS98PlQ J/HMr5azkN8ZgO2zHOFhz28d8Q3Xo/I= 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-119-R_bNKGvANTKe5_hd5zV5nA-1; Fri, 22 May 2020 00:13:38 -0400 X-MC-Unique: R_bNKGvANTKe5_hd5zV5nA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2781980183C; Fri, 22 May 2020 04:13:35 +0000 (UTC) Received: from astarta.redhat.com (ovpn-112-74.ams2.redhat.com [10.36.112.74]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B19B15D9C9; Fri, 22 May 2020 04:13:31 +0000 (UTC) From: Yauheni Kaliuta To: bpf@vger.kernel.org Cc: Jiri Benc , Jiri Olsa , Andrii Nakryiko , Daniel Borkmann Subject: [PATCH 8/8] selftests/bpf: factor out MKDIR rule Date: Fri, 22 May 2020 07:13:10 +0300 Message-Id: <20200522041310.233185-9-yauheni.kaliuta@redhat.com> In-Reply-To: <20200522041310.233185-1-yauheni.kaliuta@redhat.com> References: <20200522041310.233185-1-yauheni.kaliuta@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org Do not repeat youself, move common mkdir code (message and action) to a variable. Signed-off-by: Yauheni Kaliuta --- tools/testing/selftests/bpf/Makefile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index bade24e29a1a..26497d8869ea 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -252,6 +252,11 @@ define COMPILE_C_RULE $(CC) $(CFLAGS) -c $(filter %.c,$^) $(LDLIBS) -o $@ endef +define MKDIR_RULE + $(call msg,MKDIR,,$@) + mkdir -p $@ +endef + SKEL_BLACKLIST := btf__% test_pinning_invalid.c test_sk_assign.c # Set up extra TRUNNER_XXX "temporary" variables in the environment (relies on @@ -294,8 +299,7 @@ define DEFINE_TEST_RUNNER_RULES ifeq ($($(TRUNNER_OUTPUT)-dir),) $(TRUNNER_OUTPUT)-dir := y $(TRUNNER_OUTPUT): - $$(call msg,MKDIR,,$$@) - mkdir -p $$@ + $$(MKDIR_RULE) ifneq ($2,) EXTRA_CLEAN +=$(TRUNNER_OUTPUT) @@ -337,8 +341,7 @@ $(TRUNNER_TESTS_HDR): $(TRUNNER_TESTS_DIR)/*.c | $(dir $(TRUNNER_TESTS_HDR)) EXTRA_CLEAN += $(TRUNNER_TESTS_HDR) $(dir $(TRUNNER_TESTS_HDR)): - $$(call msg,MKDIR,,$$@) - mkdir -p $$@ + $$(MKDIR_RULE) endif # compile individual test files @@ -425,8 +428,7 @@ $(OUTPUT)/verifier/tests.h: verifier/*.c | $(OUTPUT)/verifier EXTRA_CLEAN += $(OUTPUT)/verifier/tests.h $(OUTPUT)/verifier: - $(call msg,MKDIR,,$@) - mkdir -p $@ + $(MKDIR_RULE) $(OUTPUT)/test_verifier: CFLAGS += -I$(abspath verifier) $(OUTPUT)/test_verifier: test_verifier.c $(OUTPUT)/verifier/tests.h $(BPFOBJ) \