Add option to list the generated files and exit
This is useful during the release process, when we want to commit the
generated files.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/tests/scripts/check-generated-files.sh b/tests/scripts/check-generated-files.sh
index a2c285f..0399484 100755
--- a/tests/scripts/check-generated-files.sh
+++ b/tests/scripts/check-generated-files.sh
@@ -23,12 +23,13 @@
if [ $# -ne 0 ] && [ "$1" = "--help" ]; then
cat <<EOF
-$0 [-u]
+$0 [-l | -u]
This script checks that all generated file are up-to-date. If some aren't, by
default the scripts reports it and exits in error; with the -u option, it just
updates them instead.
-u Update the files rather than return an error for out-of-date files.
+ -l List generated files, but do not update them.
EOF
exit
fi
@@ -39,10 +40,13 @@
fi
UPDATE=
-if [ $# -ne 0 ] && [ "$1" = "-u" ]; then
- shift
- UPDATE='y'
-fi
+LIST=
+while getopts lu OPTLET; do
+ case $OPTLET in
+ l) LIST=1;;
+ u) UPDATE=1;;
+ esac
+done
# check SCRIPT FILENAME[...]
# check SCRIPT DIRECTORY
@@ -58,6 +62,11 @@
SCRIPT=$1
shift
+ if [ -n "$LIST" ]; then
+ printf '%s\n' "$@"
+ return
+ fi
+
directory=
if [ -d "$1" ]; then
directory="$1"