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 |
| 21 | LINT_ARGS ?= --verbose --configure LineTooLong:120 --configure TooManyTestSteps:15 |
| 22 | VERSION ?= $(shell cat ./VERSION) |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 23 | ROBOT_VAR_FILE ?= $(ROOT_DIR)/tests/data/bbsim-kind.yaml |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 24 | |
hwchiu | 0601ec7 | 2019-10-08 00:04:43 +0000 | [diff] [blame] | 25 | .PHONY: gendocs |
| 26 | |
| 27 | ## Variables for gendocs |
| 28 | TEST_SOURCE := $(wildcard tests/*/*.robot) |
| 29 | TEST_BASENAME := $(basename $(TEST_SOURCE)) |
| 30 | TEST_DIRS := $(dir $(TEST_SOURCE)) |
| 31 | |
| 32 | LIB_SOURCE := $(wildcard libraries/*.robot) |
| 33 | LIB_BASENAME := $(basename $(LIB_SOURCE)) |
| 34 | LIB_DIRS := $(dir $(LIB_SOURCE)) |
| 35 | |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 36 | ROBOT_MISC_ARGS ?= |
hwchiu | 0601ec7 | 2019-10-08 00:04:43 +0000 | [diff] [blame] | 37 | |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 38 | sanity-kind: ROBOT_MISC_ARGS += -i sanity |
| 39 | sanity-kind: bbsim-kind |
| 40 | |
| 41 | bbsim-kind: ROBOT_MISC_ARGS += -v num_onus:1 -X |
| 42 | bbsim-kind: voltha-podtest |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 43 | |
| 44 | # virtualenv for the robot tools |
| 45 | vst_venv: |
| 46 | virtualenv $@ ;\ |
| 47 | source ./$@/bin/activate ;\ |
| 48 | pip install -r requirements.txt |
| 49 | |
| 50 | test: lint |
| 51 | |
| 52 | lint: vst_venv |
| 53 | source ./vst_venv/bin/activate ;\ |
| 54 | set -u ;\ |
| 55 | find . -name *.robot -exec rflint $(LINT_ARGS) {} + |
| 56 | |
| 57 | # tidy will be more useful once this issue with removing leading comments is |
| 58 | # resolved: https://github.com/robotframework/robotframework/issues/3263 |
| 59 | tidy: |
| 60 | source ./vst_venv/bin/activate ;\ |
| 61 | set -u ;\ |
| 62 | find . -name *.robot -exec python -m robot.tidy --inplace {} \; |
| 63 | |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 64 | voltha-podtest: vst_venv |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 65 | source ./vst_venv/bin/activate ;\ |
| 66 | set -u ;\ |
Andy Bavier | ba9866b | 2019-10-11 07:11:53 -0700 | [diff] [blame] | 67 | cd tests/functional ;\ |
| 68 | robot -V $(ROBOT_VAR_FILE) $(ROBOT_MISC_ARGS) Voltha_PODTests.robot |
hwchiu | 0601ec7 | 2019-10-08 00:04:43 +0000 | [diff] [blame] | 69 | |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 70 | gendocs: vst_venv |
| 71 | source ./vst_venv/bin/activate ;\ |
| 72 | set -u ;\ |
hwchiu | 0601ec7 | 2019-10-08 00:04:43 +0000 | [diff] [blame] | 73 | mkdir -p $@ ;\ |
| 74 | for dir in ${LIB_DIRS}; do mkdir -p $@/$$dir; done;\ |
| 75 | for dir in ${LIB_BASENAME}; do\ |
| 76 | python -m robot.libdoc --format HTML $$dir.robot $@/$$dir.html ;\ |
| 77 | done ;\ |
| 78 | for dir in ${TEST_DIRS}; do mkdir -p $@/$$dir; done;\ |
| 79 | for dir in ${TEST_BASENAME}; do\ |
| 80 | python -m robot.testdoc $$dir.robot $@/$$dir.html ;\ |
| 81 | done |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 82 | |
| 83 | # explore use of --docformat REST - integration w/Sphinx? |
| 84 | clean: |
| 85 | find . -name output.xml -print |
| 86 | |
| 87 | clean-all: clean |
| 88 | rm -rf vst_venv gendocs |