timer_crash.c (666B)
1// SPDX-License-Identifier: GPL-2.0 2#include <test_progs.h> 3#include "timer_crash.skel.h" 4 5enum { 6 MODE_ARRAY, 7 MODE_HASH, 8}; 9 10static void test_timer_crash_mode(int mode) 11{ 12 struct timer_crash *skel; 13 14 skel = timer_crash__open_and_load(); 15 if (!ASSERT_OK_PTR(skel, "timer_crash__open_and_load")) 16 return; 17 skel->bss->pid = getpid(); 18 skel->bss->crash_map = mode; 19 if (!ASSERT_OK(timer_crash__attach(skel), "timer_crash__attach")) 20 goto end; 21 usleep(1); 22end: 23 timer_crash__destroy(skel); 24} 25 26void test_timer_crash(void) 27{ 28 if (test__start_subtest("array")) 29 test_timer_crash_mode(MODE_ARRAY); 30 if (test__start_subtest("hash")) 31 test_timer_crash_mode(MODE_HASH); 32}