aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-08-02 16:23:49 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-08-02 16:31:22 +1200
commitd1c2c6339342083ceee1b96485dfc65893e68dca (patch)
treef416ef11c71c20ccc6e2eb3800b9f3a0a17d00ab
parentGet rid of a lot of comment boilerplate (diff)
downloaddotfiles-d1c2c6339342083ceee1b96485dfc65893e68dca.tar.gz
dotfiles-d1c2c6339342083ceee1b96485dfc65893e68dca.zip
Move tests and lints into their own scripts
Much nicer than having them embedded in the Makefile. Might do this for some of the more complex install targets too. Or maybe all of them ...
-rw-r--r--Makefile57
-rwxr-xr-xlint/bash2
-rwxr-xr-xlint/bin8
-rwxr-xr-xlint/games7
-rwxr-xr-xlint/sh2
-rwxr-xr-xlint/urxvt2
-rwxr-xr-xtest/bash7
-rwxr-xr-xtest/bin9
-rwxr-xr-xtest/games9
-rwxr-xr-xtest/sh7
-rwxr-xr-xtest/urxvt5
11 files changed, 68 insertions, 47 deletions
diff --git a/Makefile b/Makefile
index ac055872..19e79562 100644
--- a/Makefile
+++ b/Makefile
@@ -309,70 +309,33 @@ install-zsh :
test : test-bash test-bin test-games test-sh test-urxvt
test-bash :
- @for bash in bash/* bash/bashrc.d/* bash/bash_profile.d/* ; do \
- if [ -f "$$bash" ] && ! bash -n "$$bash" ; then \
- exit 1 ; \
- fi \
- done
- @printf 'All bash(1) scripts parsed successfully.\n'
+ test/bash
test-bin :
- @for bin in bin/* ; do \
- if sed 1q "$$bin" | grep -q 'bash$$' ; then \
- bash -n "$$bin" || exit 1 ; \
- elif sed 1q "$$bin" | grep -q 'sh$$' ; then \
- sh -n "$$bin" || exit 1 ; \
- fi ; \
- done
- @printf 'All shell scripts in bin parsed successfully.\n'
+ test/bin
test-games :
- @for game in games/* ; do \
- if sed 1q "$$game" | grep -q 'bash$$' ; then \
- bash -n "$$game" || exit 1 ; \
- elif sed 1q "$$game" | grep -q 'sh$$' ; then \
- sh -n "$$game" || exit 1 ; \
- fi ; \
- done
- @printf 'All shell scripts in games parsed successfully.\n'
+ test/games
test-sh :
- @for sh in sh/* sh/profile.d/* ; do \
- if [ -f "$$sh" ] && ! sh -n "$$sh" ; then \
- exit 1 ; \
- fi \
- done
- @printf 'All sh(1) scripts parsed successfully.\n'
+ test/sh
test-urxvt :
- @for perl in urxvt/ext/* ; do \
- perl -c "$$perl" >/dev/null || exit 1 ; \
- done
- @printf 'All Perl scripts in urxvt/ext parsed successfully.\n'
+ test/urxvt
lint : lint-sh lint-bash lint-bin lint-games lint-urxvt
lint-bash :
- find bash -type f -print -exec shellcheck -- {} \;
+ lint/bash
lint-bin :
- @for bin in bin/* ; do \
- if sed 1q "$$bin" | grep -q -- 'sh$$' ; then \
- printf '%s\n' "$$bin" ; \
- shellcheck -- "$$bin" ; \
- fi ; \
- done
+ lint/bin
lint-games :
- @for game in games/* ; do \
- if sed 1q "$$game" | grep -q -- 'sh$$' ; then \
- printf '%s\n' "$$game" ; \
- shellcheck -- "$$game" ; \
- fi ; \
- done
+ lint/games
lint-sh :
- find sh -type f -print -exec shellcheck -- {} \;
+ lint/sh
lint-urxvt :
- find urxvt/ext -type f -print -exec perlcritic --brutal -- {} \;
+ lint/urxvt
diff --git a/lint/bash b/lint/bash
new file mode 100755
index 00000000..80206f05
--- /dev/null
+++ b/lint/bash
@@ -0,0 +1,2 @@
+#!/bin/sh
+find bash -type f -print -exec shellcheck -- {} \;
diff --git a/lint/bin b/lint/bin
new file mode 100755
index 00000000..b9171652
--- /dev/null
+++ b/lint/bin
@@ -0,0 +1,8 @@
+
+#!/bin/sh
+for bin in bin/* ; do
+ if sed 1q "$bin" | grep -q -- 'sh$' ; then
+ printf '%s\n' "$bin"
+ shellcheck -- "$bin"
+ fi
+done
diff --git a/lint/games b/lint/games
new file mode 100755
index 00000000..1802b3fd
--- /dev/null
+++ b/lint/games
@@ -0,0 +1,7 @@
+#!/bin/sh
+for game in games/* ; do
+ if sed 1q "$game" | grep -q -- 'sh$' ; then
+ printf '%s\n' "$game"
+ shellcheck -- "$game"
+ fi
+done
diff --git a/lint/sh b/lint/sh
new file mode 100755
index 00000000..f21cdddd
--- /dev/null
+++ b/lint/sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+find sh -type f -print -exec shellcheck -- {} \;
diff --git a/lint/urxvt b/lint/urxvt
new file mode 100755
index 00000000..84f08619
--- /dev/null
+++ b/lint/urxvt
@@ -0,0 +1,2 @@
+#!/bin/sh
+find urxvt/ext -type f -print -exec perlcritic --brutal -- {} \;
diff --git a/test/bash b/test/bash
new file mode 100755
index 00000000..6f52d522
--- /dev/null
+++ b/test/bash
@@ -0,0 +1,7 @@
+#!/bin/sh
+for bash in bash/* bash/bashrc.d/* bash/bash_profile.d/* ; do
+ if [ -f "$bash" ] && ! bash -n "$bash" ; then
+ exit 1
+ fi
+done
+printf 'All bash(1) scripts parsed successfully.\n'
diff --git a/test/bin b/test/bin
new file mode 100755
index 00000000..c514495a
--- /dev/null
+++ b/test/bin
@@ -0,0 +1,9 @@
+#!/bin/sh
+for bin in bin/* ; do
+ if sed 1q "$bin" | grep -q 'bash$' ; then
+ bash -n "$bin" || exit 1
+ elif sed 1q "$bin" | grep -q 'sh$' ; then
+ sh -n "$bin" || exit 1
+ fi
+done
+printf 'All shell scripts in bin parsed successfully.\n'
diff --git a/test/games b/test/games
new file mode 100755
index 00000000..f75de7a5
--- /dev/null
+++ b/test/games
@@ -0,0 +1,9 @@
+#!/bin/sh
+for game in games/* ; do
+ if sed 1q "$game" | grep -q 'bash$' ; then
+ bash -n "$game" || exit 1
+ elif sed 1q "$game" | grep -q 'sh$' ; then
+ sh -n "$game" || exit 1
+ fi
+done
+printf 'All shell scripts in games parsed successfully.\n'
diff --git a/test/sh b/test/sh
new file mode 100755
index 00000000..354a40c7
--- /dev/null
+++ b/test/sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+for sh in sh/* sh/profile.d/* ; do
+ if [ -f "$sh" ] && ! sh -n "$sh" ; then
+ exit 1
+ fi
+done
+printf 'All sh(1) scripts parsed successfully.\n'
diff --git a/test/urxvt b/test/urxvt
new file mode 100755
index 00000000..90a298d7
--- /dev/null
+++ b/test/urxvt
@@ -0,0 +1,5 @@
+#!/bin/sh
+for perl in urxvt/ext/* ; do
+ perl -c "$perl" >/dev/null || exit 1
+done
+printf 'All Perl scripts in urxvt/ext parsed successfully.\n'