From 8cac7df44798abf6e1f489d9c8e4bcb7e0fc9c44 Mon Sep 17 00:00:00 2001 From: Mehdi Bouaziz Date: Mon, 8 Oct 2018 18:07:30 -0700 Subject: [PATCH] [Uninit][1/13] Move interproc tests Reviewed By: jeremydubreil Differential Revision: D10250022 fbshipit-source-id: d82863d5a --- Makefile | 1 - infer/tests/build_systems/uninit/Makefile | 21 ------------------- infer/tests/build_systems/uninit/issues.exp | 7 ------- .../cpp}/uninit/inter_proc_uninit.cpp | 19 ++++++++++------- .../tests/codetoanalyze/cpp/uninit/issues.exp | 1 + 5 files changed, 12 insertions(+), 37 deletions(-) delete mode 100644 infer/tests/build_systems/uninit/Makefile delete mode 100644 infer/tests/build_systems/uninit/issues.exp rename infer/tests/{build_systems => codetoanalyze/cpp}/uninit/inter_proc_uninit.cpp (89%) diff --git a/Makefile b/Makefile index 3c3a0bb5d..3ca3aa31a 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,6 @@ BUILD_SYSTEMS_TESTS += \ reactive \ run_hidden_linters \ tracebugs \ - uninit \ utf8_in_procname \ DIRECT_TESTS += \ diff --git a/infer/tests/build_systems/uninit/Makefile b/infer/tests/build_systems/uninit/Makefile deleted file mode 100644 index 44a453327..000000000 --- a/infer/tests/build_systems/uninit/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2017-present, Facebook, Inc. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -TESTS_DIR = ../.. - -# see explanations in cpp/errors/Makefile for the custom isystem -CLANG_OPTIONS = -x c++ -std=c++11 -nostdinc++ -isystem$(MODELS_DIR)/cpp/include -isystem$(CLANG_INCLUDES)/c++/v1/ -c -INFER_OPTIONS = --uninit-only --uninit-interproc --debug-exceptions --project-root $(TESTS_DIR) -INFERPRINT_OPTIONS = --issues-tests -SOURCES = $(wildcard *.cpp) - -include $(TESTS_DIR)/infer.make - -infer-out/report.json: $(MAKEFILE_LIST) - -infer-out/report.json: $(CLANG_DEPS) $(SOURCES) $(MAKEFILE_LIST) - $(QUIET)$(REMOVE_DIR) buck-out && \ - $(call silent_on_success,Testing uninit analysis with inter-procedural mode,\ - $(INFER_BIN) $(INFER_OPTIONS) --results-dir $(CURDIR)/infer-out -- clang $(CLANG_OPTIONS) $(SOURCES)) diff --git a/infer/tests/build_systems/uninit/issues.exp b/infer/tests/build_systems/uninit/issues.exp deleted file mode 100644 index 502dbbe1c..000000000 --- a/infer/tests/build_systems/uninit/issues.exp +++ /dev/null @@ -1,7 +0,0 @@ -build_systems/uninit/inter_proc_uninit.cpp, FP_use_init_x_OK, 5, UNINITIALIZED_VALUE, no_bucket, ERROR, [] -build_systems/uninit/inter_proc_uninit.cpp, call_init_some_field_of_struct_bad, 4, UNINITIALIZED_VALUE, no_bucket, ERROR, [] -build_systems/uninit/inter_proc_uninit.cpp, i_call_maybe_init_bad, 3, UNINITIALIZED_VALUE, no_bucket, ERROR, [] -build_systems/uninit/inter_proc_uninit.cpp, i_no_init_return_bad, 2, UNINITIALIZED_VALUE, no_bucket, ERROR, [] -build_systems/uninit/inter_proc_uninit.cpp, no_init_field_in_calee_bad, 6, UNINITIALIZED_VALUE, no_bucket, ERROR, [] -build_systems/uninit/inter_proc_uninit.cpp, no_init_in_calee_bad2, 6, UNINITIALIZED_VALUE, no_bucket, ERROR, [] -build_systems/uninit/inter_proc_uninit.cpp, no_init_in_callee_bad, 6, UNINITIALIZED_VALUE, no_bucket, ERROR, [] diff --git a/infer/tests/build_systems/uninit/inter_proc_uninit.cpp b/infer/tests/codetoanalyze/cpp/uninit/inter_proc_uninit.cpp similarity index 89% rename from infer/tests/build_systems/uninit/inter_proc_uninit.cpp rename to infer/tests/codetoanalyze/cpp/uninit/inter_proc_uninit.cpp index 4e200b1b8..f532af02e 100644 --- a/infer/tests/build_systems/uninit/inter_proc_uninit.cpp +++ b/infer/tests/codetoanalyze/cpp/uninit/inter_proc_uninit.cpp @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +namespace interproc { + struct is { int n; int b; @@ -17,7 +19,7 @@ void i_no_init(int* i) { i = 0; } // error is detected before call if x was not init int i_inc(int x) { return x++; } -int no_init_in_callee_bad() { +int no_init_in_callee_bad_FN() { int a; int b = 0; @@ -27,7 +29,7 @@ int no_init_in_callee_bad() { return b; } -int init_in_calee_ok() { +int init_in_callee_ok() { int a; int b = 0; @@ -36,7 +38,7 @@ int init_in_calee_ok() { return b; } -int no_init_field_in_calee_bad() { +int no_init_field_in_callee_bad_FN() { struct is t; int b = 0; @@ -46,7 +48,7 @@ int no_init_field_in_calee_bad() { return b; } -int init_field_in_calee_ok() { +int init_field_in_callee_ok() { struct is t; int b = 0; @@ -56,7 +58,7 @@ int init_field_in_calee_ok() { return b; } -int no_init_in_calee_bad2() { +int no_init_in_callee_bad2_FN() { int a; int c = 0; @@ -66,7 +68,7 @@ int no_init_in_calee_bad2() { return c; } -int init_in_calee_ok2() { +int init_in_callee_ok2() { int a; int c = 0; @@ -87,7 +89,7 @@ int blame_on_callee() { int c = i_no_init_return_bad(); a = c; // we don't flag the error here as it is flagged in no_init_return - // definition + // definition return 0; } @@ -108,7 +110,7 @@ void i_must_init_ok(int y, int* formal) { }; } -int i_call_maybe_init_bad(int y) { +int i_call_maybe_init_bad_FN(int y) { int x; i_maybe_init(y, &x); return x; @@ -191,3 +193,4 @@ int call_init_full_struct_ok() { return 0; } +} // namespace interproc diff --git a/infer/tests/codetoanalyze/cpp/uninit/issues.exp b/infer/tests/codetoanalyze/cpp/uninit/issues.exp index 99ae6066a..f3a1a9743 100644 --- a/infer/tests/codetoanalyze/cpp/uninit/issues.exp +++ b/infer/tests/codetoanalyze/cpp/uninit/issues.exp @@ -1,5 +1,6 @@ codetoanalyze/cpp/uninit/default_constr.cpp, init_bad, 3, UNINITIALIZED_VALUE, no_bucket, ERROR, [] codetoanalyze/cpp/uninit/default_constr.cpp, init_bad, 3, UNINITIALIZED_VALUE, no_bucket, ERROR, [] +codetoanalyze/cpp/uninit/inter_proc_uninit.cpp, interproc::i_no_init_return_bad, 2, UNINITIALIZED_VALUE, no_bucket, ERROR, [] codetoanalyze/cpp/uninit/members.cpp, access_members_bad, 4, UNINITIALIZED_VALUE, no_bucket, ERROR, [] codetoanalyze/cpp/uninit/members.cpp, access_members_bad2, 4, UNINITIALIZED_VALUE, no_bucket, ERROR, [] codetoanalyze/cpp/uninit/members.cpp, access_members_bad3, 4, UNINITIALIZED_VALUE, no_bucket, ERROR, []