Skip to content

Commit c8a6f87

Browse files
authored
input: improve error message of layer version conflicts (#652)
Give the user more hints if a deeper layer requires a higher Bob version than the project/layer(s) above.
2 parents d259d08 + 8c3e96e commit c8a6f87

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

.github/workflows/workflow.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ jobs:
8181
distribution: 'temurin'
8282
java-version: '21'
8383

84-
- name: Prepare MSYS2 environment
85-
run: |
86-
C:\msys64\usr\bin\bash -l -c "pacman -Sy --needed --noconfirm parallel || true"
87-
8884
- name: Cache Jenkins integration test
8985
uses: actions/cache@v4
9086
with:

pym/bob/input.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3938,8 +3938,12 @@ def __parseLayer(self, layerSpec, maxVer, recipesRoot, upperLayer):
39383938
config = self.loadConfigYaml(self.loadYaml, rootDir)
39393939
minVer = config.get("bobMinimumVersion", "0.16")
39403940
if compareVersion(maxVer, minVer) < 0:
3941-
raise ParseError("Layer '{}' requires a higher Bob version than root project!"
3942-
.format(layer))
3941+
if upperLayer:
3942+
upperLayer = f"layer '{upperLayer}'"
3943+
else:
3944+
upperLayer = "the root project"
3945+
raise ParseError(f"Layer '{layer}' requires a higher Bob version ({minVer}) than {upperLayer} ({maxVer})!",
3946+
help=f"You need to adjust the bobMinimumVersion of {upperLayer} to be higher or equal to layer '{layer}'. Watch out for newly introduced policies between the two versions!")
39433947
maxVer = minVer # sub-layers must not have a higher bobMinimumVersion
39443948

39453949
# Determine policies. The root layer determines the default settings

test/run-tests.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,18 @@ fi
274274
# execute all tests, possibly in parallel
275275
if [[ ${#RUN_TEST_NAMES[@]} -eq 0 ]] ; then
276276
: # No tests matched
277-
elif type -p parallel >/dev/null && [[ ${RUN_JOBS:-} != 1 ]] ; then
277+
elif [[ ${RUN_JOBS:-} != 1 ]] ; then
278278
export -f run_test print_verbose
279279
export RUN_PYTHON3
280280
export RUN_PYTHON3_COV
281281
export TEST_ENVIRONMENT
282282
export VERBOSE
283-
parallel --line-buffer ${RUN_JOBS:+-j $RUN_JOBS} run_test ::: \
284-
"${RUN_TEST_NAMES[@]}" || : $((FAILED+=$?))
283+
# Run the tests in parallel and pipe them trough a dummy sed with line
284+
# buffering. This prevents the output from being interleaced.
285+
echo "${RUN_TEST_NAMES[@]}" \
286+
| xargs -P ${RUN_JOBS:-$(nproc)} -n 1 \
287+
bash -c 'run_test "$@" | stdbuf -oL sed -e ""' bash \
288+
|| : $((FAILED+=$?))
285289
else
286290
for i in "${RUN_TEST_NAMES[@]}" ; do
287291
if ! run_test "$i" ; then

0 commit comments

Comments
 (0)