Skip to content
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

Build test-manager as a standalone executable #6615

Merged
merged 2 commits into from
Aug 14, 2024

Conversation

MarkusPettersson98
Copy link
Contributor

@MarkusPettersson98 MarkusPettersson98 commented Aug 14, 2024

This change is Reviewable

Copy link
Member

@dlon dlon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @MarkusPettersson98)


test/scripts/build.sh line 14 at r1 (raw file):

build_linux() {
    # Build the test manager
    "$SCRIPT_DIR/container-run.sh" bash -c "cd $TEST_FRAMEWORK_ROOT; OPENSSL_STATIC=1 OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu OPENSSL_INCLUDE_DIR=/usr/include/openssl cargo build -p test-manager --release"

Should we invert how container-run is used? That seems more consistent with how the test runner is built:

# ./scripts/build-manager.sh
# Statically build test-manager

export OPENSSL_STATIC=1
export OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu
export OPENSSL_INCLUDE_DIR=/usr/include/openssl

cargo build -p test-manager --release

...
# usage:
# ./scripts/container-run.sh ./scripts/build-manager.sh

test/scripts/Dockerfile line 15 at r1 (raw file):

    && ./configure --enable-remote=yes --enable-dbus=no --enable-shared=no \
    && make \
    && cp libpcap.a /usr/lib/x86_64-linux-gnu/libpcap.a

Perhaps we could remove packages/directories that are only used during compilation? Ie flex, bison, and ./libpcap.


test/scripts/Dockerfile line 15 at r1 (raw file):

    && ./configure --enable-remote=yes --enable-dbus=no --enable-shared=no \
    && make \
    && cp libpcap.a /usr/lib/x86_64-linux-gnu/libpcap.a

Nit: This is fine but I wonder if make install would work.


test/test-manager/build.rs line 5 at r1 (raw file):

    println!("cargo::rerun-if-changed=../scripts/ssh-setup.sh");

    println!("cargo::rustc-link-search=native=/usr/lib/x86_64-linux-gnu");

Does this build without the container still (including on macOS)? Otherwise, maybe we could pass this in from the script instead.

Copy link
Contributor Author

@MarkusPettersson98 MarkusPettersson98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 4 files reviewed, 2 unresolved discussions (waiting on @dlon)


test/scripts/Dockerfile line 15 at r1 (raw file):

Previously, dlon (David Lönnhager) wrote…

Perhaps we could remove packages/directories that are only used during compilation? Ie flex, bison, and ./libpcap.

Done


test/scripts/Dockerfile line 15 at r1 (raw file):

Previously, dlon (David Lönnhager) wrote…

Nit: This is fine but I wonder if make install would work.

Done Nice catch! Worked great :)

Copy link
Contributor Author

@MarkusPettersson98 MarkusPettersson98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 4 files reviewed, 2 unresolved discussions (waiting on @dlon)


test/test-manager/build.rs line 5 at r1 (raw file):

Previously, dlon (David Lönnhager) wrote…

Does this build without the container still (including on macOS)? Otherwise, maybe we could pass this in from the script instead. Or have some env var.

Introduced TEST_MANAGER_STATIC and passes it from scripts/build.sh to link against libpcap statically. So a regular cargo build should work as before 😊

Copy link
Contributor Author

@MarkusPettersson98 MarkusPettersson98 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 5 files reviewed, 2 unresolved discussions (waiting on @dlon)


test/scripts/build.sh line 14 at r1 (raw file):

Previously, dlon (David Lönnhager) wrote…

Should we invert how container-run is used? That seems more consistent with how the test runner is built:

# ./scripts/build-manager.sh
# Statically build test-manager

export OPENSSL_STATIC=1
export OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu
export OPENSSL_INCLUDE_DIR=/usr/include/openssl

cargo build -p test-manager --release

...
# usage:
# ./scripts/container-run.sh ./scripts/build-manager.sh

Running ./scripts/container-run.sh ./scripts/build.sh will now compile test-manager, test-runner and connection-checker inside of the container.

Copy link
Member

@dlon dlon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 2 files at r2, 1 of 2 files at r3, 3 of 3 files at r4, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved


test/test-manager/build.rs line 5 at r1 (raw file):

Previously, MarkusPettersson98 (Markus Pettersson) wrote…

Introduced TEST_MANAGER_STATIC and passes it from scripts/build.sh to link against libpcap statically. So a regular cargo build should work as before 😊

👍

@MarkusPettersson98 MarkusPettersson98 marked this pull request as ready for review August 14, 2024 08:49
dlon and others added 2 commits August 14, 2024 10:51
Pass `TEST_MANAGER_STATIC` when building the `test-manager` crate to
have it link statically against `libpcap`. This is optional, but
building the with the provided container will produce a statically
linked binary.
@MarkusPettersson98 MarkusPettersson98 merged commit 0d3c317 into main Aug 14, 2024
52 checks passed
@MarkusPettersson98 MarkusPettersson98 deleted the test-manager-container branch August 14, 2024 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants