Skip to content

Commit 6cc08bb

Browse files
authored
Merge pull request #231 from ds4dm/run-bash-fix
Add empty substitution on empty arrays in run.sh
2 parents e65665e + 8687095 commit 6cc08bb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

dev/run.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function configure {
9090
if [ "${warnings_as_errors}" = "true" ]; then
9191
extra_args+=("-Werror=dev" "-D" "WARNINGS_AS_ERRORS=ON")
9292
fi
93-
execute cmake -S "${source_dir}" -B "${build_dir}" -D ECOLE_BUILD_TESTS=ON -D ECOLE_BUILD_BENCHMARKS=ON "${extra_args[@]}"
93+
execute cmake -S "${source_dir}" -B "${build_dir}" -D ECOLE_BUILD_TESTS=ON -D ECOLE_BUILD_BENCHMARKS=ON ${extra_args[@]+"${extra_args[@]}"}
9494
execute ln -nfs "${build_dir}/compile_commands.json"
9595
}
9696

@@ -143,7 +143,7 @@ function build_doc {
143143
if [ "${warnings_as_errors}" = "true" ]; then
144144
local sphinx_args+=("-W")
145145
fi
146-
execute_pythonpath python -m sphinx "${sphinx_args[@]}" -b html "${source_doc_dir}" "${build_doc_dir}" "$@"
146+
execute_pythonpath python -m sphinx ${sphinx_args[@]+"${sphinx_args[@]}"} -b html "${source_doc_dir}" "${build_doc_dir}" "$@"
147147
}
148148

149149

@@ -165,7 +165,7 @@ function test_all {
165165
# Return false (1) when `diff` is set and given files pattern have modifications since `rev`.
166166
function files_have_changed {
167167
if [ "${diff}" = "true" ]; then
168-
git -C "${__ECOLE_DIR__}" diff --name-only --exit-code "${rev}" -- "${@}" > /dev/null && return 1 || return 0
168+
cd "${__ECOLE_DIR__}" && git diff --name-only --exit-code "${rev}" -- "${@}" > /dev/null && return 1 || return 0
169169
fi
170170
}
171171

@@ -177,7 +177,7 @@ function test_lib {
177177
if [ "${fail_fast}" = "true" ]; then
178178
extra_args+=("--abort")
179179
fi
180-
execute "${build_dir}/libecole/tests/ecole-lib-test" "${extra_args[@]}"
180+
execute "${build_dir}/libecole/tests/ecole-lib-test" ${extra_args[@]+"${extra_args[@]}"}
181181
else
182182
log "Skipping ${FUNCNAME[0]} as unchanged since ${rev}."
183183
fi
@@ -193,7 +193,7 @@ function ctest_lib {
193193
extra_args+=("--stop-on-failure ")
194194
fi
195195
# Possible option --parallel
196-
cmake_build test -- ARGS="${extra_args[@]}"
196+
cmake_build test -- ARGS="${extra_args[@]+"${extra_args[@]}"}"
197197
else
198198
log "Skipping ${FUNCNAME[0]} as unchanged since ${rev}."
199199
fi
@@ -208,7 +208,7 @@ function test_py {
208208
if [ "${fail_fast}" = "true" ]; then
209209
extra_args+=("--exitfirst")
210210
fi
211-
execute_pythonpath python -m pytest "${extra_args[@]}"
211+
execute_pythonpath python -m pytest ${extra_args[@]+"${extra_args[@]}"}
212212
else
213213
log "Skipping ${FUNCNAME[0]} as unchanged since ${rev}."
214214
fi
@@ -222,8 +222,8 @@ function test_doc {
222222
if [ "${warnings_as_errors}" = "true" ]; then
223223
extra_args+=("-W")
224224
fi
225-
execute python -m sphinx "${extra_args[@]}" -b linkcheck "${source_doc_dir}" "${build_doc_dir}"
226-
execute_pythonpath python -m sphinx "${extra_args[@]}" -b doctest "${source_doc_dir}" "${build_doc_dir}"
225+
execute python -m sphinx ${extra_args[@]+"${extra_args[@]}"} -b linkcheck "${source_doc_dir}" "${build_doc_dir}"
226+
execute_pythonpath python -m sphinx ${extra_args[@]+"${extra_args[@]}"} -b doctest "${source_doc_dir}" "${build_doc_dir}"
227227
else
228228
log "Skipping ${FUNCNAME[0]} as unchanged since ${rev}."
229229
fi
@@ -314,8 +314,8 @@ function check_code {
314314
# FIXME this is not used in Github Action for now
315315
function deploy_doc_locally {
316316
# Try getting from exact tag.
317-
local -r tag=$(git -C ${source_dir} describe --tags --exact-match HEAD 2> /dev/null)
318-
local -r branch="$(git rev-parse --abbrev-ref HEAD)"
317+
local -r tag=$(cd "${source_dir}" && git describe --tags --exact-match HEAD 2> /dev/null)
318+
local -r branch="$(cd "${source_dir}" && git rev-parse --abbrev-ref HEAD)"
319319

320320
local -r install_dir="${1}"
321321
if_rebuild_then build_doc

0 commit comments

Comments
 (0)