adding runner for OCaml unit tests

Reviewed By: cristianoc

Differential Revision: D2977765

fb-gh-sync-id: abb1b8b
shipit-source-id: abb1b8b
master
Sam Blackshear 9 years ago committed by Facebook Github Bot 0
parent 177574c29e
commit 62965e8051

1
.gitignore vendored

@ -70,6 +70,7 @@ buck-out/
/infer/bin/InferJava /infer/bin/InferJava
/infer/bin/InferLLVM /infer/bin/InferLLVM
/infer/bin/InferPrint /infer/bin/InferPrint
/infer/bin/InferUnit
/infer/bin/Typeprop /infer/bin/Typeprop
/infer/src/backend/version.ml /infer/src/backend/version.ml
/infer/models/java/models/ /infer/models/java/models/

@ -35,6 +35,7 @@ INFERANALYZE_BIN = $(BIN_DIR)/InferAnalyze
INFERCLANG_BIN = $(BIN_DIR)/InferClang INFERCLANG_BIN = $(BIN_DIR)/InferClang
INFERJAVA_BIN = $(BIN_DIR)/InferJava INFERJAVA_BIN = $(BIN_DIR)/InferJava
INFERPRINT_BIN = $(BIN_DIR)/InferPrint INFERPRINT_BIN = $(BIN_DIR)/InferPrint
INFERUNIT_BIN = $(BIN_DIR)/InferUnit
INFER_ANALYZERS= INFER_ANALYZERS=
ifeq (@BUILD_C_ANALYZERS@,yes) ifeq (@BUILD_C_ANALYZERS@,yes)

@ -78,10 +78,16 @@ endif
clang: clang_plugin clang: clang_plugin
endif endif
unit:
$(MAKE) -C $(SRC_DIR) unit
test_build: test_build:
$(MAKE) -C $(SRC_DIR) test_clean $(MAKE) -C $(SRC_DIR) test_clean
$(MAKE) -C $(SRC_DIR) test_build $(MAKE) -C $(SRC_DIR) test_build
ocaml_unit_test: $(INFER_ANALYZERS) unit
InferUnit
buck_test: $(INFER_ANALYZERS) buck_test: $(INFER_ANALYZERS)
NO_BUCKD=1 buck clean NO_BUCKD=1 buck clean
NO_BUCKD=1 buck test $(TARGETS_TO_TEST) NO_BUCKD=1 buck test $(TARGETS_TO_TEST)
@ -118,7 +124,7 @@ endif
--only-show > /dev/null --only-show > /dev/null
@rm -fr __test-infer-out__ @rm -fr __test-infer-out__
test: buck_test inferTraceBugs_test test: ocaml_unit_test buck_test inferTraceBugs_test
test_xml: buck_test_xml test_xml: buck_test_xml
@ -131,5 +137,6 @@ endif
$(MAKE) -C $(INFER_DIR) clean $(MAKE) -C $(INFER_DIR) clean
.PHONY: all buck_test buck_test_xml build_integration_tests clean clang .PHONY: all buck_test buck_test_xml build_integration_tests clean clang
.PHONY: clang_plugin clang_setup inferTraceBugs_test java .PHONY: clang_plugin clang_setup inferTraceBugs_test java ocaml_unit_test
.PHONY: test test_xml test_build .PHONY: test test_xml test_build

