Skip to content

Commit

Permalink
Merge branch 'main' into fix_uffd_kernel_faults
Browse files Browse the repository at this point in the history
  • Loading branch information
bchalios authored Sep 22, 2023
2 parents 5dc2b85 + 42f986e commit aa04ac6
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipeline_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

release_grp = group(
"📦 Release Sanity Build",
"./tools/devtool -y sh ./tools/release.sh --libc musl --profile release --make-release",
"mkdir -p ./test_results && touch ./test_results/test-report.json && ./tools/devtool -y sh ./tools/release.sh --libc musl --profile release --make-release",
**defaults_once_per_architecture,
)

Expand Down
1 change: 0 additions & 1 deletion .cargo/config
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[build]
target-dir = "build/cargo_target"
target = "x86_64-unknown-linux-musl"
rustflags = [
"-Wclippy::ptr_as_ptr",
"-Wclippy::undocumented_unsafe_blocks",
Expand Down
22 changes: 22 additions & 0 deletions tests/integration_tests/build/test_binary_static_linking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
"""Tests to check if the release binary is statically linked.
"""

import pytest
import host_tools.cargo_build as host
from framework import utils

@pytest.mark.timeout(500)
def test_firecracker_binary_static_linking():
"""
Test to make sure the firecracker binary is statically linked.
"""
fc_binary_path = host.get_binary("firecracker")
_, stdout,stderr = utils.run_cmd(f"file {fc_binary_path}")
assert "" in stderr
# expected "statically linked" for aarch64 and
# "static-pie linked" for x86_64
assert "statically linked" in stdout or \
"static-pie linked" in stdout
2 changes: 1 addition & 1 deletion tools/devtool
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ cmd_build() {
}

function cmd_make_release {
cmd_test -- --json-report --json-report-file=test-report.json || die "Tests failed!"
cmd_test || die "Tests failed!"

run_devctr \
--user "$(id -u):$(id -g)" \
Expand Down
12 changes: 11 additions & 1 deletion tools/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ cargo build --target "$CARGO_TARGET" $CARGO_OPTS --workspace

say "Binaries placed under $CARGO_TARGET_DIR"

# Check static linking:
# expected "statically linked" for aarch64 and
# "static-pie linked" for x86_64
binary_format=$(file $CARGO_TARGET_DIR/firecracker)
if [[ "$PROFILE" = "release"
&& "$binary_format" != *"statically linked"*
&& "$binary_format" != *"static-pie linked"* ]]; then
die "Binary not statically linked: $binary_format"
fi

# # # # Make a release
if [ -z "$MAKE_RELEASE" ]; then
exit 0
Expand All @@ -157,7 +167,7 @@ cp -v -t "$RELEASE_DIR" LICENSE NOTICE THIRD-PARTY
check_swagger_artifact src/api_server/swagger/firecracker.yaml "$VERSION"
cp -v src/api_server/swagger/firecracker.yaml "$RELEASE_DIR/firecracker_spec-$VERSION.yaml"

cp -v tests/test-report.json "$RELEASE_DIR/"
cp -v test_results/test-report.json "$RELEASE_DIR/"

(
cd "$RELEASE_DIR"
Expand Down

0 comments on commit aa04ac6

Please sign in to comment.