Reviewed By: skcho Differential Revision: D18039141 fbshipit-source-id: 3faef0615master
parent
75a18b5027
commit
d001db1e94
@ -0,0 +1 @@
|
|||||||
|
3a1d93f2ea0699f9177b11a09cfafcb02f96a902
|
@ -0,0 +1,41 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
TESTS_DIR = ../..
|
||||||
|
include $(TESTS_DIR)/base.make
|
||||||
|
|
||||||
|
A_C = src/a.c
|
||||||
|
B_C = src/b.c
|
||||||
|
BUCK_TARGET = //src:test
|
||||||
|
TEST_DETERMINATOR_RESULT = infer-out/test_determinator.json
|
||||||
|
DIFF_OUTPUT = diff.mod.test
|
||||||
|
INFER_OPTIONS = --flavors --process-clang-ast --no-linters --no-capture --test-determinator \
|
||||||
|
--modified-lines $(DIFF_OUTPUT) --project-root $(TESTS_DIR) --profiler-samples profiler_samples.json
|
||||||
|
|
||||||
|
$(DIFF_OUTPUT):
|
||||||
|
$(QUIET)echo -n '$(A_C):' > diff.mod.test
|
||||||
|
$(QUIET)(diff -N --unchanged-line-format="U" --old-line-format="O" --new-line-format="N" \
|
||||||
|
$(A_C) src/mod-a.c || [ $$? = 1 ]) >> diff.mod.test
|
||||||
|
$(QUIET)echo >> diff.mod.test
|
||||||
|
$(QUIET)echo -n '$(B_C):' >> diff.mod.test
|
||||||
|
$(QUIET)(diff -N --unchanged-line-format="U" --old-line-format="O" --new-line-format="N" \
|
||||||
|
$(B_C) src/mod-b.c || [ $$? = 1 ]) >> diff.mod.test
|
||||||
|
$(QUIET)echo >> diff.mod.test
|
||||||
|
|
||||||
|
$(TEST_DETERMINATOR_RESULT): $(DIFF_OUTPUT)
|
||||||
|
$(QUIET)$(call silent_on_success,Testing test-determinator for clang with set of changes,\
|
||||||
|
$(INFER_BIN) $(INFER_OPTIONS) -- buck build --no-cache $(BUCK_TARGET))
|
||||||
|
|
||||||
|
.PHONY: test
|
||||||
|
test: $(TEST_DETERMINATOR_RESULT)
|
||||||
|
$(QUIET)$(call check_no_diff,test_determinator.json.exp,$(TEST_DETERMINATOR_RESULT))
|
||||||
|
|
||||||
|
.PHONY: replace
|
||||||
|
replace: $(TEST_DETERMINATOR_RESULT)
|
||||||
|
$(COPY) $(TEST_DETERMINATOR_RESULT) test_determinator.json.exp
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
$(REMOVE_DIR) *.test infer-out* buck-out*
|
@ -0,0 +1,35 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"field1": {},
|
||||||
|
"test": "label_a",
|
||||||
|
"field2": {},
|
||||||
|
"native_symbols": [
|
||||||
|
{
|
||||||
|
"name": "a_test"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "example_function10",
|
||||||
|
"mangled_name" : "example_function10"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"field3": {}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"field1": {},
|
||||||
|
"field2": {},
|
||||||
|
"field3": {},
|
||||||
|
"test": "label_b",
|
||||||
|
"field4": {},
|
||||||
|
"native_symbols": [
|
||||||
|
{
|
||||||
|
"name": "b_test"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "example_function20",
|
||||||
|
"mangled_name" : "example_function20"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"field5": {},
|
||||||
|
"field6": {}
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,6 @@
|
|||||||
|
cxx_library(
|
||||||
|
name = 'test',
|
||||||
|
srcs = [
|
||||||
|
'a.c', 'b.c',
|
||||||
|
],
|
||||||
|
)
|
@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
* 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 <stdlib.h>
|
||||||
|
|
||||||
|
void a_test() {
|
||||||
|
int* s = NULL;
|
||||||
|
*s = 42;
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* 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 <stdlib.h>
|
||||||
|
|
||||||
|
void b_test() {
|
||||||
|
int* s = NULL;
|
||||||
|
*s = 42;
|
||||||
|
}
|
@ -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 <stdlib.h>
|
||||||
|
|
||||||
|
/* comment */
|
||||||
|
void a_test() {
|
||||||
|
int* s = NULL;
|
||||||
|
*s = 42 + 1;
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* 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 <stdlib.h>
|
||||||
|
|
||||||
|
void b_test() {
|
||||||
|
int* s = NULL;
|
||||||
|
*s = 42 + 3;
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
["label_a","label_b"]
|
Loading…
Reference in new issue