aboutsummaryrefslogtreecommitdiff
path: root/check
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-16 14:24:31 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-16 14:24:50 +1200
commit2f5c3f189d83b6297a93dee83819092a63a33e88 (patch)
tree20bc97584202d210d0d6ac62c21afd7850c9e697 /check
parentf993d9a6e88d6b88aa9ed4967ea87a26a9841109 (diff)
downloaddotfiles-2f5c3f189d83b6297a93dee83819092a63a33e88.tar.gz
Rename "test" targets to "check"
Mostly to make way for an actual test suite beyond mere syntax checking
Diffstat (limited to 'check')
-rwxr-xr-xcheck/bash6
-rwxr-xr-xcheck/bin14
-rwxr-xr-xcheck/games14
-rwxr-xr-xcheck/man49
-rwxr-xr-xcheck/pdksh6
-rwxr-xr-xcheck/sh6
-rwxr-xr-xcheck/urxvt6
7 files changed, 101 insertions, 0 deletions
diff --git a/check/bash b/check/bash
new file mode 100755
index 00000000..f203c2c1
--- /dev/null
+++ b/check/bash
@@ -0,0 +1,6 @@
+#!/bin/sh
+for bash in bash/* bash/bashrc.d/* bash/bash_profile.d/* ; do
+ [ -f "$bash" ] || continue
+ bash -n "$bash" || exit
+done
+printf 'All bash(1) scripts parsed successfully.\n'
diff --git a/check/bin b/check/bin
new file mode 100755
index 00000000..a4d5e452
--- /dev/null
+++ b/check/bin
@@ -0,0 +1,14 @@
+#!/bin/sh
+for bin in bin/* ; do
+ [ -f "$bin" ] || continue
+ hb=$(sed 1q "$bin") || exit
+ case $hb in
+ *bash)
+ bash -n "$bin" || exit
+ ;;
+ *sh)
+ sh -n "$bin" || exit
+ ;;
+ esac
+done
+printf 'All shell scripts in bin parsed successfully.\n'
diff --git a/check/games b/check/games
new file mode 100755
index 00000000..3afe6414
--- /dev/null
+++ b/check/games
@@ -0,0 +1,14 @@
+#!/bin/sh
+for game in games/* ; do
+ [ -f "$game" ] || continue
+ hb=$(sed 1q "$game") || exit
+ case $hb in
+ *bash)
+ bash -n "$game" || exit
+ ;;
+ *sh)
+ sh -n "$game" || exit
+ ;;
+ esac
+done
+printf 'All shell scripts in games parsed successfully.\n'
diff --git a/check/man b/check/man
new file mode 100755
index 00000000..4b5a7831
--- /dev/null
+++ b/check/man
@@ -0,0 +1,49 @@
+#!/bin/sh
+# Check that manual pages and logical binaries match up
+
+# Need some scripts from the source directory
+PATH=bin:$PATH
+
+# Create temporary directory and implement cleanup function for it
+td=
+cleanup() {
+ rm -fr -- "$td"
+}
+for sig in EXIT HUP INT TERM ; do
+ trap cleanup "$sig"
+done
+td=$(mktd test-man) || exit
+
+# Get lists of logical binaries and manual pages
+for dir in bin games ; do (
+ cd -- "$dir"
+ pa *
+) done |
+sed 's/\...*$//' |
+sort | uniq > "$td"/bin
+for dir in man/man[168] ; do (
+ cd -- "$dir"
+ pa *.[168]
+) done |
+sed 's/\.[168]$//' |
+sort | uniq > "$td"/man
+
+# Get lists of noman scripts and nobin manual pages
+comm -23 "$td"/bin "$td"/man > "$td"/noman
+comm -13 "$td"/bin "$td"/man > "$td"/nobin
+
+# Emit the content of both, if any
+ex=0
+if [ -s "$td"/noman ] ; then
+ printf >&2 '%s\n' 'No manual pages found for:'
+ cat >&2 -- "$td"/noman
+ ex=1
+fi
+if [ -s "$td"/nobin ] ; then
+ printf >&2 '%s\n' 'Stray manual page for:'
+ cat >&2 -- "$td"/nobin
+ ex=1
+fi
+
+# Exit appropriately
+exit "$ex"
diff --git a/check/pdksh b/check/pdksh
new file mode 100755
index 00000000..fd1d55b7
--- /dev/null
+++ b/check/pdksh
@@ -0,0 +1,6 @@
+#!/bin/sh
+for pdksh in pdksh/* pdksh/pdkshrc.d/* ; do
+ [ -f "$pdksh" ] || continue
+ ksh -n "$pdksh" || exit
+done
+printf 'All pdksh scripts parsed successfully.\n'
diff --git a/check/sh b/check/sh
new file mode 100755
index 00000000..47e41c77
--- /dev/null
+++ b/check/sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+for sh in sh/* sh/profile.d/* ; do
+ [ -f "$sh" ] || continue
+ sh -n "$sh" || exit
+done
+printf 'All sh(1) scripts parsed successfully.\n'
diff --git a/check/urxvt b/check/urxvt
new file mode 100755
index 00000000..d27d6660
--- /dev/null
+++ b/check/urxvt
@@ -0,0 +1,6 @@
+#!/bin/sh
+for perl in urxvt/ext/* ; do
+ [ -f "$perl" ] || continue
+ perl -c "$perl" >/dev/null || exit
+done
+printf 'All Perl scripts in urxvt/ext parsed successfully.\n'