Skip to content

Commit acc7f2a

Browse files
committed
Merge bitcoin/bitcoin#33401: ci: Remove bash -c from cmake invocation using eval
5019402 ci: Remove bash -c from cmake invocation using eval (Brandon Odiwuor) Pull request description: Follow up to bitcoin/bitcoin#32970 bitcoin/bitcoin#32970 (comment) > Does `cmake -S ...` still need to be wrapped in `bash -c "..."`? bitcoin/bitcoin#32970 (comment) > It is not trivial to replace. Maybe the `eval` hack from below can be used: > > ```shell > # parses TEST_RUNNER_EXTRA as an array which allows for multiple arguments such as TEST_RUNNER_EXTRA='--exclude "rpc_bind.py --ipv6"' > > eval "TEST_RUNNER_EXTRA=($TEST_RUNNER_EXTRA)" > ``` >however, I haven't tried this yet. bitcoin/bitcoin#32970 (comment) > Yeah, the eval hack should work: > > ``` > $ export T="-DREDUCE_EXPORTS=ON -DCMAKE_CXX_FLAGS='-Wno-psabi -Wno-error=maybe-uninitialized'"; eval "T=($T)"; for i in "${T[@]}"; do echo "_${i}_" ; done > _-DREDUCE_EXPORTS=ON_ > _-DCMAKE_CXX_FLAGS=-Wno-psabi -Wno-error=maybe-uninitialized_ > ``` > > (can be done in a follow-up) This replaces the `bash -c` wrapper with an eval-based array parsing to preserve spaces in flag values (e.g., in CMAKE_CXX_FLAGS), allowing ShellCheck to lint the cmake command ACKs for top commit: maflcko: lgtm ACK 5019402 hebasto: ACK 5019402. Tree-SHA512: 6fd22569e2c719a8d13805f18e1e7e3b8eb57d0a6307f2e7175988b25750eafb7c8260796c8e7350db67d622dbe97e6af7bab8ee52187bb8e8eeae3740a47c01
2 parents f41f972 + 5019402 commit acc7f2a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ci/test/03_test_script.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ if [[ "${RUN_TIDY}" == "true" ]]; then
130130
BITCOIN_CONFIG_ALL="$BITCOIN_CONFIG_ALL -DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
131131
fi
132132

133-
bash -c "cmake -S $BASE_ROOT_DIR -B ${BASE_BUILD_DIR} $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG" || (
133+
eval "CMAKE_ARGS=($BITCOIN_CONFIG_ALL $BITCOIN_CONFIG)"
134+
cmake -S "$BASE_ROOT_DIR" -B "$BASE_BUILD_DIR" "${CMAKE_ARGS[@]}" || (
134135
cd "${BASE_BUILD_DIR}"
135136
# shellcheck disable=SC2046
136137
cat $(cmake -P "${BASE_ROOT_DIR}/ci/test/GetCMakeLogFiles.cmake")

0 commit comments

Comments
 (0)