Skip to content

Commit

Permalink
meson: Add veristat script
Browse files Browse the repository at this point in the history
Add a meson script to run veristat. This can later be used to generate
reports for BPF program complexity at PR time.

Signed-off-by: Daniel Hodges <[email protected]>
  • Loading branch information
hodgesds committed Aug 9, 2024
1 parent 87b29a7 commit dae91b2
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
42 changes: 42 additions & 0 deletions meson-scripts/veristat
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
GUEST_TIMEOUT=25
BUILD_DIR=$1
SCHED=$2
KERNEL=$3

if [ "${KERNEL}" == "vmlinuz" ]; then
unset KERNEL
fi

cd $build_dir

if [ -n "${KERNEL}" ] && [ ! -x `which vng` ]; then
echo "vng not found, please install virtme-ng to enable testing"
exit 1
fi

if [ -n "${SCHED}" ]; then
BPF_PATH=$(find ${BUILD_DIR} -type f -name bpf.bpf.o | grep ${SCHED})
echo "Running veristat on ${BPF_PATH}"
if [ -n "${KERNEL}" ]; then
timeout --preserve-status ${GUEST_TIMEOUT} \
vng --force-9p -v -r ${KERNEL} -- \
veristat ${BPF_PATH}
exit $?
else
sudo veristat ${BPF_PATH}
exit $?
fi
fi

for BPF_PATH in $(find ${BUILD_DIR} -type f -name bpf.bpf.o); do
if [ -n "${KERNEL}" ]; then
timeout --preserve-status ${GUEST_TIMEOUT} \
vng --force-9p -v -r ${KERNEL} -- \
veristat ${BPF_PATH}
exit $?
else
sudo veristat ${BPF_PATH}
exit $?
fi
done
8 changes: 8 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,13 @@ serialize = get_option('serialize')

bpf_clang = find_program(get_option('bpf_clang'))

run_veristat = find_program(join_paths(meson.current_source_dir(),
'meson-scripts/veristat'))

enable_stress = get_option('enable_stress')

scheduler = get_option('scheduler')

if enable_rust
cargo = find_program(get_option('cargo'))
endif
Expand Down Expand Up @@ -323,6 +328,9 @@ endif

run_target('test_sched', command: [test_sched, kernel])

run_target('veristat', command: [run_veristat, meson.current_build_dir(),
get_option('scheduler'), get_option('kernel')])

if enable_rust
subdir('rust')
endif
Expand Down
2 changes: 2 additions & 0 deletions meson.options
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ option('enable_stress', type: 'boolean', value: 'true',
description: 'Enable stress tests')
option('kernel', type: 'string', value: 'vmlinuz',
description: 'kernel image used to test schedulers')
option('scheduler', type: 'string', value: '',
description: 'scheduler to build')
option('kernel_headers', type: 'string', value: '',
description: 'kernel headers to build the schedulers')
option(
Expand Down

0 comments on commit dae91b2

Please sign in to comment.