1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-10-03 18:42:38 +01:00

Initial commit of open source Workload Automation.

This commit is contained in:
Sergei Trofimov
2015-03-10 13:09:31 +00:00
commit a747ec7e4c
412 changed files with 41401 additions and 0 deletions

23
dev_scripts/README Normal file
View File

@@ -0,0 +1,23 @@
This directory contains scripts that aid the development of Workload Automation.
They were written to work as part of WA development environment and are not
guarnteed to work if moved outside their current location. They should not be
distributed as part of WA releases.
Scripts
-------
:clean_install: Performs a clean install of WA from source. This will remove any
existing WA install (regardless of whether it was made from
source or through a tarball with pip).
:clear_env: Clears ~/.workload_automation.
:get_apk_versions: Prints out a table of APKs and their versons found under the
path specified as the argument.
:pep8: Runs pep8 code checker (must be installed) over wlauto with the correct
settings for WA.
:pylint: Runs pylint (must be installed) over wlauto with the correct settings
for WA.

34
dev_scripts/clean_install Executable file
View File

@@ -0,0 +1,34 @@
#!/usr/bin/env python
import os
import sys
import shutil
import logging
logging.basicConfig(level=logging.INFO)
def get_installed_path():
paths = [p for p in sys.path if len(p) > 2]
for path in paths:
candidate = os.path.join(path, 'wlauto')
if os.path.isdir(candidate):
return candidate
if __name__ == '__main__':
installed_path = get_installed_path()
if installed_path:
logging.info('Removing installed package from {}.'.format(installed_path))
shutil.rmtree(installed_path)
if os.path.isdir('build'):
logging.info('Removing local build directory.')
shutil.rmtree('build')
logging.info('Removing *.pyc files.')
for root, dirs, files in os.walk('wlauto'):
for file in files:
if file.lower().endswith('.pyc'):
os.remove(os.path.join(root, file))
os.system('python setup.py install')

3
dev_scripts/clear_env Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
# Clear workload automation user environment.
rm -rf ~/.workload_automation/

25
dev_scripts/get_apk_versions Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env python
import os
import sys
import argparse
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from wlauto.exceptions import WAError
from wlauto.utils.misc import write_table
from distmanagement.apk import get_aapt_path, get_apk_versions
if __name__ == '__main__':
try:
aapt = get_aapt_path()
parser = argparse.ArgumentParser()
parser.add_argument('path', metavar='PATH', help='Location to look for APKs.')
args = parser.parse_args()
versions = get_apk_versions(args.path, aapt)
write_table([v.to_tuple() for v in versions], sys.stdout,
align='<<<>>', headers=['path', 'package', 'name', 'version code', 'version name'])
except WAError, e:
logging.error(e)
sys.exit(1)

22
dev_scripts/pep8 Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
EXCLUDE=wlauto/external/,wlauto/tests
EXCLUDE_COMMA=wlauto/core/bootstrap.py,wlauto/workloads/geekbench/__init__.py
IGNORE=E501,E265,E266,W391
if ! hash pep8 2>/dev/null; then
echo "pep8 not found in PATH"
echo "you can install it with \"sudo pip install pep8\""
exit 1
fi
if [[ "$1" == "" ]]; then
THIS_DIR="`dirname \"$0\"`"
pushd $THIS_DIR/.. > /dev/null
pep8 --exclude=$EXCLUDE,$EXCLUDE_COMMA --ignore=$IGNORE wlauto
pep8 --exclude=$EXCLUDE --ignore=$IGNORE,E241 $(echo "$EXCLUDE_COMMA" | sed 's/,/ /g')
popd > /dev/null
else
pep8 --exclude=$EXCLUDE,$EXCLUDE_COMMA --ignore=$IGNORE $1
fi

47
dev_scripts/pylint Executable file
View File

@@ -0,0 +1,47 @@
#!/bin/bash
target=$1
compare_versions() {
if [[ $1 == $2 ]]; then
return 0
fi
local IFS=.
local i ver1=($1) ver2=($2)
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)); do
ver1[i]=0
done
for ((i=0; i<${#ver1[@]}; i++)); do
if [[ -z ${ver2[i]} ]]; then
ver2[i]=0
fi
if ((10#${ver1[i]} > 10#${ver2[i]})); then
return 1
fi
if ((10#${ver1[i]} < 10#${ver2[i]})); then
return 2
fi
done
return 0
}
pylint_version=$(python -c 'from pylint.__pkginfo__ import version; print version')
compare_versions $pylint_version "1.3.0"
result=$?
if [ "$result" == "2" ]; then
echo "ERROR: pylint version must be at least 1.3.0; found $pylint_version"
exit 1
fi
THIS_DIR="`dirname \"$0\"`"
if [[ "$target" == "" ]]; then
pushd $THIS_DIR/.. > /dev/null
pylint --rcfile extras/pylintrc wlauto
popd > /dev/null
else
pylint --rcfile $THIS_DIR/../extras/pylintrc $target
fi