Skip to content
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

[WIP] Migrate to illumos-rs#luqmana/rusty-modules #558

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ kbench = "bench --package opte-bench --bench xde --"

[env]
CARGO_WORKSPACE_DIR = { value = "", relative = true }

[net]
git-fetch-with-cli = true
3 changes: 3 additions & 0 deletions .github/buildomat/jobs/bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#: output_rules = [
#: "=/work/bench-results.tgz",
#: ]
#: access_repos = [
#: "oxidecomputer/illumos-rs",
#: ]
#:
#: [[publish]]
#: series = "benchmark"
Expand Down
21 changes: 21 additions & 0 deletions .github/buildomat/jobs/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
#:
#: name = "lint"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = "nightly-2024-06-27"
#: access_repos = [
#: "oxidecomputer/illumos-rs",
#: ]
#:

set -o errexit
set -o pipefail
set -o xtrace

function header {
echo "# ==== $* ==== #"
}

header "check style"
ptime -m cargo xtask fmt --check
8 changes: 4 additions & 4 deletions .github/buildomat/jobs/opte-api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
#: name = "opte-api"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = "nightly-2024-05-12"
#: rust_toolchain = "nightly-2024-06-27"
#: output_rules = []
#: access_repos = [
#: "oxidecomputer/illumos-rs",
#: ]
#:

set -o errexit
Expand All @@ -23,9 +26,6 @@ cd crates/opte-api
header "check API_VERSION"
./check-api-version.sh

header "check style"
ptime -m cargo +nightly-2024-05-12 fmt -- --check

header "analyze std"
ptime -m cargo clippy --all-targets

Expand Down
8 changes: 4 additions & 4 deletions .github/buildomat/jobs/opte-ioctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
#: name = "opte-ioctl"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = "nightly-2024-05-12"
#: rust_toolchain = "nightly-2024-06-27"
#: output_rules = []
#: access_repos = [
#: "oxidecomputer/illumos-rs",
#: ]
#:

set -o errexit
Expand All @@ -20,8 +23,5 @@ rustc --version

cd lib/opte-ioctl

header "check style"
ptime -m cargo +nightly-2024-05-12 fmt -- --check

header "analyze"
ptime -m cargo clippy --all-targets
14 changes: 8 additions & 6 deletions .github/buildomat/jobs/opte.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
#: name = "opte"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = "nightly-2024-05-12"
#: rust_toolchain = "nightly-2024-06-27"
#: output_rules = []
#: access_repos = [
#: "oxidecomputer/illumos-rs",
#: ]
#:

set -o errexit
Expand All @@ -15,28 +18,27 @@ function header {
echo "# ==== $* ==== #"
}

pfexec pkg install clang-15

cargo --version
rustc --version

cd lib/opte

header "check style"
ptime -m cargo +nightly-2024-05-12 fmt -- --check

header "check docs"
#
# I believe this means any doc warnings in deps will cause this to
# fail. Using a more targeted approach in the future might be nice.
#
# Use nightly which is needed for the `kernel` feature.
RUSTDOCFLAGS="-D warnings" ptime -m \
cargo +nightly-2024-05-12 doc --no-default-features --features=api,std,engine,kernel
cargo +nightly-2024-06-27 doc --no-default-features --features=api,std,engine,kernel

header "analyze std + api"
ptime -m cargo clippy --all-targets

header "analyze no_std + engine + kernel"
ptime -m cargo +nightly-2024-05-12 clippy --no-default-features --features engine,kernel
ptime -m cargo +nightly-2024-06-27 clippy --no-default-features --features engine,kernel

header "test"
ptime -m cargo test
8 changes: 4 additions & 4 deletions .github/buildomat/jobs/opteadm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
#: name = "opteadm"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = "nightly-2024-05-12"
#: rust_toolchain = "nightly-2024-06-27"
#: output_rules = [
#: "=/work/debug/opteadm",
#: "=/work/debug/opteadm.debug.sha256",
#: "=/work/release/opteadm",
#: "=/work/release/opteadm.release.sha256",
#: ]
#: access_repos = [
#: "oxidecomputer/illumos-rs",
#: ]
#:

