Skip to content

Commit c9cc8d1

Browse files
pb8ozulinx86
authored andcommitted
fix(tests): strip debug information before a testrun
Before df112e3 the tests compiled Firecracked and stripped the debuginfo. When we moved to running release.sh the behavior changed since we only strip when making a release. Solve it by always stripping symbols when building Firecracker in --release profile. Some care was taken so it is safe to re-run, so we don't lose the debug symbols if the original binary has not changed. Fixes: df112e3 Signed-off-by: Pablo Barbáchano <[email protected]>
1 parent 9bfe98a commit c9cc8d1

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

tools/release.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,13 @@ function check_bin_artifact {
4545

4646
function strip-and-split-debuginfo {
4747
local bin=$1
48+
if [ $bin -ot $bin.debug ]; then
49+
return
50+
fi
4851
echo "STRIP $bin"
4952
objcopy --only-keep-debug $bin $bin.debug
5053
chmod a-x $bin.debug
51-
objcopy --strip-debug --add-gnu-debuglink=$bin.debug $bin
54+
objcopy --preserve-dates --strip-debug --add-gnu-debuglink=$bin.debug $bin
5255
}
5356

5457
function get-firecracker-version {
@@ -129,6 +132,10 @@ say "Building version=$VERSION, profile=$PROFILE, target=$CARGO_TARGET, Rust too
129132
# shellcheck disable=SC2086
130133
cargo build --target "$CARGO_TARGET" $CARGO_OPTS --workspace --bins --examples
131134

135+
for file in "${ARTIFACTS[@]}"; do
136+
strip-and-split-debuginfo "$CARGO_TARGET_DIR/$file"
137+
done
138+
132139
say "Binaries placed under $CARGO_TARGET_DIR"
133140

134141
# Check static linking:
@@ -156,7 +163,7 @@ mkdir "$RELEASE_DIR"
156163
for file in "${ARTIFACTS[@]}"; do
157164
check_bin_artifact "$CARGO_TARGET_DIR/$file" "$VERSION"
158165
cp -v "$CARGO_TARGET_DIR/$file" "$RELEASE_DIR/$file-$SUFFIX"
159-
strip-and-split-debuginfo "$RELEASE_DIR/$file-$SUFFIX"
166+
cp -v "$CARGO_TARGET_DIR/$file.debug" "$RELEASE_DIR/$file-$SUFFIX.debug"
160167
done
161168
cp -v "resources/seccomp/$CARGO_TARGET.json" "$RELEASE_DIR/seccomp-filter-$SUFFIX.json"
162169
# Copy over arch independent assets

0 commit comments

Comments
 (0)