diff options
-rwxr-xr-x | install-wa2.sh | 53 | ||||
-rwxr-xr-x | prepare-config.py | 7 | ||||
-rwxr-xr-x | prerequisites.sh | 42 | ||||
-rwxr-xr-x | run-workload.sh | 37 | ||||
-rwxr-xr-x | setup-linux-target.sh | 19 | ||||
-rwxr-xr-x | tear-down.sh | 15 | ||||
-rwxr-xr-x | templates/config-generic-linux.py | 24 | ||||
-rwxr-xr-x | templates/generic-linux.yaml | 21 | ||||
-rw-r--r-- | wa2host.yaml | 13 | ||||
-rw-r--r-- | wa2target-linux.yaml | 37 |
10 files changed, 178 insertions, 90 deletions
diff --git a/install-wa2.sh b/install-wa2.sh index af24bc3..3238c6e 100755 --- a/install-wa2.sh +++ b/install-wa2.sh @@ -21,34 +21,39 @@ BUILD_TOOLS_URL=$1 WA_HOME_URL=$2 +CONFIG=./templates/$3 export PATH=$PATH:/usr/local/bin -# install SDK build-tools -echo "install SDK build-tools" -cd /usr/ -pwd -# TODO: build-tools.tar.gz only accessible from Linaro LAVA lab -wget $BUILD_TOOLS_URL -tar -xvf build-tools.tar.gz -cd - +# Skip SDK and APK installation on Linux. +grep "^device = '.*_linux'" $CONFIG +if [ $? -ne 0 ]; then + # install SDK build-tools + echo "install SDK build-tools" + cd /usr/ + pwd + # TODO: build-tools.tar.gz only accessible from Linaro LAVA lab + wget $BUILD_TOOLS_URL + tar -xvf build-tools.tar.gz + cd - -# clone workload-automation git repo -echo "clone workload-automation git repo from github" -git clone https://github.com/ARM-software/workload-automation.git -cd workload-automation -echo "python setup.py sdist" -python setup.py sdist -echo "sudo pip install dist/wlauto-*.tar.gz" -sudo pip install dist/wlauto-*.tar.gz + # install workloads dependencies bbench and APKs. + echo "install workloads bbench and APKs" + cd /root + id + cd; pwd + # TODO: workload_automation_home.tar.gz only accessible from Linaro LAVA lab + wget $WA_HOME_URL + tar -xvf workload_automation_home.tar.gz +fi -# install workloads dependencies bbench and APKs. -echo "install workloads bbench and APKs" -cd /root -id -cd; pwd -# TODO: workload_automation_home.tar.gz only accessible from Linaro LAVA lab -wget $WA_HOME_URL -tar -xvf workload_automation_home.tar.gz +# Update pip and setuptools. Since the old version pip is cached +# as /usr/bin/pip, clear it to use new location /usr/local/bin/pip +pip install --upgrade pip +hash -r +pip install --upgrade setuptools +# Install the latest development version WA2 from GitHub +git clone https://github.com/ARM-software/workload-automation.git +pip install ./workload-automation # create folder for database results mkdir -p /root/db_results/ diff --git a/prepare-config.py b/prepare-config.py index 66d6ad4..3678ee4 100755 --- a/prepare-config.py +++ b/prepare-config.py @@ -72,9 +72,14 @@ if __name__ == '__main__': sys.exit(1) config = open(os.path.join(CONFIG_PATH, options.config), "r") config_template = Template(config.read()) + config.seek(0) + linux = False + for line in config: + if line.startswith('device = ') and '_linux' in line: + linux = True config.close() dest_config = open(CONFIG_NAME, "w") - if isgoodipv4(ipaddr): + if isgoodipv4(ipaddr) and not linux: dest_config.write(config_template.safe_substitute(ipaddr=ipaddr + ":5555")) else: dest_config.write(config_template.safe_substitute(ipaddr=ipaddr)) diff --git a/prerequisites.sh b/prerequisites.sh deleted file mode 100755 index 2eba199..0000000 --- a/prerequisites.sh +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# -# Workload Automation v2 for LAVA -# -# Copyright (C) 2015, 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: Naresh Kamboju <naresh.kamboju@linaro.org> -# - -apt-get -y install python-pip || true -export PATH=$PATH:/usr/bin -PIP_VERSION=`pip --version | awk '{print $2}'` -PIP_OLD_VERSION="1.5.4" -if [ "$PIP_VERSION" == $PIP_OLD_VERSION ]; then - - which pip - pip --version - - sudo chmod -R a+r /usr/local/lib/python2.7/dist-packages - sudo find /usr/local/lib/python2.7/dist-packages -type d -exec chmod a+x {} \; - sudo pip install --upgrade pip --force - sudo pip install --upgrade setuptools - - export PATH=$PATH:/usr/local/bin - which pip - pip --version -fi -exit 0 diff --git a/run-workload.sh b/run-workload.sh index 3e549e5..29acf12 100755 --- a/run-workload.sh +++ b/run-workload.sh @@ -35,19 +35,34 @@ cat $1 echo -e "**********************\n" echo -e "CPU status" echo -e "**********************\n" + IPADDR=`cat IPADDR` -expr "$IPADDR" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' -if [ $? -eq 0 ]; then adb connect $IPADDR; IPADDR=$IPADDR; fi -adb -s $IPADDR shell "cat /proc/cpuinfo" -echo -n "online: " -adb -s $IPADDR shell "cat /sys/devices/system/cpu/online" -echo -n "offline: " -adb -s $IPADDR shell "cat /sys/devices/system/cpu/offline" -echo -n "possible: " -adb -s $IPADDR shell "cat /sys/devices/system/cpu/possible" +grep "^device = '.*_linux'" ./config.py +if [ $? -ne 0 ]; then + expr "$IPADDR" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' + if [ $? -eq 0 ]; then adb connect $IPADDR; IPADDR=$IPADDR:5555; fi + adb -s $IPADDR wait-for-device + adb -s $IPADDR shell "cat /proc/cpuinfo" + echo -n "online: " + adb -s $IPADDR shell "cat /sys/devices/system/cpu/online" + echo -n "offline: " + adb -s $IPADDR shell "cat /sys/devices/system/cpu/offline" + echo -n "possible: " + adb -s $IPADDR shell "cat /sys/devices/system/cpu/possible" + echo -n "IKS enabled: " + adb -s $IPADDR shell "cat /sys/kernel/bL_switcher/active" +else + sshpass -p linarolinaro ssh -o StrictHostKeyChecking=no root@$IPADDR "cat /proc/cpuinfo" + echo -n "online: " + sshpass -p linarolinaro ssh root@$IPADDR "cat /sys/devices/system/cpu/online" + echo -n "offline: " + sshpass -p linarolinaro ssh root@$IPADDR "cat /sys/devices/system/cpu/offline" + echo -n "possible: " + sshpass -p linarolinaro ssh root@$IPADDR "cat /sys/devices/system/cpu/possible" + echo -n "IKS enabled: " + sshpass -p linarolinaro ssh root@$IPADDR "cat /sys/kernel/bL_switcher/active" +fi -echo -n "IKS enabled: " -adb -s $IPADDR shell "cat /sys/kernel/bL_switcher/active" echo -e "**********************\n" echo "wa run $1 -v -f -d $2 -c config.py" # make sure /usr/local/bin is included in the path diff --git a/setup-linux-target.sh b/setup-linux-target.sh new file mode 100755 index 0000000..55cad6c --- /dev/null +++ b/setup-linux-target.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -x + +result_parser(){ + if [ $? -eq 0 ]; then + lava-test-case $1 --result pass + else + lava-test-case $1 --result fail + fi +} + +# Enable root login with password. +sed -i 's/^PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config +grep "PermitRootLogin yes" /etc/ssh/sshd_config +result_parser step1-enable-root-login + +# Change root password to "linarolinaro". +echo "root:linarolinaro" | chpasswd +result_parser step2-change-root-passwd diff --git a/tear-down.sh b/tear-down.sh index 3211aea..a6ac6b9 100755 --- a/tear-down.sh +++ b/tear-down.sh @@ -1,11 +1,16 @@ #!/bin/bash IPADDR=`cat IPADDR` -adb devices -expr "$IPADDR" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' -if [ $? -eq 0 ] +# Skip adb disconnect steps on Linux. +grep "^device = '.*_linux'" ./config.py +if [ $? -ne 0 ] then - echo "Disconnecting adb from $IPADDR:5555" - adb disconnect $IPADDR:5555 adb devices + expr "$IPADDR" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*$' + if [ $? -eq 0 ] + then + echo "Disconnecting adb from $IPADDR:5555" + adb disconnect $IPADDR:5555 + adb devices + fi fi diff --git a/templates/config-generic-linux.py b/templates/config-generic-linux.py new file mode 100755 index 0000000..d15addb --- /dev/null +++ b/templates/config-generic-linux.py @@ -0,0 +1,24 @@ +reboot_policy = 'never' +execution_order = 'by_iteration' +instrumentation = [ + 'execution_time', +] +result_processors = [ + 'standard', + 'csv', + 'json', + 'sqlite' +] +logging = { + 'file format': '%(asctime)s %(levelname)-8s %(name)s: %(message)s', + 'verbose format': '%(asctime)s %(levelname)-8s %(name)s: %(message)s', + 'regular format': '%(levelname)-8s %(message)s', + 'colour_enabled': True, +} + +device = 'generic_linux' +device_config = dict( + host = '$ipaddr', + username = 'root', + password = 'linarolinaro' +) diff --git a/templates/generic-linux.yaml b/templates/generic-linux.yaml new file mode 100755 index 0000000..e2d7a00 --- /dev/null +++ b/templates/generic-linux.yaml @@ -0,0 +1,21 @@ +config: + instrumentation: [~execution_time] + result_processors: [sqlite] + sqlite_database: ~/.workload_automation/wa_results.db +workloads: + - id: cyclictest + name: cyclictest + - id: dhrystone + name: dhrystone + - id: hackbench + name: hackbench + - id: idle + name: idle + - id: linpack-cli + name: linpack-cli + - id: memcpy + name: memcpy + - id: stream + name: stream + - id: sysbench + name: sysbench diff --git a/wa2host.yaml b/wa2host.yaml index 764b735..9ff10f4 100644 --- a/wa2host.yaml +++ b/wa2host.yaml @@ -19,7 +19,7 @@ params: # name of the template for device config CONFIG: "config-juno.py" SIGNAL_PREFIX: "workload" - DEPENDENCIES: "git wget zip xz-utils python python-yaml python-lxml python-setuptools python-numpy python-colorama python-pip sqlite3 libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386 android-tools-adb android-tools-fastboot" + DEPENDENCIES: "git wget zip xz-utils python python-yaml python-lxml python-setuptools python-numpy python-colorama python-pip sqlite3 libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386 android-tools-adb android-tools-fastboot time sysstat openssh-client openssh-server sshpass" # TODO: build-tools.tar.gz only accessible from Linaro LAVA lab # TODO: Provide a valid build-tools URL from Json @@ -31,8 +31,7 @@ params: install: steps: - './install-deps.sh $DEPENDENCIES' - - './prerequisites.sh' - - './install-wa2.sh $BUILD_TOOLS_URL $WA_HOME_URL' + - './install-wa2.sh $BUILD_TOOLS_URL $WA_HOME_URL $CONFIG' run: steps: @@ -42,7 +41,7 @@ run: - lava-test-case step2-$SIGNAL_PREFIX-wait-for-ip --shell lava-wait $SIGNAL_PREFIX-send-ip - lava-test-case step3-$SIGNAL_PREFIX-prepare-config --shell ./prepare-config.py --prefix $SIGNAL_PREFIX --config $CONFIG - lava-test-case step4-$SIGNAL_PREFIX-run-workload --shell ./run-workload.sh $AGENDA $JOB_NAME - - if [ -f ./$JOB_NAME/results.csv ]; then lava-test-case-attach step5-$SIGNAL_PREFIX-run-workload ./$JOB_NAME/results.csv; fi - - if [ -f ./$JOB_NAME/run.log ]; then lava-test-case-attach step6-$SIGNAL_PREFIX-run-workload ./$JOB_NAME/run.log; fi - - lava-test-case step7-$SIGNAL_PREFIX-tear-down --shell ./tear-down.sh $JOB_NAME - - lava-test-case step8-$SIGNAL_PREFIX-multinode-sync --shell lava-sync $SIGNAL_PREFIX-finished + - tar caf ${JOB_NAME}.tar.xz $JOB_NAME + - lava-test-run-attach ${JOB_NAME}.tar.xz + - lava-test-case step5-$SIGNAL_PREFIX-tear-down --shell ./tear-down.sh $JOB_NAME + - lava-test-case step6-$SIGNAL_PREFIX-multinode-sync --shell lava-sync $SIGNAL_PREFIX-finished diff --git a/wa2target-linux.yaml b/wa2target-linux.yaml new file mode 100644 index 0000000..2bcede7 --- /dev/null +++ b/wa2target-linux.yaml @@ -0,0 +1,37 @@ +metadata: + format: Lava-Test Test Definition 1.0 + name: wa2-target + description: "WAv2 - target part of multinode job" + maintainer: + - milosz.wasilewski@linaro.org + - chase.qi@linaro.org + os: + - ubuntu + scope: + - functional + - performance + devices: + - vexpress-tc2 + - juno + - beaglebone-black + - mustang + - hi6220-hikey + - apq8016-sbc + +params: + SIGNAL_PREFIX: "workload" + +install: + deps: + - openssh-client + - openssh-server +run: + steps: + - set -x + # step1-enable-root-login and step2-change-root-passwd + - ./setup-linux-target.sh + - lava-test-case step3-restart-ssh-server --shell service ssh restart + - IPADDR=$(hostname -I) + - if [ -z $IPADDR ]; then IPADDR="_MISSING_"; fi + - lava-test-case step4-$SIGNAL_PREFIX-send-ip --shell lava-send $SIGNAL_PREFIX-send-ip $SIGNAL_PREFIX-ipaddr=$IPADDR + - lava-test-case step5-$SIGNAL_PREFIX-multinode-sync --shell lava-sync $SIGNAL_PREFIX-finished |