Liebe Gitlab-Nutzer, lieber Gitlab-Nutzer, es ist nun möglich sich mittels des ZIH-Logins/LDAP an unserem Dienst anzumelden. Ein Anmelden über dieses erzeugt ein neues Konto. Das alte Konto ist über den Reiter "Standard" erreichbar. Die Administratoren

Dear Gitlab user, it is now possible to log in to our service using the ZIH login/LDAP. Logging in via this will create a new account. The old account can be accessed via the "Standard" tab. The administrators

Commit a1ced2d1 authored by Jö Fahlke's avatar Jö Fahlke
Browse files

[duneci-standard-test] Restructure to make default values visible.

Ansgar prefers a pattern of the form
```sh
VAR=default_value
if explicitly_configured; then
  VAR=configured_value
fi
```
This restructures the labels parsing the make this pattern possible.
parent 1f80d2d3
......@@ -21,43 +21,48 @@ if [[ -v DUNECI_PARALLEL ]]; then
parallel_opts="-j${DUNECI_PARALLEL}"
fi
# Evaluate $DUNECI_TEST_LABELS and set $build_test_target and
# $labels_regex_arg accordingly. Labels in $DUNECI_TEST_LABELS may be
# seperated by whitespace or ','.
handle_labels()
# Parse labels in $1 and set ${parsed_targets[@]} and ${parsed_selectors[@]}
# accordingly. Labels in $1 may be seperated by whitespace or ','.
parse_labels()
{
# use a function to automatically restore IFS
local IFS=$IFS, label labels labels_regexs
labels=(${DUNECI_TEST_LABELS-})
local IFS="$IFS," label regexs status=1
if [[ ${#labels[@]} -eq 0 ]]; then
build_test_targets=(build_tests)
labels_regex_arg=
else
build_test_targets=()
labels_regexs=()
for label in "${labels[@]}"; do
# ensure the labels can be safely handled
if [[ -z $label ]] || [[ $label == *[![:word:]-]* ]]; then
cat >&2 <<EOF
parsed_targets=()
regexs=()
for label in $1; do
# ensure the labels can be safely handled
if [[ -z $label ]] || [[ $label == *[![:word:]-]* ]]; then
cat >&2 <<EOF
duneci-standard-test: Error: Invalid label in DUNECI_TEST_LABELS: '$label'
duneci-standard-test: Note: Only alphanumeric characters plus '_' and '-' are
duneci-standard-test: Note: allowed in label names, and the names must be
duneci-standard-test: Note: non-empty.
EOF
exit 2
fi
build_test_targets+=("build_${label}_tests")
labels_regexs+=("^${label}\$")
done
exit 2
fi
parsed_targets+=("build_${label}_tests")
regexs+=("^${label}\$")
status=0 # we found at least one label
done
parsed_selectors=()
if [[ ${#regexs[@]} -gt 0 ]]; then
# This will join all regexps using '|' from IFS
IFS="|"
labels_regex_arg="${labels_regexs[*]}"
# This will quote the result for when dunecontrol evals the parameters
labels_regex_arg="-L ${labels_regex_arg@Q}"
parsed_selectors=(-L "${regexs[*]}")
fi
return $status
}
handle_labels
build_test_targets=(build_tests) # passed to make/ninja to build tests
select_test_args=() # passed to ctest to select tests
if parse_labels "${DUNECI_TEST_LABELS-}"; then
build_test_target=("${parsed_targets[@]}")
select_test_args=("${parsed_selectors[@]}")
fi
# Allow oversubscription (tests might want to try having more ranks
# than environment has processors) and force degraded mode (as we
......@@ -74,4 +79,5 @@ set -x
${DUNECONTROL} --current "${@}" vcsetup
${DUNECONTROL} --current "${@}" configure
${DUNECONTROL} --current "${@}" make ${parallel_opts} all "${build_test_targets[@]}"
${DUNECONTROL} --current "${@}" bexec ${DUNE_CTEST} ${parallel_opts} "$labels_regex_arg"
# note the extra quoting for select_test_args to protect it from dunecontrol evaling it
${DUNECONTROL} --current "${@}" bexec ${DUNE_CTEST} ${parallel_opts} "${select_test_args[@]@Q}"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment