selftests, bpftool: Set EXIT trap after usage function
authorQuentin Monnet <quentin.monnet@netronome.com>
Tue, 19 Nov 2019 10:50:09 +0000 (10:50 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 25 Nov 2019 00:58:45 +0000 (16:58 -0800)
commit31f8b8295bb8997f139fe34b68654f8f1408f0da
treec6a62ad38a8a7cc87f6389a3723b0f6b2445d296
parenta89b2cbf71d64b61e79bbe5cb7ff4664797eeaaf
selftests, bpftool: Set EXIT trap after usage function

The trap on EXIT is used to clean up any temporary directory left by the
build attempts. It is not needed when the user simply calls the script
with its --help option, and may not be needed either if we add checks
(e.g. on the availability of bpftool files) before the build attempts.

Let's move this trap and related variables lower down in the code, so
that we don't accidentally change the value returned from the script
on early exits at pre-checks.

Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Link: https://lore.kernel.org/bpf/20191119105010.19189-2-quentin.monnet@netronome.com
tools/testing/selftests/bpf/test_bpftool_build.sh