set -o errexit
Expand All @@ -25,9 +28,6 @@ rustc --version

pushd bin/opteadm

header "check style"
ptime -m cargo +nightly-2024-05-12 fmt -- --check

header "analyze"
ptime -m cargo clippy --all-targets

Expand Down
14 changes: 8 additions & 6 deletions .github/buildomat/jobs/oxide-vpc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
#: name = "oxide-vpc"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = "nightly-2024-05-12"
#: rust_toolchain = "nightly-2024-06-27"
#: output_rules = []
#: access_repos = [
#: "oxidecomputer/illumos-rs",
#: ]
#:

set -o errexit
Expand All @@ -15,28 +18,27 @@ function header {
echo "# ==== $* ==== #"
}

pfexec pkg install clang-15

cargo --version
rustc --version

cd lib/oxide-vpc

header "check style"
ptime -m cargo +nightly-2024-05-12 fmt -- --check

header "check docs"
#
# I believe this means any doc warnings in deps will cause this to
# fail. Using a more targeted approach in the future might be nice.
#
# Use nightly which is needed for the `kernel` feature.
RUSTDOCFLAGS="-D warnings" ptime -m \
cargo +nightly-2024-05-12 doc --no-default-features --features=api,std,engine,kernel
cargo +nightly-2024-06-27 doc --no-default-features --features=api,std,engine,kernel

header "analyze std + api + usdt"
ptime -m cargo clippy --features usdt --all-targets

header "analyze no_std + engine + kernel"
ptime -m cargo +nightly-2024-05-12 clippy --no-default-features --features engine,kernel
ptime -m cargo +nightly-2024-06-27 clippy --no-default-features --features engine,kernel

header "test"
ptime -m cargo test
48 changes: 32 additions & 16 deletions .github/buildomat/jobs/p5p.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
#: name = "opte-p5p"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = "nightly-2024-05-12"
#: rust_toolchain = "nightly-2024-06-27"
#: output_rules = [
#: "=/out/opte.p5p",
#: "=/out/opte.p5p.sha256",
#: ]
#: access_repos = [
#: "oxidecomputer/illumos-rs",
#: ]
#:
#: [[publish]]
#: series = "repo"
Expand All @@ -19,6 +22,11 @@
#: name = "opte.p5p.sha256"
#: from_output = "/out/opte.p5p.sha256"
#:
#: [dependencies.xde]
#: job = "opte-xde"
#;
#: [dependencies.opteadm]
#: job = "opteadm"

set -o errexit
set -o pipefail
Expand All @@ -32,29 +40,37 @@ set -o xtrace
#
TGT_BASE=${TGT_BASE:=/work}

REL_SRC=target/x86_64-unknown-unknown/release
REL_TGT=$TGT_BASE/release

mkdir -p $REL_TGT

function header {
echo "# ==== $* ==== #"
}

cargo --version
rustc --version

header "build xde and opteadm (release+debug)"
ptime -m cargo xtask build
header "move artifacts for packaging"
# Copy in just-built artifacts
DBG_SRC=target/x86_64-illumos/debug
DBG_LINK_SRC=target/i686-unknown-illumos/debug
DBG_ADM_SRC=target/debug

#
# Inspect the kernel module for bad relocations in case the old
# codegen issue ever shows its face again.
#
if elfdump $REL_SRC/xde | grep GOTPCREL; then
echo "found GOTPCREL relocation in release build"
exit 1
fi
REL_SRC=target/x86_64-illumos/release
REL_LINK_SRC=target/i686-unknown-illumos/release
REL_ADM_SRC=target/release

mkdir -p $REL_SRC
cp /input/xde/work/release/xde $REL_SRC
mkdir -p $DBG_SRC
cp /input/xde/work/debug/xde.dbg $DBG_SRC/xde

