test.sh: enable a bunch of tests

add source directives to code for shellcheck. yay flow analysis!
master
FriendlyNeighborhoodShane 2 months ago
parent fccd8d9dd5
commit 64bdc4e38c

@ -71,6 +71,7 @@ mkdir -p "$tmpdir";
# Config
cp -f "$confdir/defconf-$confvar.txt" "$tmpdir/defconf";
# shellcheck source=./conf/dummy-defconf.txt
. "$tmpdir/defconf" || abort "Config for $confvar cannot be executed";
echo " ";

@ -36,6 +36,7 @@ stuff_download="
pre_update_actions() {
# shellcheck source=./res/util/func-resdl.sh
. "$resdir/util/func-resdl.sh";
return 0;

@ -35,6 +35,7 @@ for file in "/tmp/backuptool.functions" "/postinstall/tmp/backuptool.functions";
[ -f "$file" ] && { backuptool="$file"; break; }
done;
[ "$backuptool" ] || abort "could not find addon.d helper";
# shellcheck source=/dev/null
. "$backuptool" || abort "could not source addon.d helper ($backuptool)";
[ -f "$S/build.prop" ] || abort "could not find a ROM in $S";

@ -448,6 +448,7 @@ rm -rf "$filedir";
mkdir -p "$filedir";
unzip -o "$zipfile" "defconf" -d "$filedir/";
[ -f "$filedir/defconf" ] || abort "Could not find a default config";
# shellcheck source=./conf/dummy-defconf.txt
. "$filedir/defconf" || abort "Could not execute default config";
moddir="/data/media/0/$modname";

@ -25,20 +25,12 @@ done;
# These tests are only excluded in the command because they're pointless
# We don't need to do them and they only cloud the output
# SC1087: braces for array expansion
# False positive from extended regex
# Arrays aren't in sh anyway
# SC1090: non-constant source
# SC1091: not specified as input
# SC2034: assigned but not used
# SC2154: used but not assigned
# All three happen all the time due to sourcing
# Can't add directives because it's all dynamic
for script in src/META-INF/com/google/android/update-binary build.sh bump.sh test.sh update.sh res/util/script-addon.sh res/util/script-init.sh; do
echo " ";
echo " - Linting script: $script";
shellcheck -s sh -ax -W 0 -e 1087,1090,1091,2034,2154 "$@" -- "$workdir/$script";
shellcheck -s sh -ax -W 0 -e 2034 "$@" -- "$workdir/$script";
done;
echo " ";

@ -59,6 +59,7 @@ mkdir -p "$tmpdir" "$tmpdir/repos" "$(dirname "$updatelog")";
# Config
[ -f "$confdir/resdl-download.txt" ] || abort "No resdl-download.txt found";
# shellcheck source=./conf/resdl-download.txt
. "$confdir/resdl-download.txt" || abort "Cannot execute resdl-download.txt";
# Filter list by arguments if given

Loading…
Cancel
Save