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
17 echo "Running flake8 ... "
18 logfile=test_results.log
19 if [ $FILE_OPTION == "f" ]; then
20 flake8 yardstick > $logfile
27 if [ $FILE_OPTION == "f" ]; then
28 echo "Results in $logfile"
37 cd $(dirname ${BASH_SOURCE[0]})
38 TREX_DOWNLOAD="https://trex-tgn.cisco.com/trex/release/v2.05.tar.gz"
39 TREX_DIR=$PWD/trex/scripts
40 if [ ! -d "$TREX_DIR" ]; then
41 rm -rf ${TREX_DOWNLOAD##*/}
42 if [ ! -e ${TREX_DOWNLOAD##*/} ] ; then
45 tar zxvf ${TREX_DOWNLOAD##*/}
47 rm -rf trex && mkdir -p trex
50 touch "$PWD/trex/scripts/automation/trex_control_plane/stl/__init__.py"
54 export PYTHONPATH=$PYTHONPATH:"$PWD/trex/scripts/automation/trex_control_plane"
55 export PYTHONPATH=$PYTHONPATH:"$PWD/trex/scripts/automation/trex_control_plane/stl"
60 echo "Get external libs needed for unit test"
63 echo "Running unittest ... "
64 if [ $FILE_OPTION == "f" ]; then
65 python -m unittest discover -v -s tests/unit > $logfile 2>&1
67 python -m unittest discover -v -s tests/unit
71 if [ $FILE_OPTION == "f" ]; then
72 echo "FAILED, results in $logfile"
76 if [ $FILE_OPTION == "f" ]; then
77 echo "OK, results in $logfile"
83 source tests/ci/cover.sh
87 run_functional_test() {
89 mkdir -p .testrepository
90 python -m subunit.run discover tests/functional > .testrepository/subunit.log
92 subunit2pyunit < .testrepository/subunit.log
94 subunit-stats < .testrepository/subunit.log
96 if [ $EXIT_CODE -ne 0 ]; then
103 export PYTHONPATH='yardstick/vTC/apexlake'