Turn --buck-blacklist into a string list

Reviewed By: jvillard

Differential Revision: D9850743

fbshipit-source-id: f38feb0ce
master
Martin Trojer 6 years ago committed by Facebook Github Bot
parent 75e4226ea3
commit f1353ec3da

@ -51,7 +51,7 @@ DIRECT_TESTS += \
cpp_racerd cpp_siof cpp_uninit cpp_nullable cpp_conflicts cpp_linters-for-test-only \
ifneq ($(BUCK),no)
BUILD_SYSTEMS_TESTS += buck-clang-db buck_flavors buck_flavors_run buck_flavors_deterministic
BUILD_SYSTEMS_TESTS += buck_blacklist buck-clang-db buck_flavors buck_flavors_run buck_flavors_deterministic
endif
ifneq ($(CMAKE),no)
BUILD_SYSTEMS_TESTS += clang_compilation_db cmake inferconfig

@ -834,7 +834,7 @@ and bootclasspath =
and buck = CLOpt.mk_bool ~long:"buck" ""
and buck_blacklist =
CLOpt.mk_string_opt
CLOpt.mk_string_list
~deprecated:["-blacklist-regex"; "-blacklist"]
~long:"buck-blacklist"
~in_help:InferCommand.[(Run, manual_buck_flavors); (Capture, manual_buck_flavors)]

@ -249,7 +249,7 @@ val bo_relational_domain : [`Bo_relational_domain_oct | `Bo_relational_domain_po
val buck : bool
val buck_blacklist : string option
val buck_blacklist : string list
val buck_build_args : string list

@ -219,11 +219,9 @@ let capture ~changed_files = function
let infer_py = Config.lib_dir ^/ "python" ^/ "infer.py" in
let args =
List.rev_append Config.anon_args
( ( match Config.buck_blacklist with
| Some s when in_buck_mode ->
["--blacklist-regex"; s]
| _ ->
[] )
( ( if not (List.is_empty Config.buck_blacklist) then
["--blacklist-regex"; "(" ^ String.concat ~sep:")|(" Config.buck_blacklist ^ ")"]
else [] )
@ (if not Config.continue_capture then [] else ["--continue"])
@ ( match Config.force_integration with
| None ->

@ -0,0 +1,29 @@
# Copyright (c) 2017-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.
TESTS_DIR = ../..
ROOT_DIR = $(TESTS_DIR)/../..
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
CLEAN_EXTRA = buck-out
include $(TESTS_DIR)/infer.make
$(OBJECTS): $(JAVA_SOURCE_FILES)
$(QUIET)$(call silent_on_success,Compiling Buck flavors tests,\
$(BUCK) build --no-cache $(BUCK_TARGET))
infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(MAKEFILE_LIST)
$(QUIET)$(REMOVE_DIR) buck-out && \
$(call silent_on_success,Testing Buck flavors integration,\
$(INFER_BIN) $(INFER_OPTIONS) capture --flavors --results-dir $(CURDIR)/infer-out \
@blacklist.txt --buck-blacklist '.*src/hello2\.c' \
-- $(BUCK) build --no-cache $(BUCK_TARGET) &&\
$(INFER_BIN) $(INFER_OPTIONS) --merge analyze)

@ -0,0 +1,2 @@
--buck-blacklist
(.*subhello2.*)|(.*subhello2.*)

@ -0,0 +1,3 @@
src/hello.c, test, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure test()]
src/hello3.c, test3, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure test3()]
src/subtarget1/z_filename_greater_than_subhello1.c, foo_defined_in_subtarget1, 2, NULL_DEREFERENCE, no_bucket, ERROR, [start of procedure foo_defined_in_subtarget1()]

@ -0,0 +1,17 @@
cxx_library(
name = 'hello',
srcs = [
'hello.c', 'hello2.c',
],
deps = [
"//src/subtarget1:subtarget1",
"//src/subtarget2:subtarget2",
]
)
cxx_library(
name = 'hello3',
srcs = [
'hello3.c',
],
)

@ -0,0 +1,13 @@
/*
* Copyright (c) 2015-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.
*/
#include <stdlib.h>
void test() {
int* s = NULL;
*s = 42;
}

@ -0,0 +1,13 @@
/*
* Copyright (c) 2015-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.
*/
#include <stdlib.h>
void test2() {
int* s = NULL;
*s = 42;
}

@ -0,0 +1,13 @@
/*
* Copyright (c) 2015-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.
*/
#include <stdlib.h>
void test3() {
int* s = NULL;
*s = 42;
}

@ -0,0 +1,10 @@
cxx_library(
name = 'subtarget1',
visibility = [
'PUBLIC',
],
srcs = [
'z_filename_greater_than_subhello1.c',
'subhello1.c',
],
)

@ -0,0 +1,13 @@
/*
* Copyright (c) 2017-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.
*/
#include <stdlib.h>
void foo_defined_in_subtarget1() {
int* s = NULL;
*s = 42;
}

@ -0,0 +1,13 @@
/*
* Copyright (c) 2017-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.
*/
#include <stdlib.h>
void foo_defined_in_subtarget1() {
int* t = NULL;
*t = 42;
}

@ -0,0 +1,9 @@
cxx_library(
name = 'subtarget2',
visibility = [
'PUBLIC',
],
srcs = [
'subhello2.c',
],
)

@ -0,0 +1,16 @@
/*
* Copyright (c) 2017-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.
*/
#include <stdlib.h>
void foo_defined_in_subtarget1();
void goo() {
foo_defined_in_subtarget1();
int* s = NULL;
*s = 42;
}
Loading…
Cancel
Save