From 7c22d4169d6817d5812d2f89652e35d086fce25b Mon Sep 17 00:00:00 2001 From: Martin Trojer Date: Mon, 16 Dec 2019 01:40:06 -0800 Subject: [PATCH] Add project-root to buck targers when looking for infer-deps.txt Reviewed By: ngorogiannis Differential Revision: D19014744 fbshipit-source-id: 2d03a6e57 --- infer/lib/python/inferlib/capture/buck.py | 3 ++- infer/tests/build_systems/buck_blacklist/Makefile | 4 ++-- .../build_systems/buck_export_changed_functions/Makefile | 2 +- infer/tests/build_systems/buck_flavors/Makefile | 6 +++--- infer/tests/build_systems/buck_flavors_run/Makefile | 4 ++-- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/infer/lib/python/inferlib/capture/buck.py b/infer/lib/python/inferlib/capture/buck.py index 4b1ed7b2a..f8cc876fe 100644 --- a/infer/lib/python/inferlib/capture/buck.py +++ b/infer/lib/python/inferlib/capture/buck.py @@ -154,7 +154,8 @@ class BuckAnalyzer: if proc.returncode != 0: return None # remove target name prefixes from each line and split them into a list - out = [x.split(None, 1)[1] for x in buck_output.strip().split('\n')] + out = [os.path.join(self.args.project_root, x.split(None, 1)[1]) + for x in buck_output.strip().split('\n')] return [os.path.dirname(x) if os.path.isfile(x) else x for x in out if os.path.exists(x)] diff --git a/infer/tests/build_systems/buck_blacklist/Makefile b/infer/tests/build_systems/buck_blacklist/Makefile index a5e4aec77..8671cede0 100644 --- a/infer/tests/build_systems/buck_blacklist/Makefile +++ b/infer/tests/build_systems/buck_blacklist/Makefile @@ -10,8 +10,8 @@ ANALYZER = checkers BUCK_TARGET = //src:hello @buck_target.txt SOURCES = $(wildcard src/*.c) $(wildcard src/subtarget1/*.c) $(wildcard src/subtarget2/*.c) OBJECTS = buck-out/gen/src/hello\#compile-hello.c.o1f717d69,default/hello.c.o -INFER_OPTIONS = --report-custom-error --developer-mode --project-root $(TESTS_DIR) --no-linters -INFERPRINT_OPTIONS = --project-root $(TESTS_DIR) --issues-tests +INFER_OPTIONS = --report-custom-error --developer-mode --no-linters +INFERPRINT_OPTIONS = --issues-tests CLEAN_EXTRA = buck-out include $(TESTS_DIR)/infer.make diff --git a/infer/tests/build_systems/buck_export_changed_functions/Makefile b/infer/tests/build_systems/buck_export_changed_functions/Makefile index 1c283581d..389845af3 100644 --- a/infer/tests/build_systems/buck_export_changed_functions/Makefile +++ b/infer/tests/build_systems/buck_export_changed_functions/Makefile @@ -11,7 +11,7 @@ B_CPP = src/b.cpp BUCK_TARGET = //src:test TEST_DETERMINATOR_RESULT = infer-out/changed_functions.json DIFF_OUTPUT = diff.mod.test -INFER_OPTIONS = --flavors --process-clang-ast --no-linters --no-capture --export-changed-functions --modified-lines $(DIFF_OUTPUT) --project-root $(TESTS_DIR) +INFER_OPTIONS = --flavors --process-clang-ast --no-linters --no-capture --export-changed-functions --modified-lines $(DIFF_OUTPUT) $(DIFF_OUTPUT): $(QUIET)echo -n '$(A_CPP):' > diff.mod.test diff --git a/infer/tests/build_systems/buck_flavors/Makefile b/infer/tests/build_systems/buck_flavors/Makefile index d251c6fa9..3ffb056b3 100644 --- a/infer/tests/build_systems/buck_flavors/Makefile +++ b/infer/tests/build_systems/buck_flavors/Makefile @@ -6,11 +6,11 @@ TESTS_DIR = ../.. ROOT_DIR = $(TESTS_DIR)/../.. -BUCK_TARGET = //src:hello @buck_target.txt +BUCK_TARGET = //src:hello @buck_target.txt SOURCES = $(wildcard src/*.c) $(wildcard src/subtarget1/*.c) $(wildcard src/subtarget2/*.c) OBJECTS = buck-out/gen/src/hello\#compile-hello.c.o1f717d69,default/hello.c.o -INFER_OPTIONS = --report-custom-error --developer-mode --project-root $(TESTS_DIR) --no-linters -INFERPRINT_OPTIONS = --project-root $(TESTS_DIR) --issues-tests +INFER_OPTIONS = --report-custom-error --developer-mode --no-linters +INFERPRINT_OPTIONS = --issues-tests CLEAN_EXTRA = buck-out include $(TESTS_DIR)/infer.make diff --git a/infer/tests/build_systems/buck_flavors_run/Makefile b/infer/tests/build_systems/buck_flavors_run/Makefile index afda76483..3e90d648b 100644 --- a/infer/tests/build_systems/buck_flavors_run/Makefile +++ b/infer/tests/build_systems/buck_flavors_run/Makefile @@ -9,8 +9,8 @@ ROOT_DIR = $(TESTS_DIR)/../.. BUCK_TARGET = //src:hello SOURCES = src/hello.c src/hello2.c OBJECTS = buck-out/gen/src/hello\#compile-hello.c.o1f717d69,default/hello.c.o -INFER_OPTIONS = --report-custom-error --developer-mode --project-root $(TESTS_DIR) --no-linters -INFERPRINT_OPTIONS = --project-root $(TESTS_DIR) --issues-tests +INFER_OPTIONS = --report-custom-error --developer-mode --no-linters +INFERPRINT_OPTIONS = --issues-tests CLEAN_EXTRA = buck-out include $(TESTS_DIR)/infer.make