Skip to content

Commit 2381ebc

Browse files
author
Doug Coleman
committed
build-script-impl: Generate the test commands from cmake and ninja in
separate steps so that if the target does not exist the script will fail instead of continuing. `set -e` is supposed to fix this, but since the command is empty if the target doesn't exist, the subshell returns 0 and the script continues. Also, print out the cmake and ninja commands so that we don't hide so much of the machinery. Fixes rdar://problem/29003970
1 parent 983293c commit 2381ebc

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

utils/build-script-impl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2792,7 +2792,12 @@ for host in "${ALL_HOSTS[@]}"; do
27922792
# executing ninja directly, have it dump the commands it would
27932793
# run, strip Ninja's progress prefix with sed, and tell the
27942794
# shell to execute that.
2795-
sh -e -x -c "$("${build_cmd[@]}" -n -v ${target} | sed -e 's/[^]]*] //')"
2795+
# However, if we do this in a subshell in the ``sh -e -x -c`` line,
2796+
# errors in the command will not stop the script as they should.
2797+
echo "Generating dry run test command from: ${build_cmd[@]} -n -v ${target}"
2798+
dry_run_command_output="$(${build_cmd[@]} -n -v ${target} | sed -e 's/[^]]*] //')"
2799+
echo "Test command: ${dry_run_command_output}"
2800+
sh -e -x -c "${dry_run_command_output}"
27962801
else
27972802
call "${build_cmd[@]}" ${BUILD_TARGET_FLAG} ${target}
27982803
fi

0 commit comments

Comments
 (0)