-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #623 from likewhatevs/main
fix/enable rust tests, make build faster
- Loading branch information
Showing
10 changed files
with
243 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: install-deps | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
### OTHER REPOS #### | ||
|
||
# Hard turn-off interactive mode | ||
- run: echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections | ||
shell: bash | ||
|
||
# Refresh packages list | ||
- run: sudo apt update | ||
shell: bash | ||
|
||
### DOWNLOAD AND INSTALL DEPENDENCIES ### | ||
|
||
# Download dependencies packaged by Ubuntu | ||
- run: sudo apt -y install bison busybox-static cargo cmake coreutils cpio elfutils file flex gcc gcc-multilib git iproute2 jq kbd kmod libcap-dev libelf-dev libunwind-dev libvirt-clients libzstd-dev linux-headers-generic linux-tools-common linux-tools-generic make ninja-build pahole pkg-config python3-dev python3-pip python3-requests qemu-kvm rsync rustc stress-ng udev zstd | ||
shell: bash | ||
|
||
# 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 | ||
shell: bash | ||
- run: chmod +x llvm.sh | ||
shell: bash | ||
- run: sudo ./llvm.sh all | ||
shell: bash | ||
- run: sudo ln -sf /usr/bin/clang-17 /usr/bin/clang | ||
shell: bash | ||
- run: sudo ln -sf /usr/bin/llvm-strip-17 /usr/bin/llvm-strip | ||
shell: bash | ||
# meson | ||
- run: pip install meson | ||
shell: bash | ||
|
||
# Install virtme-ng | ||
- run: pip install virtme-ng | ||
shell: bash | ||
|
||
# Setup KVM support | ||
- run: | | ||
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | ||
sudo udevadm control --reload-rules | ||
sudo udevadm trigger --name-match=kvm | ||
shell: bash | ||
### END DEPENDENCIES ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
name: caching-build | ||
on: | ||
# only runs on main, hourly cache update used by all branches | ||
schedule: | ||
- cron: "0 * * * *" | ||
push: | ||
|
||
jobs: | ||
build-kernel: | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
# redundancy to exit fast | ||
- run: echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections | ||
- run: sudo apt update | ||
- run: sudo apt install -y git --no-install-recommends | ||
# get latest head commit of sched_ext for-next | ||
- run: echo "SCHED_EXT_KERNEL_COMMIT=$(git ls-remote https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git heads/for-next | awk '{print $1}')" >> $GITHUB_ENV | ||
|
||
- uses: actions/checkout@v4 | ||
|
||
# use cached kernel if available, create after job if not | ||
- name: Cache Kernel | ||
id: cache-kernel | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
linux | ||
key: ${{ env.SCHED_EXT_KERNEL_COMMIT }} | ||
|
||
- if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }} | ||
uses: ./.github/actions/install-deps-action | ||
|
||
# cache bzImage alone for rust tests (disk space limit workaround) | ||
- name: Cache bzImage | ||
id: cache-bzImage | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
linux/arch/x86/boot/bzImage | ||
key: ${{ env.SCHED_EXT_KERNEL_COMMIT }} | ||
|
||
- if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }} | ||
name: Clone Kernel | ||
# Get the latest sched-ext enabled kernel directly from the korg | ||
# for-next branch | ||
run: git clone --single-branch -b for-next --depth 1 https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git linux | ||
|
||
# guard rail because we are caching | ||
- if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }} | ||
run: cd linux && git checkout ${{ env.SCHED_EXT_KERNEL_COMMIT }} | ||
|
||
- if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }} | ||
# Print the latest commit of the checked out sched-ext kernel | ||
run: cd linux && git log -1 --pretty=format:"%h %ad %s" --date=short | ||
|
||
- if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }} | ||
# Build a minimal kernel (with sched-ext enabled) using virtme-ng | ||
run: cd linux && vng -v --build --config ../.github/workflows/sched-ext.config | ||
|
||
- if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }} | ||
# Generate kernel headers | ||
run: cd linux && make headers | ||
|
||
integration-test: | ||
runs-on: ubuntu-22.04 | ||
needs: build-kernel | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/install-deps-action | ||
# cache rust deps, invalidate when kernel commit changes | ||
# get latest head commit of sched_ext for-next | ||
- run: echo "SCHED_EXT_KERNEL_COMMIT=$(git ls-remote https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git heads/for-next | awk '{print $1}')" >> $GITHUB_ENV | ||
|
||
# use cached kernel if available, create after job if not | ||
- name: Cache Kernel | ||
id: cache-kernel | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
linux | ||
key: ${{ env.SCHED_EXT_KERNEL_COMMIT }} | ||
|
||
# need to re-run job when kernel head changes between build and test running. | ||
- if: ${{ steps.cache-kernel.outputs.cache-hit != 'true' }} | ||
name: exit if cache stale | ||
run: exit -1 | ||
|
||
# veristat | ||
- run: wget https://github.com/libbpf/veristat/releases/download/v0.3.2/veristat-v0.3.2-amd64.tar.gz | ||
- run: tar -xvf veristat-v0.3.2-amd64.tar.gz && sudo cp veristat /usr/bin/ | ||
- run: sudo chmod +x /usr/bin/veristat && sudo chmod 755 /usr/bin/veristat | ||
|
||
# The actual build: | ||
- run: meson setup build -Dkernel=$(pwd)/linux -Dkernel_headers=./linux/usr/include -Denable_stress=true | ||
- run: meson compile -C build | ||
|
||
# Print CPU model before running the tests (this can be useful for | ||
# debugging purposes) | ||
- run: grep 'model name' /proc/cpuinfo | head -1 | ||
|
||
# Test schedulers | ||
- run: meson compile -C build test_sched | ||
# Stress schedulers | ||
- run: meson compile -C build stress_tests | ||
- run: meson compile -C build veristat | ||
|
||
rust-test: | ||
runs-on: ubuntu-22.04 | ||
needs: build-kernel | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/install-deps-action | ||
# cache rust deps, invalidate when kernel commit changes | ||
# get latest head commit of sched_ext for-next | ||
- run: echo "SCHED_EXT_KERNEL_COMMIT=$(git ls-remote https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git heads/for-next | awk '{print $1}')" >> $GITHUB_ENV | ||
# cache bzImage alone for rust tests | ||
- name: Cache bzImage | ||
id: cache-bzImage | ||
uses: actions/cache@v4 | ||
with: | ||
path: | | ||
linux/arch/x86/boot/bzImage | ||
key: ${{ env.SCHED_EXT_KERNEL_COMMIT }} | ||
|
||
# need to re-run job when kernel head changes between build and test running. | ||
- if: ${{ steps.cache-bzImage.outputs.cache-hit != 'true' }} | ||
name: exit if cache stale | ||
run: exit -1 | ||
|
||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
shared-key: ${{ env.SCHED_EXT_KERNEL_COMMIT }} | ||
workspaces: rust | ||
prefix-key: "1" | ||
- run: cargo build --manifest-path rust/Cargo.toml | ||
- run: cargo test --manifest-path rust/Cargo.toml --no-run | ||
- run: vng -v -m10G -c8 --force-9p -r linux/arch/x86/boot/bzImage --net user -- cargo test --manifest-path rust/Cargo.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,11 @@ authors = ["Andrea Righi <[email protected]>"] | |
license = "GPL-2.0-only" | ||
repository = "https://github.com/sched-ext/scx" | ||
description = "Framework to implement sched_ext schedulers running in user space" | ||
include = [ | ||
"assets/bpf/intf.h", | ||
"assets/bpf/main.bpf.c", | ||
"assets/bpf.rs", | ||
] | ||
|
||
[dependencies] | ||
anyhow = "1.0.65" | ||
|
@@ -23,8 +28,3 @@ scx_utils = { path = "../scx_utils", version = "1.0.4" } | |
name = "scx_rustland_core" | ||
path = "src/lib.rs" | ||
|
||
include = [ | ||
"assets/bpf/intf.h", | ||
"assets/bpf/main.bpf.c", | ||
"assets/bpf.rs", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.