forked from open-telemetry/opentelemetry-ebpf-profiler
-
Notifications
You must be signed in to change notification settings - Fork 12
Fix QEMU distro tests, switch to hash spec_id map and remove pid based attachment #183
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -14,6 +14,16 @@ CACHE_DIR="${CACHE_DIR:-/tmp/debootstrap-cache}" | |
| echo "Building rootfs with $DISTRO $RELEASE..." | ||
|
|
||
| # Clean up previous builds | ||
| # First, unmount any leftover mounts from previous debootstrap runs | ||
| if [ -d "$ROOTFS_DIR" ]; then | ||
| echo "Cleaning up any mounted filesystems in $ROOTFS_DIR..." | ||
| # Find all mount points under ROOTFS_DIR and unmount them in reverse order (deepest first) | ||
| findmnt -o TARGET -n -l | grep "^$(pwd)/$ROOTFS_DIR" | sort -r | while read -r mountpoint; do | ||
| echo " Unmounting $mountpoint" | ||
| sudo umount "$mountpoint" || sudo umount -l "$mountpoint" || true | ||
| done | ||
| fi | ||
|
|
||
| sudo rm -rf "$ROOTFS_DIR" "$OUTPUT_DIR" | ||
| mkdir -p "$ROOTFS_DIR" "$OUTPUT_DIR" "$CACHE_DIR" | ||
|
|
||
|
|
@@ -45,7 +55,7 @@ echo "Running debootstrap to create $DISTRO $RELEASE rootfs for $DEBOOTSTRAP_ARC | |
| sudo debootstrap --variant=minbase \ | ||
| --arch="$DEBOOTSTRAP_ARCH" \ | ||
| --cache-dir="$CACHE_DIR" \ | ||
| "$RELEASE" "$ROOTFS_DIR" "$MIRROR" | ||
| "$RELEASE" "$ROOTFS_DIR" "$MIRROR" || cat "$ROOTFS_DIR/debootstrap/debootstrap.log" | ||
|
|
||
| # Change ownership of rootfs to current user to avoid needing sudo for subsequent operations | ||
| sudo chown -R "$(id -u):$(id -g)" "$ROOTFS_DIR" | ||
|
|
@@ -85,11 +95,16 @@ if [[ "${USE_DOCKER}" == "1" ]] && command -v docker &> /dev/null; then | |
| wget -q https://go.dev/dl/go1.24.7.linux-${GOARCH}.tar.gz && \ | ||
| tar -C /usr/local -xzf go1.24.7.linux-${GOARCH}.tar.gz && \ | ||
| export PATH=/usr/local/go/bin:\$PATH && \ | ||
| CGO_ENABLED=1 go test -c ../../interpreter/rtld ../../support/usdt" | ||
| CGO_ENABLED=1 go test -c ../../interpreter/rtld ../../support/usdt/test" | ||
| else | ||
| # Local build with cross-compilation if needed | ||
| echo "Building locally for ${GOARCH}..." | ||
| CGO_ENABLED=1 GOARCH=${GOARCH} go test -c ../../interpreter/rtld ../../support/usdt | ||
| if [ "$GOARCH" = "arm64" ]; then | ||
| # Cross-compile for ARM64 using aarch64-linux-gnu-gcc | ||
| CGO_ENABLED=1 GOARCH=${GOARCH} CC=aarch64-linux-gnu-gcc go test -c ../../interpreter/rtld ../../support/usdt/test | ||
| else | ||
| CGO_ENABLED=1 GOARCH=${GOARCH} go test -c ../../interpreter/rtld ../../support/usdt/test | ||
| fi | ||
|
Comment on lines
+100
to
+102
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you check if the arch is x86 here and fail otherwise? I want to limit introducing new cases where we assume the only arches in the world are arm and x86 (because that will make it easier to support riscv in the future) |
||
| fi | ||
|
|
||
| # Copy test binary into rootfs | ||
|
|
@@ -129,7 +144,7 @@ export DEBUG_TEST=1 | |
|
|
||
| # Run the tests | ||
| echo "" | ||
| /rtld.test -test.v && /usdt.test -test.v | ||
| /rtld.test -test.v && /test.test -test.v | ||
| RESULT=$? | ||
|
|
||
| if [ $RESULT -eq 0 ]; then | ||
|
|
@@ -204,7 +219,8 @@ echo "" | |
| echo "===== Starting QEMU with kernel ${KERNEL_VERSION} on ${QEMU_ARCH} =====" | ||
| echo "" | ||
|
|
||
| # Run QEMU | ||
| # Run QEMU and capture output | ||
| QEMU_OUTPUT=$(mktemp) | ||
| ${sudo} qemu-system-${QEMU_ARCH} ${additionalQemuArgs} \ | ||
| -nographic \ | ||
| -monitor none \ | ||
|
|
@@ -214,15 +230,28 @@ ${sudo} qemu-system-${QEMU_ARCH} ${additionalQemuArgs} \ | |
| -initrd "$OUTPUT_DIR/initramfs.gz" \ | ||
| -append "${CONSOLE_ARG} init=/init quiet loglevel=3" \ | ||
| -no-reboot \ | ||
| -display none | ||
|
|
||
| EXIT_CODE=$? | ||
| -display none \ | ||
| | tee "$QEMU_OUTPUT" | ||
|
|
||
| # QEMU with sysrq poweroff returns 0 on clean shutdown | ||
| if [ $EXIT_CODE -eq 0 ]; then | ||
| # Parse output for test result | ||
| if grep -q "===== TEST PASSED =====" "$QEMU_OUTPUT"; then | ||
| rm -f "$QEMU_OUTPUT" | ||
| echo "" | ||
| echo "✅ Test completed successfully" | ||
| exit 0 | ||
| elif grep -q "===== TEST FAILED" "$QEMU_OUTPUT"; then | ||
| rm -f "$QEMU_OUTPUT" | ||
| echo "" | ||
| echo "❌ Test failed" | ||
| exit 1 | ||
| elif grep -q "===== TEST TIMED OUT =====" "$QEMU_OUTPUT"; then | ||
| rm -f "$QEMU_OUTPUT" | ||
| echo "" | ||
| echo "❌ Test timed out" | ||
| exit 124 | ||
| else | ||
| echo "❌ Test failed with QEMU exit code $EXIT_CODE" | ||
| exit $EXIT_CODE | ||
| rm -f "$QEMU_OUTPUT" | ||
| echo "" | ||
| echo "❌ Could not determine test result (QEMU may have crashed)" | ||
| exit 2 | ||
| fi | ||
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this comment needs to be updated