Skip to content

Commit

Permalink
Merge pull request xapi-project#5656 from psafont/meta
Browse files Browse the repository at this point in the history
  • Loading branch information
psafont authored May 31, 2024
2 parents 5ec4c26 + 5ab3899 commit ea8bffb
Show file tree
Hide file tree
Showing 44 changed files with 138 additions and 458 deletions.
65 changes: 42 additions & 23 deletions dune-project
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(lang dune 2.0)
(lang dune 3.0)
(formatting (enabled_for ocaml))

(generate_opam_files true)
Expand Down Expand Up @@ -68,8 +68,8 @@
re
uri
(uuid :with-test)
(xapi-log :version)
(xapi-stdext-threads :version)
(xapi-log (= :version))
(xapi-stdext-threads (= :version))
)
(synopsis "Allows to instrument code to generate tracing information")
(description "This library provides modules to allow gathering runtime traces.")
Expand All @@ -83,12 +83,13 @@
dune
cohttp
rpclib
(xapi-log :version)
(xapi-open-uri :version)
(xapi-stdext-threads :version)
(xapi-stdext-unix :version)
(xapi-tracing :version)
(zstd :version)
ppx_deriving_rpc
(xapi-log (= :version))
(xapi-open-uri (= :version))
(xapi-stdext-threads (= :version))
(xapi-stdext-unix (= :version))
(xapi-tracing (= :version))
(zstd (= :version))
)
(synopsis "Export traces in multiple protocols and formats")
(description "This library export traces is able to push traces to http endpoints or generate compressed tarballs in the filesystem.")
Expand Down Expand Up @@ -122,12 +123,13 @@
ocaml
astring
rpclib
(xapi-forkexecd :version)
(xapi-stdext-pervasives :version)
(xapi-stdext-std :version)
(xapi-stdext-threads :version)
(xapi-stdext-unix :version)
(xapi-idl :version)
(rrd-transport (= :version))
(xapi-forkexecd (= :version))
(xapi-stdext-pervasives (= :version))
(xapi-stdext-std (= :version))
(xapi-stdext-threads (= :version))
(xapi-stdext-unix (= :version))
(xapi-idl (= :version))
xenstore_transport
)
)
Expand All @@ -140,20 +142,21 @@
(ocaml (>= "4.02.0"))
dune-build-info
astring
(gzip :version)
(http-lib :version)
(gzip (= :version))
(http-lib (= :version))
inotify
io-page
mtime
ppx_deriving_rpc
rpclib
systemd
(ezxenstore :version)
(uuid :version)
(xapi-backtrace :version)
(xapi-idl :version)
(xapi-rrd :version)
(xapi-stdext-threads :version)
(ezxenstore (= :version))
(uuid (= :version))
xapi-backtrace
(xapi-idl (= :version))
(xapi-rrd (= :version))
(xapi-stdext-threads (= :version))
(xapi-stdext-unix (= :version))
)
)

Expand All @@ -165,6 +168,9 @@
(depends
ocaml
cmdliner
(rrd-transport (= :version))
(xapi-idl (= :version))
(xapi-rrd (= :version))
)
)

Expand Down Expand Up @@ -286,6 +292,19 @@

(package
(name message-switch-core)
(synopsis "A simple store-and-forward message switch")
(description "The switch stores messages in queues with well-known names. Clients use a simple HTTP protocol to enqueue and dequeue messages.")
(depends
astring
(cohttp (>= "0.21.1"))
ppx_deriving_rpc
ppx_sexp_conv
rpclib
sexplib
(xapi-log (= :version))
(xapi-stdext-threads (= :version))
(odoc :with-doc)
)
)

(package
Expand Down
48 changes: 26 additions & 22 deletions message-switch-core.opam
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
# This file is generated by dune, edit dune-project instead
license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"
opam-version: "2.0"
name: "message-switch-core"
maintainer: "[email protected]"
authors: [ "[email protected]" ]
homepage: "https://github.com/xapi-project/xen-api"
synopsis: "A simple store-and-forward message switch"
description:
"The switch stores messages in queues with well-known names. Clients use a simple HTTP protocol to enqueue and dequeue messages."
maintainer: ["Xapi project maintainers"]
authors: ["[email protected]"]
license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"
homepage: "https://xapi-project.github.io/"
bug-reports: "https://github.com/xapi-project/xen-api/issues"
dev-repo: "git+https://github.com/xapi-project/xen-api.git"
tags: [ "org:xapi-project" ]
build: [
["./configure" "--prefix" "%{prefix}%"]
[ "dune" "build" "-p" name "-j" jobs ]
]
depends: [
"ocaml"
"dune" {build & >= "1.4"}
"odoc" {with-doc}
"dune" {>= "3.0"}
"astring"
"cohttp" {>= "0.21.1"}
"ppx_deriving_rpc"
"ppx_sexp_conv"
"rpclib"
"sexplib"
"xapi-log"
"xapi-log" {= version}
"xapi-stdext-threads" {= version}
"odoc" {with-doc}
]
synopsis: "A simple store-and-forward message switch"
description: """
The switch stores messages in queues with well-known names. Clients use
a simple HTTP protocol to enqueue and dequeue messages."""
url {
src: "https://github.com/xapi-project/xen-api/archive/master.tar.gz"
}
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/xapi-project/xen-api.git"
31 changes: 0 additions & 31 deletions message-switch-core.opam.template

This file was deleted.

1 change: 1 addition & 0 deletions ocaml/database/unit_test_marshall.ml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ let tests =
; (test_ivr_response, "test_ivr_response")
; (test_rr_args, "test_rr_args")
; (test_rr_response, "test_rr_response")
; (test_rfw_args, "test_rfw_args")
; (test_cra_args, "test_cra_args")
; (test_cra_response, "test_cra_response")
; (test_dr_args, "test_dr_args")
Expand Down
2 changes: 0 additions & 2 deletions ocaml/database/unit_test_sql.ml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ let str = Xml.to_string_fmt xml

let parse () = ignore (Xml.parse_string str)

let to_string () = ignore (Xml.to_string_fmt xml)

let rec repeat f i () =
if i = 0 then
()
Expand Down
3 changes: 0 additions & 3 deletions ocaml/db_process/xapi_db_process.ml
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ let write_out_databases () =
(Db_conn_store.read_db_connections ())
(Db_ref.get_database (Db_backend.make ()))

(* should never be thrown due to checking argument at start *)
exception UnknownFormat

let write_out_database filename =
print_string ("Dumping database to: " ^ filename ^ "\n") ;
Db_cache_impl.sync
Expand Down
2 changes: 0 additions & 2 deletions ocaml/gencert/test_lib.ml
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ let corrupt_chain_certificates =
)
]

