Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 #include <test_progs.h>
0003 #include "timer_crash.skel.h"
0004 
0005 enum {
0006     MODE_ARRAY,
0007     MODE_HASH,
0008 };
0009 
0010 static void test_timer_crash_mode(int mode)
0011 {
0012     struct timer_crash *skel;
0013 
0014     skel = timer_crash__open_and_load();
0015     if (!ASSERT_OK_PTR(skel, "timer_crash__open_and_load"))
0016         return;
0017     skel->bss->pid = getpid();
0018     skel->bss->crash_map = mode;
0019     if (!ASSERT_OK(timer_crash__attach(skel), "timer_crash__attach"))
0020         goto end;
0021     usleep(1);
0022 end:
0023     timer_crash__destroy(skel);
0024 }
0025 
0026 void test_timer_crash(void)
0027 {
0028     if (test__start_subtest("array"))
0029         test_timer_crash_mode(MODE_ARRAY);
0030     if (test__start_subtest("hash"))
0031         test_timer_crash_mode(MODE_HASH);
0032 }