Skip to content

Commit b896a7b

Browse files
committed
Make native custom labels test run in CI
1 parent d388f92 commit b896a7b

File tree

7 files changed

+252
-34
lines changed

7 files changed

+252
-34
lines changed

.github/workflows/unit-test-on-pull-request.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ jobs:
154154
uses: actions/checkout@v4
155155
- name: Set up environment
156156
uses: ./.github/workflows/env
157+
- name: Install Rust
158+
uses: dtolnay/rust-toolchain@stable
159+
- name: Install rust cross compile for arm64
160+
run: rustup target add aarch64-unknown-linux-gnu
157161
- name: Prepare integration test binaries for qemu tests
158162
run: make integration-test-binaries TARGET_ARCH=${{ matrix.target_arch }}
159163
- name: Upload integration test binaries

Cargo.lock

Lines changed: 218 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
members = [
77
"rust-crates/symblib",
88
"rust-crates/symblib-capi",
9+
"rust-crates/custom-labels-example"
910
]
1011
resolver = "2"
1112

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ SHELL := /usr/bin/env bash
88
NATIVE_ARCH := $(shell uname -m)
99
ifeq ($(NATIVE_ARCH),x86_64)
1010
NATIVE_ARCH := amd64
11+
# Building a static Rust binary require explicit target https://github.com/rust-lang/rust/issues/78210
12+
INT_TEST_CARGO_BUILD_TARGET := x86_64-unknown-linux-musl
1113
else ifneq (,$(filter $(NATIVE_ARCH),aarch64 arm64))
1214
NATIVE_ARCH := arm64
1315
else
@@ -21,7 +23,12 @@ ifeq ($(NATIVE_ARCH),$(TARGET_ARCH))
2123
ARCH_PREFIX :=
2224
else ifeq ($(TARGET_ARCH),arm64)
2325
ARCH_PREFIX := aarch64-linux-gnu-
26+
INT_TEST_CARGO_BUILD_TARGET := aarch64-unknown-linux-gnu
27+
# Fixes -m64 command line errors: https://stackoverflow.com/questions/58244095/gcc-7-error-unrecognized-command-line-option-m64
28+
export CC_aarch64_unknown_linux_gnu = aarch64-linux-gnu-gcc
29+
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER = aarch64-linux-gnu-gcc
2430
else ifeq ($(TARGET_ARCH),amd64)
31+
export CARGO_BUILD_TARGET = x86_64-unknown-linux-musl
2532
ARCH_PREFIX := x86_64-linux-gnu-
2633
else
2734
$(error Unsupported architecture: $(TARGET_ARCH))
@@ -111,9 +118,11 @@ test-deps:
111118
($(MAKE) -C "$(testdata_dir)") || exit ; \
112119
)
113120

114-
TEST_INTEGRATION_BINARY_DIRS := tracer processmanager/ebpf support go_labels
121+
TEST_INTEGRATION_BINARY_DIRS := tracer processmanager/ebpf support go_labels customlabelstest
115122

116123
integration-test-binaries: generate ebpf
124+
RUSTFLAGS="-Ctarget-feature=+crt-static" CC= cargo build --target $(INT_TEST_CARGO_BUILD_TARGET) --release --bin custom-labels-example
125+
cp -f target/$(INT_TEST_CARGO_BUILD_TARGET)/release/custom-labels-example ./support/custom_labels_example.test
117126
# Call it a ".test" even though it isn't to get included into bluebox initramfs
118127
go build -o ./support/go_labels_canary.test ./go_labels
119128
$(foreach test_name, $(TEST_INTEGRATION_BINARY_DIRS), \

0 commit comments

Comments
 (0)