Reviewed By: jvillard Differential Revision: D9850743 fbshipit-source-id: f38feb0cemaster
parent
75e4226ea3
commit
f1353ec3da
@ -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 @@
|
|||||||
|
//src:hello3
|
@ -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…
Reference in new issue