File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
tools/testing/selftests/bpf/prog_tests Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 21
21
#include "../progs/test_user_ringbuf.h"
22
22
23
23
static const long c_sample_size = sizeof (struct sample ) + BPF_RINGBUF_HDR_SZ ;
24
- static const long c_ringbuf_size = 1 << 12 ; /* 1 small page */
25
- static const long c_max_entries = c_ringbuf_size / c_sample_size ;
24
+ static long c_ringbuf_size , c_max_entries ;
26
25
27
26
static void drain_current_samples (void )
28
27
{
@@ -424,7 +423,9 @@ static void test_user_ringbuf_loop(void)
424
423
uint32_t remaining_samples = total_samples ;
425
424
int err ;
426
425
427
- BUILD_BUG_ON (total_samples <= c_max_entries );
426
+ if (!ASSERT_LT (c_max_entries , total_samples , "compare_c_max_entries" ))
427
+ return ;
428
+
428
429
err = load_skel_create_user_ringbuf (& skel , & ringbuf );
429
430
if (err )
430
431
return ;
@@ -686,6 +687,9 @@ void test_user_ringbuf(void)
686
687
{
687
688
int i ;
688
689
690
+ c_ringbuf_size = getpagesize (); /* 1 page */
691
+ c_max_entries = c_ringbuf_size / c_sample_size ;
692
+
689
693
for (i = 0 ; i < ARRAY_SIZE (success_tests ); i ++ ) {
690
694
if (!test__start_subtest (success_tests [i ].test_name ))
691
695
continue ;
You can’t perform that action at this time.
0 commit comments