lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzZGOSAFU-75hymmv2pThs_WJd+o25zFO0q4XQ=mWpYgZA@mail.gmail.com>
Date:   Mon, 2 Dec 2019 13:30:25 -0800
From:   Andrii Nakryiko <andrii.nakryiko@...il.com>
To:     Stanislav Fomichev <sdf@...gle.com>
Cc:     Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>
Subject: Re: [PATCH bpf] selftests/bpf: bring back c++ include/link test

On Mon, Dec 2, 2019 at 12:28 PM Stanislav Fomichev <sdf@...gle.com> wrote:
>
> Commit 5c26f9a78358 ("libbpf: Don't use cxx to test_libpf target")
> converted existing c++ test to c. We still want to include and
> link against libbpf from c++ code, so reinstate this test back,
> this time in a form of a selftest with a clear comment about
> its purpose.
>
> Fixes: 5c26f9a78358 ("libbpf: Don't use cxx to test_libpf target")
> Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
> ---

thanks for clean up! Looks good except for explicit -lelf below.

>  tools/lib/bpf/.gitignore                                    | 1 -
>  tools/lib/bpf/Makefile                                      | 5 +----
>  tools/testing/selftests/bpf/.gitignore                      | 1 +
>  tools/testing/selftests/bpf/Makefile                        | 6 +++++-
>  .../test_libbpf.c => testing/selftests/bpf/test_cpp.cpp}    | 0
>  5 files changed, 7 insertions(+), 6 deletions(-)
>  rename tools/{lib/bpf/test_libbpf.c => testing/selftests/bpf/test_cpp.cpp} (100%)
>

[...]

>
> @@ -317,6 +317,10 @@ verifier/tests.h: verifier/*.c
>  $(OUTPUT)/test_verifier: test_verifier.c verifier/tests.h $(BPFOBJ) | $(OUTPUT)
>         $(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@
>
> +# Make sure we are able to include and link libbpf against c++.
> +$(OUTPUT)/test_cpp: test_cpp.cpp $(BPFOBJ)
> +       $(CXX) $(CFLAGS) $^ -lelf -o $@

let's use $(LDLIBS) instead here

> +
>  EXTRA_CLEAN := $(TEST_CUSTOM_PROGS)                                    \
>         prog_tests/tests.h map_tests/tests.h verifier/tests.h           \
>         feature $(OUTPUT)/*.o $(OUTPUT)/no_alu32 $(OUTPUT)/bpf_gcc
> diff --git a/tools/lib/bpf/test_libbpf.c b/tools/testing/selftests/bpf/test_cpp.cpp
> similarity index 100%
> rename from tools/lib/bpf/test_libbpf.c
> rename to tools/testing/selftests/bpf/test_cpp.cpp
> --
> 2.24.0.393.g34dc348eaf-goog
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