diff --git a/DEFS b/DEFS index 45bfc2c62..7e3650fd7 100644 --- a/DEFS +++ b/DEFS @@ -40,6 +40,7 @@ def create_infer_genrule( srcs=srcs, cmd = ' '.join([ os.getenv('INFER_BIN', 'infer'), + '--project-root', os.getenv('PROJECT_ROOT', os.environ['PWD']), '--eradicate-only', '--results-dir', '$OUT', '--classpath', '$(classpath :{})'.format(name), diff --git a/infer/tests/build_systems/genrule/Makefile b/infer/tests/build_systems/genrule/Makefile index 477af51df..5357fd40a 100644 --- a/infer/tests/build_systems/genrule/Makefile +++ b/infer/tests/build_systems/genrule/Makefile @@ -14,9 +14,7 @@ INFER_TARGET = $(BUCK_TARGET)_infer SOURCES = $(wildcard $(TESTS_DIR)/codetoanalyze/java/infer/*.java) OBJECTS = $(ROOT_DIR)/buck-out/genruletest/gen/infer/tests/build_systems/genrule/module2/lib__module2_compile__output/module2_compile.jar JSON_REPORT = $(ROOT_DIR)/buck-out/gen/infer/tests/build_systems/genrule/module2/module2_infer/infer_out/report.json -INFER_OPTIONS = --project-root $(ROOT_DIR) INFERPRINT_OPTIONS = --project-root $(ROOT_DIR) --issues-tests -CLEAN_EXTRA = $(ROOT_DIR)/buck-out/genruletest report.json # fake infer-out because we only copy the results.json from buck-out. INFER_OUT = . @@ -37,7 +35,7 @@ $(JSON_REPORT): $(JAVA_DEPS) $(JAVA_SOURCE_FILES) $(MAKEFILE_LIST) $(QUIET)cd $(ROOT_DIR) && \ $(REMOVE_DIR) buck-out && \ $(call silent_on_success,Testing Buck genrule for Java integration,\ - INFER_BIN="$(INFER_BIN)" $(BUCK) build --no-cache $(INFER_TARGET)) + INFER_BIN="$(INFER_BIN)" PROJECT_ROOT="$(PWD)" $(BUCK) build --no-cache $(INFER_TARGET)) $(QUIET)touch $@ report.json: $(JSON_REPORT) $(MAKEFILE_LIST) diff --git a/infer/tests/build_systems/genrule/issues.exp b/infer/tests/build_systems/genrule/issues.exp index 8cda83a76..e67a14888 100644 --- a/infer/tests/build_systems/genrule/issues.exp +++ b/infer/tests/build_systems/genrule/issues.exp @@ -1,8 +1,8 @@ -build_systems/genrule/module2/Class2.java, int Class2.dereferenceInterTargetField2Bad(Class1), 1, ERADICATE_NULL_FIELD_ACCESS, ERROR, [origin,Object `class1.field2` could be null when accessing field `Class1.x`. (Origin: field Class1.field2 at line 59)] -build_systems/genrule/module2/Class2.java, void Class2.dereferenceInterTargetField1Bad(Class1), 1, ERADICATE_NULL_METHOD_CALL, ERROR, [origin,The value of `class1.field1` in the call to `toString()` could be null. (Origin: field Class1.field1 at line 55)] -build_systems/genrule/module2/Class2.java, void Class2.dereferenceLocalNullableFieldBad(), 1, ERADICATE_NULL_METHOD_CALL, ERROR, [origin,The value of `Class2.field` in the call to `toString()` could be null. (Origin: field Class2.field at line 51)] -build_systems/genrule/module2/Class2.java, void Class2.followMethodDeclarationOnlyBad(SkipImplementationClass1), 2, ERADICATE_NULL_METHOD_CALL, ERROR, [origin,The value of `obj2` in the call to `toString()` could be null. (Origin: call to annotatedNullable() at line 41)] -build_systems/genrule/module2/Class2.java, void Class2.interTargetAbstractNPEBad(Class1), 2, ERADICATE_NULL_METHOD_CALL, ERROR, [origin,The value of `obj` in the call to `toString()` could be null. (Origin: call to abstractMayReturnNull() at line 31)] -build_systems/genrule/module2/Class2.java, void Class2.interTargetNPEBad(), 2, ERADICATE_NULL_METHOD_CALL, ERROR, [origin,The value of `obj` in the call to `toString()` could be null. (Origin: call to returnsNull() at line 26)] -build_systems/genrule/module2/Class2.java, void Class2.interTargetNativeNPEBad(Class1), 2, ERADICATE_NULL_METHOD_CALL, ERROR, [origin,The value of `obj` in the call to `toString()` could be null. (Origin: call to nativeMayReturnNull() at line 36)] -build_systems/genrule/module2/Class2.java, void Class2.localNPE2Bad(), 2, ERADICATE_NULL_METHOD_CALL, ERROR, [origin,The value of `obj` in the call to `toString()` could be null. (Origin: null constant at line 21)] +infer/tests/build_systems/genrule/module2/Class2.java, int Class2.dereferenceInterTargetField2Bad(Class1), 1, ERADICATE_NULL_FIELD_ACCESS, ERROR, [origin,Object `class1.field2` could be null when accessing field `Class1.x`. (Origin: field Class1.field2 at line 59)] +infer/tests/build_systems/genrule/module2/Class2.java, void Class2.dereferenceInterTargetField1Bad(Class1), 1, ERADICATE_NULL_METHOD_CALL, ERROR, [origin,The value of `class1.field1` in the call to `toString()` could be null. (Origin: field Class1.field1 at line 55)] +infer/tests/build_systems/genrule/module2/Class2.java, void Class2.dereferenceLocalNullableFieldBad(), 1, ERADICATE_NULL_METHOD_CALL, ERROR, [origin,The value of `Class2.field` in the call to `toString()` could be null. (Origin: field Class2.field at line 51)] +infer/tests/build_systems/genrule/module2/Class2.java, void Class2.followMethodDeclarationOnlyBad(SkipImplementationClass1), 2, ERADICATE_NULL_METHOD_CALL, ERROR, [origin,The value of `obj2` in the call to `toString()` could be null. (Origin: call to annotatedNullable() at line 41)] +infer/tests/build_systems/genrule/module2/Class2.java, void Class2.interTargetAbstractNPEBad(Class1), 2, ERADICATE_NULL_METHOD_CALL, ERROR, [origin,The value of `obj` in the call to `toString()` could be null. (Origin: call to abstractMayReturnNull() at line 31)] +infer/tests/build_systems/genrule/module2/Class2.java, void Class2.interTargetNPEBad(), 2, ERADICATE_NULL_METHOD_CALL, ERROR, [origin,The value of `obj` in the call to `toString()` could be null. (Origin: call to returnsNull() at line 26)] +infer/tests/build_systems/genrule/module2/Class2.java, void Class2.interTargetNativeNPEBad(Class1), 2, ERADICATE_NULL_METHOD_CALL, ERROR, [origin,The value of `obj` in the call to `toString()` could be null. (Origin: call to nativeMayReturnNull() at line 36)] +infer/tests/build_systems/genrule/module2/Class2.java, void Class2.localNPE2Bad(), 2, ERADICATE_NULL_METHOD_CALL, ERROR, [origin,The value of `obj` in the call to `toString()` could be null. (Origin: null constant at line 21)]