blob: 66626ceb35fdf161cd298eecb6d8c2af9e40ee6b [file] [log] [blame]
Kailash92764922019-07-25 08:21:39 -07001# 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 Williamsec53a1b2019-09-16 15:50:52 -070015# use bash for pushd/popd, and to fail quickly. virtualenv's activate
16# has undefined variables, so no -u
17SHELL = bash -e -o pipefail
Kailash92764922019-07-25 08:21:39 -070018
Zack Williamsec53a1b2019-09-16 15:50:52 -070019# Variables
20LINT_ARGS ?= --verbose --configure LineTooLong:120 --configure TooManyTestSteps:15
21VERSION ?= $(shell cat ./VERSION)
David Bainbridge8da6dd92019-10-08 18:58:12 +000022ROBOT_OLT_SN =
23ROBOT_ONU_SN =
24
25ifneq ($(BBSIM_OLT_SN),)
26ROBOT_OLT_SN=-v BBSIM_OLT_SN:$(BBSIM_OLT_SN)
27endif
28
29ifneq ($(BBSIM_ONU_SN),)
30ROBOT_ONU_SN=-v BBSIM_ONU_SN:$(BBSIM_ONU_SN)
31endif
Kailash92764922019-07-25 08:21:39 -070032
Zack Williamsec53a1b2019-09-16 15:50:52 -070033sanity-kind: ROBOT_PORT_ARGS ?= -v ONOS_REST_PORT:8181 -v ONOS_SSH_PORT:8101
34sanity-kind: ROBOT_TEST_ARGS ?= --exclude notready --critical sanity
35sanity-kind: ROBOT_MISC_ARGS ?= -v num_onus:1
36sanity-kind: sanity
37
38# virtualenv for the robot tools
39vst_venv:
40 virtualenv $@ ;\
41 source ./$@/bin/activate ;\
42 pip install -r requirements.txt
43
44test: lint
45
46lint: vst_venv
47 source ./vst_venv/bin/activate ;\
48 set -u ;\
49 find . -name *.robot -exec rflint $(LINT_ARGS) {} +
50
51# tidy will be more useful once this issue with removing leading comments is
52# resolved: https://github.com/robotframework/robotframework/issues/3263
53tidy:
54 source ./vst_venv/bin/activate ;\
55 set -u ;\
56 find . -name *.robot -exec python -m robot.tidy --inplace {} \;
57
58sanity: vst_venv
59 source ./vst_venv/bin/activate ;\
60 set -u ;\
61 cd tests/sanity ;\
David Bainbridge8da6dd92019-10-08 18:58:12 +000062 robot $(ROBOT_PORT_ARGS) $(ROBOT_TEST_ARGS) $(ROBOT_MISC_ARGS) $(ROBOT_OLT_SN) $(ROBOT_ONU_SN) sanity.robot
Zack Williamsec53a1b2019-09-16 15:50:52 -070063
64gendocs: vst_venv
65 source ./vst_venv/bin/activate ;\
66 set -u ;\
67 mkdir -p gendocs ;\
68 python -m robot.libdoc --format HTML libraries/onos.robot gendocs/lib_onos_robot.html ;\
69 python -m robot.testdoc tests/Voltha_PODTests.robot gendocs/voltha_podtests.html
70
71# explore use of --docformat REST - integration w/Sphinx?
72clean:
73 find . -name output.xml -print
74
75clean-all: clean
76 rm -rf vst_venv gendocs