History

selftests/bpf: Fix overflow tests to reflect iter size increase

bpf iter size increase to PAGE_SIZE << 3 means overflow tests assuming page size need to be bumped also.

Alan Maguire committed 6 years ago

Commit eb58bbf1 parent af653201 file · +7 −7Browse files

Unified · Split

tools/testing/selftests/bpf/prog_tests/bpf_iter.c+7−7
@@ -352,7 +352,7 @@ static void test_overflow(bool test_e2big_overflow, bool ret1) · 351 unmodified lines
352352 struct bpf_map_info map_info = {};
353353 struct bpf_iter_test_kern4 *skel;
354354 struct bpf_link *link;
355− __u32 page_size;
355+ __u32 iter_size;
356356 char *buf;
357357
358358 skel = bpf_iter_test_kern4__open();
@@ -374,19 +374,19 @@ static void test_overflow(bool test_e2big_overflow, bool ret1) · 15 unmodified lines
374374 "map_creation failed: %s\n", strerror(errno)))
375375 goto free_map1;
376376
377− /* bpf_seq_printf kernel buffer is one page, so one map
377+ /* bpf_seq_printf kernel buffer is 8 pages, so one map
378378 * bpf_seq_write will mostly fill it, and the other map
379379 * will partially fill and then trigger overflow and need
380380 * bpf_seq_read restart.
381381 */
382− page_size = sysconf(_SC_PAGE_SIZE);
382+ iter_size = sysconf(_SC_PAGE_SIZE) << 3;
383383
384384 if (test_e2big_overflow) {
385− skel->rodata->print_len = (page_size + 8) / 8;
386− expected_read_len = 2 * (page_size + 8);
385+ skel->rodata->print_len = (iter_size + 8) / 8;
386+ expected_read_len = 2 * (iter_size + 8);
387387 } else if (!ret1) {
388− skel->rodata->print_len = (page_size - 8) / 8;
389− expected_read_len = 2 * (page_size - 8);
388+ skel->rodata->print_len = (iter_size - 8) / 8;
389+ expected_read_len = 2 * (iter_size - 8);
390390 } else {
391391 skel->rodata->print_len = 1;
392392 expected_read_len = 2 * 8;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t