<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/tools/testing/selftests/bpf/testing_helpers.c, branch v6.8</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.8</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.8'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2023-11-17T18:30:02Z</updated>
<entry>
<title>bpf: rename BPF_F_TEST_SANITY_STRICT to BPF_F_TEST_REG_INVARIANTS</title>
<updated>2023-11-17T18:30:02Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2023-11-17T17:14:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ff8867af01daa7ea770bebf5f91199b7434b74e5'/>
<id>urn:sha1:ff8867af01daa7ea770bebf5f91199b7434b74e5</id>
<content type='text'>
Rename verifier internal flag BPF_F_TEST_SANITY_STRICT to more neutral
BPF_F_TEST_REG_INVARIANTS. This is a follow up to [0].

A few selftests and veristat need to be adjusted in the same patch as
well.

  [0] https://patchwork.kernel.org/project/netdevbpf/patch/20231112010609.848406-5-andrii@kernel.org/

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/r/20231117171404.225508-1-andrii@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/bpf: set BPF_F_TEST_SANITY_SCRIPT by default</title>
<updated>2023-11-15T20:03:42Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2023-11-12T01:06:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8c5677f8b31e92b57be7d5d0fbb1ac66eedf4f91'/>
<id>urn:sha1:8c5677f8b31e92b57be7d5d0fbb1ac66eedf4f91</id>
<content type='text'>
Make sure to set BPF_F_TEST_SANITY_STRICT program flag by default across
most verifier tests (and a bunch of others that set custom prog flags).

There are currently two tests that do fail validation, if enforced
strictly: verifier_bounds/crossing_64_bit_signed_boundary_2 and
verifier_bounds/crossing_32_bit_signed_boundary_2. To accommodate them,
we teach test_loader a flag negation:

__flag(!&lt;flagname&gt;) will *clear* specified flag, allowing easy opt-out.

We apply __flag(!BPF_F_TEST_SANITY_STRICT) to these to tests.

Also sprinkle BPF_F_TEST_SANITY_STRICT everywhere where we already set
test-only BPF_F_TEST_RND_HI32 flag, for completeness.

Acked-by: Eduard Zingerman &lt;eddyz87@gmail.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/r/20231112010609.848406-12-andrii@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/bpf: Use un/load_bpf_testmod functions in tests</title>
<updated>2023-05-17T05:09:23Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@kernel.org</email>
</author>
<published>2023-05-15T13:37:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=11642eb92b3bc67171b23abff0d062758c5a4730'/>
<id>urn:sha1:11642eb92b3bc67171b23abff0d062758c5a4730</id>
<content type='text'>
Now that we have un/load_bpf_testmod helpers in testing_helpers.h,
we can use it in other tests and save some lines.

Acked-by: David Vernet &lt;void@manifault.com&gt;
Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Link: https://lore.kernel.org/r/20230515133756.1658301-7-jolsa@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/bpf: Do not unload bpf_testmod in load_bpf_testmod</title>
<updated>2023-05-17T05:09:23Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@kernel.org</email>
</author>
<published>2023-05-15T13:37:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b58f3f0e6f3cbea56be39d8fb190b37f049505bb'/>
<id>urn:sha1:b58f3f0e6f3cbea56be39d8fb190b37f049505bb</id>
<content type='text'>
Do not unload bpf_testmod in load_bpf_testmod, instead call
unload_bpf_testmod separatelly.

This way we will be able use un/load_bpf_testmod functions
in other tests that un/load bpf_testmod module.

Acked-by: David Vernet &lt;void@manifault.com&gt;
Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Link: https://lore.kernel.org/r/20230515133756.1658301-6-jolsa@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/bpf: Use only stdout in un/load_bpf_testmod functions</title>
<updated>2023-05-17T05:09:23Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@kernel.org</email>
</author>
<published>2023-05-15T13:37:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d18decca69e36480247a73086336f4a44a08e36f'/>
<id>urn:sha1:d18decca69e36480247a73086336f4a44a08e36f</id>
<content type='text'>
We are about to use un/load_bpf_testmod functions in couple tests
and it's better  to print output to stdout,  so it's aligned with
tests ASSERT macros output, which use stdout as well.

Acked-by: David Vernet &lt;void@manifault.com&gt;
Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Link: https://lore.kernel.org/r/20230515133756.1658301-5-jolsa@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/bpf: Move test_progs helpers to testing_helpers object</title>
<updated>2023-05-17T05:09:23Z</updated>
<author>
<name>Jiri Olsa</name>
<email>jolsa@kernel.org</email>
</author>
<published>2023-05-15T13:37:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=45db310984bfea977177fb5fc0ea23ab430129bd'/>
<id>urn:sha1:45db310984bfea977177fb5fc0ea23ab430129bd</id>
<content type='text'>
Moving test_progs helpers to testing_helpers object so they can be
used from test_verifier in following changes.

Also adding missing ifndef header guard to testing_helpers.h header.

