source: tests/scripts/checkscripts.sh @ 6d9aa92

Last change on this file since 6d9aa92 was 6d9aa92, checked in by zzz <zzz@…>, 10 months ago

Tests: Fix some bashisms, add more files to bashisms check

  • Property mode set to 100755
File size: 1.8 KB
Line 
1#!/bin/sh
2
3# Check scripts in the I2P source for validity by running with "sh -n
4# $SCRIPTNAME". Optionally checks for bashisms if "checkbashisms" is installed.
5
6# Exits 0 if no errors, non-zero otherwise
7
8
9cd `dirname $0`/../..
10
11# Only Bourne-compatible scripts should be in this list.
12SCRIPTFILES="\
13        ./apps/desktopgui/bundle-messages.sh \
14        ./apps/i2psnark/java/bundle-messages.sh \
15        ./apps/i2psnark/launch-i2psnark \
16        ./apps/i2ptunnel/java/bundle-messages*.sh \
17        ./apps/ministreaming/java/bundle-messages.sh \
18        ./apps/routerconsole/java/bundle-messages*.sh \
19        ./apps/sam/c/examples/i2p-ping/pinger.sh \
20        ./apps/susidns/src/bundle-messages.sh \
21        ./apps/susimail/bundle-messages.sh \
22        ./core/c/*.sh \
23        ./core/c/jbigi/*.sh \
24        ./debian/*.config \
25        ./debian/*.init \
26        ./debian/*.preinst \
27        ./debian/*.postinst \
28        ./debian/*.postrm \
29        ./Docker.entrypoint.sh
30        ./installer/resources/*.sh \
31        ./installer/resources/eepget \
32        ./installer/resources/i2prouter \
33        ./installer/resources/install_i2p_service_osx.command \
34        ./installer/resources/install_i2p_service_unix \
35        ./installer/resources/locale/bundle-messages.sh \
36        ./installer/resources/uninstall_i2p_service_osx.command
37        ./installer/resources/uninstall_i2p_service_unix \
38        ./launchers/macosx/check_latest_java.sh \
39        ./launchers/macosx/download_and_build_sparkle.sh \
40        ./Slackware/i2p/i2p.SlackBuild \
41        ./Slackware/i2p/doinst.sh \
42        ./Slackware/i2p/rc.i2p \
43        ./tests/scripts/*.sh \
44"
45
46echo "Checking scripts for bashisms ..."
47for script in $SCRIPTFILES; do
48    #echo "Checking $script ..."
49    if sh -n "$script" ; then : ; else
50        echo "********* FAILED CHECK FOR $script *************"
51        FAIL=1
52    fi
53    if $(which checkbashisms > /dev/null 2>&1) ; then
54        checkbashisms $script
55    fi
56done
57
58if [ "$FAIL" != "" ]
59then
60    echo "******** At least one file failed check *********"
61else
62    echo "All files passed"
63fi
64exit $FAIL
Note: See TracBrowser for help on using the repository browser.