Re: [PATCH bpf-next v3 5/5] selftests/bpf: Add test for "bpftool feature" command

From: Quentin Monnet
Date: Wed Feb 26 2020 - 10:43:29 EST


2020-02-26 16:34 UTC+0100 ~ Daniel Borkmann <daniel@xxxxxxxxxxxxx>
On 2/25/20 8:44 PM, Michal Rostecki wrote:
Add Python module with tests for "bpftool feature" command, which mainly
wheck whether the "full" option is working properly.

nit, typo: wheck


Signed-off-by: Michal Rostecki <mrostecki@xxxxxxxxxxxx>

Ptal, when running the test I'm getting the following error:

root@tank:~/bpf-next/tools/testing/selftests/bpf# ./test_bpftool.sh
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 "/root/bpf-next/tools/testing/selftests/bpf/test_bpftool.py", line 58, in wrapper
ÂÂÂ return f(*args, iface, **kwargs)
 File "/root/bpf-next/tools/testing/selftests/bpf/test_bpftool.py", line 83, in test_feature_dev_json
ÂÂÂ res = bpftool_json(["feature", "probe", "dev", iface])
 File "/root/bpf-next/tools/testing/selftests/bpf/test_bpftool.py", line 43, in bpftool_json
ÂÂÂ res = _bpftool(args)
 File "/root/bpf-next/tools/testing/selftests/bpf/test_bpftool.py", line 34, in _bpftool
ÂÂÂ res = subprocess.run(_args, capture_output=True)
 File "/usr/lib/python3.6/subprocess.py", line 423, in run
ÂÂÂ with Popen(*popenargs, **kwargs) as process:
TypeError: __init__() got an unexpected keyword argument 'capture_output'


Apparently the âcapture_outputâ option for subprocess was added to python 3.7 [0]. It worked on my system (python 3.7.5) but didn't pass on yours with 3.6.

Michal, can you change it to something less recent please, so that people don't have to upgrade python to test?

Quentin

[0] https://docs.python.org/3/whatsnew/3.7.html#subprocess