Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp66520ybl; Mon, 2 Dec 2019 07:39:55 -0800 (PST) X-Google-Smtp-Source: APXvYqwcp989qLx5D3hXEkSrCj00aAC5iKMpn3pexLSnPRxWDviUgKOmamnCLnnfD/hvhdXngrMe X-Received: by 2002:aa7:c994:: with SMTP id c20mr24383803edt.113.1575301195053; Mon, 02 Dec 2019 07:39:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575301195; cv=none; d=google.com; s=arc-20160816; b=cEfw/z5/MYSP2f9ZDdwflbKRayWztHuPN7luXm/uOxqJ3rqADpsXbSgl5RhtSqzYYP TecfnRGEo7Ho1MF0Ujbn43xvfbosPFN0WHmfLUfICDuAvPX8+wXYL2z52jezy4THDLE5 SVJzl7zCNq25pHrj1/vTq0ZAp4zeTk+DV+5l8f3PZZtPq0zbkWLOxgWJ3i1u5Avj/r9D AcOfyigzy7QLkuyIGIgMvqa6WAonK2rro3WSeQgXLPk+06+MmMAyMtfrsS+AWwZU9IZl xk9eOmlcfVphuFhbM8WebCZMQFvWOqPejtk08pLR1PaPrAaTpDnRAf4JCuf0WOBuUu8A DAMg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:subject:autocrypt:openpgp:from:references:cc:to :dkim-signature; bh=QKV9dnpf6rp/7gDFmeYHF8ufaitXlU/8eSk2SUEebjs=; b=QWamafKgtA2o/qGeDBcqEUoEgIWTwEVuI1WuuQuwN5+gbf6xzHfgTtGfPoZpW+RSGs wXMDfySyAYObdkkfBU9O4lShFcCS3T29kVBOdXrj8rKnQLk6nzERouvs5G3srmekYwQq Pkca4u179Ylndgff790rbi+6RTbwaAA7FfCpDuLguogqKoNYV/OyAXtGhOwkmOKxsGFt 4NsWlaY0JpXkrkgmbyn+xdpQi/DIcGskA6DdV4mYbN+8T+2HyedwUI+wvNvZYsUdoasX MOi+1tahqlV4xWHRtV/vpsb4ls29EaFS3lxqfKTgGLFJUFIGK3bEkBr7Cc4tn9tPprCn XogA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=ZyvekxJL; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c38si9639384edf.356.2019.12.02.07.39.30; Mon, 02 Dec 2019 07: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; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=ZyvekxJL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727502AbfLBPiL (ORCPT + 99 others); Mon, 2 Dec 2019 10:38:11 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:39183 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727431AbfLBPiK (ORCPT ); Mon, 2 Dec 2019 10:38:10 -0500 Received: by mail-wr1-f68.google.com with SMTP id y11so41731675wrt.6 for ; Mon, 02 Dec 2019 07:38:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=to:cc:references:from:openpgp:autocrypt:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=QKV9dnpf6rp/7gDFmeYHF8ufaitXlU/8eSk2SUEebjs=; b=ZyvekxJLZtDwVbwOLLgdQNc4s2uE92lbdxbxNobLNUKUv0rn8HRutBpDS4oquS+Qht eRvAoInkI1A2tv1aOZrP9H4qPdsQmb52aZIqdXHwBI/ELB8bk3QBuMnVVI6SIIpCeV71 PwjVnZ/LkHCSgib5zTsyRxjw2/ybKVRsdKkg6nHhrCbsc0uMZwDLlwQWNTkmcfjrPKg1 /Vmfb1F8IJl/6ENpg7LRe5+HqZobiv+POOr8xL3a3mpbhFx38nUsrIW3q34+94T4xoZp jFg+4r+Qx+I5lzArrdMY7ism2O8ZJzERvuFfT9B4Z7qosuW2RyxogLZmT9tik6Ma1njW VXAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:openpgp:autocrypt:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=QKV9dnpf6rp/7gDFmeYHF8ufaitXlU/8eSk2SUEebjs=; b=R3aYMlY6elPfVXaTLPkfE5CTsWxjcx8fuOMlv0zrm+riZ/GtyHZBHhO92oXwv6yHb8 gm66m+txlmvUEciQdxPkNLfxOaNbHphSxHmgyNGbf1PWDpFNFm63n1DY3ARjE3LyxXwY VqEw1izWlCVwNl5B2GqtZaH7N2NUddI12AOzP/x2oY536q+t6oVDz7HL25Kw4K+5Wyy2 p8cstb6lKVbf1AnZEPxZP8xRgNs6sjH8LuCInAKgLli8ij1zqkimF+ozGAmWyVB5W8TS 8pVkDfDpOeBr5hEs8e+UXBe4fcXFKEN22EHAjIikQXNQv0uzpfdsisaesWW1cYnm5qd0 dUvw== X-Gm-Message-State: APjAAAXWaaGdcjp5e0UFu2O0HN2a/Mm/UHU/S6k7jw1oTjLEbIedBN5C YJ3pK++qQXZwClXe3+zXkQUY/g== X-Received: by 2002:adf:ef92:: with SMTP id d18mr32451336wro.234.1575301087685; Mon, 02 Dec 2019 07:38:07 -0800 (PST) Received: from [172.20.1.104] ([217.38.71.146]) by smtp.gmail.com with ESMTPSA id n3sm16187328wrs.8.2019.12.02.07.38.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Dec 2019 07:38:06 -0800 (PST) To: Jiri Olsa , Arnaldo Carvalho de Melo Cc: lkml , netdev@vger.kernel.org, bpf@vger.kernel.org, Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan , =?UTF-8?Q?Toke_H=c3=b8iland-J=c3=b8rgensen?= , Jesper Dangaard Brouer , Daniel Borkmann , Alexei Starovoitov , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko References: <20191202131847.30837-1-jolsa@kernel.org> <20191202131847.30837-7-jolsa@kernel.org> From: Quentin Monnet Openpgp: preference=signencrypt Autocrypt: addr=quentin.monnet@netronome.com; prefer-encrypt=mutual; keydata= mQINBFnqRlsBEADfkCdH/bkkfjbglpUeGssNbYr/TD4aopXiDZ0dL2EwafFImsGOWmCIIva2 MofTQHQ0tFbwY3Ir74exzU9X0aUqrtHirQHLkKeMwExgDxJYysYsZGfM5WfW7j8X4aVwYtfs AVRXxAOy6/bw1Mccq8ZMTYKhdCgS3BfC7qK+VYC4bhM2AOWxSQWlH5WKQaRbqGOVLyq8Jlxk 2FGLThUsPRlXKz4nl+GabKCX6x3rioSuNoHoWdoPDKsRgYGbP9LKRRQy3ZeJha4x+apy8rAM jcGHppIrciyfH38+LdV1FVi6sCx8sRKX++ypQc3fa6O7d7mKLr6uy16xS9U7zauLu1FYLy2U N/F1c4F+bOlPMndxEzNc/XqMOM9JZu1XLluqbi2C6JWGy0IYfoyirddKpwzEtKIwiDBI08JJ Cv4jtTWKeX8pjTmstay0yWbe0sTINPh+iDw+ybMwgXhr4A/jZ1wcKmPCFOpb7U3JYC+ysD6m 6+O/eOs21wVag/LnnMuOKHZa2oNsi6Zl0Cs6C7Vve87jtj+3xgeZ8NLvYyWrQhIHRu1tUeuf T8qdexDphTguMGJbA8iOrncHXjpxWhMWykIyN4TYrNwnyhqP9UgqRPLwJ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MLRi483eqT0eG1QBE4O8dFNYdK5XUIz oHhplrRgXwPBSOkMMlLKu+FJsmYVFeLAJ81sfmFuTTliRb3Fl2Q27cEr7kNKlsz/t6vLSEN2 j8x+tWD8x53SEOSn94g2AyJA9Txh2xBhWGuZ9CpBuXjtPrnRSd8xdrw36AL53goTt/NiLHUd RHhSHGnKaQ6MfrTge5Q0h5A= Subject: Re: [PATCH 6/6] selftests, bpftool: Add build test for libbpf dynamic linking Message-ID: <091d7dc2-0adb-f907-38d2-1750b1ec008a@netronome.com> Date: Mon, 2 Dec 2019 15:38:05 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: <20191202131847.30837-7-jolsa@kernel.org> Content-Type: text/plain; charset=windows-1252 Content-Language: en-GB Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thanks Jiri ! A few comments inline. 2019-12-02 14:18 UTC+0100 ~ Jiri Olsa > Adding new test to test_bpftool_build.sh script to > test the dynamic linkage of libbpf for bpftool: > > $ ./test_bpftool_build.sh > [SNIP] > > ... with dynamic libbpf > > $PWD: /home/jolsa/kernel/linux-perf/tools/bpf/bpftool > command: make -s -C ../../build/feature clean >/dev/null > command: make -s -C ../../lib/bpf clean >/dev/null > command: make -s -C ../../lib/bpf prefix=/tmp/tmp.fG8O2Ps8ER install_lib install_headers >/dev/null > Parsed description of 117 helper function(s) > command: make -s clean >/dev/null > command: make -s LIBBPF_DYNAMIC=1 LIBBPF_DIR=/tmp/tmp.fG8O2Ps8ER >/dev/null > binary: /home/jolsa/kernel/linux-perf/tools/bpf/bpftool/bpftool > binary: linked with libbpf > > The test installs libbpf into temp directory > and links bpftool dynamically with it. > > Signed-off-by: Jiri Olsa > --- > .../selftests/bpf/test_bpftool_build.sh | 53 +++++++++++++++++++ > 1 file changed, 53 insertions(+) > > diff --git a/tools/testing/selftests/bpf/test_bpftool_build.sh b/tools/testing/selftests/bpf/test_bpftool_build.sh > index ac349a5cea7e..e4a6a0520f8e 100755 > --- a/tools/testing/selftests/bpf/test_bpftool_build.sh > +++ b/tools/testing/selftests/bpf/test_bpftool_build.sh > @@ -85,6 +85,55 @@ make_with_tmpdir() { > echo > } > > +# Assumes current directory is tools/bpf/bpftool > +make_with_dynamic_libbpf() { > + TMPDIR=$(mktemp -d) > + echo -e "\$PWD: $PWD" > + > + # It might be needed to clean build tree first because features > + # framework does not detect the change properly > + echo -e "command: make -s -C ../../build/feature clean >/dev/null" (So far I did not echo the "make clean" commands, I printed only the ones used to build bpftool. But that's your call.) > + make $J -s -C ../../build/feature clean >/dev/null > + if [ $? -ne 0 ] ; then > + ERROR=1 > + fi > + echo -e "command: make -s -C ../../lib/bpf clean >/dev/null" > + make $J -s -C ../../lib/bpf clean >/dev/null > + if [ $? -ne 0 ] ; then > + ERROR=1 > + fi > + > + # Now install libbpf into TMPDIR > + echo -e "command: make -s -C ../../lib/bpf prefix=$TMPDIR install_lib install_headers >/dev/null" > + make $J -s -C ../../lib/bpf prefix=$TMPDIR install_lib install_headers >/dev/null > + if [ $? -ne 0 ] ; then > + ERROR=1 > + fi > + > + # And final bpftool build (with clean first) with libbpf dynamic link > + echo -e "command: make -s clean >/dev/null" > + if [ $? -ne 0 ] ; then > + ERROR=1 > + fi I do not believe you need to "make clean" here, this should have been done by the previous test in that dir earlier in the script (cd tools/bpf/bpftool; make_and_clean) > + echo -e "command: make -s LIBBPF_DYNAMIC=1 LIBBPF_DIR=$TMPDIR >/dev/null" > + make $J -s LIBBPF_DYNAMIC=1 LIBBPF_DIR=$TMPDIR >/dev/null > + if [ $? -ne 0 ] ; then > + ERROR=1 > + fi > + > + check . > + ldd bpftool | grep -q libbpf.so > + if [ $? -ne 0 ] ; then (Or "if ldd bpftool | grep -q libbpf.so ; then") > + printf "FAILURE: Did not find libbpf linked\n" Please also set $(ERROR) here. (Also, stick to echo rather than mixing with printf? I can't remember why I used one over echo in the check() function, that was probably not on purpose.) > + else > + echo "binary: linked with libbpf" > + fi > + make -s -C ../../lib/bpf clean > + make -s clean > + rm -rf -- $TMPDIR We probably want to clean features too? We tried to check that libbpf was available, but with a very specific $(LIBBPF_DIR), which was temporary and no longer exist. So better to reset features to a clean state? > + echo > +} > + > echo "Trying to build bpftool" > echo -e "... through kbuild\n" > > @@ -145,3 +194,7 @@ make_and_clean > make_with_tmpdir OUTPUT > > make_with_tmpdir O > + > +echo -e "... with dynamic libbpf\n" > + > +make_with_dynamic_libbpf > Thanks, Quentin