blob: aeb6acbcce75254a586a774112ff91eee9a20574 [file] [log] [blame]
Joey Armstrong0ebb7822023-08-17 14:21:41 -04001# -*- makefile -*-
2# Copyright 2018-2023 Open Networking Foundation (ONF) and the ONF Contributors
Girish Gowdraddf9a162020-01-27 12:56:27 +05303#
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#limitations under the License.
15
16########################################################################
17
18# This Makefile provides hook for Jenkins to invoke the test target for
19# CI integration.
20# The main Makefile for product compilation is available at
Girish Gowdra489425a2020-02-22 13:07:42 +053021# agent/Makefile. Please see ./README.md and ./agent/test/README.md for more
22# details.
Girish Gowdraddf9a162020-01-27 12:56:27 +053023
Girish Gowdra489425a2020-02-22 13:07:42 +053024# set default shell options
25SHELL = bash -e -o pipefail
Joey Armstrong0ebb7822023-08-17 14:21:41 -040026## See also: https://github.com/opencord/onf-make/blob/master/makefiles/consts.mk
Girish Gowdraddf9a162020-01-27 12:56:27 +053027
Jason Huang5d9ab1a2020-04-15 16:53:49 +080028export OPENOLT_ROOT_DIR=$(shell pwd)
29
Girish Gowdra489425a2020-02-22 13:07:42 +053030## Variables
Girish Gowdra5287fde2021-07-31 00:41:45 +000031OPENOLTDEVICE ?= sim
nikesh.krishnan331d38c2023-04-06 03:24:53 +053032OPENOLT_PROTO_VER ?= v5.4.6
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 ?=
Burak Gurdag74e3ab82020-12-17 13:35:06 +000038DOCKER_TAG ?= 2.1.1
Girish Gowdra489425a2020-02-22 13:07:42 +053039IMAGENAME = ${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} \
Girish Gowdra252f4972020-09-07 21:24:01 -070044 --build-arg OPENOLT_PROTO_VER=${OPENOLT_PROTO_VER}
Girish Gowdraddf9a162020-01-27 12:56:27 +053045
Joey Armstrong0ebb7822023-08-17 14:21:41 -040046## -----------------------------------------------------------------------
47## See github::onf-make (docker --tty), docker -it inhibits jenkins logging output
48## https://github.com/opencord/onf-make/blob/master/makefiles/docker/include.mk#L34
49## -----------------------------------------------------------------------
50## Overhead from $(shell pwd) can be avoided using a ./Makefile derived path
51## path := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
52## -----------------------------------------------------------------------
53
Girish Gowdraddf9a162020-01-27 12:56:27 +053054test:
Girish Gowdra489425a2020-02-22 13:07:42 +053055 ${DOCKER} run --rm -v $(shell pwd):/app $(shell test -t 0 && echo "-it") ${IMAGENAME} make -C agent/test test
56
Girish Gowdrab0337eb2022-03-25 16:44:21 -070057build:
58 ${DOCKER} run --rm -v $(shell pwd):/app $(shell test -t 0 && echo "-it") ${IMAGENAME} make -C agent/test all
59
Girish Gowdra489425a2020-02-22 13:07:42 +053060clean:
61 ${DOCKER} run --rm -v $(shell pwd):/app $(shell test -t 0 && echo "-it") ${IMAGENAME} make -C agent/test clean
62
63cleanall:
64 ${DOCKER} run --rm -v $(shell pwd):/app $(shell test -t 0 && echo "-it") ${IMAGENAME} make -C agent/test clean
65 ${DOCKER} run --rm -v $(shell pwd):/app $(shell test -t 0 && echo "-it") ${IMAGENAME} make -C protos distclean
Joey Armstrong0ebb7822023-08-17 14:21:41 -040066
67# [EOF]