@@ -220,11 +220,11 @@ fn sched_switch_handler(ctx: *trace_event_raw_sched_switch) -> i32 {
220220let test_multiple_tracepoint_targets _ =
221221 (* Test various tracepoint targets to ensure they all work correctly *)
222222 let test_cases = [
223- (" sched/sched_switch" , " SEC(\" raw_tracepoint /sched_switch\" )" );
224- (" net/netif_rx" , " SEC(\" raw_tracepoint /netif_rx\" )" );
225- (" syscalls/sys_enter_read" , " SEC(\" raw_tracepoint /sys_enter_read\" )" );
226- (" syscalls/sys_exit_write" , " SEC(\" raw_tracepoint /sys_exit_write\" )" );
227- (" irq/irq_handler_entry" , " SEC(\" raw_tracepoint /irq_handler_entry\" )" );
223+ (" sched/sched_switch" , " SEC(\" tracepoint/sched /sched_switch\" )" );
224+ (" net/netif_rx" , " SEC(\" tracepoint/net /netif_rx\" )" );
225+ (" syscalls/sys_enter_read" , " SEC(\" tracepoint/syscalls /sys_enter_read\" )" );
226+ (" syscalls/sys_exit_write" , " SEC(\" tracepoint/syscalls /sys_exit_write\" )" );
227+ (" irq/irq_handler_entry" , " SEC(\" tracepoint/irq /irq_handler_entry\" )" );
228228 ] in
229229
230230 List. iter (fun (target , expected_sec ) ->
@@ -255,34 +255,34 @@ fn sched_switch_handler(ctx: *trace_event_raw_sched_switch) -> i32 {
255255 let c_code = generate_c_multi_program ir_multi_prog in
256256
257257 (* Ensure correct SEC() is generated *)
258- check bool " Should generate correct SEC(raw_tracepoint /sched_switch)" true
259- (Str. search_forward (Str. regexp_string " SEC(\" raw_tracepoint /sched_switch\" )" ) c_code 0 > = 0 );
258+ check bool " Should generate correct SEC(tracepoint/sched /sched_switch)" true
259+ (Str. search_forward (Str. regexp_string " SEC(\" tracepoint/sched /sched_switch\" )" ) c_code 0 > = 0 );
260260
261261 (* Ensure buggy SEC() is NOT generated *)
262- check bool " Should NOT generate buggy SEC( raw_tracepoint/sched_sched) " true
262+ check bool " Should NOT generate any raw_tracepoint SEC format " true
263263 (try
264- let _ = Str. search_forward (Str. regexp_string " SEC(\" raw_tracepoint/sched_sched \" ) " ) c_code 0 in
265- false (* Found the buggy pattern - test should fail *)
264+ let _ = Str. search_forward (Str. regexp_string " SEC(\" raw_tracepoint/" ) c_code 0 in
265+ false (* Found raw_tracepoint - test should fail *)
266266 with Not_found ->
267- true (* Didn't find the buggy pattern - test should pass *)
267+ true (* No raw_tracepoint found - test should pass *)
268268 )
269269
270270(* 4. Code Generation Tests *)
271- let test_raw_tracepoint_section_name_generation _ =
272- (* Test correct raw tracepoint section name generation *)
271+ let test_tracepoint_section_name_generation _ =
272+ (* Test correct tracepoint section name generation *)
273273 let source = " @tracepoint(\" sched/sched_switch\" )
274274fn sched_switch_handler(ctx: *trace_event_raw_sched_switch) -> i32 {
275275 return 0
276276}" in
277277 let ast = parse_string source in
278278 let typed_ast = type_check_ast ast in
279279 let symbol_table = Kernelscript.Symbol_table. build_symbol_table typed_ast in
280- let ir_multi_prog = generate_ir typed_ast symbol_table " test_raw_tracepoint " in
280+ let ir_multi_prog = generate_ir typed_ast symbol_table " test_tracepoint " in
281281 let c_code = generate_c_multi_program ir_multi_prog in
282282
283- (* Check that the correct SEC() is generated with just the event name *)
284- check bool " Should contain correct raw_tracepoint /sched_switch section" true
285- (Str. search_forward (Str. regexp_string " SEC(\" raw_tracepoint /sched_switch\" )" ) c_code 0 > = 0 )
283+ (* Check that the correct SEC() is generated with the full path *)
284+ check bool " Should contain correct tracepoint/sched /sched_switch section" true
285+ (Str. search_forward (Str. regexp_string " SEC(\" tracepoint/sched /sched_switch\" )" ) c_code 0 > = 0 )
286286
287287let test_tracepoint_ebpf_codegen _ =
288288 let source = " @tracepoint(\" sched/sched_switch\" )
@@ -296,8 +296,8 @@ fn sched_switch_handler(ctx: *trace_event_raw_sched_switch) -> i32 {
296296 let c_code = generate_c_multi_program ir_multi_prog in
297297
298298 (* Check for tracepoint-specific C code elements *)
299- check bool " Should contain correct raw_tracepoint SEC" true
300- (Str. search_forward (Str. regexp_string " SEC(\" raw_tracepoint /sched_switch\" )" ) c_code 0 > = 0 );
299+ check bool " Should contain correct tracepoint SEC" true
300+ (Str. search_forward (Str. regexp_string " SEC(\" tracepoint/sched /sched_switch\" )" ) c_code 0 > = 0 );
301301 check bool " Should contain function definition" true
302302 (String. contains c_code (String. get " sched_switch_handler" 0 ));
303303 check bool " Should contain struct parameter" true
@@ -408,8 +408,8 @@ fn sys_enter_open_handler(ctx: *trace_event_raw_sys_enter) -> i32 {
408408 let c_code = generate_c_multi_program ir_multi_prog in
409409
410410 (* Comprehensive end-to-end validation *)
411- check bool " Contains correct raw_tracepoint section" true
412- (Str. search_forward (Str. regexp_string " SEC(\" raw_tracepoint /sys_enter_open\" )" ) c_code 0 > = 0 );
411+ check bool " Contains correct tracepoint section" true
412+ (Str. search_forward (Str. regexp_string " SEC(\" tracepoint/syscalls /sys_enter_open\" )" ) c_code 0 > = 0 );
413413 check bool " Contains function name" true
414414 (String. contains c_code (String. get " sys_enter_open_handler" 0 ));
415415 check bool " Contains context struct" true
@@ -453,7 +453,7 @@ let ir_generation_tests = [
453453]
454454
455455let code_generation_tests = [
456- " raw tracepoint section name generation" , `Quick , test_raw_tracepoint_section_name_generation ;
456+ " tracepoint section name generation" , `Quick , test_tracepoint_section_name_generation ;
457457 " tracepoint eBPF code generation" , `Quick , test_tracepoint_ebpf_codegen;
458458 " tracepoint includes generation" , `Quick , test_tracepoint_includes_generation;
459459]
0 commit comments