Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 1 | # Copyright 2017-present Open Networking Foundation |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 15 | # use bash for pushd/popd, and to fail quickly. virtualenv's activate |
| 16 | # has undefined variables, so no -u |
| 17 | SHELL = bash -e -o pipefail |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 18 | ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 19 | |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 20 | # Variables |
Gilles Depatie | 6c727ff | 2019-10-21 16:23:13 -0400 | [diff] [blame] | 21 | LINT_ARGS ?= --verbose --configure LineTooLong:120 --configure TooManyTestSteps:15 \ |
| 22 | --configure TooFewTestSteps:1 --configure TooFewKeywordSteps:1 |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 23 | VERSION ?= $(shell cat ./VERSION) |
Gilles Depatie | 45fbe04 | 2019-11-11 17:10:06 -0500 | [diff] [blame] | 24 | ROBOT_SANITY_SINGLE_PON_FILE ?= $(ROOT_DIR)/tests/data/bbsim-kind.yaml |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 25 | ROBOT_FAIL_SINGLE_PON_FILE ?= $(ROOT_DIR)/tests/data/bbsim-kind.yaml |
Gilles Depatie | 45fbe04 | 2019-11-11 17:10:06 -0500 | [diff] [blame] | 26 | ROBOT_SANITY_MULT_PON_FILE ?= $(ROOT_DIR)/tests/data/bbsim-kind-2x2.yaml |
| 27 | ROBOT_SCALE_SINGLE_PON_FILE ?= $(ROOT_DIR)/tests/data/bbsim-kind-16.yaml |
| 28 | ROBOT_SCALE_MULT_PON_FILE ?= $(ROOT_DIR)/tests/data/bbsim-kind-8x2.yaml |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 29 | ROBOT_DEBUG_LOG_OPT ?= |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 30 | |
hwchiu | 1128912 | 2019-11-27 16:20:15 +0000 | [diff] [blame] | 31 | ROBOT_SYSTEM_SETUP_MISC_ARGS ?= -i scaledown -l systemup_log.html -r systemup_report.html -o systemup_output.xml |
| 32 | ROBOT_SYSTEM_TEARDOWN_MISC_ARGS ?= -i scaleup -l systemdown_log.html -r systemdown_report.html -o sysstemdown_output.xml |
| 33 | ROBOT_SYSTEM_FILE ?= K8S_SystemTest.robot |
| 34 | |
hwchiu | 0601ec7 | 2019-10-08 00:04:43 +0000 | [diff] [blame] | 35 | .PHONY: gendocs |
| 36 | |
| 37 | ## Variables for gendocs |
| 38 | TEST_SOURCE := $(wildcard tests/*/*.robot) |
| 39 | TEST_BASENAME := $(basename $(TEST_SOURCE)) |
| 40 | TEST_DIRS := $(dir $(TEST_SOURCE)) |
| 41 | |
| 42 | LIB_SOURCE := $(wildcard libraries/*.robot) |
| 43 | LIB_BASENAME := $(basename $(LIB_SOURCE)) |
| 44 | LIB_DIRS := $(dir $(LIB_SOURCE)) |
| 45 | |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 46 | ROBOT_MISC_ARGS ?= |
hwchiu | 0601ec7 | 2019-10-08 00:04:43 +0000 | [diff] [blame] | 47 | |
Gilles Depatie | 45fbe04 | 2019-11-11 17:10:06 -0500 | [diff] [blame] | 48 | # for backwards compatibility |
| 49 | sanity-kind: sanity-single-kind |
| 50 | |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 51 | sanity-single-kind: ROBOT_MISC_ARGS += -i sanity $(ROBOT_DEBUG_LOG_OPT) |
Gilles Depatie | 45fbe04 | 2019-11-11 17:10:06 -0500 | [diff] [blame] | 52 | sanity-single-kind: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_SINGLE_PON_FILE) |
| 53 | sanity-single-kind: bbsim-kind |
| 54 | |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 55 | rwcore-restart-single-kind: ROBOT_MISC_ARGS += -X -i bbsimANDrwcore-restart $(ROBOT_DEBUG_LOG_OPT) |
| 56 | rwcore-restart-single-kind: ROBOT_CONFIG_FILE := $(ROBOT_FAIL_SINGLE_PON_FILE) |
| 57 | rwcore-restart-single-kind: ROBOT_FILE := Voltha_PODTests.robot |
| 58 | rwcore-restart-single-kind: voltha-test |
| 59 | |
| 60 | sanity-multi-kind: ROBOT_MISC_ARGS += -i sanity $(ROBOT_DEBUG_LOG_OPT) |
Gilles Depatie | 45fbe04 | 2019-11-11 17:10:06 -0500 | [diff] [blame] | 61 | sanity-multi-kind: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_MULT_PON_FILE) |
| 62 | sanity-multi-kind: bbsim-kind |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 63 | |
Suchitra Vemuri | 8a9c378 | 2019-10-23 12:43:01 -0700 | [diff] [blame] | 64 | bbsim-kind: ROBOT_MISC_ARGS += -X |
Gilles Depatie | 45fbe04 | 2019-11-11 17:10:06 -0500 | [diff] [blame] | 65 | bbsim-kind: ROBOT_FILE := Voltha_PODTests.robot |
| 66 | bbsim-kind: voltha-test |
| 67 | |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 68 | scale-single-kind: ROBOT_MISC_ARGS += -i active $(ROBOT_DEBUG_LOG_OPT) |
Gilles Depatie | 45fbe04 | 2019-11-11 17:10:06 -0500 | [diff] [blame] | 69 | scale-single-kind: ROBOT_CONFIG_FILE := $(ROBOT_SCALE_SINGLE_PON_FILE) |
| 70 | scale-single-kind: bbsim-scale-kind |
| 71 | |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 72 | scale-multi-kind: ROBOT_MISC_ARGS += -i active $(ROBOT_DEBUG_LOG_OPT) |
Gilles Depatie | 45fbe04 | 2019-11-11 17:10:06 -0500 | [diff] [blame] | 73 | scale-multi-kind: ROBOT_CONFIG_FILE := $(ROBOT_SCALE_MULT_PON_FILE) |
| 74 | scale-multi-kind: bbsim-scale-kind |
| 75 | |
David Bainbridge | f81cd64 | 2019-11-20 00:14:47 +0000 | [diff] [blame] | 76 | bbsim-scale-kind: ROBOT_MISC_ARGS += -X $(ROBOT_DEBUG_LOG_OPT) |
Gilles Depatie | 45fbe04 | 2019-11-11 17:10:06 -0500 | [diff] [blame] | 77 | bbsim-scale-kind: ROBOT_FILE := Voltha_ScaleFunctionalTests.robot |
| 78 | bbsim-scale-kind: voltha-test |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 79 | |
hwchiu | 1128912 | 2019-11-27 16:20:15 +0000 | [diff] [blame] | 80 | system-scale-test: ROBOT_FILE := Voltha_PODTests.robot |
| 81 | system-scale-test: ROBOT_MISC_ARGS += -X -i sanity |
| 82 | system-scale-test: ROBOT_CONFIG_FILE := $(ROBOT_SANITY_SINGLE_PON_FILE) |
| 83 | system-scale-test: k8s-system-test |
| 84 | |
hwchiu | 8569593 | 2019-12-18 08:05:25 +0000 | [diff] [blame^] | 85 | failure-test: ROBOT_MISC_ARGS += -X -i FailureTest $(ROBOT_DEBUG_LOG_OPT) |
| 86 | failure-test: ROBOT_FILE := $(ROBOT_SYSTEM_FILE) |
| 87 | failure-test: ROBOT_CONFIG_FILE := $(ROBOT_FAIL_SINGLE_PON_FILE) |
| 88 | failure-test: voltha-test |
| 89 | |
Andy Bavier | 70eab04 | 2019-12-14 14:16:26 -0700 | [diff] [blame] | 90 | voltha-test: ROBOT_MISC_ARGS += -e notready |
| 91 | k8s-system-test: ROBOT_MISC_ARGS += -e notready |
| 92 | |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 93 | # virtualenv for the robot tools |
| 94 | vst_venv: |
| 95 | virtualenv $@ ;\ |
| 96 | source ./$@/bin/activate ;\ |
| 97 | pip install -r requirements.txt |
| 98 | |
| 99 | test: lint |
| 100 | |
| 101 | lint: vst_venv |
| 102 | source ./vst_venv/bin/activate ;\ |
| 103 | set -u ;\ |
| 104 | find . -name *.robot -exec rflint $(LINT_ARGS) {} + |
| 105 | |
| 106 | # tidy will be more useful once this issue with removing leading comments is |
| 107 | # resolved: https://github.com/robotframework/robotframework/issues/3263 |
| 108 | tidy: |
| 109 | source ./vst_venv/bin/activate ;\ |
| 110 | set -u ;\ |
| 111 | find . -name *.robot -exec python -m robot.tidy --inplace {} \; |
| 112 | |
Gilles Depatie | 45fbe04 | 2019-11-11 17:10:06 -0500 | [diff] [blame] | 113 | voltha-test: vst_venv |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 114 | source ./vst_venv/bin/activate ;\ |
| 115 | set -u ;\ |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 116 | cd tests/functional ;\ |
Gilles Depatie | 45fbe04 | 2019-11-11 17:10:06 -0500 | [diff] [blame] | 117 | robot -V $(ROBOT_CONFIG_FILE) $(ROBOT_MISC_ARGS) $(ROBOT_FILE) |
hwchiu | 0601ec7 | 2019-10-08 00:04:43 +0000 | [diff] [blame] | 118 | |
hwchiu | 1128912 | 2019-11-27 16:20:15 +0000 | [diff] [blame] | 119 | #bbsim-only |
| 120 | k8s-system-test: vst_venv |
| 121 | source ./vst_venv/bin/activate ;\ |
| 122 | set -u ;\ |
| 123 | cd tests/functional ;\ |
| 124 | robot $(ROBOT_SYSTEM_SETUP_MISC_ARGS) $(ROBOT_MISC_ARGS) $(ROBOT_SYSTEM_FILE) && \ |
| 125 | robot -V $(ROBOT_CONFIG_FILE) $(ROBOT_MISC_ARGS) $(ROBOT_FILE) && \ |
| 126 | robot $(ROBOT_SYSTEM_TEARDOWN_MISC_ARGS) $(ROBOT_MISC_ARGS) $(ROBOT_SYSTEM_FILE) |
| 127 | |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 128 | gendocs: vst_venv |
| 129 | source ./vst_venv/bin/activate ;\ |
| 130 | set -u ;\ |
hwchiu | 0601ec7 | 2019-10-08 00:04:43 +0000 | [diff] [blame] | 131 | mkdir -p $@ ;\ |
| 132 | for dir in ${LIB_DIRS}; do mkdir -p $@/$$dir; done;\ |
| 133 | for dir in ${LIB_BASENAME}; do\ |
| 134 | python -m robot.libdoc --format HTML $$dir.robot $@/$$dir.html ;\ |
| 135 | done ;\ |
| 136 | for dir in ${TEST_DIRS}; do mkdir -p $@/$$dir; done;\ |
| 137 | for dir in ${TEST_BASENAME}; do\ |
| 138 | python -m robot.testdoc $$dir.robot $@/$$dir.html ;\ |
| 139 | done |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 140 | |
| 141 | # explore use of --docformat REST - integration w/Sphinx? |
| 142 | clean: |
| 143 | find . -name output.xml -print |
| 144 | |
| 145 | clean-all: clean |
| 146 | rm -rf vst_venv gendocs |