3 ##############################################################################
4 # Copyright (c) 2015 Ericsson AB and others.
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
12 # Run yardstick's flake8, unit, coverage, functional test
14 getopts ":f" FILE_OPTION
16 # don't write .pyc files this can cause odd unittest results
17 export PYTHONDONTWRITEBYTECODE=1
20 echo "Running flake8 ... "
21 logfile=test_results.log
22 if [ $FILE_OPTION == "f" ]; then
23 flake8 yardstick > $logfile
30 if [ $FILE_OPTION == "f" ]; then
31 echo "Results in $logfile"
41 echo "Get external libs needed for unit test"
43 echo "Running unittest ... "
44 if [ $FILE_OPTION == "f" ]; then
45 python -m unittest discover -v -s tests/unit > $logfile 2>&1
47 python -m unittest discover -v -s tests/unit
51 if [ $FILE_OPTION == "f" ]; then
52 echo "FAILED, results in $logfile"
56 if [ $FILE_OPTION == "f" ]; then
57 echo "OK, results in $logfile"
63 source tests/ci/cover.sh
67 run_functional_test() {
69 mkdir -p .testrepository
70 python -m subunit.run discover tests/functional > .testrepository/subunit.log
72 subunit2pyunit < .testrepository/subunit.log
74 subunit-stats < .testrepository/subunit.log
76 if [ $EXIT_CODE -ne 0 ]; then
83 export PYTHONPATH='yardstick/vTC/apexlake'