-
Notifications
You must be signed in to change notification settings - Fork 1
Add kernel_kselftest.sh #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mainline
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,245 @@ | ||
#!/bin/sh | ||
set -e | ||
|
||
# So we can detect what version of Rocky we are running on | ||
. /etc/os-release | ||
|
||
if [ ! -f .config ] ; then | ||
echo "No .config found. Please configure before testing" | ||
exit 1 | ||
fi | ||
|
||
if [ $# -eq 1 ] ; then | ||
runs=$1 | ||
else | ||
runs=1 | ||
fi | ||
|
||
install_kselftest_deps_8() { | ||
echo | ||
echo "Installing kselftest deps for Rocky 8" | ||
echo | ||
sudo dnf -y groupinstall 'Development Tools' | ||
sudo dnf -y install epel-release | ||
sudo dnf -y install --enablerepo=devel \ | ||
VirtualGL \ | ||
alsa-lib-devel \ | ||
bc \ | ||
clang \ | ||
curl \ | ||
dropwatch \ | ||
dwarves \ | ||
glibc \ | ||
iperf3 \ | ||
jq \ | ||
kernel-devel \ | ||
libasan \ | ||
libcap-devel \ | ||
libcap-ng-devel \ | ||
libmnl-devel \ | ||
libreswan \ | ||
libubsan \ | ||
llvm \ | ||
ncurses-devel \ | ||
net-tools \ | ||
netsniff-ng \ | ||
nmap-ncat \ | ||
numactl-devel \ | ||
openssl-devel \ | ||
perf \ | ||
popt-devel \ | ||
python3-pip \ | ||
rsync \ | ||
socat \ | ||
tcpdump \ | ||
wget | ||
|
||
# Doesn't work for 8.6? | ||
sudo dnf -y install --enablerepo=devel \ | ||
fuse-devel \ | ||
gcc-toolset-13-libasan-devel \ | ||
glibc-static \ | ||
kernel-selftests-internal | ||
|
||
pip3 install --user \ | ||
netaddr \ | ||
packaging \ | ||
pyftpdlib \ | ||
pyparsing \ | ||
pytest \ | ||
scapy \ | ||
tftpy | ||
} | ||
|
||
install_kselftest_deps_9() { | ||
echo | ||
echo "Installing kselftest deps for Rocky 9" | ||
echo | ||
sudo dnf -y groupinstall 'Development Tools' | ||
sudo dnf -y install epel-release | ||
sudo dnf -y install --enablerepo=crb,devel \ | ||
VirtualGL \ | ||
alsa-lib-devel \ | ||
bc \ | ||
clang \ | ||
curl \ | ||
dropwatch \ | ||
dwarves \ | ||
fuse-devel \ | ||
gcc-toolset-13-libasan-devel \ | ||
glibc \ | ||
glibc-static \ | ||
iperf3 \ | ||
jq \ | ||
kernel-devel \ | ||
kernel-selftests-internal \ | ||
libasan \ | ||
libcap-devel \ | ||
libcap-ng-devel \ | ||
libmnl-devel \ | ||
libreswan \ | ||
libubsan \ | ||
llvm \ | ||
ncurses-devel \ | ||
net-tools \ | ||
netsniff-ng \ | ||
nmap-ncat \ | ||
numactl-devel \ | ||
openssl-devel \ | ||
packetdrill \ | ||
perf \ | ||
popt-devel \ | ||
python3-pip \ | ||
rsync \ | ||
socat \ | ||
tcpdump \ | ||
virtme-ng \ | ||
wget | ||
|
||
pip3 install --user \ | ||
netaddr \ | ||
packaging \ | ||
pyftpdlib \ | ||
pyparsing \ | ||
pytest \ | ||
scapy \ | ||
tftpy \ | ||
wheel | ||
} | ||
|
||
install_kselftest_deps_10() { | ||
echo | ||
echo "Installing kselftest deps for Rocky 10" | ||
echo | ||
sudo dnf -y groupinstall 'Development Tools' | ||
sudo dnf -y install epel-release | ||
sudo dnf -y install --enablerepo=crb,devel \ | ||
alsa-lib-devel \ | ||
bc \ | ||
clang \ | ||
curl \ | ||
dropwatch \ | ||
dwarves \ | ||
fuse-devel \ | ||
glibc \ | ||
glibc-static \ | ||
iperf3 \ | ||
kernel-devel \ | ||
kernel-selftests-internal \ | ||
libasan \ | ||
libasan-static \ | ||
libcap-devel \ | ||
libcap-ng-devel \ | ||
libmnl-devel \ | ||
libreswan \ | ||
libubsan \ | ||
llvm \ | ||
ncurses-devel \ | ||
net-tools \ | ||
nmap-ncat \ | ||
numactl-devel \ | ||
openssl-devel \ | ||
packetdrill \ | ||
perf \ | ||
popt-devel \ | ||
python3-pip \ | ||
rsync \ | ||
socat \ | ||
tcpdump \ | ||
virtme-ng \ | ||
wget | ||
|
||
pip3 install --user \ | ||
netaddr \ | ||
packaging \ | ||
pyftpdlib \ | ||
pyparsing \ | ||
pytest \ | ||
scapy \ | ||
tftpy \ | ||
wheel | ||
} | ||
|
||
run_kselftest() { | ||
SUDO_TARGETS=$1 | ||
SKIP_TARGETS=$2 | ||
make -C tools/testing/selftests clean | ||
make -C tools/testing/selftests SKIP_TARGETS="$SKIP_TARGETS" | ||
for run in $(seq 1 $runs) ; do | ||
make -C tools/testing/selftests SKIP_TARGETS="$SUDO_TARGETS $SKIP_TARGETS" run_tests | tee ~/selftest-$(uname -r)-$run.log | ||
bmastbergen marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The folder structure for each vm (kernel type) I have is:
So for me ../kselftests-logs/selftest-$(uname -r)-$run.log would work. Or something similar, happy to adjust it. We can also add a param for this, but I would keep it simple. I think it would be super easier for our tooling if we all have the same tree structure for kernels. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yea, ../kselftests-logs makes sense. or....err... ../kselftest-logs I never know whether to use kselftest or kselftests There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am also bad at naming. Pick one and stick with it :) |
||
sudo make -C tools/testing/selftests TARGETS="$SUDO_TARGETS" run_tests | tee -a ~/selftest-$(uname -r)-$run.log | ||
done | ||
} | ||
|
||
case "$ROCKY_SUPPORT_PRODUCT" in | ||
Rocky-Linux-10) | ||
install_kselftest_deps_10 | ||
;; | ||
Rocky-Linux-9) | ||
install_kselftest_deps_9 | ||
;; | ||
Rocky-Linux-8) | ||
install_kselftest_deps_8 | ||
;; | ||
esac | ||
|
||
case $(uname -r) in | ||
*3.10.0*) | ||
echo | ||
echo "Running 3.10.0 kselftests" | ||
echo | ||
SUDO_TARGETS="x86" | ||
SKIP_TARGETS="" | ||
;; | ||
*4.18.0*) | ||
echo | ||
echo "Running 4.18.0 kselftests" | ||
echo | ||
SUDO_TARGETS="capabilities cpu-hotplug cpufreq efivars efivarfs fpu ipc intel_pstate kexec lib livepatch memfd memory-hotplug mptcp mqueue net netfilter sync sysctl timens timers vm x86 zram" | ||
SKIP_TARGETS="" | ||
;; | ||
*5.14.0*) | ||
echo | ||
echo "Running 5.14.0 kselftests" | ||
echo | ||
SUDO_TARGETS="binderfs capabilities cgroup cpu-hotplug cpufreq efivars efivarfs firmware fpu gpio ipc intel_pstate ir kexec lib livepatch memfd memory-hotplug mptcp mqueue net netfilter sync sysctl timens timers vm x86 zram" | ||
SKIP_TARGETS="lkdtm proc" | ||
;; | ||
*6.12.*) | ||
echo | ||
echo "Running 6.12 kselftests" | ||
echo | ||
SUDO_TARGETS="binderfs capabilities cgroup clone3 cpu-hotplug cpufreq damon drivers/net efivars efivarfs exec firmware fpu gpio ipc intel_pstate ir kexec lib livepatch memfd memory-hotplug mptcp mqueue net netfilter sync sysctl timens timers vm x86 zram" | ||
SKIP_TARGETS="lkdtm" | ||
;; | ||
bmastbergen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
*) | ||
echo | ||
echo "Warning: Unknown kernel version ($(uname -r)). No kselftest targets defined." | ||
echo "SUDO_TARGETS and SKIP_TARGETS will be empty." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I would exit here. Because otherwise it will run the kselftests for an unknown version. I would imagine we run into this if we test a new kernel. So an early exit would catch this and then the person running this would add a case here for the new kernel version. Otherwise the kselftests would run and this warning may be missed. What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea, I almost made it exit here. I could go either way. |
||
SUDO_TARGETS="" | ||
SKIP_TARGETS="" | ||
;; | ||
esac | ||
|
||
run_kselftest "$SUDO_TARGETS" "$SKIP_TARGETS" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yesterday I triggered another run by mistake and I wish I saved the previous log.
If you also think it's valuable, I would check if a file with the same name exists and adjust the run var accordingly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or maybe timestamping logs makes more sense than numbering?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either way, I will not know easily which one is which if they have long names. Not sure here which one is the best at the moment. Maybe this is over engineering at the moment.