aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2016-08-01 18:50:05 +0800
committerChase Qi <chase.qi@linaro.org>2016-08-01 18:50:05 +0800
commitc7a5d5e089a1839836e7b23fe4dd5012ad5a511b (patch)
tree983cd9f6d66de805aa6a176d21cd65778206dc4a
parent7e9d29ccd7953cb80b6a30699926b4cc942bc821 (diff)
Improvements and bug fixesHEADmaster
* Added readme file * Changed defult output directory to ./output * Fixed a bug with '-o' by coverting input to absolute path * Changed yaml to pyyaml in requirements.txt
-rw-r--r--README.rst48
-rw-r--r--agenda-example.yaml4
-rwxr-xr-xlava-local-test.py16
-rw-r--r--requirements.txt2
4 files changed, 59 insertions, 11 deletions
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..66f0b0b
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,48 @@
+LAVA Local Test
++++++++++++++++
+lava-local-test is developed for executing LAVA test definitions on local test target. It feeds lava-test-runner with everything it needs and executes it without LAVA instance. lava-test-runner is part of lava-test-shell which is provided by `lava-dispatch <https://git.linaro.org/lava/lava-dispatcher.git>`_ for test automation.
+
+Requirements
+============
+- Python 2.7
+- Linux(Debian or fedora based)
+
+Basic Usage
+===========
+It uses Linaro `qa/test-definitions <https://git.linaro.org/qa/test-definitions.git>`_ as the default test repo, which can be modified with "-r". It supports remote git repo and local repo as well. Execute "./lava-local-test -h" for detailed help info. Either option "-d test_def" or "-a agenda_file" is required.
+ lava-local-test.py [-h] [-o LAVA_PATH] [-a AGENDA] [-r REPO] [-d TEST_DEF] [-t TEST_TIMEOUT] [-s]
+
+Examples
+--------
+Run a simple smoke test:
+ ./lava-local-test.py -d ubuntu/smoke-tests-basic.yaml
+
+Run multiple tests with agenda file. The current agenda schema supports to customize test params, skip install steps and set timeout for each test, refer to `agenda-example.yaml <./agenda-example.yaml>`_:
+ ./lava-local-test.py -a agenda-example.yaml
+
+Modify test output directory, the default is ./output:
+ ./lava-local-test.py -d ubuntu/smoke-tests-basic.yaml -o /tmp
+
+Specify a different remote git test definition repo:
+ ./lava-local-test.py -d ubuntu/smoke-tests-basic.yaml -r https://git.linaro.org/people/chase.qi/test-definitions.git
+
+Use a local test definition repo:
+ ./lava-local-test.py -d ubuntu/smoke-tests-basic.yaml -r ./test-definitions
+
+Skip install steps defined in test definition:
+ ./lava-local-test.py -d ubuntu/pi-stress-test.yaml -s
+
+Set test timeout to 30 minutes:
+ ./lava-local-test.py -d ubuntu/pi-stress-test.yaml -t 1800
+
+Test result files will be saved to ./output/results/test-name_uuid/ in json and csv format.
+
+For multiple test runs with agenda file, ./output/results.csv also will be created to collect test results from all tests.
+
+License
+=======
+LAVA Local Test is distributed under GPL Version 2.
+
+Feedback and Support
+====================
+Contact chase.qi@linaro.org
diff --git a/agenda-example.yaml b/agenda-example.yaml
index fcba369..74f0e26 100644
--- a/agenda-example.yaml
+++ b/agenda-example.yaml
@@ -1,6 +1,6 @@
-# support remote and local repo
-repository: https://git.linaro.org/qa/test-definitions.git
+# Support remote and local repo
# repository: ./test-definitions
+repository: https://git.linaro.org/qa/test-definitions.git
definitions:
- path: ubuntu/smoke-tests-basic.yaml
timeout: 180
diff --git a/lava-local-test.py b/lava-local-test.py
index 4a2b8f2..f59a4f4 100755
--- a/lava-local-test.py
+++ b/lava-local-test.py
@@ -205,17 +205,17 @@ class TestRunner(object):
if self.test_timeout:
print('Test timeout: %s' % self.test_timeout)
test_end = time.time() + self.test_timeout
+
while self.child.isalive():
+ if self.test_timeout and time.time() > test_end:
+ print('%s test timed out, killing test process.\n' % self.test_uuid)
+ self.child.terminate(force=True)
+ break
try:
self.child.expect('\n')
print(self.child.before)
except pexpect.TIMEOUT:
- if self.test_timeout and time.time() > test_end:
- print('%s test timed out, killing test process.\n' % self.test_uuid)
- self.child.terminate(force=True)
- break
- else:
- continue
+ continue
except pexpect.EOF:
print('%s test finished.\n' % self.test_uuid)
break
@@ -305,7 +305,7 @@ class ResultPaser(object):
# Parse arguments.
parser = argparse.ArgumentParser()
-parser.add_argument('-o', '--output', default='/result', dest='LAVA_PATH',
+parser.add_argument('-o', '--output', default='./output', dest='LAVA_PATH',
help='''
specify a directory to store test and result files.
Default: /result
@@ -336,7 +336,7 @@ parser.add_argument('-s', '--skip_install', dest='skip_install',
args = parser.parse_args()
# Obtain values from arguments.
-LAVA_PATH = args.LAVA_PATH
+LAVA_PATH = os.path.realpath(args.LAVA_PATH)
agenda = args.agenda
repo = args.repo
test_def = args.test_def
diff --git a/requirements.txt b/requirements.txt
index d4c3ab2..867cb6f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,2 +1,2 @@
pexpect
-yaml
+pyyaml