Skip to content

Commit a9e7943

Browse files
committed
Merge branch 'maint/fix-rust-tests'
2 parents 763491a + ad17158 commit a9e7943

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ set(CMAKE_C_FLAGS_DEBUG "-Os -ggdb")
244244
set(CMAKE_C_FLAGS_RELWITHDEBINFO "-Os -ggdb -DNDEBUG")
245245

246246
if(DEFINED ENV{RUSTFLAGS})
247-
set(RUSTFLAGS $ENV{RUSTFLAGS})
247+
set(RUSTFLAGS "$ENV{RUSTFLAGS}")
248+
else()
249+
set(RUSTFLAGS "")
248250
endif()
249251

250252
#-----------------------------------------------------------------------------

src/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,12 +230,12 @@ else()
230230
set(RUST_PROFILE "release")
231231
set(RUST_CARGO_FLAGS "--release")
232232
# For binary reproducibility, strip path prefixes that can be different depending on environment (e.g. /home/<user>, etc.).
233-
string(APPEND RUSTFLAGS " --remap-path-prefix=${CMAKE_CURRENT_SOURCE_DIR}/rust=src --remap-path-prefix=$ENV{HOME}=")
233+
string(JOIN " " RUSTFLAGS "${RUSTFLAGS}" "--remap-path-prefix=${CMAKE_CURRENT_SOURCE_DIR}/rust=src" "--remap-path-prefix=$ENV{HOME}=")
234234
endif()
235235

236236
# Use libsecp256k1 that we link ourselves.
237237
# See https://github.com/rust-bitcoin/rust-secp256k1/tree/7c8270a8506e31731e540fab7ee1abde1f48314e/secp256k1-sys#linking-to-external-symbols
238-
string(APPEND RUSTFLAGS " --cfg=rust_secp_no_symbol_renaming")
238+
string(JOIN " " RUSTFLAGS "${RUSTFLAGS}" "--cfg=rust_secp_no_symbol_renaming")
239239

240240
if(CMAKE_CROSSCOMPILING)
241241
set(RUST_TARGET_ARCH thumbv7em-none-eabi)
@@ -284,7 +284,7 @@ add_custom_target(rust-cbindgen
284284

285285
# Test rust crates that contain business logic. Avoid testing crates that depend on hardware.
286286
if(NOT CMAKE_CROSSCOMPILING)
287-
set(RUSTFLAGS_TESTS ${RUSTFLAGS} -L${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -lsecp256k1 -lstatic=fatfs)
287+
set(RUSTFLAGS_TESTS "${RUSTFLAGS} -L${CMAKE_ARCHIVE_OUTPUT_DIRECTORY} -lsecp256k1 -lstatic=fatfs")
288288

289289
# Since we build with all features we need to use a separate build directory.
290290
# Otherwise we invalidate the result from the normal compilation that uses a
@@ -295,7 +295,7 @@ if(NOT CMAKE_CROSSCOMPILING)
295295
CMAKE_SYSROOT=${CMAKE_SYSROOT}
296296
CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}
297297
FIRMWARE_VERSION_SHORT=${FIRMWARE_VERSION}
298-
RUSTFLAGS="${RUSTFLAGS_TESTS}"
298+
RUSTFLAGS=${RUSTFLAGS_TESTS}
299299
# only one test thread because of unsafe concurrent access to `SafeData`, `mock_sd()` and `mock_memory()`. Using mutexes instead leads to mutex poisoning and very messy output in case of a unit test failure.
300300
${CARGO}
301301
test

0 commit comments

Comments
 (0)