@ -34,6 +34,7 @@ CLANG_BUILD_DIR = $(BUILD_DIR)/clang
LLVM_BUILD_DIR = $(BUILD_DIR)/llvm LLVM_BUILD_DIR = $(BUILD_DIR)/llvm
SCRIPTS_BUILD_DIR = $(BUILD_DIR)/scripts SCRIPTS_BUILD_DIR = $(BUILD_DIR)/scripts
TEST_BUILD_DIR = $(BUILD_DIR)/test TEST_BUILD_DIR = $(BUILD_DIR)/test
UNIT_BUILD_DIR = $(BUILD_DIR)/unit
ANNOT_DIR = $(SRC_DIR)/_build ANNOT_DIR = $(SRC_DIR)/_build
ETC_DIR = $(INFER_DIR)/etc ETC_DIR = $(INFER_DIR)/etc
@ -80,6 +81,12 @@ INFERPRINT_ATDGEN_STUBS = $(addprefix $(INFERPRINT_ATDGEN_STUB_BASE), $(INFERPRI
INFERPRINT_MAIN = $(BACKEND_SOURCES)/inferprint INFERPRINT_MAIN = $(BACKEND_SOURCES)/inferprint
### InferUnit declarations ###
UNIT_SOURCES = unit
INFERUNIT_MAIN = $(UNIT_SOURCES)/inferunit
#### Java declarations #### #### Java declarations ####
JAVA_OCAMLBUILD_OPTIONS = -pkgs javalib,ptrees,sawja JAVA_OCAMLBUILD_OPTIONS = -pkgs javalib,ptrees,sawja
@ -140,13 +147,13 @@ DEPENDENCIES = $(BACKEND_SOURCES) checkers eradicate facebook/checkers facebook/
OCAMLBUILD = ocamlbuild $(OCAMLBUILD_OPTIONS) -j 0 $(addprefix -I , $(DEPENDENCIES)) OCAMLBUILD = ocamlbuild $(OCAMLBUILD_OPTIONS) -j 0 $(addprefix -I , $(DEPENDENCIES))
.PHONY: all java clang llvm checkCopyright build_java build_clang build_llvm build_checkCopyright \ .PHONY: all java clang llvm unit checkCopyright build_java build_clang build_llvm build_unit \
java_annotations clang_annotations llvm_annotations scripts_annotations \ build_checkCopyright java_annotations clang_annotations llvm_annotations \
init version sanitize clean scripts_annotations init version sanitize clean
default: $(INFER_ANALYZERS) default: $(INFER_ANALYZERS)
all: java clang llvm checkCopyright all: java clang llvm checkCopyright unit
java: $(INFERJAVA_BIN) java: $(INFERJAVA_BIN)
@ -154,6 +161,8 @@ clang: $(INFERCLANG_BIN) $(CLANG_BINIOU_DICT)
llvm: $(INFERLLVM_BIN) llvm: $(INFERLLVM_BIN)
unit: $(INFERUNIT_BIN)
checkCopyright: $(CHECKCOPYRIGHT_BIN) checkCopyright: $(CHECKCOPYRIGHT_BIN)
build_java: init $(INFERPRINT_ATDGEN_STUBS) build_java: init $(INFERPRINT_ATDGEN_STUBS)
@ -175,12 +184,17 @@ build_checkCopyright:
$(OCAMLBUILD) -build-dir $(SCRIPTS_BUILD_DIR) -I $(SCRIPT_SOURCES) \ $(OCAMLBUILD) -build-dir $(SCRIPTS_BUILD_DIR) -I $(SCRIPT_SOURCES) \
$(CHECKCOPYRIGHT_MAIN).native $(CHECKCOPYRIGHT_MAIN).native
build_unit:
$(OCAMLBUILD) -build-dir $(UNIT_BUILD_DIR) -I $(UNIT_SOURCES) \
$(INFERUNIT_MAIN).native
byte: init $(INFERPRINT_ATDGEN_STUBS) $(CLANG_ATDGEN_STUBS) $(INFER_CLANG_FCP_MIRRORED_FILES) byte: init $(INFERPRINT_ATDGEN_STUBS) $(CLANG_ATDGEN_STUBS) $(INFER_CLANG_FCP_MIRRORED_FILES)
$(OCAMLBUILD) -build-dir $(TEST_BUILD_DIR) $(JAVA_OCAMLBUILD_OPTIONS) \ $(OCAMLBUILD) -build-dir $(TEST_BUILD_DIR) $(JAVA_OCAMLBUILD_OPTIONS) \
$(INFERANALYZE_MAIN).byte \ $(INFERANALYZE_MAIN).byte \
$(INFERPRINT_MAIN).byte \ $(INFERPRINT_MAIN).byte \
$(INFERJAVA_MAIN).byte \ $(INFERJAVA_MAIN).byte \
$(INFERCLANG_MAIN).byte $(INFERCLANG_MAIN).byte \
$(INFERUNIT_MAIN).byte
test_build: init $(INFERPRINT_ATDGEN_STUBS) $(CLANG_ATDGEN_STUBS) $(INFER_CLANG_FCP_MIRRORED_FILES) test_build: init $(INFERPRINT_ATDGEN_STUBS) $(CLANG_ATDGEN_STUBS) $(INFER_CLANG_FCP_MIRRORED_FILES)
$(OCAMLBUILD) -build-dir $(TEST_BUILD_DIR) $(JAVA_OCAMLBUILD_OPTIONS) \ $(OCAMLBUILD) -build-dir $(TEST_BUILD_DIR) $(JAVA_OCAMLBUILD_OPTIONS) \
@ -188,7 +202,8 @@ test_build: init $(INFERPRINT_ATDGEN_STUBS) $(CLANG_ATDGEN_STUBS) $(INFER_CLANG_
$(INFERANALYZE_MAIN).byte \ $(INFERANALYZE_MAIN).byte \
$(INFERPRINT_MAIN).byte \ $(INFERPRINT_MAIN).byte \
$(INFERJAVA_MAIN).byte \ $(INFERJAVA_MAIN).byte \
$(INFERCLANG_MAIN).byte $(INFERCLANG_MAIN).byte \
$(INFERUNIT_MAIN).byte
ifeq (@ENABLE_OCAML_ANNOT@,yes) ifeq (@ENABLE_OCAML_ANNOT@,yes)
java_annotations: build_java java_annotations: build_java
@ -288,6 +303,9 @@ $(INFERCLANG_BIN): build_clang
$(INFERLLVM_BIN): build_llvm $(INFERLLVM_BIN): build_llvm
$(COPY) $(LLVM_BUILD_DIR)/$(INFERLLVM_MAIN).native $(INFERLLVM_BIN) $(COPY) $(LLVM_BUILD_DIR)/$(INFERLLVM_MAIN).native $(INFERLLVM_BIN)
$(INFERUNIT_BIN): build_unit
$(COPY) $(UNIT_BUILD_DIR)/$(INFERUNIT_MAIN).native $(INFERUNIT_BIN)
$(CHECKCOPYRIGHT_BIN): build_checkCopyright $(CHECKCOPYRIGHT_BIN): build_checkCopyright
$(COPY) $(SCRIPTS_BUILD_DIR)/$(CHECKCOPYRIGHT_MAIN).native $(CHECKCOPYRIGHT_BIN) $(COPY) $(SCRIPTS_BUILD_DIR)/$(CHECKCOPYRIGHT_MAIN).native $(CHECKCOPYRIGHT_BIN)
@ -301,7 +319,7 @@ ifeq (@ENABLE_OCAML_ANNOT@,yes)
endif endif
$(REMOVE) $(BACKEND_SOURCES)/version.ml $(REMOVE) $(BACKEND_SOURCES)/version.ml
$(REMOVE) $(BACKEND_SOURCES)/version.ml.tmp.* $(REMOVE) $(BACKEND_SOURCES)/version.ml.tmp.*
$(REMOVE) $(INFERJAVA_BIN) $(INFERCLANG_BIN) $(INFERLLVM_BIN) $(REMOVE) $(INFERJAVA_BIN) $(INFERCLANG_BIN) $(INFERLLVM_BIN) $(INFERUNIT_BIN)
$(REMOVE) $(CHECKCOPYRIGHT_BIN) $(REMOVE) $(CHECKCOPYRIGHT_BIN)
$(REMOVE) $(CLANG_ATDGEN_STUBS) $(REMOVE) $(CLANG_ATDGEN_STUBS)
$(REMOVE) $(INFER_CLANG_FCP_MIRRORED_FILES) $(REMOVE) $(INFER_CLANG_FCP_MIRRORED_FILES)

@ -0,0 +1,15 @@
(*
* 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.
*)
(** module for running OCaml unit tests *)
module L = Logging
let () =
L.stdout "All OCaml unit tests passed.@."
Loading…
Cancel
Save