Initial gating test for bpftool

Signed-off-by: Ziqian SUN (Zamir) <zsun@redhat.com>
This commit is contained in:
Ziqian SUN (Zamir) 2025-01-09 15:34:07 +08:00
parent 90bd09a815
commit 52aeb5db0f
4 changed files with 67 additions and 0 deletions

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-10
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

13
tests/sanity/metadata Normal file
View File

@ -0,0 +1,13 @@
[General]
name=bpftool gating test
owner=Ziqian SUN <zsun@redhat.com>
description=bpftool gating test
license=GPLv2
confidential=no
destructive=no
[restraint]
entry_point=./runtest.sh
max_time=15m
use_pty=false

38
tests/sanity/runtest.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
. /usr/share/beakerlib/beakerlib.sh
rlJournalStart
CONFIG_FILE=/boot/config-$(uname -r)
if ! grep "CONFIG_BPF_SYSCALL=y" $CONFIG_FILE; then
rstrnt-report-result $TEST SKIP 0
exit 0
fi
rlPhaseStartSetup
dnf install -y kernel-devel
rpm -q bpftool || dnf install -y -q bpftool
BEAHARCH=${ARCH}
unset ARCH
rlPhaseEnd
for cmds in prog map link perf net; do
if ! bpftool help 2>&1 | grep " OBJECT" | grep -q "${cmds}"; then
continue
fi
rlPhaseStartTest "bpftool ${cmds}"
rlRun -l "bpftool ${cmds}"
rlPhaseEnd
done
for cmds in feature btf; do
if ! bpftool help 2>&1 | grep " OBJECT" | grep -q "${cmds}"; then
continue
fi
rlPhaseStartTest "bpftool ${cmds}"
rlRun -l "bpftool ${cmds} &> bpftool-${cmds}.log"
rstrnt-report-log bpftool-${cmds}.log
rlPhaseEnd
done
rlPhaseStartCleanup
ARCH=${BEAHARCH}
rlPhaseEnd
rlJournalEnd

10
tests/tests.yml Normal file
View File

@ -0,0 +1,10 @@
- hosts: localhost
tags:
- classic
roles:
- role: standard-test-basic
tests:
- sanity
required_packages:
- kernel-devel
- bpftool