Makefile 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. help:
  2. @echo "Tasks for local development:"
  3. @echo "* tests-single-ci: Run a single test from inside the CI"
  4. @echo "* tests-single-local: Run a single test locally"
  5. @echo "* tests-single-local-docker: Run a single test locally, using docker-compose"
  6. @echo "* tests-all-local: Run all tests locally"
  7. @echo "* tests-all-local-docker: Run all tests locally, using docker-compose"
  8. @echo "* setup-local-docker: Setup local docker-compose"
  9. @echo ""
  10. @echo "Options for testing:"
  11. @echo " TEST_TARGET Set when running tests-single-*, to select the"
  12. @echo " test. If you set it to ALL it will run all "
  13. @echo " tests, but some of them are broken: use "
  14. @echo " tests-all-* instead to run only the ones that "
  15. @echo " run on GitHub CI"
  16. @echo " ONLY_TEST Limit tests to only those that contain this, or"
  17. @echo " the index of the test (1-based)"
  18. @echo " VERBOSE_PLATFORMIO If you want the full PIO output, set any value"
  19. @echo " GIT_RESET_HARD Used by CI: reset all local changes. WARNING:"
  20. @echo " THIS WILL UNDO ANY CHANGES YOU'VE MADE!"
  21. .PHONY: help
  22. tests-single-ci:
  23. export GIT_RESET_HARD=true
  24. $(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET)
  25. .PHONY: tests-single-ci
  26. tests-single-local:
  27. @if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local" ; return 1; fi
  28. export PATH=./buildroot/bin/:./buildroot/tests/:${PATH} \
  29. && export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
  30. && run_tests . $(TEST_TARGET) "$(ONLY_TEST)"
  31. .PHONY: tests-single-local
  32. tests-single-local-docker:
  33. @if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local-docker" ; return 1; fi
  34. docker-compose run --rm marlin $(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET) VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD) ONLY_TEST="$(ONLY_TEST)"
  35. .PHONY: tests-single-local-docker
  36. tests-all-local:
  37. export PATH=./buildroot/bin/:./buildroot/tests/:${PATH} \
  38. && export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
  39. && for TEST_TARGET in $$(./get_test_targets.py) ; do echo "Running tests for $$TEST_TARGET" ; run_tests . $$TEST_TARGET ; done
  40. .PHONY: tests-all-local
  41. tests-all-local-docker:
  42. docker-compose run --rm marlin $(MAKE) tests-all-local VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD)
  43. .PHONY: tests-all-local-docker
  44. setup-local-docker:
  45. docker-compose build
  46. .PHONY: setup-local-docker