Refactor fails into a fail command
This commit is contained in:
parent
ad1795f6ed
commit
5cf903354f
|
@ -94,3 +94,5 @@ navigation_bar_width
|
||||||
notification_header_padding_top
|
notification_header_padding_top
|
||||||
notification_header_padding_bottom
|
notification_header_padding_bottom
|
||||||
config_fillMainBuiltInDisplayCutout
|
config_fillMainBuiltInDisplayCutout
|
||||||
|
config_dozeAfterScreenOff
|
||||||
|
config_autoBrightnessAmbientLightHorizon
|
||||||
|
|
|
@ -3,6 +3,16 @@
|
||||||
base="$(dirname "$(readlink -f -- $0)")/.."
|
base="$(dirname "$(readlink -f -- $0)")/.."
|
||||||
cd $base
|
cd $base
|
||||||
|
|
||||||
|
#Usage: fail <file> <message> [ignore string]
|
||||||
|
fail() {
|
||||||
|
if [ -z "$3" ] || ! grep -qF "$3" "$1";then
|
||||||
|
echo "F: $1: $2"
|
||||||
|
touch fail
|
||||||
|
else
|
||||||
|
echo "W: $1: $2"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#Keep knownKeys
|
#Keep knownKeys
|
||||||
rm -f tests/priorities fail
|
rm -f tests/priorities fail
|
||||||
touch tests/priorities tests/knownKeys
|
touch tests/priorities tests/knownKeys
|
||||||
|
@ -11,8 +21,7 @@ find -name AndroidManifest.xml |while read manifest;do
|
||||||
#Ensure this overlay doesn't override blacklist-ed properties
|
#Ensure this overlay doesn't override blacklist-ed properties
|
||||||
for b in $(cat tests/blacklist);do
|
for b in $(cat tests/blacklist);do
|
||||||
if grep -qRF "$b" $folder;then
|
if grep -qRF "$b" $folder;then
|
||||||
echo "Overlay $folder is defining $b which is forbidden"
|
fail $folder "Overlay $folder is defining $b which is forbidden"
|
||||||
touch fail
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -23,15 +32,14 @@ find -name AndroidManifest.xml |while read manifest;do
|
||||||
#Ensure priorities unique-ness
|
#Ensure priorities unique-ness
|
||||||
priority="$(xmlstarlet sel -t -m '//overlay' -v @android:priority -n $manifest)"
|
priority="$(xmlstarlet sel -t -m '//overlay' -v @android:priority -n $manifest)"
|
||||||
if grep -qE '^'$priority'$' tests/priorities;then
|
if grep -qE '^'$priority'$' tests/priorities;then
|
||||||
echo $manifest priority $priority conflicts with another manifest
|
fail $manifest "priority $priority conflicts with another manifest"
|
||||||
touch fail
|
|
||||||
fi
|
fi
|
||||||
echo $priority >> tests/priorities
|
echo $priority >> tests/priorities
|
||||||
|
|
||||||
systemPropertyName="$(xmlstarlet sel -t -m '//overlay' -v @android:requiredSystemPropertyName -n $manifest)"
|
systemPropertyName="$(xmlstarlet sel -t -m '//overlay' -v @android:requiredSystemPropertyName -n $manifest)"
|
||||||
if [ "$systemPropertyName" == "ro.vendor.product.name" ];then
|
if [ "$systemPropertyName" == "ro.vendor.product.name" ];then
|
||||||
echo "$manifest: ro.vendor.product.name is deprecated. Please use ro.vendor.build.fingerprint"
|
fail "$manifest" "ro.vendor.product.name is deprecated. Please use ro.vendor.build.fingerprint" \
|
||||||
touch fail
|
'TESTS: Ignore ro.vendor.product.name'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Ensure the overloaded properties exist in AOSP
|
#Ensure the overloaded properties exist in AOSP
|
||||||
|
@ -46,18 +54,15 @@ find -name AndroidManifest.xml |while read manifest;do
|
||||||
ag '"'$key'"' /build/AOSP-8.1/frameworks/base/core/res/res)> /dev/null ;then
|
ag '"'$key'"' /build/AOSP-8.1/frameworks/base/core/res/res)> /dev/null ;then
|
||||||
echo $key >> tests/knownKeys
|
echo $key >> tests/knownKeys
|
||||||
else
|
else
|
||||||
echo $xml defines a non-existing attribute $key
|
fail "$xml" "defines a non-existing attribute $key"
|
||||||
touch fail
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
rm -f tests/priorities
|
rm -f tests/priorities
|
||||||
|
|
||||||
if find -name \*.xml |xargs dos2unix -ic |grep -qE .;then
|
find -name \*.xml |xargs dos2unix -ic |while read f;do
|
||||||
echo "The following files have dos end of lines"
|
fail $f "File is DOS type"
|
||||||
find -name \*.xml |xargs dos2unix -ic
|
done
|
||||||
touch fail
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f fail ];then exit 1; fi
|
if [ -f fail ];then exit 1; fi
|
||||||
|
|
Loading…
Reference in a new issue