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  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 14 Aug 2020 14:27:56 +0530
From:   Balamuruhan S <>
Cc:,,,,,,,,,,,, Balamuruhan S <>
Subject: [PATCH bpf] selftest/bpf: make bpftool if it is not already built

test_bpftool error out if bpftool is not available in bpftool dir
linux/tools/bpf/bpftool, build and clean it as part of test
bootstrap and teardown.

Error log:
test_feature_dev_json (test_bpftool.TestBpftool) ... ERROR
test_feature_kernel (test_bpftool.TestBpftool) ... ERROR
test_feature_kernel_full (test_bpftool.TestBpftool) ... ERROR
test_feature_kernel_full_vs_not_full (test_bpftool.TestBpftool) ... ERROR
test_feature_macros (test_bpftool.TestBpftool) ... ERROR

ERROR: test_feature_dev_json (test_bpftool.TestBpftool)
Traceback (most recent call last):
  File "/home/ubuntu/disk/linux/tools/testing/selftests/bpf/",
    return f(*args, iface, **kwargs)
  File "/home/ubuntu/disk/linux/tools/testing/selftests/bpf/",
    res = bpftool_json(["feature", "probe", "dev", iface])
  File "/home/ubuntu/disk/linux/tools/testing/selftests/bpf/",
    res = _bpftool(args)
  File "/home/ubuntu/disk/linux/tools/testing/selftests/bpf/",
    return subprocess.check_output(_args)
  File "/usr/lib/python3.8/", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/", line 489, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.8/", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'bpftool'

Signed-off-by: Balamuruhan S <>
 tools/testing/selftests/bpf/ | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/tools/testing/selftests/bpf/ b/tools/testing/selftests/bpf/
index 4fed2dc25c0a..60357c6891a6 100644
--- a/tools/testing/selftests/bpf/
+++ b/tools/testing/selftests/bpf/
@@ -58,12 +58,25 @@ def default_iface(f):
     return wrapper
+def make_bpftool(clean=False):
+    cmd = "make"
+    if clean:
+        cmd = "make clean"
+    return, shell=True, cwd=bpftool_dir, check=True,
+                          stdout=subprocess.DEVNULL)
 class TestBpftool(unittest.TestCase):
     def setUpClass(cls):
         if os.getuid() != 0:
             raise UnprivilegedUserError(
                 "This test suite needs root privileges")
+        if subprocess.getstatusoutput("bpftool -h")[0]:
+            make_bpftool()
+    @classmethod
+    def tearDownClass(cls):
+        make_bpftool(clean=True)
     def test_feature_dev_json(self, iface):

base-commit: 6e868cf355725fbe9fa512d01b09b8ee7f3358f0

Powered by blists - more mailing lists