From 44a0ea3dd828d2eeea41be99dad7b8743cf7a0b4 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Mon, 10 Aug 2026 10:18:17 +0200 Subject: [PATCH] attr: check the version in test-version.sh In actions-shared-workflows the version is now checked in test-version.sh, while test.sh is left for the generic tests. While moving it, assert the version where it can be asserted. The package installs attr, getfattr and setfattr, and the latter two do implement --version: printf("%s " VERSION "\\n", progname); so only attr itself needs the presence check; its getopt string is "s:V:g:r:lqLRS", where -V takes a value rather than printing a version. The greps carry an explicit || exit 1: the harness uses only the exit status of the whole script, so without it a failed match would be discarded by the [ -x ] that ends the arm and the assertion would never report anything. Give libattr an arm of its own as well, so that an unknown sub-package fails loudly instead of falling off the end of the case and returning 0. Signed-off-by: Josef Schlehofer --- utils/attr/test-version.sh | 24 ++++++++++++++++++++++++ utils/attr/test.sh | 8 -------- 2 files changed, 24 insertions(+), 8 deletions(-) create mode 100644 utils/attr/test-version.sh delete mode 100644 utils/attr/test.sh diff --git a/utils/attr/test-version.sh b/utils/attr/test-version.sh new file mode 100644 index 0000000000..306703a684 --- /dev/null +++ b/utils/attr/test-version.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +# shellcheck shell=busybox + +case "$1" in + attr) + getfattr --version | grep -F "$2" || exit 1 + setfattr --version | grep -F "$2" || exit 1 + # attr does not implement --version; its getopt string is + # "s:V:g:r:lqLRS", where -V takes a value, so just verify it + # is present + [ -x /usr/bin/attr ] || exit 1 + ;; + + libattr) + # ships no executable, nothing to assert + exit 0 + ;; + + *) + echo "Untested package: $1" >&2 + exit 1 + ;; +esac diff --git a/utils/attr/test.sh b/utils/attr/test.sh deleted file mode 100644 index 00a92d0cb1..0000000000 --- a/utils/attr/test.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -case "$1" in - attr) - # attr does not implement --version; just verify it is present - [ -x /usr/bin/attr ] || exit 1 - ;; -esac