Summary: This change introduces the a new argument that lets you restrict the results of a differential report to only certain files. Reviewed By: mbouaziz Differential Revision: D5236626 fbshipit-source-id: 52711e9master
parent
336b7182c3
commit
20a6131ccf
@ -0,0 +1,66 @@
|
||||
# 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.
|
||||
|
||||
# E2E test involving the interesting_paths_filter function
|
||||
|
||||
TESTS_DIR = ../..
|
||||
|
||||
MODIFIED_FILES_FILE = filter_files.test.txt
|
||||
DIFFERENTIAL_ARGS = --differential-filter-files $(MODIFIED_FILES_FILE) \
|
||||
--differential-filter-set fixed --differential-filter-set preexisting
|
||||
SRC_OBJECT_FILES = src/com/example/*.java src/com/example/*.class com/
|
||||
CLEAN_EXTRA = $(SRC_OBJECT_FILES) $(MODIFIED_FILES_FILE)
|
||||
|
||||
include ../../differential.make
|
||||
|
||||
.PHONY: compare_reports replace_reports
|
||||
compare_reports: current.exp.test previous.exp.test
|
||||
$(QUIET)$(call check_no_diff,current.exp,current.exp.test)
|
||||
$(QUIET)$(call check_no_diff,previous.exp,previous.exp.test)
|
||||
|
||||
replace_reports:
|
||||
$(COPY) current.exp.test current.exp
|
||||
$(COPY) previous.exp.test previous.exp
|
||||
|
||||
$(MODIFIED_FILES_FILE):
|
||||
$(QUIET)$(call silent_on_success,Creating interesting paths input file, \
|
||||
sed 's#__ABSOLUTE_PATH__#$(CURDIR)#g' '$(MODIFIED_FILES_FILE).template' > $@)
|
||||
|
||||
current.exp.test: $(CURRENT_REPORT)
|
||||
$(QUIET)$(INFER_BIN) report \
|
||||
--issues-fields $(INFERPRINT_ISSUES_FIELDS) \
|
||||
--from-json-report $(CURRENT_DIR)/report.json \
|
||||
--issues-tests current.exp.test
|
||||
|
||||
previous.exp.test: $(PREVIOUS_REPORT)
|
||||
$(QUIET)$(INFER_BIN) report \
|
||||
--issues-fields $(INFERPRINT_ISSUES_FIELDS) \
|
||||
--from-json-report $(PREVIOUS_DIR)/report.json \
|
||||
--issues-tests previous.exp.test
|
||||
|
||||
test: compare_reports
|
||||
print: current.exp.test previous.exp.test
|
||||
replace: replace_reports
|
||||
$(DIFFERENTIAL_REPORT): $(MODIFIED_FILES_FILE)
|
||||
|
||||
$(CURRENT_REPORT):
|
||||
$(QUIET)$(COPY) src/com/example/DiffClass1.java.current src/com/example/DiffClass1.java
|
||||
$(QUIET)$(COPY) src/com/example/DiffClass2.java.current src/com/example/DiffClass2.java
|
||||
$(QUIET)$(COPY) src/com/example/DiffClass3.java.current src/com/example/DiffClass3.java
|
||||
$(QUIET)$(COPY) src/com/example/DiffClassUnchanged.java.unchanged src/com/example/DiffClassUnchanged.java
|
||||
$(QUIET)$(call silent_on_success,Testing Differential with interesting paths: current,\
|
||||
$(INFER_BIN) -o $(CURRENT_DIR) -- $(JAVAC) src/com/example/*.java)
|
||||
$(QUIET)$(REMOVE_DIR) $(SRC_OBJECT_FILES)
|
||||
|
||||
$(PREVIOUS_REPORT):
|
||||
$(QUIET)$(COPY) src/com/example/DiffClass1.java.previous src/com/example/DiffClass1.java
|
||||
$(QUIET)$(COPY) src/com/example/DiffClass2.java.previous src/com/example/DiffClass2.java
|
||||
$(QUIET)$(COPY) src/com/example/DiffClassThree.java.previous src/com/example/DiffClassThree.java
|
||||
$(QUIET)$(COPY) src/com/example/DiffClassUnchanged.java.unchanged src/com/example/DiffClassUnchanged.java
|
||||
$(QUIET)$(call silent_on_success,Testing Differential with interesting paths: previous,\
|
||||
$(INFER_BIN) -o $(PREVIOUS_DIR) -- $(JAVAC) src/com/example/*.java)
|
||||
$(QUIET)$(REMOVE_DIR) $(SRC_OBJECT_FILES)
|
@ -0,0 +1,5 @@
|
||||
NULL_DEREFERENCE, src/com/example/DiffClass1.java, int DiffClass1.triggerNpe(), 1, com.example.DiffClass1.triggerNpe():int.0f35dc00a0f5d9c32cb58361b79c5a0c, com.example.DiffClass1.triggerNpe():int
|
||||
RESOURCE_LEAK, src/com/example/DiffClass2.java, void DiffClass2.openResource(), 5, com.example.DiffClass2.openResource():void.6561ab0ad86c3847cc965b847ac80324, com.example.DiffClass2.openResource():void
|
||||
NULL_DEREFERENCE, src/com/example/DiffClass3.java, int DiffClassThree.doStuff3(), 1, com.example.DiffClassThree.doStuff3():int.d5d2e8b4c4f1e60721b0e4cebf811191, com.example.DiffClassThree.doStuff3():int
|
||||
NULL_DEREFERENCE, src/com/example/DiffClassUnchanged.java, int DiffClassUnchanged.doWrongStuff(), 1, com.example.DiffClassUnchanged.doWrongStuff():int.8aa1760ea64381fc9a842a0c0c3f0909, com.example.DiffClassUnchanged.doWrongStuff():int
|
||||
NULL_DEREFERENCE, src/com/example/DiffClassUnchanged.java, int DiffClassUnchanged.tellMeTheLength(), 1, com.example.DiffClassUnchanged.tellMeTheLength():int.06e7bdb4fc272c724e2b9dfc4e5026dc, com.example.DiffClassUnchanged.tellMeTheLength():int
|
@ -0,0 +1,6 @@
|
||||
src/com/example/DiffClass2.java
|
||||
__ABSOLUTE_PATH__/src/com/example/DiffClass3.java
|
||||
src/com/example/DiffClassThreeRenamed.java
|
||||
non-existing-unrelated-file.txt
|
||||
src/com/example/unrelated_file.txt
|
||||
/absolute/non-existing/p_a_t_h/to/file.txt
|
@ -0,0 +1 @@
|
||||
NULL_DEREFERENCE, src/com/example/DiffClass2.java, int DiffClass2.doStuff(), 1, com.example.DiffClass2.doStuff():int.0bd745e5e0ee00c272a09256adbe19d2, com.example.DiffClass2.doStuff():int
|
@ -0,0 +1,2 @@
|
||||
NULL_DEREFERENCE, src/com/example/DiffClass3.java, int DiffClassThree.doStuff3(), 1, com.example.DiffClassThree.doStuff3():int.d5d2e8b4c4f1e60721b0e4cebf811191, com.example.DiffClassThree.doStuff3():int
|
||||
NULL_DEREFERENCE, src/com/example/DiffClassUnchanged.java, int DiffClassUnchanged.tellMeTheLength(), 1, com.example.DiffClassUnchanged.tellMeTheLength():int.06e7bdb4fc272c724e2b9dfc4e5026dc, com.example.DiffClassUnchanged.tellMeTheLength():int
|
@ -0,0 +1 @@
|
||||
RESOURCE_LEAK, src/com/example/DiffClass2.java, void DiffClass2.openResource(), 5, com.example.DiffClass2.openResource():void.6561ab0ad86c3847cc965b847ac80324, com.example.DiffClass2.openResource():void
|
@ -0,0 +1,4 @@
|
||||
NULL_DEREFERENCE, src/com/example/DiffClass1.java, int DiffClass1.triggerNpe(), 1, com.example.DiffClass1.triggerNpe():int.0f35dc00a0f5d9c32cb58361b79c5a0c, com.example.DiffClass1.triggerNpe():int
|
||||
NULL_DEREFERENCE, src/com/example/DiffClass2.java, int DiffClass2.doStuff(), 1, com.example.DiffClass2.doStuff():int.0bd745e5e0ee00c272a09256adbe19d2, com.example.DiffClass2.doStuff():int
|
||||
RESOURCE_LEAK, src/com/example/DiffClass2.java, void DiffClass2.openResource(), 5, com.example.DiffClass2.openResource():void.6561ab0ad86c3847cc965b847ac80324, com.example.DiffClass2.openResource():void
|
||||
NULL_DEREFERENCE, src/com/example/DiffClassUnchanged.java, int DiffClassUnchanged.doWrongStuff(), 1, com.example.DiffClassUnchanged.doWrongStuff():int.8aa1760ea64381fc9a842a0c0c3f0909, com.example.DiffClassUnchanged.doWrongStuff():int
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* 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 com.example;
|
||||
|
||||
class DiffClass1 {
|
||||
private String genString() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private int triggerNpe() {
|
||||
return this.genString().length();
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* 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 com.example;
|
||||
|
||||
class DiffClass1 {
|
||||
private String genString() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private int triggerNpe() {
|
||||
return this.genString().length();
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* 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 com.example;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
|
||||
class DiffClass2 {
|
||||
private void openResource() {
|
||||
try {
|
||||
FileInputStream fis = new FileInputStream("AAA");
|
||||
fis.read();
|
||||
fis.close();
|
||||
} catch (Exception exc) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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 com.example;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
|
||||
class DiffClass2 {
|
||||
private String createString() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private int doStuff() {
|
||||
return this.createString().length();
|
||||
}
|
||||
|
||||
|
||||
private void openResource() {
|
||||
try {
|
||||
FileInputStream fis = new FileInputStream("AAA");
|
||||
fis.read();
|
||||
fis.close();
|
||||
} catch (Exception exc) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
/*
|
||||
* 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 com.example;
|
||||
|
||||
class DiffClassThree {
|
||||
public static String createString3() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private int doStuff3() {
|
||||
return DiffClassThree.createString3().length();
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* 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 com.example;
|
||||
|
||||
class DiffClassThree {
|
||||
public static String createString3() {
|
||||
return "this is a string";
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* 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 com.example;
|
||||
|
||||
class DiffClassUnchanged {
|
||||
private int tellMeTheLength() {
|
||||
return DiffClassThree.createString3().length();
|
||||
}
|
||||
|
||||
private String createNullString() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private int doWrongStuff() {
|
||||
return this.createNullString().length();
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
this file is unrelated_file.txt
|
Loading…
Reference in new issue