Using stderr instead of env.stderr because un/load_bpf_testmod helpers
will be used outside test_progs. Also at the point of calling them
in test_progs the std files are not hijacked yet and stderr is the
same as env.stderr.

Acked-by: David Vernet &lt;void@manifault.com&gt;
Signed-off-by: Jiri Olsa &lt;jolsa@kernel.org&gt;
Link: https://lore.kernel.org/r/20230515133756.1658301-4-jolsa@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
<entry>
<title>selftests/bpf: Test_progs can read test lists from file</title>
<updated>2023-05-01T22:30:02Z</updated>
<author>
<name>Stephen Veiss</name>
<email>sveiss@meta.com</email>
</author>
<published>2023-04-27T22:53:33Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=64276f01dce85f72853617e513622b5645497d81'/>
<id>urn:sha1:64276f01dce85f72853617e513622b5645497d81</id>
<content type='text'>
Improve test selection logic when using -a/-b/-d/-t options.
The list of tests to include or exclude can now be read from a file,
specified as @&lt;filename&gt;.

The file contains one name (or wildcard pattern) per line, and
comments beginning with # are ignored.

These options can be passed multiple times to read more than one file.

Signed-off-by: Stephen Veiss &lt;sveiss@meta.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20230427225333.3506052-3-sveiss@meta.com
</content>
</entry>
<entry>
<title>selftests/bpf: Extract insert_test from parse_test_list</title>
<updated>2023-05-01T22:30:02Z</updated>
<author>
<name>Stephen Veiss</name>
<email>sveiss@meta.com</email>
</author>
<published>2023-04-27T22:53:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0a5c0de8b66f9789422f04de7304e374a2ea8df5'/>
<id>urn:sha1:0a5c0de8b66f9789422f04de7304e374a2ea8df5</id>
<content type='text'>
Split the logic to insert new tests into test filter sets out from
parse_test_list.

Fix the subtest insertion logic to reuse an existing top-level test
filter, which prevents the creation of duplicate top-level test filters
each with a single subtest.

Signed-off-by: Stephen Veiss &lt;sveiss@meta.com&gt;
Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Acked-by: Yonghong Song &lt;yhs@fb.com&gt;
Link: https://lore.kernel.org/bpf/20230427225333.3506052-2-sveiss@meta.com
</content>
</entry>
<entry>
<title>selftests/bpf: Use read_perf_max_sample_freq() in perf_event_stackmap</title>
<updated>2023-04-13T12:32:04Z</updated>
<author>
<name>Song Liu</name>
<email>song@kernel.org</email>
</author>
<published>2023-04-12T21:04:21Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=de6d014a09bf12a9a8959d60c0a1d4a41d394a89'/>
<id>urn:sha1:de6d014a09bf12a9a8959d60c0a1d4a41d394a89</id>
<content type='text'>
Currently, perf_event sample period in perf_event_stackmap is set too low
that the test fails randomly. Fix this by using the max sample frequency,
from read_perf_max_sample_freq().

Move read_perf_max_sample_freq() to testing_helpers.c. Replace the CHECK()
with if-printf, as CHECK is not available in testing_helpers.c.

Fixes: 1da4864c2b20 ("selftests/bpf: Add callchain_stackid")
Signed-off-by: Song Liu &lt;song@kernel.org&gt;
Signed-off-by: Daniel Borkmann &lt;daniel@iogearbox.net&gt;
Link: https://lore.kernel.org/bpf/20230412210423.900851-2-song@kernel.org
</content>
</entry>
<entry>
<title>libbpf: disassociate section handler on explicit bpf_program__set_type() call</title>
<updated>2023-03-30T00:22:01Z</updated>
<author>
<name>Andrii Nakryiko</name>
<email>andrii@kernel.org</email>
</author>
<published>2023-03-27T18:52:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d6e6286a12e7b8a4ddc66237c4ccf6f531ef1c82'/>
<id>urn:sha1:d6e6286a12e7b8a4ddc66237c4ccf6f531ef1c82</id>
<content type='text'>
If user explicitly overrides programs's type with
bpf_program__set_type() API call, we need to disassociate whatever
SEC_DEF handler libbpf determined initially based on program's SEC()
definition, as it's not goind to be valid anymore and could lead to
crashes and/or confusing failures.

Also, fix up bpf_prog_test_load() helper in selftests/bpf, which is
force-setting program type (even if that's completely unnecessary; this
is quite a legacy piece of code), and thus should expect auto-attach to
not work, yet one of the tests explicitly relies on auto-attach for
testing.

Instead, force-set program type only if it differs from the desired one.

Signed-off-by: Andrii Nakryiko &lt;andrii@kernel.org&gt;
Link: https://lore.kernel.org/r/20230327185202.1929145-2-andrii@kernel.org
Signed-off-by: Alexei Starovoitov &lt;ast@kernel.org&gt;
</content>
</entry>
</feed>
