diff options
author | Chase Qi <chase.qi@linaro.org> | 2014-09-11 16:15:07 +0800 |
---|---|---|
committer | Chase Qi <chase.qi@linaro.org> | 2014-09-11 16:15:07 +0800 |
commit | 9097fd91ccc4f614893065987eef82c41373da2d (patch) | |
tree | ac9ca1e705fedbb051fb12d8525a28b240bf85c5 /android/scripts/toolchain-android-measurement.sh | |
parent | 32eccfd0b610a48868aa84f4caafc80afa651d09 (diff) |
update
Diffstat (limited to 'android/scripts/toolchain-android-measurement.sh')
-rwxr-xr-x | android/scripts/toolchain-android-measurement.sh | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/android/scripts/toolchain-android-measurement.sh b/android/scripts/toolchain-android-measurement.sh new file mode 100755 index 0000000..121e2a1 --- /dev/null +++ b/android/scripts/toolchain-android-measurement.sh @@ -0,0 +1,89 @@ +#!/system/bin/sh +# +# toolchain test cases for Linaro Android +# +# Copyright (C) 2013, Linaro Limited. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# Author: Chase Qi <chase.qi@linaro.org> + +# Test case definitions +# Check if /proc/version and toolchain version not empty +toolchain_not_empty() { + echo -e "\n================" + echo "Check if /proc/version and toolchain version not empty" + echo "Content of /proc/version:" + echo `cat /proc/version` + version=`grep "Linaro GCC" /proc/version` + if [ -z "$version" ] + then + echo "toolchain_not_empty:" "fail" "0" + return 1 + else + echo "toolchain_not_empty:" "pass" "0" + fi +} + +# Check if toolchain version correct +toolchain_version_measurement() { + echo -e "\n================" + echo "Check if toolchain version correct" + echo "Content of /proc/version:" + echo `cat /proc/version` + LinaroGCC=`awk '{print substr($12,5,7)}' /proc/version` + BuildYear=`awk '{print $22;}' /proc/version` + BuildMonth=`awk '{print $18;}' /proc/version` + case $BuildMonth in + Jan) BuildMonth=01 ;; + Feb) BuildMonth=02 ;; + Mar) BuildMonth=03 ;; + Apr) BuildMonth=04 ;; + May) BuildMonth=05 ;; + Jun) BuildMonth=06 ;; + Jul) BuildMonth=07 ;; + Aug) BuildMonth=08 ;; + Sep) BuildMonth=09 ;; + Oct) BuildMonth=10 ;; + Nov) BuildMonth=11 ;; + Dec) BuildMonth=12 ;; + esac + BuildDay=`awk '{print $19;}' /proc/version` + Measurement=$BuildYear.$BuildMonth + + if [ $BuildDay -ge 16 ] + then + if [ "$LinaroGCC" != "$Measurement" ] + then + echo "Toolchain $Measurement should be used after the 15th" + echo "Toolchain used for this image: $LinaroGCC" + echo "toolchain_version_measurement:" "fail" "$LinaroGCC" + return 1 + else + echo "Toolchain version: $LinaroGCC" + echo "toolchain_version_measurement:" "pass" "$LinaroGCC" + fi + else + echo "Toolchain version: $LinaroGCC" + echo "toolchain_version_measurement:" "pass" "$LinaroGCC" + fi +} + +# run the tests +toolchain_not_empty +toolchain_version_measurement + +# clean exit so lava-test can trust the results +exit 0 |