Skip to content

Commit

Permalink
add test runner profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Qix- committed Nov 22, 2023
1 parent f9f7b55 commit 4465815
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 10 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build-x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ jobs:
path: target/
key: x64-kernel-build-target
- name: Build <D>
run: make DEBUG=1 all
run: make all DEBUG=1
- name: Build <R>
run: make all x64-limine.pxe
run: make all
- name: Build <D-T>
run: make all TEST=1 DEBUG=1
- name: Build <R-T>
run: make all x64-limine.pxe TEST=1
- name: Lint
run: make lint
- name: Clippy
Expand All @@ -57,7 +61,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: kernel-pxe
path: target/x64/release/pxe
path: target/x64/test-release/pxe
test-link:
name: Test - Link
runs-on: [self-hosted, oro, oro-link, x64]
Expand Down
51 changes: 47 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,51 @@ default-members = [
"oro-kernel"
]

[profile.dev]
opt-level = 1 # Basic optimizations
debug = "full" # Generate full debug information
debug-assertions = true # Turn on debug assertions
overflow-checks = true # Turn on overflow checks
incremental = true # Enable incremental building
strip = false # Don't strip symbols from the binary
lto = false # perform "thin local" LTO
panic = "abort" # Use "abort" panic strategy

[profile.test-dev]
inherits = "dev"

[profile.test-release]
inherits = "release"
opt-level = "s" # Optimize for binary size
debug = 1 # Generate minimal debug information
strip = false # Don't strip symbols from binary
debug-assertions = true # Turn on debug assertions
#overflow-checks = true # Turn on overflow checks # FIXME(qix-): this causes a linker error on x64

[profile.release]
opt-level = 3 # Maximum optimizations
lto = "fat" # Perform LTO across all crates
codegen-units = 1 # Reduce number of codegen units to increase optimizations.
strip = true # Strip symbols from binary
opt-level = 3 # Maximum optimizations
lto = "fat" # Perform LTO across all crates
codegen-units = 1 # Reduce number of codegen units to increase optimizations.
strip = true # Strip symbols from binary
incremental = false # Disable incremental building
panic = "abort" # Use "abort" panic strategy
debug = 0 # Do not generate debug information

# Speed up build programs
[profile.test.build-override]
opt-level = 0
codegen-units = 256
debug = false

[profile.test-release.build-override]
opt-level = 0
codegen-units = 256

[profile.dev.build-override]
opt-level = 0
codegen-units = 256
debug = false

[profile.release.build-override]
opt-level = 0
codegen-units = 256
18 changes: 15 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,21 @@
ORO_VERSION = $(shell cargo metadata --format-version=1 | jq -r '.packages | map(select(.name == "oro-kernel")) | .[].version')

ifeq ($(DEBUG),1)
override RELEASE = debug
ifeq ($(TEST),1)
override RELEASE = test-dev
CARGO_FLAGS += --profile=test-dev --features oro_test
else
override RELEASE = debug
CARGO_FLAGS += --profile=dev
endif
else
override RELEASE = release
CARGO_FLAGS += --release
ifeq ($(TEST),1)
override RELEASE = test-release
CARGO_FLAGS += --profile=test-release --features oro_test
else
override RELEASE = release
CARGO_FLAGS += --release
endif
endif

all: x64 x64-limine.iso x64-limine.pxe
Expand All @@ -24,6 +35,7 @@ clippy:
env cargo clippy $(CARGO_FLAGS) --target=./triple/x64.json -Zunstable-options -Zbuild-std=core,compiler_builtins,alloc -Zbuild-std-features=compiler-builtins-mem --all -- -D clippy::all

# oro x64
x64: target/x64/$(RELEASE)/oro-kernel
.PHONY: target/x64/$(RELEASE)/oro-kernel
target/x64/$(RELEASE)/oro-kernel:
env RUSTFLAGS="-Z macro-backtrace" cargo build -p oro-kernel --target=./triple/x64.json -Zunstable-options -Zbuild-std=core,compiler_builtins,alloc -Zbuild-std-features=compiler-builtins-mem $(CARGO_FLAGS)
Expand Down
3 changes: 3 additions & 0 deletions oro-boot-limine-x64/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ edition = { workspace = true }

build = "build.rs"

[features]
oro_test = []

[[bin]]
name = "oro-boot-limine-x64"
path = "./src/main.rs"
Expand Down
3 changes: 3 additions & 0 deletions oro-kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ edition = { workspace = true }

build = "build.rs"

[features]
oro_test = []

[[bin]]
name = "oro-kernel"
path = "./src/main.rs"
Expand Down
2 changes: 2 additions & 0 deletions oro-ser2mem-proc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ edition = { workspace = true }

[lib]
proc-macro = true
test = false
bench = false

[dependencies]
proc-macro2 = "1.0.56"
Expand Down
4 changes: 4 additions & 0 deletions oro-ser2mem/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ repository = { workspace = true }
publish = { workspace = true }
edition = { workspace = true }

[lib]
test = false
bench = false

[dependencies]
oro-ser2mem-proc = { path = "../oro-ser2mem-proc" }

0 comments on commit 4465815

Please sign in to comment.