From ce7ab164417e89236f94bea53a72999b7151fb8f Mon Sep 17 00:00:00 2001 From: David Sterba Date: Wed, 16 Dec 2020 15:18:13 +0100 Subject: [PATCH] btrfs-progs: tests: add Makefile for testsuite Add a Makefile so tests can be run the same way from the standalone testsuite as they are from git. The build dependencies are not checked and the default path is for the system binaries. Because of the path auto detection, running 'make' from the tests/ directory now works the same way as from the toplevel git directory. Signed-off-by: David Sterba --- tests/Makefile | 68 +++++++++++++++++++++++++++++++++++++++++++ tests/testsuite-files | 1 + 2 files changed, 69 insertions(+) create mode 100644 tests/Makefile diff --git a/tests/Makefile b/tests/Makefile new file mode 100644 index 00000000..5e8934e4 --- /dev/null +++ b/tests/Makefile @@ -0,0 +1,68 @@ +# +# Testing-specific options (see also README.md): +# TEST=GLOB run test(s) from directories matching GLOB +# TEST_LOG=tty print name of a command run via the execution helpers +# TEST_LOG=dump dump testing log file when a test fails +# +# TOP=path test binaries from the given path + +# Export all variables to sub-makes by default +export + +ABSTOPDIR = $(shell pwd) +TOPDIR := . + +ifeq ("$(origin V)", "command line") + BUILD_VERBOSE = $(V) +endif +ifndef BUILD_VERBOSE + BUILD_VERBOSE = 0 +endif + +ifeq ($(BUILD_VERBOSE),1) + Q = +else + Q = @ +endif + +MAKEOPTS = --no-print-directory Q=$(Q) + +.PHONY: all +.PHONY: FORCE + +test: test-check test-check-lowmem test-mkfs test-misc test-cli test-convert test-fuzz + +test-convert: + @echo " [TEST] convert-tests.sh" + $(Q)bash ./convert-tests.sh + +test-check: test-fsck +test-check-lowmem: test-fsck +test-fsck: +ifneq ($(MAKECMDGOALS),test-check-lowmem) + @echo " [TEST] fsck-tests.sh" + $(Q)bash ./fsck-tests.sh +else + @echo " [TEST] fsck-tests.sh (mode=lowmem)" + $(Q)TEST_ENABLE_OVERRIDE=true TEST_ARGS_CHECK=--mode=lowmem bash ./fsck-tests.sh +endif + +test-misc: + @echo " [TEST] misc-tests.sh" + $(Q)bash ./misc-tests.sh + +test-mkfs: + @echo " [TEST] mkfs-tests.sh" + $(Q)bash ./mkfs-tests.sh + +test-fuzz: + @echo " [TEST] fuzz-tests.sh" + $(Q)bash ./fuzz-tests.sh + +test-cli: + @echo " [TEST] cli-tests.sh" + $(Q)bash ./cli-tests.sh + +test-clean: + @echo "Cleaning tests" + $(Q)bash ./clean-tests.sh diff --git a/tests/testsuite-files b/tests/testsuite-files index 507d35fb..10950383 100644 --- a/tests/testsuite-files +++ b/tests/testsuite-files @@ -23,3 +23,4 @@ F mkfs-tests.sh F scan-results.sh F test-console.sh F clean-tests.sh +F Makefile