elastic / quark

https://elastic.github.io/quark/index.html
Other
14 stars 2 forks source link

Humble beginnings of quark-test(8) #87

Closed haesbaert closed 3 weeks ago

haesbaert commented 3 weeks ago

quark-test(8) is a testing binary, the idea is for all the tests to reside in one single binary that we can run selected tests or all.

Currently we test that we can install the probes, it then forks and execs and checks if it got an event with all the required attributes.

Changes were made to init.c to be able to properly run quark-test and halt after, we can run quark-test locally or in a qemu instance:

$ sudo ./quark-test
t_probe @ ebpf: ok
t_probe @ kprobe: ok
t_fork_exec_exit @ ebpf: ok
t_fork_exec_exit @ kprobe: ok
failed tests 0

or in qemu:

$ make initramfs.gz && qemu-system-x86_64 -initrd initramfs.gz \
  -kernel /d/e/ebpf/kernel-images/debian/x86_64/linux-image-x86_64-5.10.46-5 \
  -nographic --append "console=ttyS0 quark-test"
....
....
....
[    1.337177] Run /init as init process
[    2.052140] tsc: Refined TSC clocksource calibration: 2803.152 MHz
[    2.052956] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x2867e297e4e, max_idle_ns: 440795313952 ns
[    2.053860] clocksource: Switched to clocksource tsc
[    5.916017] random: fast init done
t_probe @ ebpf: ok
t_probe @ kprobe: ok
t_fork_exec_exit @ ebpf: ok
t_fork_exec_exit @ kprobe: ok
failed tests 0
quark-test exited with 0
[    7.701678] ACPI: Preparing to enter system sleep state S5
[    7.702269] reboot: Power down

More importantly, spinning wheels! Party like it's the 90s!

Screencast from 2024-10-23 15-51-58.webm