[VOL-5272] - Fixed a problem with relative paths.
app-install.sh
Makefile
--------------
o Add SPDX copyright tags.
https://spdx.github.io/spdx-spec/v2.3/file-tags.
o Create named test-* targets so 'make test' can be conditional.
o No need to invoke tests/version-check for a non-release job.
app-install.sh
--------------
o set -euo pipefail to detect shell problems.
o Added ERR signal handler, display a stack trace for ($? != 0).
o Added args --download and --install to begin weakening dependency
on global variables.
o Script now verbose when run. Display banners, paths, artifacts, etc.
o Replace cp with "rsync --checksum" everywhere for file copying.
o Display contents of app.xml when unable to parse name=.
Also display grep and sed output then fail hard.
test
test/bats/makefile
test/bats/display-help.sh
-------------------------
o Add initial support for the bats testing harness (shell scripts).
o Create a stub unit test directory to automate testing app-install.sh
Change-Id: I138fd2218a10121fbcce4fa8dbcf5776278d05ac
diff --git a/Makefile b/Makefile
index 75c0cc2..aac2d87 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2016-2024 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2016-2024 Open Networking Foundation Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -14,6 +14,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------
+# SPDX-FileCopyrightText: 2017-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
.PHONY: help
.DEFAULT_GOAL := help
@@ -49,6 +52,15 @@
# For each makefile target, add ## <description> on the target line and it will be listed by 'make help'
help :: ## Print help for each Makefile target
+ @echo "Usage: $(MAKE) [options] [target] ..."
+
+ @printf ' %-33.33s %s' 'test' \
+ 'Run repository based test suites (test=)'
+ @printf ' %-33.33s %s' 'test-bats' \
+ 'Invoke bats harness shell test suites (wip)'
+ @printf ' %-33.33s %s' 'test-release' \
+ 'Verify released VERSION does ont contain dev/SNAPSHOT apps'
+
@echo
@grep --no-filename '^[[:alpha:]_-]*:.* ##' $(MAKEFILE_LIST) \
| sort \
@@ -86,15 +98,51 @@
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
-test: ## verify that if the version is released we're not pointing to SNAPSHOT apps
+test := $(null)
+
+ifdef TEST-BATS
+ test += test-bats
+endif
+
+ifdef RELEASE
+ test += test-release
+endif
+
+test :: $(test) ## verify that if the version is released we're not pointing to SNAPSHOT apps
+
+## -----------------------------------------------------------------------
+## Intent: Shell script testing with the bats test harness.
+## Usage: make test TEST-BATS=1
+## -----------------------------------------------------------------------
+test-bats:
+ $(HIDE)$(MAKE) -C test/bats $@
+
+## -----------------------------------------------------------------------
+## Intent: Release based testing.
+## -----------------------------------------------------------------------
+## Usage:
+## make test-release
+## make test RELEASE=1
+## -----------------------------------------------------------------------
+## Legacy: VERSION validation has been defined as a default repository
+## based test. The target should be isolated and should only
+## be required durring a release cycle.
+## -----------------------------------------------------------------------
+test-release :
bash tests/version-check.sh
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
docker-push: ## push to docker registy: use DOCKER_REGISTRY, DOCKER_REPOSITORY and DOCKER_TAG to customize
docker push ${ONOS_IMAGENAME}
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
clean :: ## clean the build environment
$(RM) -r local_imports
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
sterile :: clean
# end file