Summary: Due to limitations in our Buck integration, the thread-safety analysis cannot create a trace that bottoms out in a Buck target that is not a direct dependency of the current target. These truncated traces are confusing and tough to act on. Until we can address these limitations, let's avoid reporting on truncated traces. Reviewed By: jeremydubreil Differential Revision: D5969840 fbshipit-source-id: 877b9demaster
parent
386a6d718d
commit
47ab1a2e67
@ -0,0 +1,30 @@
|
|||||||
|
# Copyright (c) 2017 - present Facebook, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the BSD style license found in the
|
||||||
|
# LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
# of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
|
||||||
|
TESTS_DIR = ../..
|
||||||
|
ROOT_DIR = $(TESTS_DIR)/../..
|
||||||
|
|
||||||
|
ANALYZER = checkers
|
||||||
|
BUCK_TARGET = //infer/tests/build_systems/threadsafety_traces/module3:module3
|
||||||
|
INFERPRINT_OPTIONS = --project-root $(ROOT_DIR) --issues-tests
|
||||||
|
CLEAN_EXTRA = $(ROOT_DIR)/buck-out
|
||||||
|
|
||||||
|
include $(TESTS_DIR)/infer.make
|
||||||
|
|
||||||
|
$(OBJECTS): $(JAVA_SOURCE_FILES)
|
||||||
|
$(QUIET)cd $(ROOT_DIR) && \
|
||||||
|
$(call silent_on_success,Compiling thread-safety trace tests,\
|
||||||
|
INFER_BIN=$(INFER_BIN) NO_BUCKD=1 \
|
||||||
|
$(BUCK) build --no-cache $(BUCK_TARGET))
|
||||||
|
|
||||||
|
infer-out/report.json: $(JAVA_DEPS) $(JAVA_SOURCE_FILES)
|
||||||
|
$(QUIET)cd $(ROOT_DIR) && \
|
||||||
|
$(REMOVE_DIR) buck-out && \
|
||||||
|
$(call silent_on_success,Testing thread-safety trace tests with Buck,\
|
||||||
|
INFER_BIN=$(INFER_BIN) NO_BUCKD=1 \
|
||||||
|
$(INFER_BIN) -a $(ANALYZER) --results-dir $(CURDIR)/infer-out -- \
|
||||||
|
$(BUCK) build --no-cache $(BUCK_TARGET))
|
@ -0,0 +1,8 @@
|
|||||||
|
java_library(
|
||||||
|
name='module1',
|
||||||
|
srcs=['Class1.java'],
|
||||||
|
deps=[],
|
||||||
|
visibility=[
|
||||||
|
'PUBLIC'
|
||||||
|
],
|
||||||
|
)
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017 - present Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package threadsafety_traces.module1;
|
||||||
|
|
||||||
|
public class Class1 {
|
||||||
|
|
||||||
|
static int sField;
|
||||||
|
|
||||||
|
public static void method() {
|
||||||
|
sField++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
java_library(
|
||||||
|
name='module2',
|
||||||
|
srcs=['Class2.java'],
|
||||||
|
deps=[
|
||||||
|
'//infer/tests/build_systems/threadsafety_traces/module1:module1'
|
||||||
|
],
|
||||||
|
visibility=[
|
||||||
|
'PUBLIC'
|
||||||
|
],
|
||||||
|
)
|
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017 - present Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package threadsafety_traces.module2;
|
||||||
|
|
||||||
|
import threadsafety_traces.module1.Class1;
|
||||||
|
|
||||||
|
public class Class2 {
|
||||||
|
|
||||||
|
public static void method() {
|
||||||
|
Class1.method();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,7 @@
|
|||||||
|
java_library(
|
||||||
|
name='module3',
|
||||||
|
srcs=['Class3.java'],
|
||||||
|
deps=[
|
||||||
|
'//infer/tests/build_systems/threadsafety_traces/module2:module2',
|
||||||
|
]
|
||||||
|
)
|
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017 - present Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package threadsafety_traces.module3;
|
||||||
|
|
||||||
|
import threadsafety_traces.module2.Class2;
|
||||||
|
|
||||||
|
@interface ThreadSafe {
|
||||||
|
}
|
||||||
|
|
||||||
|
@ThreadSafe
|
||||||
|
public class Class3 {
|
||||||
|
|
||||||
|
/** this will produce a truncated trace that should bottom out in Class1.method, but will stop
|
||||||
|
short due to limitations in our Buck integration. test that we don't report a truncated
|
||||||
|
trace in this situation. */
|
||||||
|
public void callClass2() {
|
||||||
|
Class2.method();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue