-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(preload): build once, then test against both libc flavors
The previous build & test setup was invalid: So far we have built _different_ libdash0envhook.so binaries for the LD_PRELOAD hook per libc flavor. With this, the binary works in the target system. But actually this approach is not not possible in the real world. We can set one binary as LD_PRELOAD when instrumenting a container and we do not know which libc flavor it is ahead of time. Thus we ultimately need to build a libdash0envhook.so binary that works independently of which libc flavor the target system uses. This commit only fixes the test setup. The binary does not yet support both libc flavors. This will be handled in a follow up commit. [skip ci]
- Loading branch information
Showing
17 changed files
with
144 additions
and
48 deletions.
There are no files selected for viewing
This file contains 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
12 changes: 12 additions & 0 deletions
12
images/dash0-instrumentation/preload/docker/Dockerfile-build
This file contains 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# SPDX-FileCopyrightText: Copyright 2024 Dash0 Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
FROM ubuntu:24.10 | ||
|
||
RUN apt update && \ | ||
apt-get install -y \ | ||
build-essential | ||
|
||
WORKDIR /usr/src/dash0/preload/ | ||
|
||
CMD ["scripts/make-clean.sh"] |
This file contains 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 |
---|---|---|
|
@@ -9,4 +9,4 @@ RUN apt update && \ | |
|
||
WORKDIR /usr/src/dash0/preload/ | ||
|
||
CMD ["test/smoke-test.sh"] | ||
CMD ["test/run-tests.sh"] |
This file contains 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
54 changes: 54 additions & 0 deletions
54
images/dash0-instrumentation/preload/scripts/build-in-container.sh
This file contains 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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env sh | ||
|
||
# SPDX-FileCopyrightText: Copyright 2024 Dash0 Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -eu | ||
|
||
cd "$(dirname "$0")"/.. | ||
|
||
# TODO build multi platform image | ||
|
||
if [ -z "${ARCH:-}" ]; then | ||
ARCH=arm64 | ||
fi | ||
if [ "$ARCH" = arm64 ]; then | ||
docker_platform=linux/arm64 | ||
elif [ "$ARCH" = x86_64 ]; then | ||
docker_platform=linux/amd64 | ||
else | ||
echo "The architecture $ARCH is not supported." | ||
exit 1 | ||
fi | ||
|
||
dockerfile_name=docker/Dockerfile-build | ||
image_name=dash0-env-hook-builder | ||
container_name=$image_name | ||
|
||
docker_run_extra_arguments="" | ||
if [ "${INTERACTIVE:-}" = "true" ]; then | ||
docker_run_extra_arguments=/bin/bash | ||
fi | ||
|
||
echo | ||
echo | ||
echo ">>> Building the library on $ARCH <<<" | ||
|
||
docker rm -f "$container_name" | ||
docker build \ | ||
--platform "$docker_platform" \ | ||
. \ | ||
-f "$dockerfile_name" \ | ||
-t "$image_name" | ||
|
||
# note: building one image for both platforms is not supported by Docker desktop's standard "docker build" command. | ||
# docker build --platform linux/amd64,linux/arm64 . -f $dockerfile_name -t dash0-env-hook-builder-all-$LIBC | ||
|
||
docker run \ | ||
--platform "$docker_platform" \ | ||
--name "$container_name" \ | ||
-it \ | ||
--volume "$(pwd):/usr/src/dash0/preload/" \ | ||
"$image_name" \ | ||
$docker_run_extra_arguments | ||
|
12 changes: 12 additions & 0 deletions
12
images/dash0-instrumentation/preload/scripts/make-clean.sh
This file contains 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env sh | ||
|
||
# SPDX-FileCopyrightText: Copyright 2024 Dash0 Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -eu | ||
|
||
cd "$(dirname "$0")"/.. | ||
|
||
make clean | ||
make | ||
|
This file contains 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 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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env sh | ||
|
||
# SPDX-FileCopyrightText: Copyright 2024 Dash0 Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -eu | ||
|
||
cd "$(dirname "$0")"/.. | ||
|
||
scripts/build-in-container.sh | ||
|
||
ARCH=arm64 LIBC=glibc scripts/run-tests-in-container.sh | ||
ARCH=x86_64 LIBC=glibc scripts/run-tests-in-container.sh | ||
ARCH=arm64 LIBC=musl scripts/run-tests-in-container.sh | ||
ARCH=x86_64 LIBC=musl scripts/run-tests-in-container.sh | ||
|
This file contains 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 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 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 was deleted.
Oops, something went wrong.
This file contains 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 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 was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
images/dash0-instrumentation/preload/testbin/aarch64/.gitignore
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
*.o |
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
*.o |