-
Paul Spooren authored
Testing OpenWrt is important, and there is a test suite in the making. For maximum convenience and minimal CI over-usage, make it simple to run tests locally. The main Makefile now attempts to include `tests/Makefile` and silently fails if it doesn't. While the test suite[1] is still young, it provides good examples of how to test things around OpenWrt: starting with shell scripts using `bats`[2], followed by QEMU tests, and finally real device tests using LabGrid[3]. This could lead to the creation of the best OpenWrt version yet. Please consult the `openwrt-tests.git` README.md for details on the setup. Once installed you may run commands like the following: * make tests/shell # run shell tests * make tests/x86-64 # run and test x86/64 in QEMU [1]: http://github.com/aparcar/openwrt-tests/ [2]: https://bats-core.readthedocs.io [3]: https://labgrid.readthedocs.io Signed-off-by:
Paul Spooren <mail@aparcar.org> Link: https://github.com/openwrt/openwrt/pull/15647 Signed-off-by:
Christian Marangi <ansuelsmth@gmail.com> (cherry picked from commit a8ff0c1b7e5aefb8bcd31e0eeb82d2c11399223f)
Paul Spooren authoredTesting OpenWrt is important, and there is a test suite in the making. For maximum convenience and minimal CI over-usage, make it simple to run tests locally. The main Makefile now attempts to include `tests/Makefile` and silently fails if it doesn't. While the test suite[1] is still young, it provides good examples of how to test things around OpenWrt: starting with shell scripts using `bats`[2], followed by QEMU tests, and finally real device tests using LabGrid[3]. This could lead to the creation of the best OpenWrt version yet. Please consult the `openwrt-tests.git` README.md for details on the setup. Once installed you may run commands like the following: * make tests/shell # run shell tests * make tests/x86-64 # run and test x86/64 in QEMU [1]: http://github.com/aparcar/openwrt-tests/ [2]: https://bats-core.readthedocs.io [3]: https://labgrid.readthedocs.io Signed-off-by:
Paul Spooren <mail@aparcar.org> Link: https://github.com/openwrt/openwrt/pull/15647 Signed-off-by:
Christian Marangi <ansuelsmth@gmail.com> (cherry picked from commit a8ff0c1b7e5aefb8bcd31e0eeb82d2c11399223f)
Makefile 4.13 KiB
# SPDX-License-Identifier: GPL-2.0-only
#
# Copyright (C) 2007 OpenWrt.org
TOPDIR:=${CURDIR}
LC_ALL:=C
LANG:=C
TZ:=UTC
export TOPDIR LC_ALL LANG TZ
empty:=
space:= $(empty) $(empty)
$(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt directory must not include any spaces))
world:
DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep -e '/usr' -e '/nix/store' -m 1)
export ORIG_PATH:=$(if $(ORIG_PATH),$(ORIG_PATH),$(PATH))
export PATH:=$(if $(STAGING_DIR),$(abspath $(STAGING_DIR)/../host/bin),$(TOPDIR)/staging_dir/host/bin):$(PATH)
ifneq ($(OPENWRT_BUILD),1)
_SINGLE=export MAKEFLAGS=$(space);
override OPENWRT_BUILD=1
export OPENWRT_BUILD
GREP_OPTIONS=
export GREP_OPTIONS
CDPATH=
export CDPATH
include $(TOPDIR)/include/debug.mk
include $(TOPDIR)/include/depends.mk
include $(TOPDIR)/include/toplevel.mk
else
include rules.mk
include $(INCLUDE_DIR)/depends.mk
include $(INCLUDE_DIR)/subdir.mk
include target/Makefile
include package/Makefile
include tools/Makefile
include toolchain/Makefile
# Include the test suite Makefile if it exists
-include tests/Makefile
$(toolchain/stamp-compile): $(tools/stamp-compile) $(if $(CONFIG_BUILDBOT),toolchain_rebuild_check)
$(target/stamp-compile): $(toolchain/stamp-compile) $(tools/stamp-compile) $(BUILD_DIR)/.prepared
$(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
$(package/stamp-install): $(package/stamp-compile)
$(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
check: $(tools/stamp-check) $(toolchain/stamp-check) $(package/stamp-check)
printdb:
@true
prepare: $(target/stamp-compile)
_clean: FORCE
rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES) $(TOPDIR)/staging_dir/packages
clean: _clean
rm -rf $(BUILD_LOG_DIR)
targetclean: _clean
rm -rf $(TOOLCHAIN_DIR) $(BUILD_DIR_BASE)/hostpkg $(BUILD_DIR_TOOLCHAIN)
dirclean: targetclean clean
rm -rf $(STAGING_DIR_HOST) $(STAGING_DIR_HOSTPKG) $(BUILD_DIR_BASE)/host
rm -rf $(TMP_DIR)
$(MAKE) -C $(TOPDIR)/scripts/config clean