aboutsummaryrefslogtreecommitdiff
path: root/aux/checks
diff options
context:
space:
mode:
Diffstat (limited to 'aux/checks')
-rw-r--r--aux/checks/repo.env5
-rwxr-xr-xaux/checks/repo.sh150
-rwxr-xr-xaux/checks/shellcheck.sh6
3 files changed, 83 insertions, 78 deletions
diff --git a/aux/checks/repo.env b/aux/checks/repo.env
new file mode 100644
index 0000000..79b46d9
--- /dev/null
+++ b/aux/checks/repo.env
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+export EXECUTABLES=1
+export SYMLINKS=2
+export FILES=9
diff --git a/aux/checks/repo.sh b/aux/checks/repo.sh
index 0c00e92..323f68e 100755
--- a/aux/checks/repo.sh
+++ b/aux/checks/repo.sh
@@ -1,9 +1,6 @@
#!/bin/sh
set -eu
-if true; then
- exit
-fi
if [ -n "${RECURSIVE_CHECK:-}" ]; then
exit
@@ -11,30 +8,14 @@ fi
export RECURSIVE_CHECK=true
. aux/lib.sh
+. aux/checks/repo.env
+set -eu
-REPODIR="$PWD"
-
-INSTALLCHECK=false
-while getopts 'x:l:f:' flag; do
- case "$flag" in
- x)
- EXECUTABLES="$OPTARG"
- INSTALLCHECK=true
- ;;
- l)
- SYMLINKS="$OPTARG"
- INSTALLCHECK=true
- ;;
- f)
- FILES="$OPTARG"
- INSTALLCHECK=true
- ;;
- *)
- exit 2
- ;;
- esac
-done
-shift $((OPTIND - 1))
+usage() {
+ cat <<-'EOF'
+ FIXME
+ EOF
+}
assert_no_diffs() {
if [ -n "$(git status -s)" ]; then
@@ -45,37 +26,31 @@ assert_no_diffs() {
}
assert_installed_files() {
- if [ -n "${EXECUTABLES:-}" ]; then
- ACTUAL="$(find "$1" -type f -perm -u=x | wc -l)"
- if [ "$EXECUTABLES" != "$ACTUAL" ]; then
- printf 'Expected %s executables, found %s:\n' \
- "$EXECUTABLES" "$ACTUAL" >&2
- echo "find $1 -type f -perm -u=x:" >&2
- find "$1" -type f -perm -u=x >&2
- exit 1
- fi
+ ACTUAL="$(find "$1" -type f -perm -u=x | wc -l)"
+ if [ "$EXECUTABLES" != "$ACTUAL" ]; then
+ printf 'Expected %s executables, found %s:\n' \
+ "$EXECUTABLES" "$ACTUAL" >&2
+ echo "find $1 -type f -perm -u=x:" >&2
+ find "$1" -type f -perm -u=x >&2
+ exit 1
fi
- if [ -n "${SYMLINKS:-}" ]; then
- ACTUAL="$(find "$1" -type l | wc -l)"
- if [ "$SYMLINKS" != "$ACTUAL" ]; then
- printf 'Expected %s symlinks, found %s:\n' \
- "$SYMLINKS" "$ACTUAL" >&2
- echo "find $1 -type l:" >&2
- find "$1" -type l >&2
- exit 1
- fi
+ ACTUAL="$(find "$1" -type l | wc -l)"
+ if [ "$SYMLINKS" != "$ACTUAL" ]; then
+ printf 'Expected %s symlinks, found %s:\n' \
+ "$SYMLINKS" "$ACTUAL" >&2
+ echo "find $1 -type l:" >&2
+ find "$1" -type l >&2
+ exit 1
fi
- if [ -n "${FILES:-}" ]; then
- ACTUAL="$(find "$1" -type f | wc -l)"
- if [ "$FILES" != "$ACTUAL" ]; then
- printf 'Expected %s files, found %s:\n' \
- "$FILES" "$ACTUAL" >&2
- echo "find $1 -type f:" >&2
- find "$1" -type f >&2
- exit 1
- fi
+ ACTUAL="$(find "$1" -type f | wc -l)"
+ if [ "$FILES" != "$ACTUAL" ]; then
+ printf 'Expected %s files, found %s:\n' \
+ "$FILES" "$ACTUAL" >&2
+ echo "find $1 -type f:" >&2
+ find "$1" -type f >&2
+ exit 1
fi
}
@@ -89,14 +64,10 @@ assert_uninstalled_files() {
}
assert_install() {
- if [ "$INSTALLCHECK" != 'true' ]; then
- return
- fi
-
make clean
echo 'Asserting "canonical" install path' >&2
- INSTALL1="$(mkdtemp)"
+ INSTALL1="$(tmpname)"
make PREFIX="$INSTALL1"
make check PREFIX="$INSTALL1"
make install PREFIX="$INSTALL1"
@@ -107,7 +78,7 @@ assert_install() {
make clean
echo 'Asserting "straigh-forward" install path' >&2
- INSTALL2="$(mkdtemp)"
+ INSTALL2="$(tmpname)"
make install PREFIX="$INSTALL2"
assert_installed_files "$INSTALL2"
make uninstall PREFIX="$INSTALL2"
@@ -116,7 +87,7 @@ assert_install() {
make clean
echo 'Asserting "idempotent" install path' >&2
- INSTALL3="$(mkdtemp)"
+ INSTALL3="$(tmpname)"
make install PREFIX="$INSTALL3"
make install PREFIX="$INSTALL3"
assert_installed_files "$INSTALL3"
@@ -127,21 +98,26 @@ assert_install() {
make clean
echo 'Asserting "destdir" install path' >&2
- DESTDIR="$(mkdtemp)"
- INSTALL4="$(mkdtemp)"
+ DESTDIR="$(tmpname)"
+ INSTALL4="$(tmpname)"
make install DESTDIR="$DESTDIR" PREFIX="$INSTALL4"
assert_installed_files "$DESTDIR/$INSTALL4"
make uninstall DESTDIR="$DESTDIR" PREFIX="$INSTALL4"
assert_uninstalled_files "$DESTDIR/$INSTALL4"
}
-assert_clean_clone() {
- CLONEDIR="$(mkdtemp)"
+check_clean_clone() {
+ um
+ unreachable
+ return 12
+ oijwsx
+ CLONEDIR="$(tmpname)/$NAME"
+ mkdir -p -- "$CLONEDIR"
cd "$CLONEDIR"
- git clone "$REPODIR" .
+ git clone "$OLDPWD" .
- make clean public dev-check
+ make dev
assert_no_diffs
make clean
assert_no_diffs
@@ -154,35 +130,59 @@ assert_clean_clone() {
fi
rm -rf aux/
- make clean check || {
+ make check || {
echo 'Cannot run "make check" without "aux/".' >&2
echo "Clone directory: $CLONEDIR" >&2
- exit 1
+ exit 1 #FIXME
}
assert_install
+ oijwsx
cd - > /dev/null
}
-assert_clean_checkout() {
- CHECKOUTDIR="$(mkdtemp)"
+check_clean_checkout() {
+ set -x
+ echo dois
+ dois
+ CHECKOUTDIR="$(tmpname)/$NAME"
+ mkdir -p -- "$CHECKOUTDIR"
git --work-tree="$CHECKOUTDIR" checkout HEAD -- .
cd "$CHECKOUTDIR"
FILECOUNT="$(find . -type f | wc -l)"
- make clean public dev-check
- make clean
+ : make clean public dev-check
+ : make clean
if [ "$FILECOUNT" != "$(find . -type f | wc -l)" ]; then
echo 'File count mismatch after "make clean".' >&2
echo "Checkout directory: $CHECKOUTDIR" >&2
exit 1
fi
- assert_install
+ assert_insta
cd - > /dev/null
}
-assert_clean_clone
-assert_clean_checkout
+set -eu
+# set -eE
+D="$(mkdtemp)"
+
+check_clean_clone && echo aaa
+exit
+if ! check_clean_clone; then
+ touch "$D"/clean-clone.err
+fi
+check_clean_clone
+# || touch "$D"/clean-clone.err
+# check_clean_checkout || touch "$D"/clean-checkout.err
+# check_no_aux
+wait
+tree "$D"
+if [ "$(find "$D" -name '*.err' | wc -l)" != 0 ]; then
+ find "$D" -name '*.err' | while read -r f; do
+ cat -- "${f%.err}"
+ done
+ exit 1
+fi
diff --git a/aux/checks/shellcheck.sh b/aux/checks/shellcheck.sh
index 40fd364..585a75f 100755
--- a/aux/checks/shellcheck.sh
+++ b/aux/checks/shellcheck.sh
@@ -1,6 +1,6 @@
#!/bin/sh
set -eu
-find . -name '*.sh' -print0 |
- xargs -0 awk 'FNR==1 && /^#!\/bin\/sh$/ { print FILENAME }' |
- xargs shellcheck
+git ls-files |
+ xargs awk '/^#!\/bin\/sh$/ { print FILENAME } { nextfile }' |
+ xargs shellcheck -x