From 2f5c3f189d83b6297a93dee83819092a63a33e88 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 16 Aug 2016 14:24:31 +1200 Subject: Rename "test" targets to "check" Mostly to make way for an actual test suite beyond mere syntax checking --- check/bash | 6 ++++++ check/bin | 14 ++++++++++++++ check/games | 14 ++++++++++++++ check/man | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ check/pdksh | 6 ++++++ check/sh | 6 ++++++ check/urxvt | 6 ++++++ 7 files changed, 101 insertions(+) create mode 100755 check/bash create mode 100755 check/bin create mode 100755 check/games create mode 100755 check/man create mode 100755 check/pdksh create mode 100755 check/sh create mode 100755 check/urxvt (limited to 'check') 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' -- cgit v1.2.3