(t *testing.T)
| 507 | } |
| 508 | |
| 509 | func TestGenerateNfqueueDropProbe(t *testing.T) { |
| 510 | config := TraceConfig{ |
| 511 | EnableNfqueueDrops: true, |
| 512 | } |
| 513 | |
| 514 | gen := NewScriptGenerator(config) |
| 515 | script := gen.Generate() |
| 516 | |
| 517 | // Verify fexit probe is present |
| 518 | if !strings.Contains(script, "fexit:vmlinux:__nf_queue") { |
| 519 | t.Error("script missing fexit:vmlinux:__nf_queue probe") |
| 520 | } |
| 521 | |
| 522 | // Verify it checks return value |
| 523 | if !strings.Contains(script, "retval") { |
| 524 | t.Error("script missing retval check") |
| 525 | } |
| 526 | |
| 527 | // Verify it accesses args->skb |
| 528 | if !strings.Contains(script, "args->skb") { |
| 529 | t.Error("script missing args->skb access") |
| 530 | } |
| 531 | |
| 532 | // Verify it reads queue number |
| 533 | if !strings.Contains(script, "args->queuenum") { |
| 534 | t.Error("script missing args->queuenum access") |
| 535 | } |
| 536 | |
| 537 | // Verify NFQ_DROP event type in table output |
| 538 | if !strings.Contains(script, "NFQ_DROP") { |
| 539 | t.Error("script missing NFQ_DROP event type") |
| 540 | } |
| 541 | |
| 542 | // Verify __nf_queue probe name in output |
| 543 | if !strings.Contains(script, "__nf_queue") { |
| 544 | t.Error("script missing __nf_queue probe name in output") |
| 545 | } |
| 546 | |
| 547 | // Verify errno decoding |
| 548 | if !strings.Contains(script, "ESRCH") { |
| 549 | t.Error("script missing ESRCH errno name") |
| 550 | } |
| 551 | if !strings.Contains(script, "ENOMEM") { |
| 552 | t.Error("script missing ENOMEM errno name") |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | func TestGenerateNfqueueDropProbeJSON(t *testing.T) { |
| 557 | config := TraceConfig{ |
nothing calls this directly
no test coverage detected