tests: Add version check to check_shellcheck
@@ -11,6 +11,20 @@ command -v shellcheck > /dev/null 2>&1 || {
exit 0
}
+shellcheck_version=$(shellcheck --version | sed -n 's/version: //p')
+shellcheck_required_version="0.7.1"
+
+shellcheck_min_version=$(
+ printf '%s\n%s\n' "$shellcheck_version" "$shellcheck_required_version" |
+ sort -V |
+ head -1
+)
+
+if [ ! "$shellcheck_min_version" = "$shellcheck_required_version" ]; then
+ echo "shellcheck version ${shellcheck_required_version} or later required, aborting"
+ exit 0
+fi
+
cd "@CMAKE_SOURCE_DIR@" || exit
# shellcheck disable=SC2046
