diff --git a/.gitignore b/.gitignore index d1e52ca29..4ea3f453b 100644 --- a/.gitignore +++ b/.gitignore @@ -167,7 +167,9 @@ infer/src/.project /infer/src/clang/dune /infer/src/integration/dune /infer/src/java/dune +/infer/src/nullsafe/unit/dune /infer/src/opensource/dune +/infer/src/unit/dune .merlin # generated when looking for dead code @@ -176,7 +178,6 @@ infer/src/.project /infer/src/deadcode/all_ml_files_copied /infer/src/deadcode/all_mli_files /infer/src/deadcode/all_mli_files_copied -/infer/src/deadcode/dune /infer/src/deadcode/*.ml /infer/src/deadcode/*.mli _opam diff --git a/infer/src/Makefile b/infer/src/Makefile index f0b89f2a4..d8560dbc8 100644 --- a/infer/src/Makefile +++ b/infer/src/Makefile @@ -76,7 +76,7 @@ GENERATED_FROM_AUTOCONF = dune.common ../dune-workspace base/Version.ml .PHONY: dune-workspace dune-workspace: ../dune-workspace -GENERATED_DUNES += dune al/dune clang/dune integration/dune java/dune opensource/dune +GENERATED_DUNES += dune al/dune clang/dune integration/dune java/dune opensource/dune unit/dune SRC_BUILD_COMMON = $(GENERATED_FROM_AUTOCONF) $(GENERATED_DUNES) $(OCAML_SOURCES) ifeq ($(BUILD_C_ANALYZERS),yes) @@ -244,10 +244,10 @@ $(GENERATED_DUNES): dune.common dune: dune.in al/dune: al/dune.in clang/dune: clang/dune.in -deadcode/dune: deadcode/dune.in integration/dune: integration/dune.in java/dune: java/dune.in opensource/dune: opensource/dune.in +unit/dune: unit/dune.in .PHONY: clean clean: diff --git a/infer/src/clang/ClangFrontendStubs.ml b/infer/src/clang/ClangFrontendStubs.ml index 660b72080..672154c8c 100644 --- a/infer/src/clang/ClangFrontendStubs.ml +++ b/infer/src/clang/ClangFrontendStubs.ml @@ -18,6 +18,10 @@ module ClangQuotes = struct let mk_arg_file _ _ _ = die () end +module ClangTests = struct + let tests = [OUnitTest.TestList []] +end + module ClangWrapper = struct let exe ~prog:_ ~args:_ = () end diff --git a/infer/src/clang/ClangFrontendStubs.mli b/infer/src/clang/ClangFrontendStubs.mli index 6146f7d41..e4c39d748 100644 --- a/infer/src/clang/ClangFrontendStubs.mli +++ b/infer/src/clang/ClangFrontendStubs.mli @@ -18,6 +18,10 @@ module ClangQuotes : sig val mk_arg_file : string -> style -> string list -> string end +module ClangTests : sig + val tests : OUnit2.test list +end + module ClangWrapper : sig val exe : prog:string -> args:string list -> unit end diff --git a/infer/src/clang/dune.in b/infer/src/clang/dune.in index 3073f54b5..6c3c39de3 100644 --- a/infer/src/clang/dune.in +++ b/infer/src/clang/dune.in @@ -17,7 +17,7 @@ let clang = (:standard -open Core -open IStdlib -open IStd -open OpenSource -open ATDGenerated -open IBase -open IR -open Absint -open Checkers -open TestDeterminators)) - (libraries core IStdlib ATDGenerated IBase IR Absint Checkers TestDeterminators) + (libraries oUnit core IStdlib ATDGenerated IBase IR Absint Checkers TestDeterminators) (preprocess (pps ppx_compare)) )|} (if clang then ":standard \\ ClangFrontendStubs" else "ClangFrontendStubs") diff --git a/infer/src/unit/clang/ALIssuesTests.ml b/infer/src/clang/unit/ALIssuesTests.ml similarity index 100% rename from infer/src/unit/clang/ALIssuesTests.ml rename to infer/src/clang/unit/ALIssuesTests.ml diff --git a/infer/src/unit/clang/ALIssuesTests.mli b/infer/src/clang/unit/ALIssuesTests.mli similarity index 100% rename from infer/src/unit/clang/ALIssuesTests.mli rename to infer/src/clang/unit/ALIssuesTests.mli diff --git a/infer/src/unit/clang/CiOSVersionNumbersTests.ml b/infer/src/clang/unit/CiOSVersionNumbersTests.ml similarity index 100% rename from infer/src/unit/clang/CiOSVersionNumbersTests.ml rename to infer/src/clang/unit/CiOSVersionNumbersTests.ml diff --git a/infer/src/unit/clang/ClangTests.ml b/infer/src/clang/unit/ClangTests.ml similarity index 100% rename from infer/src/unit/clang/ClangTests.ml rename to infer/src/clang/unit/ClangTests.ml diff --git a/infer/src/unit/clang/ClangTests.mli b/infer/src/clang/unit/ClangTests.mli similarity index 100% rename from infer/src/unit/clang/ClangTests.mli rename to infer/src/clang/unit/ClangTests.mli diff --git a/infer/src/unit/clang/QualifiedCppNameTests.ml b/infer/src/clang/unit/QualifiedCppNameTests.ml similarity index 100% rename from infer/src/unit/clang/QualifiedCppNameTests.ml rename to infer/src/clang/unit/QualifiedCppNameTests.ml diff --git a/infer/src/unit/clang/QualifiedCppNameTests.mli b/infer/src/clang/unit/QualifiedCppNameTests.mli similarity index 100% rename from infer/src/unit/clang/QualifiedCppNameTests.mli rename to infer/src/clang/unit/QualifiedCppNameTests.mli diff --git a/infer/src/clang/unit/dune b/infer/src/clang/unit/dune new file mode 100644 index 000000000..5d42cc873 --- /dev/null +++ b/infer/src/clang/unit/dune @@ -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. + +(library + (name ClangUnitTests) + (public_name infer.ClangUnitTests) + (flags + (:standard -open Core -open IR -open IStdlib -open IStd -open ATDGenerated + -open IBase -open ClangFrontend -open ASTLanguage)) + (libraries oUnit core IStdlib ATDGenerated IBase IR ClangFrontend ASTLanguage) + (preprocess (pps ppx_compare)) +) diff --git a/infer/src/deadcode/Makefile b/infer/src/deadcode/Makefile index 4978c38d4..41e0ecc7f 100644 --- a/infer/src/deadcode/Makefile +++ b/infer/src/deadcode/Makefile @@ -50,8 +50,8 @@ endif # Note that we run find under _build directory. Since we copy some # sources from subfolders to src/ folder to avoid duplicates we use # $(DEPTH_ONE) and iteration over main and library folders. -LIBRARY_FOLDERS = . ./IR ./absint ./al ./atd ./backend ./base ./biabduction ./bufferoverrun ./c_stubs ./checkers ./clang ./concurrency ./cost ./integration ./istd ./java ./labs ./nullsafe ./pulse ./quandary ./scripts ./test_determinator ./topl -INCLUDE_FOLDERS = -I IR -I absint -I al -I atd -I backend -I base -I biabduction -I bufferoverrun -I c_stubs -I checkers -I clang -I concurrency -I cost -I integration -I istd -I java -I labs -I nullsafe -I pulse -I quandary -I scripts -I test_determinator -I topl +LIBRARY_FOLDERS = . ./IR ./absint ./al ./atd ./backend ./base ./biabduction ./bufferoverrun ./c_stubs ./checkers ./clang ./clang/unit ./concurrency ./cost ./integration ./istd ./java ./labs ./nullsafe ./nullsafe/unit ./pulse ./quandary ./scripts ./test_determinator ./topl ./unit +INCLUDE_FOLDERS = -I IR -I absint -I al -I atd -I backend -I base -I biabduction -I bufferoverrun -I c_stubs -I checkers -I clang -I clang/unit -I concurrency -I cost -I integration -I istd -I java -I labs -I nullsafe -I nullsafe/unit -I pulse -I quandary -I scripts -I test_determinator -I topl -I unit ml_src_files:=$(shell \ cd $(INFER_BUILD_DIR); \ @@ -170,7 +170,7 @@ detect_dead_code: # dune file for this directory touch $(ALL_INFER_IN_ONE_FILE_ML) $(ALL_INFER_IN_ONE_FILE_ML:.ml=.mli) # needed to get dune generated, and the generated code for the lexers and parsers in ../_build - $(MAKE) GENERATED_DUNES=deadcode/dune -C .. test + $(MAKE) -C .. test $(MAKE) depend # Need to be sequential to avoid getting a garbled file. Need to re-include .depend as it may # have changed. For both of these reasons, run another `make`. @@ -192,6 +192,7 @@ detect_dead_code: detect_dead_src_file: function is_in_blacklist { \ if [ $$1 = infertop.ml ] \ + || [ $$1 = infertop.mli ] \ || [ $$1 = deadcode/all_infer_in_one_file.ml ] \ || [ $$1 = deadcode/all_infer_in_one_file.mli ] \ || [[ $$1 =~ .*FrontendStubs.mli?$$ ]] \ @@ -236,6 +237,6 @@ detect_dead_src_file: .PHONY: clean clean: - $(REMOVE) .depend *.ml *.mli dune $(ALL_ML_FILES) $(ALL_MLI_FILES) $(ALL_ML_FILES_COPIED) \ + $(REMOVE) .depend *.ml *.mli $(ALL_ML_FILES) $(ALL_MLI_FILES) $(ALL_ML_FILES_COPIED) \ $(ALL_MLI_FILES_COPIED) diff --git a/infer/src/deadcode/dune b/infer/src/deadcode/dune new file mode 100644 index 000000000..b72d52fd2 --- /dev/null +++ b/infer/src/deadcode/dune @@ -0,0 +1,15 @@ +; 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. + +(executable + (name all_infer_in_one_file) + (modes byte) + (flags (:standard -w +60)) + (libraries javalib ANSITerminal async atdgen base base64 cmdliner core + mtime.clock.os ocamlgraph oUnit parmap re sawja sledge sqlite3 str unix xmlm + yojson zarith zip CStubs) + (modules All_infer_in_one_file) + (preprocess (pps ppx_compare ppx_enumerate ppx_fields_conv ppx_hash ppx_sexp_conv ppx_variants_conv -no-check)) +) diff --git a/infer/src/deadcode/dune.in b/infer/src/deadcode/dune.in deleted file mode 100644 index 61067007c..000000000 --- a/infer/src/deadcode/dune.in +++ /dev/null @@ -1,23 +0,0 @@ -(* -*- tuareg -*- *) -(* - * 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. - *) -(* NOTE: prepend dune.common to this file! *) - -;; -Format.sprintf - {| -(executable - (name all_infer_in_one_file) - (modes byte) - (flags (:standard -w +60)) - (libraries %s sledge) - (modules All_infer_in_one_file) - (preprocess (pps ppx_compare ppx_enumerate ppx_fields_conv ppx_hash ppx_sexp_conv ppx_variants_conv -no-check)) -) -|} - (String.concat " " ("Absint" :: "IR" :: "CStubs" :: common_libraries)) -|> Jbuild_plugin.V1.send diff --git a/infer/src/dune.common.in b/infer/src/dune.common.in index 2e87e30e1..a37fa6870 100644 --- a/infer/src/dune.common.in +++ b/infer/src/dune.common.in @@ -18,54 +18,3 @@ let java = is_yes "@BUILD_JAVA_ANALYZERS@" let facebook = is_yes "@IS_FACEBOOK_TREE@" let extra_cflags = if is_empty "@EXTRA_CFLAGS@" then [] else ["@EXTRA_CFLAGS@"] - -(* - * A known issue: At the moment of writing warning 14 (illegal backslash - * escape in string) does not manifest as an error, presumably due to - * peculiarities in communication between preprocessor and compiler. - * Still leave it for visibility and in hope that the issue will be - * fixed one day. - *) -let fatal_warnings = - "+3+5+6+8+10+11+12+14+18+19+20+21+23+26+29+27+28+32+33+34+35+37+38+39+50+52+57+60" - - -let warnings = fatal_warnings ^ "-4-9-40-41-42-45-48" - -let ocamlc_flags = - [ "-g" - ; "-short-paths" - ; "-safe-string" - ; "-principal" - ; "-strict-formats" - ; "-strict-sequence" - ; "-bin-annot" ] - - -let lenient_flags = ocamlc_flags @ ["-w"; warnings] |> String.concat " " - -let strict_flags = - ocamlc_flags @ ["-w"; warnings; "-warn-error"; fatal_warnings] |> String.concat " " - - -let common_libraries = - (if java then ["javalib"; "sawja"] else []) - @ [ "ANSITerminal" - ; "async" - ; "atdgen" - ; "base" - ; "base64" - ; "cmdliner" - ; "core" - ; "mtime.clock.os" - ; "ocamlgraph" - ; "oUnit" - ; "parmap" - ; "re" - ; "sqlite3" - ; "str" - ; "unix" - ; "xmlm" - ; "yojson" - ; "zarith" - ; "zip" ] diff --git a/infer/src/dune.in b/infer/src/dune.in index 30393226e..2153afd83 100644 --- a/infer/src/dune.in +++ b/infer/src/dune.in @@ -7,13 +7,34 @@ *) (* NOTE: prepend dune.common to this file! *) -let ( ^/ ) = Filename.concat +(* + * A known issue: At the moment of writing warning 14 (illegal backslash + * escape in string) does not manifest as an error, presumably due to + * peculiarities in communication between preprocessor and compiler. + * Still leave it for visibility and in hope that the issue will be + * fixed one day. + *) +let fatal_warnings = + "+3+5+6+8+10+11+12+14+18+19+20+21+23+26+29+27+28+32+33+34+35+37+38+39+50+52+57+60" + + +let warnings = fatal_warnings ^ "-4-9-40-41-42-45-48" + +let ocamlc_flags = + [ "-g" + ; "-short-paths" + ; "-safe-string" + ; "-principal" + ; "-strict-formats" + ; "-strict-sequence" + ; "-bin-annot" ] + -let source_dirs = - (if clang then ["unit" ^/ "clang"] else ["unit" ^/ "clang_stubs"]) @ ["unit"; "unit" ^/ "nullsafe"] +let lenient_flags = ocamlc_flags @ ["-w"; warnings] |> String.concat " " +let strict_flags = + ocamlc_flags @ ["-w"; warnings; "-warn-error"; fatal_warnings] |> String.concat " " -let infer_binaries = ["infer"; "inferunit"] @ if facebook then ["InferCreateTraceViewLinks"] else [] let env_stanza = Format.sprintf @@ -31,115 +52,40 @@ let env_stanza = lenient_flags lenient_flags strict_flags -let infer_cflags = - ( [ "-open" - ; "Core" - ; "-open" - ; "Biabduction" - ; "-open" - ; "BO" - ; "-open" - ; "Nullsafe" - ; "-open" - ; "Pulselib" - ; "-open" - ; "Checkers" - ; "-open" - ; "Costlib" - ; "-open" - ; "Quandary" - ; "-open" - ; "TOPLlib" - ; "-open" - ; "Concurrency" - ; "-open" - ; "Labs" - ; "-open" - ; "Absint" - ; "-open" - ; "OpenSource" - ; "-open" - ; "IStdlib" - ; "-open" - ; "IStd" - ; "-open" - ; "ATDGenerated" - ; "-open" - ; "IR" - ; "-open" - ; "IBase" - ; "-open" - ; "CStubs" - ; "-open" - ; "Backend" - ; "-open" - ; "JavaFrontend" - ; "-open" - ; "ClangFrontend" - ; "-open" - ; "ASTLanguage" - ; "-open" - ; "TestDeterminators" - ; "-open" - ; "Integration" ] - @ (if java then [] else ["-open"; "JavaFrontendStubs"]) - @ if clang then [] else ["-open"; "ClangFrontendStubs"] ) - |> String.concat " " - - -let main_lib_stanza = - Format.sprintf - {| -(library - (name InferModules) - (public_name infer) - (flags (:standard %s)) - (libraries %s) - (modules :standard \ %s infertop) - (preprocess (pps ppx_compare ppx_fields_conv ppx_hash ppx_sexp_conv ppx_variants_conv -no-check)) -) -|} - infer_cflags - (String.concat " " - (* we need JavaFrontend first to avoid clashes around base64 vs extlib *) - ( ("JavaFrontend" :: common_libraries) - @ [ "IR" - ; "CStubs" - ; "Absint" - ; "Biabduction" - ; "Nullsafe" - ; "BO" - ; "Pulselib" - ; "Checkers" - ; "Costlib" - ; "Quandary" - ; "TOPLlib" - ; "Concurrency" - ; "Labs" - ; "Backend" - ; "ClangFrontend" - ; "ASTLanguage" - ; "TestDeterminators" - ; "Integration" ] )) - (String.concat " " infer_binaries) - +(** Put this *first* in (libraries) specifications to prevent a clash between extlib's and base64's + versions of Base64. Only Javalib depends on extlib so do it conditionally to avoid introducing a + new dependency in the clang-only build. *) +let extlib_if_java = if java then "extlib" else "" let infer_exe_stanza = - Format.sprintf - {| -(executables - (names %s) + Printf.sprintf + {|(executable + (name infer) (modes byte_complete exe) - (flags (:standard -open InferModules %s)) - (libraries InferModules) - (modules %s) - (preprocess (pps ppx_compare ppx_fields_conv ppx_hash ppx_sexp_conv ppx_variants_conv -no-check)) + (modules Infer) + (flags (:standard -open Core -open IStdlib -open IStd -open IBase -open IR -open Backend -open Integration -open Biabduction -open TestDeterminators -open ClangFrontend -open ASTLanguage %s)) + (libraries %s core IStdlib IBase IR Backend Integration Biabduction TestDeterminators ClangFrontend ASTLanguage) + (preprocess (pps ppx_compare)) (promote (until-clean) (into ../bin)) -) -|} - (String.concat " " infer_binaries) - infer_cflags - (String.concat " " infer_binaries) +)|} + (if clang then "" else "-open ClangFrontendStubs") + extlib_if_java + + +let inferunit_stanza = + Printf.sprintf + {|(executable + (name inferunit) + (modes byte_complete exe) + (modules Inferunit) + (flags (:standard -open Core -open IStdlib -open IStd -open IBase -open Backend -open Integration -open UnitTests -open NullsafeUnitTests -open ClangFrontend %s)) + (libraries %s oUnit core IStdlib IBase Backend Integration UnitTests NullsafeUnitTests %s) + (preprocess (pps ppx_compare)) + (promote (until-clean) (into ../bin)) +)|} + (if clang then "-open ClangUnitTests" else "-open ClangFrontendStubs") + extlib_if_java + (if clang then "ClangUnitTests" else "") let infertop_stanza = @@ -148,32 +94,34 @@ let infertop_stanza = (executable (name infertop) (modes byte_complete) - (flags (:standard %s)) - (libraries utop InferModules) - (link_flags (-linkall -warn-error -31)) (modules Infertop) - (preprocess (pps ppx_compare ppx_fields_conv ppx_hash ppx_sexp_conv ppx_variants_conv -no-check)) + (flags (:standard -open Core -open IStdlib -open IStd)) + (libraries %s utop Absint ASTLanguage ATDGenerated Backend IBase Biabduction BO Checkers Concurrency Costlib CStubs IR IStdlib Labs Nullsafe Pulselib Quandary Integration TestDeterminators TOPLlib UnitTests) + (link_flags (-linkall -warn-error -31)) + (preprocess (pps ppx_compare)) (promote (until-clean) (into ../bin)) ) |} - infer_cflags + extlib_if_java -let flatten_sources_stanzas = - List.map - (fun source_dir -> - [ Printf.sprintf "(copy_files# %s/*.ml{,i,l})" source_dir - ; (* menhir doesn't support '# 1 ""' directives at the start of the file inserted by - copy# actions *) - Printf.sprintf "(copy_files %s/*.mly)" source_dir ] ) - source_dirs - |> List.concat +let inferCreateTraceViewLinks_stanza = + {|(executable + (name InferCreateTraceViewLinks) + (modes byte_complete exe) + (modules InferCreateTraceViewLinks) + (flags (:standard -open Core -open IStdlib -open IStd -open ATDGenerated -open IBase)) + (libraries core async IStdlib ATDGenerated IBase) + (preprocess (pps ppx_compare)) + (promote (until-clean) (into ../bin)) +)|} (** The build stanzas to be passed to dune *) let stanzas = - env_stanza :: main_lib_stanza :: infer_exe_stanza :: infertop_stanza :: flatten_sources_stanzas + [env_stanza; infer_exe_stanza; inferunit_stanza; infertop_stanza] + @ if facebook then [inferCreateTraceViewLinks_stanza] else [] ;; -String.concat "\n" stanzas |> Jbuild_plugin.V1.send +Jbuild_plugin.V1.send (String.concat "\n" stanzas) diff --git a/infer/src/infer.ml b/infer/src/infer.ml index 929966d05..5bae0b612 100644 --- a/infer/src/infer.ml +++ b/infer/src/infer.ml @@ -60,7 +60,6 @@ let setup () = | Explore -> ResultsDir.assert_results_dir "please run an infer analysis first" ) ; db_start () ; - NullsafeInit.init () ; if CLOpt.is_originator then ResultsDir.RunState.add_run_to_sequence () ; () diff --git a/infer/src/unit/clang_stubs/ClangTests.ml b/infer/src/infertop.mli similarity index 74% rename from infer/src/unit/clang_stubs/ClangTests.ml rename to infer/src/infertop.mli index 3b25c888f..ca5efa56c 100644 --- a/infer/src/unit/clang_stubs/ClangTests.ml +++ b/infer/src/infertop.mli @@ -7,4 +7,4 @@ open! IStd -let tests = [OUnitTest.TestList []] +(** module for running an OCaml toplevel that embeds infer modules *) diff --git a/infer/src/unit/inferunit.ml b/infer/src/inferunit.ml similarity index 100% rename from infer/src/unit/inferunit.ml rename to infer/src/inferunit.ml diff --git a/infer/src/unit/inferunit.mli b/infer/src/inferunit.mli similarity index 100% rename from infer/src/unit/inferunit.mli rename to infer/src/inferunit.mli diff --git a/infer/src/nullsafe/eradicate.ml b/infer/src/nullsafe/eradicate.ml index 287771369..a4b014008 100644 --- a/infer/src/nullsafe/eradicate.ml +++ b/infer/src/nullsafe/eradicate.ml @@ -9,6 +9,9 @@ open! IStd module L = Logging module F = Format +(* make sure that this is initialized *) +let () = NullsafeInit.init () + let callback1 ({IntraproceduralAnalysis.proc_desc= curr_pdesc; _} as analysis_data) find_canonical_duplicate calls_this checks idenv annotated_signature linereader proc_loc : bool * TypeState.t option = diff --git a/infer/src/unit/nullsafe/AggregatedSummariesTest.ml b/infer/src/nullsafe/unit/AggregatedSummariesTest.ml similarity index 100% rename from infer/src/unit/nullsafe/AggregatedSummariesTest.ml rename to infer/src/nullsafe/unit/AggregatedSummariesTest.ml diff --git a/infer/src/unit/nullsafe/AllNullsafeTests.ml b/infer/src/nullsafe/unit/AllNullsafeTests.ml similarity index 100% rename from infer/src/unit/nullsafe/AllNullsafeTests.ml rename to infer/src/nullsafe/unit/AllNullsafeTests.ml diff --git a/infer/src/unit/nullsafe/AllNullsafeTests.mli b/infer/src/nullsafe/unit/AllNullsafeTests.mli similarity index 100% rename from infer/src/unit/nullsafe/AllNullsafeTests.mli rename to infer/src/nullsafe/unit/AllNullsafeTests.mli diff --git a/infer/src/unit/nullsafe/ThirdPartyAnnotationInfoTests.ml b/infer/src/nullsafe/unit/ThirdPartyAnnotationInfoTests.ml similarity index 100% rename from infer/src/unit/nullsafe/ThirdPartyAnnotationInfoTests.ml rename to infer/src/nullsafe/unit/ThirdPartyAnnotationInfoTests.ml diff --git a/infer/src/unit/nullsafe/ThirdPartyMethodTests.ml b/infer/src/nullsafe/unit/ThirdPartyMethodTests.ml similarity index 100% rename from infer/src/unit/nullsafe/ThirdPartyMethodTests.ml rename to infer/src/nullsafe/unit/ThirdPartyMethodTests.ml diff --git a/infer/src/nullsafe/unit/dune b/infer/src/nullsafe/unit/dune new file mode 100644 index 000000000..2a28cfe88 --- /dev/null +++ b/infer/src/nullsafe/unit/dune @@ -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. + +(library + (name NullsafeUnitTests) + (public_name infer.NullsafeUnitTests) + (flags + (:standard -open Core -open IR -open IStdlib -open IStd -open ATDGenerated + -open IBase -open Nullsafe)) + (libraries oUnit core IStdlib ATDGenerated IBase IR Nullsafe) + (preprocess (pps ppx_compare)) +) diff --git a/infer/src/unit/abstractInterpreterTests.ml b/infer/src/unit/abstractInterpreterTests.ml index b26216114..1840f45ee 100644 --- a/infer/src/unit/abstractInterpreterTests.ml +++ b/infer/src/unit/abstractInterpreterTests.ml @@ -49,7 +49,7 @@ module PathCountTransferFunctions (CFG : ProcCfg.S) = struct module CFG = CFG module Domain = PathCountDomain - type analysis_data = unit ProcData.t + type analysis_data = unit (* just propagate the current path count *) let exec_instr astate _ _ _ = astate @@ -102,9 +102,7 @@ let tests = , (* we expect the finally block to be visited *) [invariant "1"] ) ; invariant "1" ] ) ] - |> NormalTestInterpreter.create_tests - (fun summary -> {ProcData.summary; tenv= Tenv.create (); extras= ()}) - ~initial + |> NormalTestInterpreter.create_tests (fun _summary -> ()) ~initial in let exceptional_test_list = [ ( "try1" @@ -129,8 +127,6 @@ let tests = , (* could arrive here via (1, 2, 3), (1, 4), or (2, 4) *) [invariant "3"] ) ; invariant "3" ] ) ] - |> ExceptionalTestInterpreter.create_tests - (fun summary -> {ProcData.summary; tenv= Tenv.create (); extras= ()}) - ~initial + |> ExceptionalTestInterpreter.create_tests (fun _summary -> ()) ~initial in "analyzer_tests_suite" >::: normal_test_list @ exceptional_test_list diff --git a/infer/src/unit/dune.in b/infer/src/unit/dune.in new file mode 100644 index 000000000..f23ff218b --- /dev/null +++ b/infer/src/unit/dune.in @@ -0,0 +1,27 @@ +(* -*- tuareg -*- *) +(* + * 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. + *) +(* NOTE: prepend dune.common to this file! *) + +let library = + Printf.sprintf + {|(library + (name UnitTests) + (public_name infer.UnitTests) + (flags + (:standard -open Core -open IR -open IStdlib -open IStd -open ATDGenerated + -open IBase -open Absint -open Backend -open CStubs -open ClangFrontend -open ASTLanguage %s + -open Checkers -open Quandary -open TestDeterminators -open Integration)) + (libraries oUnit core IStdlib ATDGenerated IBase IR Absint Backend CStubs ClangFrontend + ASTLanguage Checkers Quandary TestDeterminators Integration) + (preprocess (pps ppx_compare)) +)|} + (if clang then "-open ClangFrontend -open ASTLanguage" else "-open ClangFrontendStubs") + + +;; +Jbuild_plugin.V1.send library