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 |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 18 | |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 19 | # Variables |
| 20 | LINT_ARGS ?= --verbose --configure LineTooLong:120 --configure TooManyTestSteps:15 |
| 21 | VERSION ?= $(shell cat ./VERSION) |
Kailash | 9276492 | 2019-07-25 08:21:39 -0700 | [diff] [blame] | 22 | |
Zack Williams | ec53a1b | 2019-09-16 15:50:52 -0700 | [diff] [blame] | 23 | sanity-kind: ROBOT_PORT_ARGS ?= -v ONOS_REST_PORT:8181 -v ONOS_SSH_PORT:8101 |
| 24 | sanity-kind: ROBOT_TEST_ARGS ?= --exclude notready --critical sanity |
| 25 | sanity-kind: ROBOT_MISC_ARGS ?= -v num_onus:1 |
| 26 | sanity-kind: sanity |
| 27 | |
| 28 | # virtualenv for the robot tools |
| 29 | vst_venv: |
| 30 | virtualenv $@ ;\ |
| 31 | source ./$@/bin/activate ;\ |
| 32 | pip install -r requirements.txt |
| 33 | |
| 34 | test: lint |
| 35 | |
| 36 | lint: vst_venv |
| 37 | source ./vst_venv/bin/activate ;\ |
| 38 | set -u ;\ |
| 39 | find . -name *.robot -exec rflint $(LINT_ARGS) {} + |
| 40 | |
| 41 | # tidy will be more useful once this issue with removing leading comments is |
| 42 | # resolved: https://github.com/robotframework/robotframework/issues/3263 |
| 43 | tidy: |
| 44 | source ./vst_venv/bin/activate ;\ |
| 45 | set -u ;\ |
| 46 | find . -name *.robot -exec python -m robot.tidy --inplace {} \; |
| 47 | |
| 48 | sanity: vst_venv |
| 49 | source ./vst_venv/bin/activate ;\ |
| 50 | set -u ;\ |
| 51 | cd tests/sanity ;\ |
| 52 | robot $(ROBOT_PORT_ARGS) $(ROBOT_TEST_ARGS) $(ROBOT_MISC_ARGS) sanity.robot |
| 53 | |
| 54 | gendocs: vst_venv |
| 55 | source ./vst_venv/bin/activate ;\ |
| 56 | set -u ;\ |
| 57 | mkdir -p gendocs ;\ |
| 58 | python -m robot.libdoc --format HTML libraries/onos.robot gendocs/lib_onos_robot.html ;\ |
| 59 | python -m robot.testdoc tests/Voltha_PODTests.robot gendocs/voltha_podtests.html |
| 60 | |
| 61 | # explore use of --docformat REST - integration w/Sphinx? |
| 62 | clean: |
| 63 | find . -name output.xml -print |
| 64 | |
| 65 | clean-all: clean |
| 66 | rm -rf vst_venv gendocs |