blob: fb7f456c59d1bd820591ca2539033236f2cc0615 [file] [log] [blame]
Girish Gowdraddf9a162020-01-27 12:56:27 +05301#Copyright 2018-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
15########################################################################
16
17# This Makefile provides hook for Jenkins to invoke the test target for
18# CI integration.
19# The main Makefile for product compilation is available at
Girish Gowdra489425a2020-02-22 13:07:42 +053020# agent/Makefile. Please see ./README.md and ./agent/test/README.md for more
21# details.
Girish Gowdraddf9a162020-01-27 12:56:27 +053022
Girish Gowdra489425a2020-02-22 13:07:42 +053023# set default shell options
24SHELL = bash -e -o pipefail
Girish Gowdraddf9a162020-01-27 12:56:27 +053025
Girish Gowdra489425a2020-02-22 13:07:42 +053026## Variables
27OPENOLTDEVICE ?= asfvolt16
Burak Gurdag2f2618c2020-04-23 13:20:30 +000028OPENOLT_PROTO_VER ?= v3.3.5
Girish Gowdra489425a2020-02-22 13:07:42 +053029GTEST_VER ?= release-1.8.0
30CMOCK_VER ?= 0207b30
31GMOCK_GLOBAL_VER ?= 1.0.2
32GRPC_VER ?= v1.27.1
Girish Gowdraddf9a162020-01-27 12:56:27 +053033
Girish Gowdra489425a2020-02-22 13:07:42 +053034DOCKER ?= docker
35DOCKER_REGISTRY ?=
36DOCKER_REPOSITORY ?= voltha/
37DOCKER_EXTRA_ARGS ?=
38DOCKER_TAG ?= 1.0.0
39IMAGENAME = ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}openolt-test:${DOCKER_TAG}
Girish Gowdraddf9a162020-01-27 12:56:27 +053040
Girish Gowdra489425a2020-02-22 13:07:42 +053041DOCKER_BUILD_ARGS ?= \
42 ${DOCKER_EXTRA_ARGS} \
43 --build-arg OPENOLTDEVICE=${OPENOLTDEVICE} \
44 --build-arg OPENOLT_PROTO_VER=${OPENOLT_PROTO_VER} \
45 --build-arg GTEST_VER=${GTEST_VER} \
46 --build-arg CMOCK_VER=${CMOCK_VER} \
47 --build-arg GMOCK_GLOBAL_VER=${GMOCK_GLOBAL_VER} \
48 --build-arg GRPC_VER=${GRPC_VER}
Girish Gowdraddf9a162020-01-27 12:56:27 +053049
Girish Gowdraddf9a162020-01-27 12:56:27 +053050test:
Girish Gowdra489425a2020-02-22 13:07:42 +053051 ${DOCKER} run --rm -v $(shell pwd):/app $(shell test -t 0 && echo "-it") ${IMAGENAME} make -C agent/test test
52
53clean:
54 ${DOCKER} run --rm -v $(shell pwd):/app $(shell test -t 0 && echo "-it") ${IMAGENAME} make -C agent/test clean
55
56cleanall:
57 ${DOCKER} run --rm -v $(shell pwd):/app $(shell test -t 0 && echo "-it") ${IMAGENAME} make -C agent/test clean
58 ${DOCKER} run --rm -v $(shell pwd):/app $(shell test -t 0 && echo "-it") ${IMAGENAME} make -C protos distclean