Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
scx: Test CI
Browse files Browse the repository at this point in the history
Let's add a CI action which verifies that we can build the kernel, and
run the tests in tools/testing/selftests/scx, on pushes and PRs.

Signed-off-by: David Vernet <[email protected]>
  • Loading branch information
Byte-Lab committed Jan 3, 2024
1 parent b3c9936 commit 7e46484
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 61 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/build-run.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: build-run
run-name: ${{ github.actor }} PR run
on: [pull_request, push]
jobs:
build-run-schedulers:
runs-on: ubuntu-22.04
steps:
### OTHER REPOS ####

# Hard turn-off interactive mode
- run: echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections

# Refresh packages list
- run: sudo apt update

### DOWNLOAD AND INSTALL DEPENDENCIES ###

# Download dependencies packaged by Ubuntu
- run: sudo apt -y install coreutils cmake cargo elfutils libelf-dev libunwind-dev libzstd-dev linux-headers-generic linux-tools-common linux-tools-generic ninja-build python3-pip python3-requests qemu-kvm udev iproute2 busybox-static libvirt-clients kbd kmod file pahole rsync zstd

# clang 17
# Use a custom llvm.sh script which includes the -y flag for
# add-apt-repository. Otherwise, the CI job will hang. If and when
# https://github.com/opencollab/llvm-jenkins.debian.net/pull/26 is
# merged, we can go back to using https://apt.llvm.org/llvm.sh.
- run: wget https://raw.githubusercontent.com/Decave/llvm-jenkins.debian.net/fix_llvmsh/llvm.sh
- run: chmod +x llvm.sh
- run: sudo ./llvm.sh all
- run: sudo ln -sf /usr/bin/clang-17 /usr/bin/clang
- run: sudo ln -sf /usr/bin/llvm-strip-17 /usr/bin/llvm-strip

# bpftool
- run: git clone --recurse-submodules --branch v7.3.0 https://github.com/libbpf/bpftool.git
- run: make -j -C bpftool/src
- run: sudo make -j -C bpftool/src install

- uses: actions/checkout@v4

### END DEPENDENCIES ###

# The actual build:
- run: make CC=clang LD=ld.lld olddefconfig
- run: cat tools/testing/selftests/scx/config | xargs ./scripts/config -e
- run: make CC=clang LD=ld.lld -j$(nproc)

# Test schedulers
- run: make CC=clang Ld=ld.lld -C tools/testing/selftests/scx -j$(nproc)
- run: ./tools/testing/selftests/scx/test_sched.sh ./vmlinux
61 changes: 0 additions & 61 deletions tools/testing/selftests/scx/run.sh

This file was deleted.

49 changes: 49 additions & 0 deletions tools/testing/selftests/scx/test_sched.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash
#
# Run a scheduler for TIMEOUT seconds inside virtme-ng and catch potential
# errors, then unload the scheduler and return the exit status.

# Maximum time for each scheduler run.
TEST_TIMEOUT=30

# Maximum timeout for the guest used for each scheduler run (this is used to
# hard-shutdown the guest in case of system hangs).
GUEST_TIMEOUT=60

# List of schedulers to test
#
# TODO:
# - scx_layered: temporarily excluded because it
# cannot run with a default configuration
#
#SCHEDULERS="scx_simple scx_central scx_flatcg scx_nest scx_pair scx_qmap scx_userland scx_rusty scx_rustland"
SCHEDULERS=""

if [ ! -x `which vng` ]; then
echo "vng not found, please install virtme-ng to enable testing"
exit 1
fi
if [ $# -lt 1 ]; then
echo "Usage: $0 VMLINUZ"
exit 1
fi
kernel=$1

rm -f /tmp/output
timeout --preserve-status ${GUEST_TIMEOUT} \
vng --force-9p --disable-microvm -v -r ${kernel} -- \
"timeout --foreground --preserve-status ${TEST_TIMEOUT} ${sched_path}" \
2>&1 </dev/null | tee /tmp/output
sed -n -e '/\bBUG:/q1' \
-e '/\bWARNING:/q1' \
-e '/\berror\b/Iq1' \
-e '/\bstall/Iq1' \
-e '/\btimeout\b/Iq1' /tmp/output
res=$?
if [ ${res} -ne 0 ]; then
echo "FAIL: ${sched}"
exit 1
else
echo "OK: ${sched}"
exit 0
fi

0 comments on commit 7e46484

Please sign in to comment.