From 7cf0a5e2cc21c9fe2b5ece7e6ffc83346c322ffb Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Tue, 8 May 2018 05:07:01 -0700 Subject: [PATCH] [make] ignore copy-copy races in clang compilation db tests Summary: concurrency-with-parallelism Reviewed By: mbouaziz Differential Revision: D7908386 fbshipit-source-id: a1d7ae5 --- Makefile.config | 4 ++++ .../tests/build_systems/clang_compilation_db_escaped/Makefile | 3 ++- .../tests/build_systems/clang_compilation_db_relpath/Makefile | 3 ++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Makefile.config b/Makefile.config index 290842a42..90c11882e 100644 --- a/Makefile.config +++ b/Makefile.config @@ -106,6 +106,10 @@ CLANG_DEPS_NO_MODELS = \ CLANG_DEPS = $(CLANG_DEPS_NO_MODELS) $(MODELS_RESULTS_FILE) \ $(shell find $(MODELS_DIR)/cpp/include -type f) +define copy_or_same_file + $(COPY) "$(1)" "$(2)" || diff -q "$(1)" "$(2)" +endef + INTERACTIVE = $(shell [ -t 0 ] && echo 1) # remove "jobserver-fds" because it contains "s"... SILENT = $(findstring s,$(subst jobserver-fds,,$(MAKEFLAGS))) diff --git a/infer/tests/build_systems/clang_compilation_db_escaped/Makefile b/infer/tests/build_systems/clang_compilation_db_escaped/Makefile index f7afaf97f..a53abc724 100644 --- a/infer/tests/build_systems/clang_compilation_db_escaped/Makefile +++ b/infer/tests/build_systems/clang_compilation_db_escaped/Makefile @@ -19,7 +19,8 @@ include $(TESTS_DIR)/infer.make ../codetoanalyze/path\ with\ spaces/hel\ lo.c: ../codetoanalyze/path_with_spaces/hel_lo.c # make does not want to interpret "$(@D)" in the right way here... $(QUIET)$(MKDIR_P) ../codetoanalyze/path\ with\ spaces/ - $(QUIET)cp "$<" "$@" +# allow copy races with other tests if they are doing the same action + $(QUIET)$(call copy_or_same_file,$<,$@) $(QUIET)touch "$@" compile_commands.json: compile_commands.json.in diff --git a/infer/tests/build_systems/clang_compilation_db_relpath/Makefile b/infer/tests/build_systems/clang_compilation_db_relpath/Makefile index b9b6b7860..5dbd606db 100644 --- a/infer/tests/build_systems/clang_compilation_db_relpath/Makefile +++ b/infer/tests/build_systems/clang_compilation_db_relpath/Makefile @@ -21,7 +21,8 @@ include $(TESTS_DIR)/infer.make ../codetoanalyze/path\ with\ spaces/hel\ lo.c ../codetoanalyze/path\ with\ spaces/hel\ lo2.c: # make does not want to interpret "$(@D)" in the right way here... $(QUIET)$(MKDIR_P) ../codetoanalyze/path\ with\ spaces/ - $(QUIET)cp "$<" "$@" +# allow copy races with other tests if they are doing the same action + $(QUIET)$(call copy_or_same_file,$<,$@) $(QUIET)touch "$@" ../codetoanalyze/path\ with\ spaces/hel\ lo.c: ../codetoanalyze/path_with_spaces/hel_lo.c ../codetoanalyze/path\ with\ spaces/hel\ lo2.c: ../codetoanalyze/path_with_spaces/hel_lo2.c