mkdir -p $REL_LINK_SRC
cp /input/xde/work/release/xde_link.so $REL_LINK_SRC/libxde_link.so
mkdir -p $DBG_LINK_SRC
cp /input/xde/work/debug/xde_link.dbg.so $DBG_LINK_SRC/libxde_link.so

mkdir -p $REL_ADM_SRC
cp /input/opteadm/work/release/opteadm $REL_ADM_SRC
mkdir -p $DBG_ADM_SRC
cp /input/opteadm/work/debug/opteadm $DBG_ADM_SRC

header "package opte"
cargo xtask package --skip-build
Expand Down
3 changes: 3 additions & 0 deletions .github/buildomat/jobs/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#: output_rules = [
#: "/work/*.log",
#: ]
#: access_repos = [
#: "oxidecomputer/illumos-rs",
#: ]
#:
#: [dependencies.xde]
#: job = "opte-xde"
Expand Down
28 changes: 13 additions & 15 deletions .github/buildomat/jobs/xde.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#: name = "opte-xde"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = "nightly-2024-05-12"
#: rust_toolchain = "nightly-2024-06-27"
#: output_rules = [
#: "=/work/debug/xde.dbg",
#: "=/work/debug/xde.dbg.sha256",
Expand All @@ -16,6 +16,9 @@
#: "=/work/test/loopback",
#: "=/work/xde.conf",
#: ]
#: access_repos = [
#: "oxidecomputer/illumos-rs",
#: ]
#:
#: [[publish]]
#: series = "module"
Expand All @@ -39,11 +42,11 @@ set -o xtrace
#
TGT_BASE=${TGT_BASE:=/work}

DBG_SRC=target/x86_64-unknown-unknown/debug
DBG_SRC=target/x86_64-illumos/debug
DBG_LINK_SRC=target/i686-unknown-illumos/debug
DBG_TGT=$TGT_BASE/debug

REL_SRC=target/x86_64-unknown-unknown/release
REL_SRC=target/x86_64-illumos/release
REL_LINK_SRC=target/i686-unknown-illumos/release
REL_TGT=$TGT_BASE/release

Expand All @@ -69,14 +72,12 @@ cargo --version
rustc --version

install_pkg jq
install_pkg clang-15

pushd xde

cp xde.conf /work/xde.conf

header "check style"
ptime -m cargo +nightly-2024-05-12 fmt -p xde -p xde-link -- --check

header "analyze"
ptime -m cargo clippy -- \
--allow clippy::uninlined-format-args --allow clippy::bad_bit_mask
Expand All @@ -86,19 +87,16 @@ ptime -m cargo clippy -- \
--allow clippy::uninlined-format-args --allow clippy::bad_bit_mask
popd

header "build xde (debug)"
ptime -m ./build-debug.sh

header "build xde (release)"
ptime -m ./build.sh

popd

header "build xde (release/debug)"
ptime cargo xtask build

#
# Inspect the kernel module for bad relocations in case the old
# codegen issue ever shows its face again.
#
if elfdump $DBG_SRC/xde.dbg | grep GOTPCREL; then
if elfdump $DBG_SRC/xde | grep GOTPCREL; then
echo "found GOTPCREL relocation in debug build"
exit 1
fi
Expand All @@ -108,7 +106,7 @@ if elfdump $REL_SRC/xde | grep GOTPCREL; then
exit 1
fi

cp $DBG_SRC/xde.dbg $DBG_TGT/
cp $DBG_SRC/xde $DBG_TGT/xde.dbg
sha256sum $DBG_TGT/xde.dbg > $DBG_TGT/xde.dbg.sha256

cp $DBG_LINK_SRC/libxde_link.so $DBG_TGT/xde_link.dbg.so
Expand All @@ -123,7 +121,7 @@ sha256sum $REL_TGT/xde_link.so > $REL_TGT/xde_link.so.sha256

header "build xde integration tests"
pushd xde-tests
cargo +nightly-2024-05-12 fmt -- --check
cargo +nightly-2024-06-27 fmt -- --check
cargo clippy --all-targets
cargo build --test loopback
loopback_test=$(
Expand Down
Loading