Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit of new xapi unit test suite
Signed-off-by: Mike McClurg <mike.mcclurg@citrix.com>
- Loading branch information
Mike McClurg
committed
Jul 16, 2012
1 parent
341dcc5
commit 1fba502
Showing
4 changed files
with
72 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,20 @@ | |||
OCAMLPACKS = oUnit sexpr log xmlm stunnel xml-light2 http-svr | |||
|
|||
OCAMLINCLUDES = \ | |||
../database \ | |||
../xapi \ | |||
../idl \ | |||
../idl/ocaml_backend | |||
|
|||
OCAML_LIBS = \ | |||
../fhs \ | |||
../util/version \ | |||
../idl/ocaml_backend/common \ | |||
../idl/ocaml_backend/client \ | |||
../idl/ocaml_backend/server | |||
|
|||
OCAML_OBJS = \ | |||
../idl/api_lowlevel \ | |||
../idl/datamodel_schema | |||
|
|||
OCamlProgram(suite, suite $(OCAML_OBJS) ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,48 @@ | |||
(* | |||
* Copyright (C) 2006-2012 Citrix Systems Inc. | |||
* | |||
* This program is free software; you can redistribute it and/or modify | |||
* it under the terms of the GNU Lesser General Public License as published | |||
* by the Free Software Foundation; version 2.1 only. with the special | |||
* exception on linking described in file LICENSE. | |||
* | |||
* This program is distributed in the hope that it will be useful, | |||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
* GNU Lesser General Public License for more details. | |||
*) | |||
|
|||
open OUnit | |||
|
|||
module MockDatabase= struct | |||
|
|||
let schema = ref (Datamodel_schema.of_datamodel ()) | |||
let db_ref = ref (Db_cache_types.Database.make !schema) | |||
let make_db () = Db_ref.in_memory (ref db_ref) | |||
|
|||
end (* MockDatabase *) | |||
|
|||
let skip str = skip_if true str | |||
|
|||
let test_always_pass () = assert_equal 1 1 | |||
let test_always_fail () = skip "This will fail" ; assert_equal 1 0 | |||
|
|||
let test_mock_db () = | |||
let open MockDatabase in | |||
let db = make_db () in | |||
let __context = Context.make | |||
~database:db | |||
"Mock context" | |||
in | |||
ignore __context ; | |||
ignore (Db.VM.get_all_records ~__context) ; | |||
assert_equal 0 0 | |||
|
|||
let test_suite = "test_suit" >::: | |||
[ | |||
"test_always_pass" >:: test_always_pass ; | |||
"test_always_fail" >:: test_always_fail ; | |||
"test_mock_db" >:: test_mock_db ; | |||
] | |||
|
|||
let _ = run_test_tt_main test_suite |