mirror of
https://github.com/NixOS/nix.git
synced 2024-11-25 08:12:29 +00:00
33ca905cdb
pararameterisation is not actually needed the way things are currently set up, and it confused me when trying to understand what the code does. all but one test sources vars-and-functions.sh, which nominally only defines variables, but in practice is always coupled with the actual initialisation. while the cleaner way of making this more legible would be to source variables and initialisation separately, this would produce a huge diff. the change requires a few small fixes to keep the tests working: - only create test home directory during initialisation that vars-and-functions.sh wrote to the file system seems not write - fix creation of the test directory due to statefulness, the test home directory was implicitly creating the test root, too. decoupling that made it apparent that this was probably not intentional, and certainly confusing. - only source vars-and-functions.sh if init.sh is not needed there is one test case that only needs a helper function but no initialisation side effects - remove some unnecessary cleanups and split parts of re-used test code there were confusing bits in how initialisation code was repurposed, which break if trying to refactor the outer layers naively...
31 lines
513 B
Makefile
31 lines
513 B
Makefile
# Run program $1 as part of ‘make installcheck’.
|
||
|
||
test-deps =
|
||
|
||
define run-bash
|
||
|
||
.PHONY: $1
|
||
$1: $2
|
||
@env BASH=$(bash) $(bash) $3 < /dev/null
|
||
|
||
endef
|
||
|
||
define run-test
|
||
|
||
$(eval $(call run-bash,$1.test,$1 $(test-deps),mk/run-test.sh $1))
|
||
$(eval $(call run-bash,$1.test-debug,$1 $(test-deps),mk/debug-test.sh $1))
|
||
|
||
endef
|
||
|
||
define run-test-group
|
||
|
||
.PHONY: $1.test-group
|
||
|
||
endef
|
||
|
||
.PHONY: check installcheck
|
||
|
||
print-top-help += \
|
||
echo " check: Run unit tests"; \
|
||
echo " installcheck: Run functional tests";
|