let server_error err reason = Server_error (err, reason)

let test_valid_key key_name () =
match validate_private_key (load_test_data key_name) with
| Ok _ ->
Expand Down
6 changes: 0 additions & 6 deletions ocaml/libs/vhd/vhd_format_lwt_test/parse_test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ let create () =
let _ = Create_vhd.disk in
()

let diff () =
let _ = Diff_vhd.disk in
()

let tmp_file_dir = Filename.get_temp_dir_name ()

let disk_name_stem = tmp_file_dir ^ "/parse_test."
Expand Down Expand Up @@ -174,8 +170,6 @@ let absolute_sector_of vhd {block; sector} =
(of_int relative_sector)
)

let cstruct_to_string c = String.escaped (Cstruct.to_string c)

type state = {
to_close: fd Vhd.t list
; to_unlink: string list
Expand Down
12 changes: 0 additions & 12 deletions ocaml/libs/xapi-rrd/lib_test/crowbar_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ let test_ranges rrd =
let in_range_rra dss rra = Array.iter2 in_range_fring dss rra.rra_data in
Array.iter (in_range_rra rrd.rrd_dss) rrd.rrd_rras

let same_input_type vf vf' =
let open Rrd in
match vf vf' with
| VT_Unknown, VT_Unknown ->
true
| VT_Int64 _, VT_Int64 _ ->
true
| VT_Float _, VT_Float _ ->
true
| _ ->
false

let cf =
Cb.choose
[
Expand Down
31 changes: 3 additions & 28 deletions ocaml/libs/xapi-rrd/lib_test/unit_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -106,31 +106,6 @@ let test_marshall_unmarshall rrd () =
let rrd' = Rrd.from_xml xml in
assert_rrds_equal rrd rrd'

let test_export rrd () =
let check_same_as_rras (updates : Rrd_updates.row array) (rras : Rrd.rra array)
=
let cf_count = Array.length rras in
for i = 0 to cf_count - 1 do
(* consolidation functions *)
for j = 0 to Array.length rras.(0).Rrd.rra_data - 1 do
(* datasources *)
for k = 0 to Rrd_fring.length rras.(0).Rrd.rra_data.(0) - 1 do
(* time datapoints *)
let update_value =
updates.(k).Rrd_updates.row_data.(i + (j * cf_count))
in
let rra_value = Rrd_fring.peek rras.(i).Rrd.rra_data.(j) k in
compare_float
(Printf.sprintf "CF: %d Datasource: %d datapoint: %d " i j k)
update_value rra_value
done
done
done
in

let updates = Rrd_updates.(of_string @@ export [("", rrd)] 0L 5L None) in
check_same_as_rras updates.Rrd_updates.data rrd.rrd_rras

let test_length_invariants rrd () =
let check_length_of_fring dss (frings : Rrd_fring.t array) =
Alcotest.(check int)
Expand Down Expand Up @@ -172,9 +147,9 @@ let of_file filename =
let input = Xmlm.make_input (`String (0, body)) in
Rrd.from_xml input

(* Used to generate flip_flop.xml for test_ca_325844,
* then gets edited manually to set min to 0 *)
let deserialize_verify_rrd =
(* Used to generate flip_flop.xml for test_ca_325844, then gets edited manually
to set min to 0 *)
let _deserialize_verify_rrd =
let init_time = 0. in

let rra1 = rra_create CF_Average 100 1 0.5 in
Expand Down
2 changes: 0 additions & 2 deletions ocaml/libs/xapi-stdext/lib/xapi-stdext-date/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ open Xapi_stdext_date.Date

let check_float = Alcotest.(check @@ float 1e-2)

let check_float_neq = Alcotest.(check @@ neg @@ float 1e-2)

let check_string = Alcotest.(check string)

let check_true str = Alcotest.(check bool) str true
Expand Down
Loading

0 comments on commit ea8bffb

Please sign in to comment.