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 | |
parent | 32eccfd0b610a48868aa84f4caafc80afa651d09 (diff) |
update
Diffstat (limited to 'android')
-rwxr-xr-x | android/scripts/toolchain-android-measurement.sh | 89 | ||||
-rwxr-xr-x | android/scripts/toolchain-android.sh | 60 | ||||
-rw-r--r-- | android/toolchain-android.yaml | 4 |
3 files changed, 97 insertions, 56 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 diff --git a/android/scripts/toolchain-android.sh b/android/scripts/toolchain-android.sh index 121e2a1..bd5ab94 100755 --- a/android/scripts/toolchain-android.sh +++ b/android/scripts/toolchain-android.sh @@ -21,69 +21,21 @@ # 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" +toolchain(){ echo "Content of /proc/version:" echo `cat /proc/version` - version=`grep "Linaro GCC" /proc/version` + version=`awk '{print substr($5,2,4),$6,$7,$8,$9,$11,$12;}' /proc/version` if [ -z "$version" ] then - echo "toolchain_not_empty:" "fail" "0" + echo "toolchain:" "fail" "toolchain not exist" return 1 else - echo "toolchain_not_empty:" "pass" "0" + echo "toolchain:" "pass" "$version" 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 +# run the test +toolchain # clean exit so lava-test can trust the results exit 0 diff --git a/android/toolchain-android.yaml b/android/toolchain-android.yaml index 7c031bc..d29fd86 100644 --- a/android/toolchain-android.yaml +++ b/android/toolchain-android.yaml @@ -1,7 +1,7 @@ metadata: name: toolchain-version format: "Lava-Test-Shell Test Definition 1.0" - description: "Check if toolchain version correct. If the build date later then the 15th of each month, new version toolchain should be used" + description: "Check toolchain version" maintainer: - chase.qi@linaro.org os: @@ -24,4 +24,4 @@ run: - "./android/scripts/toolchain-android.sh" parse: - pattern: "(?P<test_case_id>.*-*):\\s+(?P<result>(pass|fail))\\s+(?P<measurement>[0-9.]+)" + pattern: "(?P<test_case_id>.*-*):\\s+(?P<result>(pass|fail))\\s+(?P<measurement>\\s\\S+)" |