Skip to content

Commit 84a8f9c

Browse files
committed
Make native custom labels test run in CI
1 parent 7d0f26a commit 84a8f9c

File tree

6 files changed

+238
-22
lines changed

6 files changed

+238
-22
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ 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
157159
- name: Prepare integration test binaries for qemu tests
158160
run: make integration-test-binaries TARGET_ARCH=${{ matrix.target_arch }}
159161
- 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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,11 @@ test-deps:
111111
($(MAKE) -C "$(testdata_dir)") || exit ; \
112112
)
113113

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

116116
integration-test-binaries: generate ebpf
117+
cargo build --release --bin custom-labels-example
118+
ln -sf ../target/release/custom-labels-example ./support/custom-labels-example.test
117119
# Call it a ".test" even though it isn't to get included into bluebox initramfs
118120
go build -o ./support/go_labels_canary.test ./go_labels
119121
$(foreach test_name, $(TEST_INTEGRATION_BINARY_DIRS), \

customlabelstest/customlabels_test.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,10 @@ func TestNativeCustomLabels(t *testing.T) {
2323
defer cancel()
2424

2525
traceCh, _ := testutils.StartTracer(ctx, t, enabledTracers, r)
26-
// TODO - change this to `cargo build --release --bin custom-labels-example`
27-
// once we have the Rust workspace from upstream.
28-
cmd := exec.Command("cargo", "build", "--release",
29-
"--manifest-path", "./rust-crates/custom-labels-example/Cargo.toml")
30-
out, err := cmd.CombinedOutput()
31-
require.NoError(t, err, string(out))
32-
3326
errCh := make(chan error, 1)
3427

35-
cmd = exec.CommandContext(ctx,
36-
"./rust-crates/custom-labels-example/target/release/custom-labels-example")
37-
err = cmd.Start()
28+
cmd := exec.CommandContext(ctx, "./custom-labels-example.test")
29+
err := cmd.Start()
3830
require.NoError(t, err)
3931

4032
go func() {
@@ -53,6 +45,9 @@ Loop:
5345
if !ok {
5446
break Loop
5547
}
48+
if trace == nil {
49+
continue
50+
}
5651
t.Logf("got a trace %s", trace.Comm)
5752
if len(trace.CustomLabels) > 0 {
5853
var gotL1, gotL2 bool

0 commit comments

Comments
 (0)