Skip to content

Commit

Permalink
testscripts build target: check shell scripts for validity
Browse files Browse the repository at this point in the history
(also adding missing shebang lines)
  • Loading branch information
kytv committed Sep 20, 2013
1 parent df55573 commit 683ce32
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 2 deletions.
1 change: 1 addition & 0 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1380,6 +1380,7 @@
<exec executable="tests/scripts/checkpo.sh" failonerror="true" />
<exec executable="tests/scripts/checkutf8.sh" failonerror="true" />
<exec executable="tests/scripts/checkxml.sh" failonerror="true" />
<exec executable="tests/scripts/checkscripts.sh" failonerror="true" />
</target>


Expand Down
2 changes: 1 addition & 1 deletion core/c/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/bin/sh
#!/bin/sh

(cd jcpuid ; sh build.sh ; cd ..)
(cd jbigi ; sh build.sh ; cd ..)
Expand Down
2 changes: 1 addition & 1 deletion core/c/jbigi/build-all.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#/bin/sh
#!/bin/sh

case `uname -sr` in
MINGW*)
Expand Down
1 change: 1 addition & 0 deletions tests/scripts/checkpo.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
#
# Run 'msgfmt -c' on all .po files
# Returns nonzero on failure
Expand Down
72 changes: 72 additions & 0 deletions tests/scripts/checkscripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/sh

# Check scripts in the I2P source for validity by running with "sh -n
# $SCRIPTNAME". Optionally checks for bashisms if "checkbashisms" is installed.

# Exits 0 if no errors, non-zero otherwise


cd `dirname $0`/../..

# Only Bourne-compatible scripts should be in this list.
SCRIPTFILES="\
./apps/desktopgui/bundle-messages.sh \
./apps/i2psnark/java/bundle-messages.sh \
./apps/i2psnark/launch-i2psnark \
./apps/i2ptunnel/java/bundle-messages-proxy.sh \
./apps/i2ptunnel/java/bundle-messages.sh \
./apps/routerconsole/java/bundle-messages-news.sh \
./apps/routerconsole/java/bundle-messages.sh \
./apps/sam/c/examples/i2p-ping/pinger.sh \
./apps/susidns/src/bundle-messages.sh \
./apps/susimail/bundle-messages.sh \
./core/c/build.sh \
./core/c/jbigi/build-all.sh \
./core/c/jbigi/build_jbigi.sh \
./core/c/jbigi/build.sh \
./core/c/jbigi/mbuild-all.sh \
./core/c/jcpuid/build.sh \
./core/c/mbuild.sh \
./debian/i2p.config \
./debian/i2p-doc.preinst \
./debian/i2p.init \
./debian/i2p.postinst \
./debian/i2p.postrm \
./debian/i2p.preinst \
./debian/libjbigi-jni.preinst \
./debian/repack.sh \
./installer/resources/certificates/show.sh \
./installer/resources/install_i2p_service_osx.command \
./installer/resources/install_i2p_service_unix \
./installer/resources/locale/bundle-messages.sh \
./installer/resources/makegeoipv6.sh \
./installer/resources/postinstall.sh \
./installer/resources/runplain.sh \
./installer/resources/uninstall_i2p_service_osx.command
./installer/resources/uninstall_i2p_service_unix \
./tests/scripts/checkcerts.sh \
./tests/scripts/checkpo.sh \
./tests/scripts/checksitecert.sh \
./tests/scripts/checkutf8.sh \
./tests/scripts/checkxml.sh \
./tests/scripts/testjbigi.sh \
"

for script in $SCRIPTFILES; do
echo "Checking $script"
if sh -n "$script" ; then : ; else
echo "********* FAILED CHECK FOR $script *************"
FAIL=1
fi
if $(which checkbashisms > /dev/null 2>&1) ; then
checkbashisms $script
fi
done

if [ "$FAIL" != "" ]
then
echo "******** At least one file failed check *********"
else
echo "All files passed"
fi
exit $FAIL
1 change: 1 addition & 0 deletions tests/scripts/checkutf8.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
#
# Check for UTF-8 problems in all files where they might appear
# Also check all Java source files
Expand Down
1 change: 1 addition & 0 deletions tests/scripts/checkxml.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
#
# Validate XML and HTML files using xmllint
# Returns nonzero on failure
Expand Down
1 change: 1 addition & 0 deletions tests/scripts/testjbigi.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh
#
# Runs a test using each libjbigi-linux-*.so file
# Returns nonzero on failure, but it will always
Expand Down

0 comments on commit 683ce32

Please sign in to comment.