blob: 6c1a42092d95faa9962a7cc0b57051b03da9adf0 [file] [log] [blame]
Martin Cosyns0efdc872021-09-27 16:24:30 +00001# Copyright 2020-present Open Networking Foundation
2# Original copyright 2020-present ADTRAN, Inc.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14
15# set default shell
16SHELL = bash -e -o pipefail
17
18ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
19
20# Variables
21VERSION ?= $(shell cat ./VERSION)
22LINT_ARGS ?= --verbose --configure LineTooLong:130 -e LineTooLong \
23 --configure TooManyTestSteps:60 -e TooManyTestSteps \
24 --configure TooManyTestCases:50 -e TooManyTestCases \
25 --configure TooFewTestSteps:1 \
26 --configure TooFewKeywordSteps:1 \
27 --configure FileTooLong:1500 -e FileTooLong \
28 -e TrailingWhitespace
29
30ROBOT_FILES := $(shell find . -name test.robot -print)
31DMI_SERVER_FILE ?= $(ROOT_DIR)/tests/servers/dmi/dmi_server.py
32
33# For each makefile target, add ## <description> on the target line and it will be listed by 'make help'
34help: ## Print help for each Makefile target
35 @echo "Usage: make [<target>]"
36 @echo "where available targets are:"
37 @echo
38 @grep '^[[:alpha:]_-]*:.* ##' $(MAKEFILE_LIST) \
39 | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s : %s\n", $$1, $$2};'
40
41vst_venv:
42 virtualenv -p python3 $@ ;\
43 source ./$@/bin/activate ;\
44 python -m pip install -r requirements.txt
45 python $(DMI_SERVER_FILE) & echo $$! > server.PID
46
47test: vst_venv
48 source ./$</bin/activate ; set -u ;\
49 rflint $(LINT_ARGS) $(ROBOT_FILES)
50
51clean:
52 find . -name output.xml -print
53
54clean-all: clean
55 rm -rf vst_venv
56 kill `cat server.PID` && rm server.PID
57
58# end file