aboutsummaryrefslogtreecommitdiff
path: root/build/lib.linux-x86_64-2.7/lava_android_test/main.py
diff options
context:
space:
mode:
authorYongqin Liu <yongqin.liu@linaro.org>2015-01-03 17:46:21 +0800
committerYongqin Liu <yongqin.liu@linaro.org>2015-01-03 17:46:21 +0800
commitcf7013d6e23f0a0da3bcae5fb9d8e20639b1d21f (patch)
tree4888505a53fc2070d376945391ae48bbee333166 /build/lib.linux-x86_64-2.7/lava_android_test/main.py
downloadlava-android-test-cf7013d6e23f0a0da3bcae5fb9d8e20639b1d21f.tar.gz
first commit
Signed-off-by: Yongqin Liu <yongqin.liu@linaro.org>
Diffstat (limited to 'build/lib.linux-x86_64-2.7/lava_android_test/main.py')
-rw-r--r--build/lib.linux-x86_64-2.7/lava_android_test/main.py63
1 files changed, 63 insertions, 0 deletions
diff --git a/build/lib.linux-x86_64-2.7/lava_android_test/main.py b/build/lib.linux-x86_64-2.7/lava_android_test/main.py
new file mode 100644
index 0000000..cb39a72
--- /dev/null
+++ b/build/lib.linux-x86_64-2.7/lava_android_test/main.py
@@ -0,0 +1,63 @@
+# Copyright (c) 2010-2012 Linaro
+#
+# 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 3 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, see <http://www.gnu.org/licenses/>.
+import os
+import sys
+import shutil
+from tempfile import mkdtemp
+from lava_android_test import utils
+from lava_android_test.config import get_config, set_config
+from lava_tool.dispatcher import LavaDispatcher, run_with_dispatcher_class
+
+
+class LAVAAndroidTestDispatcher(LavaDispatcher):
+ toolname = 'lava_android_test'
+ description = """
+ LAVA Android Test wrapper framework
+ """
+ epilog = """
+ Please report all bugs using the Launchpad bug tracker:
+ http://bugs.launchpad.net/lava-android-test/+filebug
+ """
+
+
+def check_adb_installed():
+ return utils.check_command_exist('adb')
+
+
+def main():
+ if not check_adb_installed():
+ print >> sys.stderr, "Can't find the command adb."
+ print >> sys.stderr, ("Please add the path of adb"
+ " command to PATH environment.")
+ sys.exit(1)
+
+ config = get_config()
+ try:
+ if not os.path.exists(config.tempdir_host):
+ os.makedirs(config.tempdir_host)
+ #make every user can write/read this directory
+ os.chmod(config.tempdir_host, 0777)
+ config.tempdir_host = mkdtemp(dir=config.tempdir_host)
+ set_config(config)
+ os.chmod(config.tempdir_host, 0755)
+ run_with_dispatcher_class(LAVAAndroidTestDispatcher)
+ finally:
+ #can't remove the parent directory, because there may be other
+ #instance using the parent directory
+ shutil.rmtree(config.tempdir_host)
+
+
+if __name__ == '__main__':
+ main()