msxbuild/lib/make/𓃬𓍄𓋹𓀭/mb_flow_assert.mk

65 lines
3.8 KiB
Makefile
Raw Normal View History

2024-07-12 15:59:26 +00:00
2024-07-12 17:30:19 +00:00
define __mb_flow_assert_grep_binary_x
2024-07-12 15:59:26 +00:00
.RECIPEPREFIX := $(MB_@RECIPE)
$(1)/@@$(5)-deps:: $(1)/@assert/$(5)/$(2)
$(1)/@assert/$(5)/$(2): $(1)/@build
2024-07-12 15:59:26 +00:00
$(MB_@RECIPE)grep -q -U $(4) $(1)/$(3)
$(MB_@RECIPE)$$(call mb_make_call,mb_os_echo_assert,$$(MB_I18N_ASSERT_SUCCESS) $(1)/@assert/$(2)/$(5))
$(MB_@RECIPE)$$(call mb_make_call,mb_proj_grow_assert_success,$(5))
2024-07-14 20:39:03 +00:00
$(MB_   )$$(call mb_make_call,mb_doc_target_assert,$(1)/@assert/$(5)/$(2),"Asserts that $(3) output matches.")
$(MB_   )$$(call mb_make_call,mb_make_target_phony,$(1)/@assert/$(5)/$(2))
$(MB_   )$$(call mb_make_call,mb_proj_grow_deps_phase,$(5),$(1)/@assert/$(5)/$(2))
2024-07-12 15:59:26 +00:00
.RECIPEPREFIX := $(MB_@RECIPEPREFIX)
endef
2024-07-12 17:30:19 +00:00
define mb_flow_assert_grep_binary_test
$(MB_   )$(call mb_make_call,mb_make_check_arg4,$(0),$(1),$(2),$(3),$(4))
$(MB_   )$(eval $(call mb_make_call,__mb_flow_assert_grep_binary_x,$(1),$(2),$(3),$(4),@test))
endef
$(call mb_make_call,mb_doc_function_flow,mb_flow_assert_grep_binary_test,"Inject flow of single binary grep assert.","<build-dir> <test-id> <file> <grep-match>")
define mb_flow_assert_grep_binary_package_qa
$(MB_   )$(call mb_make_call,mb_make_check_arg4,$(0),$(1),$(2),$(3),$(4))
$(MB_   )$(eval $(call mb_make_call,__mb_flow_assert_grep_binary_x,$(1),$(2),$(3),$(4),@package-qa))
2024-07-12 15:59:26 +00:00
endef
2024-07-12 17:30:19 +00:00
$(call mb_make_call,mb_doc_function_flow,mb_flow_assert_grep_binary_package_qa,"Inject flow of single binary grep assert.","<build-dir> <test-id> <file> <grep-match>")
2024-07-12 15:59:26 +00:00
define __mb_flow_assert_msxpipe_grep_x2
$(MB_   )$(shell grep -q $(1) $(2) && echo || echo fail)
endef
define __mb_flow_assert_msxpipe_grep_x
2024-07-12 15:59:26 +00:00
.RECIPEPREFIX := $(MB_@RECIPE)
2024-07-15 00:34:29 +00:00
$(1)/@$(5)-deps:: $(1)/@assert/$(5)/$(2)
$(7)/@@init-deps:: $(1)/@build
$(1)/@assert/$(5)/$(2): $(7)/@build
$(MB_@RECIPE)$$(if $$(wildcard $(7)/$(3).out),,$$(call mb_make_call,mb_os_file_delete,$(7)/$(3).out))
$(MB_@RECIPE)$$(call mb_make_call,mb_msxpipe_safe_assert,$(7),$(3) > $(3).out,$(6))
$(MB_@RECIPE)grep -q $(4) $(7)/$(3).out
$(MB_@RECIPE)$$(call mb_make_call,mb_os_echo_assert,$$(MB_I18N_ASSERT_SUCCESS) $(1)/@assert/$(2)/$(5))
$(MB_@RECIPE)$$(call mb_make_call,mb_proj_grow_assert_success,$(5))
2024-07-14 20:39:03 +00:00
$(MB_   )$$(call mb_make_call,mb_doc_target_assert,$(1)/@assert/$(5)/$(2),"Asserts that $(3) output matches.")
$(MB_   )$$(call mb_make_call,mb_make_target_phony,$(1)/@assert/$(5)/$(2))
$(MB_   )$$(call mb_make_call,mb_proj_grow_deps_phase,$(5),$(1)/@assert/$(5)/$(2))
2024-07-12 15:59:26 +00:00
.RECIPEPREFIX := $(MB_@RECIPEPREFIX)
endef
define mb_flow_assert_msxpipe_grep_test
$(MB_   )$(call mb_make_call,mb_make_check_arg5,$(0),$(1),$(2),$(3),$(4),$(5))
$(MB_   )$(eval $(call mb_make_call,mb_flow_clone_deps,$(1)$(MB_@WORK)_assert/$(notdir $(1))/test-$(3),$(1),$(2),$(6),$(7)))
$(MB_   )$(eval $(call mb_make_call,__mb_flow_assert_msxpipe_grep_x,$(1),$(3),$(4),$(5),@test,$(7),$(1)$(MB_@WORK)_assert/$(notdir $(1))/test-$(3)))
endef
$(call mb_make_call,mb_doc_function_flow,mb_flow_assert_msxpipe_grep_test,"Inject flow of single grep assert.","<build-dir> <deps> <test-id> <cmd-name> <grep-match> [packages] [machine]")
define mb_flow_assert_msxpipe_grep_package_qa
$(MB_   )$(call mb_make_call,mb_make_check_arg5,$(0),$(1),$(2),$(3),$(4),$(5))
$(MB_   )$(eval $(call mb_make_call,mb_flow_clone_deps,$(1)$(MB_@WORK)_assert/$(notdir $(1))/package-qa-$(3),$(1),$(2),$(6),$(7)))
$(MB_   )$(eval $(call mb_make_call,__mb_flow_assert_msxpipe_grep_x,$(1),$(3),$(4),$(5),@package-qa,$(7),$(1)$(MB_@WORK)_assert/$(notdir $(1))/package-qa-$(3)))
2024-07-12 15:59:26 +00:00
endef
$(call mb_make_call,mb_doc_function_flow,mb_flow_assert_msxpipe_grep_package_qa,"Inject flow of single grep assert.","<build-dir> <deps> <test-id> <cmd-name> <grep-match> [packages] [machine]")
2024-07-12 15:59:26 +00:00