Summary:public Deprecate the incremental mode. Several parts of the back-end can be removed. The options for incremental analysis -i at the python level are now deprecated, and re-routed to --reactive. The main difference with --reactive is that it does not produce an analysis of the whole project, but is limited to what is reachable via reactive propagation starting from the changed files. Reviewed By: sblackshear Differential Revision: D2960078 fb-gh-sync-id: 6e8b46b shipit-source-id: 6e8b46bmaster
parent
c868f51b2d
commit
e0d5847eb8
@ -1,12 +0,0 @@
|
||||
java_test(
|
||||
name='incremental',
|
||||
deps=[
|
||||
'//infer/tests/codetoanalyze/java/incremental/file_unchanged:file_unchanged',
|
||||
'//infer/tests/codetoanalyze/java/incremental/parent_changed:parent_changed',
|
||||
'//infer/tests/codetoanalyze/java/incremental/child_changed:child_changed',
|
||||
'//infer/tests/codetoanalyze/java/incremental/changed_only_mode:changed_only_mode',
|
||||
],
|
||||
visibility = [
|
||||
'PUBLIC'
|
||||
]
|
||||
)
|
@ -1,42 +0,0 @@
|
||||
v1_files = glob([ '**/*.java.v1'])
|
||||
v2_files = glob(['**/*.java.v2'])
|
||||
v3_files = glob(['**/*.java.v3'])
|
||||
sources = v1_files + v2_files + v3_files
|
||||
|
||||
def copy_files_strip_suffix_cmd(sfx, files):
|
||||
return ' && '.join([' '.join(['cp', f, f.replace(sfx, '')]) for f in files])
|
||||
|
||||
out = 'out'
|
||||
clean_out = ' '.join(['rm', '-rf', out])
|
||||
clean_java = ' '.join(['rm', '-rf', '*.java'])
|
||||
clean_cmd = ' && '.join([clean_out, clean_java])
|
||||
stripped_suffix_files = map(lambda f: f.replace('.v1', ''), v1_files)
|
||||
to_compile = ' '.join(stripped_suffix_files)
|
||||
infer_cmd = ' '.join([
|
||||
'infer',
|
||||
'--no-progress-bar',
|
||||
'-i',
|
||||
'--changed-only',
|
||||
'--absolute-paths',
|
||||
'-o', out,
|
||||
'-a', 'infer',
|
||||
'--',
|
||||
'javac',
|
||||
to_compile
|
||||
])
|
||||
v1_copy_cmd = copy_files_strip_suffix_cmd('.v1', v1_files)
|
||||
v2_copy_cmd = copy_files_strip_suffix_cmd('.v2', v2_files)
|
||||
v3_copy_cmd = copy_files_strip_suffix_cmd('.v3', v3_files)
|
||||
stats_copy_cmd = ' '.join(['cp', out + '/stats.json', '$OUT'])
|
||||
command = ' && '.join([clean_cmd, v1_copy_cmd, infer_cmd, v2_copy_cmd, infer_cmd, v3_copy_cmd, infer_cmd, stats_copy_cmd])
|
||||
|
||||
genrule(
|
||||
name = 'analyze',
|
||||
srcs = sources,
|
||||
out = 'stats.json',
|
||||
cmd = command,
|
||||
deps = [],
|
||||
visibility = [
|
||||
'PUBLIC',
|
||||
]
|
||||
)
|
@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.changed_only_future;
|
||||
|
||||
class Child {
|
||||
|
||||
Object bar() {
|
||||
return new Object();
|
||||
}
|
||||
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.changed_only_future;
|
||||
|
||||
class Child {
|
||||
|
||||
Object bar() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.changed_only_future;
|
||||
|
||||
class Parent {
|
||||
|
||||
Object foo() {
|
||||
Child c = new Child();
|
||||
return c.bar();
|
||||
}
|
||||
|
||||
void bar() {
|
||||
Object o1 = new Object();
|
||||
}
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.changed_only_future;
|
||||
|
||||
class Parent {
|
||||
|
||||
Object foo() {
|
||||
Child c = new Child();
|
||||
return c.bar();
|
||||
}
|
||||
|
||||
void bar() {
|
||||
Object o1 = new Object();
|
||||
}
|
||||
|
||||
void baz() {
|
||||
foo().toString(); // should be an NPE with Child.v2
|
||||
}
|
||||
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
v1_files = glob([ '**/*.java.v1'])
|
||||
v2_files = glob(['**/*.java.v2'])
|
||||
normal_files = glob(['**/*.java'])
|
||||
sources = v1_files + v2_files + normal_files
|
||||
|
||||
java_library(
|
||||
name = 'changed_only_mode',
|
||||
srcs = sources,
|
||||
deps = [],
|
||||
visibility = [
|
||||
'PUBLIC'
|
||||
]
|
||||
)
|
||||
|
||||
def copy_files_strip_suffix_cmd(sfx, files):
|
||||
return ' && '.join([' '.join(['cp', f, f.replace(sfx, '')]) for f in files])
|
||||
|
||||
out = 'out'
|
||||
clean_cmd = ' '.join(['rm', '-rf', out])
|
||||
stripped_suffix_files = map(lambda f: f.replace('.v1', ''), v1_files)
|
||||
to_compile = ' '.join(set(normal_files + stripped_suffix_files))
|
||||
infer_cmd = ' '.join([
|
||||
'infer',
|
||||
'--no-progress-bar',
|
||||
'-i',
|
||||
'--changed-only',
|
||||
'--absolute-paths',
|
||||
'-o', out,
|
||||
'-a', 'infer',
|
||||
'--',
|
||||
'javac',
|
||||
to_compile
|
||||
])
|
||||
v1_copy_cmd = copy_files_strip_suffix_cmd('.v1', v1_files)
|
||||
v2_copy_cmd = copy_files_strip_suffix_cmd('.v2', v2_files)
|
||||
stats_copy_cmd = ' '.join(['cp', out + '/stats.json', '$OUT'])
|
||||
command = ' && '.join([clean_cmd, v1_copy_cmd, infer_cmd, v2_copy_cmd, infer_cmd, stats_copy_cmd])
|
||||
|
||||
genrule(
|
||||
name = 'analyze',
|
||||
srcs = sources,
|
||||
out = 'stats.json',
|
||||
cmd = command,
|
||||
deps = [':changed_only_mode'],
|
||||
visibility = [
|
||||
'PUBLIC',
|
||||
]
|
||||
)
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.changed_only_mode;
|
||||
|
||||
class Child {
|
||||
|
||||
Object bar() {
|
||||
return null;
|
||||
}
|
||||
|
||||
Object dontReanalyze(Object o) {
|
||||
return o;
|
||||
}
|
||||
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.changed_only_mode;
|
||||
|
||||
class Child {
|
||||
|
||||
Object bar() {
|
||||
return new Object();
|
||||
}
|
||||
|
||||
Object dontReanalyze(Object o) {
|
||||
return o;
|
||||
}
|
||||
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.changed_only_mode;
|
||||
|
||||
class Child {
|
||||
|
||||
Object bar() {
|
||||
return null;
|
||||
}
|
||||
|
||||
Object dontReanalyze(Object o) {
|
||||
return o;
|
||||
}
|
||||
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.changed_only_mode;
|
||||
|
||||
class Parent {
|
||||
|
||||
Object foo() {
|
||||
Child c = new Child();
|
||||
Object o = c.bar();
|
||||
return o;
|
||||
}
|
||||
|
||||
void dontReanalyze() {
|
||||
Object o1 = new Object();
|
||||
}
|
||||
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
v1_files = glob([ '**/*.java.v1'])
|
||||
v2_files = glob(['**/*.java.v2'])
|
||||
normal_files = glob(['**/*.java'])
|
||||
sources = v1_files + v2_files + normal_files
|
||||
|
||||
java_library(
|
||||
name = 'child_changed',
|
||||
srcs = sources,
|
||||
deps = [],
|
||||
visibility = [
|
||||
'PUBLIC'
|
||||
]
|
||||
)
|
||||
|
||||
def copy_files_strip_suffix_cmd(sfx, files):
|
||||
return ' && '.join([' '.join(['cp', f, f.replace(sfx, '')]) for f in files])
|
||||
|
||||
out = 'out'
|
||||
clean_cmd = ' '.join(['rm', '-rf', out])
|
||||
stripped_suffix_files = map(lambda f: f.replace('.v1', ''), v1_files)
|
||||
to_compile = ' '.join(normal_files + stripped_suffix_files)
|
||||
infer_cmd = ' '.join([
|
||||
'infer',
|
||||
'--no-progress-bar',
|
||||
'-i',
|
||||
'--absolute-paths',
|
||||
'-o', out,
|
||||
'-a', 'infer',
|
||||
'--',
|
||||
'javac',
|
||||
to_compile
|
||||
])
|
||||
v1_copy_cmd = copy_files_strip_suffix_cmd('.v1', v1_files)
|
||||
v2_copy_cmd = copy_files_strip_suffix_cmd('.v2', v2_files)
|
||||
stats_copy_cmd = ' '.join(['cp', out + '/stats.json', '$OUT'])
|
||||
command = ' && '.join([clean_cmd, v1_copy_cmd, infer_cmd, v2_copy_cmd, infer_cmd, stats_copy_cmd])
|
||||
|
||||
genrule(
|
||||
name = 'analyze',
|
||||
srcs = sources,
|
||||
out = 'stats.json',
|
||||
cmd = command,
|
||||
deps = [':child_changed'],
|
||||
visibility = [
|
||||
'PUBLIC',
|
||||
]
|
||||
)
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.child_changed;
|
||||
|
||||
class Child {
|
||||
|
||||
Object bar() {
|
||||
return null;
|
||||
}
|
||||
|
||||
Object dontReanalyze(Object o) {
|
||||
return o;
|
||||
}
|
||||
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.child_changed;
|
||||
|
||||
class Child {
|
||||
|
||||
Object bar() {
|
||||
return new Object();
|
||||
}
|
||||
|
||||
Object dontReanalyze(Object o) {
|
||||
return o;
|
||||
}
|
||||
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.child_changed;
|
||||
|
||||
class Child {
|
||||
|
||||
Object bar() {
|
||||
return null;
|
||||
}
|
||||
|
||||
Object dontReanalyze(Object o) {
|
||||
return o;
|
||||
}
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.child_changed;
|
||||
|
||||
class Grandparent {
|
||||
|
||||
void baz() {
|
||||
Parent p = new Parent();
|
||||
Object o = p.foo();
|
||||
o.toString();
|
||||
}
|
||||
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.child_changed;
|
||||
|
||||
class Parent {
|
||||
|
||||
Object foo() {
|
||||
Child c = new Child();
|
||||
Object o = c.bar();
|
||||
return o;
|
||||
}
|
||||
|
||||
void dontReanalyze() {
|
||||
Object o1 = new Object();
|
||||
}
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
sources = glob([ '**/*.java'])
|
||||
|
||||
java_library(
|
||||
name = 'file_unchanged',
|
||||
srcs = sources,
|
||||
visibility = [
|
||||
'PUBLIC'
|
||||
]
|
||||
)
|
||||
|
||||
out = 'out'
|
||||
clean_cmd = ' '.join(['rm', '-rf', out])
|
||||
infer_cmd = ' '.join([
|
||||
'infer',
|
||||
'--no-progress-bar',
|
||||
'-i',
|
||||
'--absolute-paths',
|
||||
'-o', out,
|
||||
'-a', 'infer',
|
||||
'--',
|
||||
'javac',
|
||||
'$SRCS',
|
||||
])
|
||||
stats_copy_cmd = ' '.join(['cp', out + '/stats.json', '$OUT'])
|
||||
command = ' && '.join([clean_cmd, infer_cmd, infer_cmd, stats_copy_cmd])
|
||||
|
||||
genrule(
|
||||
name = 'analyze',
|
||||
srcs = sources,
|
||||
out = 'stats.json',
|
||||
cmd = command,
|
||||
deps = [':file_unchanged'],
|
||||
visibility = [
|
||||
'PUBLIC',
|
||||
]
|
||||
)
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.file_unchanged;
|
||||
|
||||
public class File {
|
||||
|
||||
Object o() {
|
||||
return new Object();
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
v1_files = glob([ '**/*.java.v1'])
|
||||
v2_files = glob(['**/*.java.v2'])
|
||||
normal_files = glob(['**/*.java'])
|
||||
sources = v1_files + v2_files + normal_files
|
||||
|
||||
java_library(
|
||||
name = 'parent_changed',
|
||||
srcs = sources,
|
||||
deps = [],
|
||||
visibility = [
|
||||
'PUBLIC'
|
||||
]
|
||||
)
|
||||
|
||||
def copy_files_strip_suffix_cmd(sfx, files):
|
||||
return ' && '.join([' '.join(['cp', f, f.replace(sfx, '')]) for f in files])
|
||||
|
||||
out = 'out'
|
||||
clean_cmd = ' '.join(['rm', '-rf', out])
|
||||
stripped_suffix_files = map(lambda f: f.replace('.v1', ''), v1_files)
|
||||
to_compile = ' '.join(normal_files + stripped_suffix_files)
|
||||
infer_cmd = ' '.join([
|
||||
'infer',
|
||||
'--no-progress-bar',
|
||||
'-i',
|
||||
'--absolute-paths',
|
||||
'-o', out,
|
||||
'-a', 'infer',
|
||||
'--',
|
||||
'javac',
|
||||
to_compile
|
||||
])
|
||||
v1_copy_cmd = copy_files_strip_suffix_cmd('.v1', v1_files)
|
||||
v2_copy_cmd = copy_files_strip_suffix_cmd('.v2', v2_files)
|
||||
stats_copy_cmd = ' '.join(['cp', out + '/stats.json', '$OUT'])
|
||||
command = ' && '.join([clean_cmd, v1_copy_cmd, infer_cmd, v2_copy_cmd, infer_cmd, stats_copy_cmd])
|
||||
|
||||
genrule(
|
||||
name = 'analyze',
|
||||
srcs = sources,
|
||||
out = 'stats.json',
|
||||
cmd = command,
|
||||
deps = [':parent_changed'],
|
||||
visibility = [
|
||||
'PUBLIC',
|
||||
]
|
||||
)
|
@ -1,17 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.parent_changed;
|
||||
|
||||
class Child {
|
||||
|
||||
Object bar() {
|
||||
return new Object();
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.parent_changed;
|
||||
|
||||
class Parent {
|
||||
|
||||
void foo() {
|
||||
Child c = new Child();
|
||||
Object o = c.bar();
|
||||
o.toString();
|
||||
}
|
||||
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 codetoanalyze.java.incremental.parent_changed;
|
||||
|
||||
class Parent {
|
||||
|
||||
void foo() {
|
||||
Child c = new Child();
|
||||
Object o = c.bar();
|
||||
o.toString();
|
||||
}
|
||||
|
||||
void bar() {
|
||||
Object o1 = new Object();
|
||||
}
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
java_test(
|
||||
name='incremental',
|
||||
srcs=glob(['*.java']),
|
||||
deps=[
|
||||
'//dependencies/java/guava:guava',
|
||||
'//dependencies/java/junit:hamcrest',
|
||||
'//dependencies/java/junit:junit',
|
||||
'//infer/tests/utils:utils',
|
||||
],
|
||||
resources=[
|
||||
'//infer/tests/codetoanalyze/java/incremental/file_unchanged:analyze',
|
||||
'//infer/tests/codetoanalyze/java/incremental/parent_changed:analyze',
|
||||
'//infer/tests/codetoanalyze/java/incremental/child_changed:analyze',
|
||||
'//infer/tests/codetoanalyze/java/incremental/changed_only_mode:analyze',
|
||||
'//infer/tests/codetoanalyze/java/incremental/changed_only_future:analyze',
|
||||
],
|
||||
visibility=[
|
||||
'PUBLIC',
|
||||
],
|
||||
)
|
@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 endtoend.java.incremental;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.NumberOfFilesAnalyzed.numberOfFilesAnalyzed;
|
||||
import static utils.matchers.NumberOfProceduresAnalyzed.numberOfProceduresAnalyzed;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.Path;
|
||||
import java.io.*;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferStats;
|
||||
|
||||
/**
|
||||
* Make sure the incremental --changed-only mode doesn't corrupt the results for future analyses by
|
||||
* refusing to analyze callers of changed procedures (and thereby creating stale specs for some poor
|
||||
* future analysis).
|
||||
*/
|
||||
public class ChangedOnlyFuture {
|
||||
|
||||
public static final String SOURCE_DIR =
|
||||
"/infer/tests/codetoanalyze/java/incremental/changed_only_future/";
|
||||
|
||||
private static InferStats inferStats;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferStats = InferStats.loadInferStats(ChangedOnlyModeTest.class, SOURCE_DIR);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onlyChangedFileReanalyzedInChangedOnlyMode()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
assertThat(
|
||||
"Only the changed file should be re-analyzed",
|
||||
inferStats,
|
||||
numberOfFilesAnalyzed(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void changedAndStaleProcsReanalyze()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
assertThat(
|
||||
"Both the new (changed) procedure and its stale (unchanged) callee should be re-analyzed",
|
||||
inferStats,
|
||||
numberOfProceduresAnalyzed(2));
|
||||
}
|
||||
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 endtoend.java.incremental;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.NumberOfFilesAnalyzed.numberOfFilesAnalyzed;
|
||||
import static utils.matchers.NumberOfProceduresAnalyzed.numberOfProceduresAnalyzed;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.Path;
|
||||
import java.io.*;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferStats;
|
||||
|
||||
public class ChangedOnlyModeTest {
|
||||
|
||||
public static final String SOURCE_DIR =
|
||||
"/infer/tests/codetoanalyze/java/incremental/changed_only_mode/";
|
||||
|
||||
private static InferStats inferStats;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferStats = InferStats.loadInferStats(ChangedOnlyModeTest.class, SOURCE_DIR);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onlyChangedFileReanalyzedInChangedOnlyMode()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
assertThat(
|
||||
"After changing the child file, parent should not be re-analyzed in changed-only mode",
|
||||
inferStats,
|
||||
numberOfFilesAnalyzed(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onlyChangedProcsReanalyzedInIncrementalMode()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
assertThat(
|
||||
"After changing a procedure, its callers should not be re-analyzed in changed-only mode",
|
||||
inferStats,
|
||||
numberOfProceduresAnalyzed(1));
|
||||
}
|
||||
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 endtoend.java.incremental;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.NumberOfFilesAnalyzed.numberOfFilesAnalyzed;
|
||||
import static utils.matchers.NumberOfProceduresAnalyzed.numberOfProceduresAnalyzed;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.Path;
|
||||
import java.io.*;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferStats;
|
||||
|
||||
public class ChildChangedTest {
|
||||
|
||||
public static final String SOURCE_DIR =
|
||||
"/infer/tests/codetoanalyze/java/incremental/child_changed/";
|
||||
|
||||
private static InferStats inferStats;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferStats = InferStats.loadInferStats(ChildChangedTest.class, SOURCE_DIR);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void changedFilesReanalyzedInIncrementalMode()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
assertThat(
|
||||
"After changing the child file, parent and grandparent should be re-analyzed",
|
||||
inferStats,
|
||||
numberOfFilesAnalyzed(3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onlyChangedProcsReanalyzedInIncrementalMode()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
assertThat(
|
||||
"After changing a procedure, only the proc and its callers should be re-analyzed",
|
||||
inferStats,
|
||||
numberOfProceduresAnalyzed(3));
|
||||
}
|
||||
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 endtoend.java.incremental;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.NumberOfFilesAnalyzed.numberOfFilesAnalyzed;
|
||||
import static utils.matchers.NumberOfProceduresAnalyzed.numberOfProceduresAnalyzed;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.Path;
|
||||
import java.io.*;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferStats;
|
||||
|
||||
public class FileUnchangedTest {
|
||||
|
||||
public static final String SOURCE_DIR =
|
||||
"/infer/tests/codetoanalyze/java/incremental/file_unchanged/";
|
||||
|
||||
private static InferStats inferStats;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferStats = InferStats.loadInferStats(FileUnchangedTest.class, SOURCE_DIR);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unchangedFileNotReanalyzedInIncrementalMode()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
assertThat(
|
||||
"Unchanged file should not be re-analyzed in incremental mode",
|
||||
inferStats,
|
||||
numberOfFilesAnalyzed(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unchangedProcdureNotReanalyzedInIncrementalMode()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
assertThat(
|
||||
"Unchanged procedure should not be re-analyzed in incremental mode",
|
||||
inferStats,
|
||||
numberOfProceduresAnalyzed(0));
|
||||
}
|
||||
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2015 - 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 endtoend.java.incremental;
|
||||
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static utils.matchers.NumberOfFilesAnalyzed.numberOfFilesAnalyzed;
|
||||
import static utils.matchers.NumberOfProceduresAnalyzed.numberOfProceduresAnalyzed;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.Path;
|
||||
import java.io.*;
|
||||
|
||||
import utils.InferException;
|
||||
import utils.InferStats;
|
||||
|
||||
public class ParentChangedTest {
|
||||
|
||||
public static final String SOURCE_DIR =
|
||||
"/infer/tests/codetoanalyze/java/incremental/parent_changed/";
|
||||
|
||||
private static InferStats inferStats;
|
||||
|
||||
@BeforeClass
|
||||
public static void loadResults() throws InterruptedException, IOException {
|
||||
inferStats = InferStats.loadInferStats(ParentChangedTest.class, SOURCE_DIR);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unchangedFileNotReanalyzedInIncrementalMode()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
assertThat(
|
||||
"After changing only the parent file, the child file should not be re-analyzed",
|
||||
inferStats,
|
||||
numberOfFilesAnalyzed(1));
|
||||
assertThat(
|
||||
"When adding a new procedure, the old ones should not be re-analyzed",
|
||||
inferStats,
|
||||
numberOfProceduresAnalyzed(1));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unchangedProcedureNotReanalyzedInIncrementalMode()
|
||||
throws IOException, InterruptedException, InferException {
|
||||
assertThat(
|
||||
"When adding a new procedure, the old ones should not be re-analyzed",
|
||||
inferStats,
|
||||
numberOfProceduresAnalyzed(1));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue