Summary: Write a test for the invalidation of changed procedures Reverse analysis graph for this test: https://fburl.com/graphviz/ybidpidq The procedures marked as changed are `a` and `d`, and this causes `a,b,c,d,e,main` to be invalidated as expected Reviewed By: jvillard Differential Revision: D16579526 fbshipit-source-id: cbec304cemaster
parent
e3668daaa5
commit
e7af794abb
@ -0,0 +1,39 @@
|
|||||||
|
# Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the MIT license found in the
|
||||||
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
|
# E2E test involving the interesting_paths_filter function
|
||||||
|
|
||||||
|
TESTS_DIR = ../..
|
||||||
|
|
||||||
|
MODIFIED_FILES_FILE = changed_files.txt
|
||||||
|
SOURCES = $(wildcard src/*.c src/*.h)
|
||||||
|
INFER_OPTIONS = --changed-files-index $(MODIFIED_FILES_FILE) \
|
||||||
|
--incremental-analysis \
|
||||||
|
--debug-level-analysis 1
|
||||||
|
|
||||||
|
include $(TESTS_DIR)/differential.make
|
||||||
|
|
||||||
|
.PHONY: compare_cg
|
||||||
|
compare_cg: $(PREVIOUS_REPORT)
|
||||||
|
$(QUIET)$(call check_no_diff,\
|
||||||
|
reverse_analysis_callgraph.dot,\
|
||||||
|
reverse_analysis_callgraph.dot.test)
|
||||||
|
|
||||||
|
replace_cg: $(PREVIOUS_REPORT)
|
||||||
|
$(COPY) reverse_analysis_callgraph.dot.test reverse_analysis_callgraph.dot
|
||||||
|
|
||||||
|
test: compare_cg
|
||||||
|
replace: replace_cg
|
||||||
|
|
||||||
|
$(CURRENT_REPORT): $(INFER_CLANG_DEPS) $(SOURCES)
|
||||||
|
$(QUIET)$(INFER_BIN) -o $(CURRENT_DIR) -- clang -c src/*.c
|
||||||
|
|
||||||
|
$(PREVIOUS_REPORT): $(INFER_CLANG_DEPS) $(SOURCES) $(CURRENT_REPORT)
|
||||||
|
$(QUIET)$(REMOVE_DIR) $(PREVIOUS_DIR)
|
||||||
|
$(QUIET)$(COPY) -r $(CURRENT_DIR) $(PREVIOUS_DIR)
|
||||||
|
$(QUIET)$(REMOVE_DIR) $@
|
||||||
|
$(QUIET)$(INFER_BIN) -o $(PREVIOUS_DIR) $(INFER_OPTIONS) -- clang -c src/*.c
|
||||||
|
$(QUIET)$(COPY) $(PREVIOUS_DIR)/reverse_analysis_callgraph.dot \
|
||||||
|
reverse_analysis_callgraph.dot.test
|
@ -0,0 +1 @@
|
|||||||
|
src/a_and_d.c
|
@ -0,0 +1 @@
|
|||||||
|
{"top":{"current":0,"previous":0},"zero":{"current":0,"previous":0},"degrees":[]}
|
@ -0,0 +1,27 @@
|
|||||||
|
|
||||||
|
digraph callgraph {
|
||||||
|
N1 [ label = "a", flag = true ];
|
||||||
|
N1 -> N7 ;
|
||||||
|
|
||||||
|
N5 [ label = "f", flag = false ];
|
||||||
|
N5 -> N4 ;
|
||||||
|
|
||||||
|
N0 [ label = "b", flag = true ];
|
||||||
|
N0 -> N1 ;
|
||||||
|
|
||||||
|
N7 [ label = "main", flag = true ];
|
||||||
|
|
||||||
|
N6 [ label = "e", flag = true ];
|
||||||
|
N6 -> N7 ;
|
||||||
|
|
||||||
|
N4 [ label = "d", flag = true ];
|
||||||
|
N4 -> N6 ;
|
||||||
|
N4 -> N3 ;
|
||||||
|
|
||||||
|
N2 [ label = "g", flag = false ];
|
||||||
|
N2 -> N1 ;
|
||||||
|
|
||||||
|
N3 [ label = "c", flag = true ];
|
||||||
|
N3 -> N0 ;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
#include "b_c_f_g_and_e.h"
|
||||||
|
|
||||||
|
void a() {
|
||||||
|
g();
|
||||||
|
b();
|
||||||
|
}
|
||||||
|
|
||||||
|
void d() { f(); }
|
@ -0,0 +1,8 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
void a();
|
||||||
|
void d();
|
@ -0,0 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
#include "a_and_d.h"
|
||||||
|
|
||||||
|
void e() { d(); }
|
||||||
|
|
||||||
|
void g() {}
|
||||||
|
|
||||||
|
void f() {}
|
||||||
|
|
||||||
|
void c() { d(); }
|
||||||
|
|
||||||
|
void b() { c(); }
|
@ -0,0 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
void g();
|
||||||
|
void f();
|
||||||
|
void b();
|
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*/
|
||||||
|
#include "a_and_d.h"
|
||||||
|
#include "b_c_f_g_and_e.h"
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
e();
|
||||||
|
a();
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in new issue