Skip to content

Commit

Permalink
ros: make linter tests more flexible (#4223)
Browse files Browse the repository at this point in the history
Signed-off-by: Callahan Kovacs <callahan.kovacs@canonical.com>
  • Loading branch information
mr-cal authored and cmatsuoka committed Aug 4, 2023
1 parent 6e77a86 commit 591939f
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/spread/core22/linters/linter-ros2-humble-mixed/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,16 @@ execute: |
test -f linter-ros2-humble-mixed_1.0_*.snap
sed -n '/^Running linters/,/^Creating snap/p' < output.txt > linter_output.txt
diff -u linter_output.txt expected_linter_output.txt
# diff everything except the list of libraries
diff --ignore-matching-lines "^- library: lib" expected_linter_output.txt linter_output.txt
# `|| true` is used because grep will error if there is no output from the `diff` call
NUM_DIFFERENCES=$(diff expected_linter_output.txt linter_output.txt | grep --count "[<>]" || true)
# the list of unused libraries may change from time to time, so check the output is similar but not identical
if [[ $NUM_DIFFERENCES -gt 10 ]]; then
echo "Error: linter warnings are significantly different:"
diff --unified expected_linter_output.txt linter_output.txt
exit 1
fi

0 comments on commit 591939f

Please sign in to comment.