Add verification to build script

This commit is contained in:
Ethan P 2019-09-26 15:49:36 -07:00
parent 7e4d8257fd
commit efbf911f82
No known key found for this signature in database
GPG Key ID: 6963FD04F6CF35EA
2 changed files with 16 additions and 1 deletions

View File

@ -60,3 +60,9 @@ If you only want to install a single script, you can run the build process and c
Depending on the distribution, bat may have been renamed to avoid package conflicts. Depending on the distribution, bat may have been renamed to avoid package conflicts.
If you wish to use these scripts on a distribution where this is the case, there is an `--alternate-executable=NAME` option which will build the scripts to use an alternate executable name. If you wish to use these scripts on a distribution where this is the case, there is an `--alternate-executable=NAME` option which will build the scripts to use an alternate executable name.
**Verification:**
The build script will attempt to verify the correctness of the "bin" scripts by comparing their output with their source counterparts. It is recommended to let it do this, but you can disable verification with the `--no-verify` option.

View File

@ -180,6 +180,7 @@ pp_minify() {
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Options. # Options.
OPT_INSTALL=false OPT_INSTALL=false
OPT_VERIFY=true
OPT_MINIFY="lib" OPT_MINIFY="lib"
OPT_PREFIX="/usr/local" OPT_PREFIX="/usr/local"
OPT_BAT="bat" OPT_BAT="bat"
@ -193,6 +194,7 @@ while shiftopt; do
--prefix) shiftval; OPT_PREFIX="$OPT_VAL";; --prefix) shiftval; OPT_PREFIX="$OPT_VAL";;
--alternate-executable) shiftval; OPT_BAT="$OPT_VAL";; --alternate-executable) shiftval; OPT_BAT="$OPT_VAL";;
--minify) shiftval; OPT_MINIFY="$OPT_VAL";; --minify) shiftval; OPT_MINIFY="$OPT_VAL";;
--no-verify) shiftval; OPT_VERIFY=false;;
--docs:url) shiftval; DOCS_URL="$OPT_VAL";; --docs:url) shiftval; DOCS_URL="$OPT_VAL";;
--docs:maintainer) shiftval; DOCS_MAINTAINER="$OPT_VAL";; --docs:maintainer) shiftval; DOCS_MAINTAINER="$OPT_VAL";;
@ -240,7 +242,6 @@ done
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
# Build files. # Build files.
printc "%{YELLOW}Building scripts...%{CLEAR}\n" 1>&2 printc "%{YELLOW}Building scripts...%{CLEAR}\n" 1>&2
file_i=0 file_i=0
file_n="${#SOURCES[@]}" file_n="${#SOURCES[@]}"
@ -258,4 +259,12 @@ for file in "${SOURCES[@]}"; do
cat >/dev/null cat >/dev/null
done done
# -----------------------------------------------------------------------------
# Verify files by running the tests.
if "$OPT_VERIFY"; then
printc "\n%{YELLOW}Verifying scripts...%{CLEAR}\n" 1>&2
"$HERE/test/run.sh" consistency-test
exit $?
fi