You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.3 KiB

# Copyright (c) 2016-present, Facebook, Inc.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
ROOT_DIR = $(TESTS_DIR)/../..
include $(ROOT_DIR)/Makefile.config
# The relative path from infer/tests/ to the directory containing the current Makefile. This is
# computed in a hacky way and might not always be a relative path, so only use this for cosmetic
# reasons.
TEST_REL_DIR = $(patsubst $(abspath $(TESTS_DIR))/%,%,$(abspath $(CURDIR)))
define check_no_duplicates
if grep -q "DUPLICATE_SYMBOLS" $(1); then \
printf '$(TERM_ERROR)Duplicate symbols found in $(CURDIR).$(TERM_RESET)\n' >&2; \
printf '$(TERM_ERROR)Please make sure all the function names in all the source test files are different.$(TERM_RESET)' >&2; \
exit 1; \
fi
endef
define check_no_diff
diff -u $(1) $(2) >&2 || \
(printf '\n' >&2; \
printf '$(TERM_ERROR)Test output ($(2)) differs from expected test output $(1)$(TERM_RESET)\n' >&2; \
printf '$(TERM_ERROR)Run the following command to replace the expected test output with the new output:$(TERM_RESET)\n' >&2; \
printf '\n' >&2; \
printf '$(TERM_ERROR) make -C $(TEST_REL_DIR) replace\n$(TERM_RESET)' >&2; \
printf '\n' >&2; \
exit 1)
endef