Skip to content

Commit

Permalink
Merge pull request #5684 from psafont/lesstestlogs
Browse files Browse the repository at this point in the history
Testing: reduce amount of logs produced, drop ounit2
  • Loading branch information
robhoes committed Jun 17, 2024
2 parents 130bbbe + 0a1822f commit b944326
Show file tree
Hide file tree
Showing 31 changed files with 581 additions and 603 deletions.
1 change: 0 additions & 1 deletion .github/workflows/setup-xapi-environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ runs:
ocaml-compiler: ${{ steps.dotenv.outputs.ocaml_version_full }}
opam-repositories: |
xs-opam: ${{ steps.dotenv.outputs.repository }}
opam-pin: false
dune-cache: true
env:
DUNE_CACHE_STORAGE_MODE: copy
Expand Down
101 changes: 101 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@
(name xml-light2)
)

(package
(name xapi-sdk)
(license "BSD-2-Clause")
(synopsis "Xen API SDK generation code")
(depends
(alcotest :with-test)
astring
mustache
(xapi-datamodel (= :version))
(xapi-stdext-unix (and (= :version) :with-test))
)
(allow_empty)
)
(package
(name xen-api-client-lwt)
)
Expand All @@ -34,6 +47,23 @@

(package
(name xen-api-client)
(synopsis "Xen-API client library for remotely-controlling a xapi host")
(authors "David Scott" "Anil Madhavapeddy" "Jerome Maloberti" "John Else" "Jon Ludlam" "Thomas Sanders" "Mike McClurg")
(depends
dune-build-info
(alcotest :with-test)
astring
(cohttp (>= "0.22.0"))
re
rpclib
uri
(uuid (= :version))
(xapi-client (= :version))
(xapi-idl (= :version))
(xapi-rrd (= :version))
(xapi-types (= :version))
xmlm
)
)

(package
Expand Down Expand Up @@ -142,6 +172,7 @@
(depends
(ocaml (>= "4.02.0"))
dune-build-info
(alcotest :with-test)
astring
(gzip (= :version))
(http-lib (= :version))
Expand Down Expand Up @@ -229,6 +260,19 @@

(package
(name wsproxy)
(synopsis "Websockets proxy for VNC traffic")
(authors "Jon Ludlam" "Marcello Seri")
(license "LGPL-2.0-only WITH OCaml-LGPL-linking-exception")
(depends
(alcotest :with-test)
(base64 (>= "3.1.0"))
fmt
logs
(lwt (>= "3.0.0"))
re
uuid
(qcheck-core :with-test)
)
)

(package
Expand All @@ -241,6 +285,29 @@

(package
(name vhd-format-lwt)
(synopsis "Lwt interface to read/write VHD format data")
(description "A pure OCaml library to read and write
[vhd](http://en.wikipedia.org/wiki/VHD_(file_format)) format data, plus a
simple command-line tool which allows vhd files to be interrogated,
manipulated, format-converted and streamed to and from files and remote
servers.
This package provides an Lwt compatible interface to the library.")
(authors "Jon Ludlam" "Dave Scott")
(maintainers "Dave Scott <dave@recoil.org>")
(tags ("org:mirage" "org:xapi-project"))
(homepage "https://github.com/mirage/ocaml-vhd")
(source (github mirage/ocaml-vhd))
(depends
(ocaml (and (>= "4.02.3") (< "5.0.0")))
(alcotest :with-test)
(alcotest-lwt :with-test)
(cstruct (< "6.1.0"))
(lwt (>= "3.2.0"))
(mirage-block (>= "2.0.1"))
(vhd-format (= :version))
(io-page (and :with-test (>= "2.4.0")))
)
)

(package
Expand Down Expand Up @@ -277,6 +344,19 @@

(package
(name rrd-transport)
(synopsis "Shared-memory protocols for exposing system metrics")
(description "VMs running on a Xen host can use this library to expose performance counters which can be sampled by xapi's metric daemon.")
(authors "John Else")
(depends
(alcotest :with-test)
astring
cstruct
crc
yojson
(xapi-idl (= :version))
(xapi-rrd (= :version))
(odoc :with-doc)
)
)

(package
Expand Down Expand Up @@ -322,6 +402,27 @@

(package
(name http-lib)
(synopsis "An HTTP required used by xapi")
(description "This library allows xapi to perform varios activities related to the HTTP protocol.")
(depends
(alcotest :with-test)
astring
(base64 (>= "3.1.0"))
rpclib
(safe-resources(= :version))
sha
(stunnel (= :version))
(uuid (= :version))
xapi-backtrace
(xapi-idl (= :version))
(xapi-log (= :version))
(xapi-stdext-date (= :version))
(xapi-stdext-pervasives (= :version))
(xapi-stdext-threads (= :version))
(xapi-tracing (= :version))
(xml-light2 (= :version))
(odoc :with-doc)
)
)

(package
Expand Down
67 changes: 35 additions & 32 deletions http-lib.opam
Original file line number Diff line number Diff line change
@@ -1,42 +1,45 @@
# This file is generated by dune, edit dune-project instead
license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"
opam-version: "2.0"
maintainer: "xen-api@lists.xen.org"
authors: "xen-api@lists.xen.org"
synopsis: "An HTTP required used by xapi"
description:
"This library allows xapi to perform varios activities related to the HTTP protocol."
maintainer: ["Xapi project maintainers"]
authors: ["xen-api@lists.xen.org"]
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.git"
dev-repo: "git+https://github.com/xapi-project/xen-api.git"
build: [
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
]
available: [ os = "linux" | os = "macos" ]
bug-reports: "https://github.com/xapi-project/xen-api/issues"
depends: [
"ocaml"
"dune"
"dune" {>= "3.0"}
"alcotest" {with-test}
"astring"
"base64" {>= "3.1.0"}
"rpclib"
"safe-resources"
"safe-resources" {= version}
"sha"
"stunnel"
"uuid"
"stunnel" {= version}
"uuid" {= version}
"xapi-backtrace"
"xapi-idl"
"xapi-log"
"xapi-stdext-date"
"xapi-stdext-pervasives"
"xapi-stdext-threads"
"xapi-stdext-unix"
"xapi-tracing"
"xml-light2"
"ounit2" {with-test & >= "2.0.0"}
"xapi-idl" {= version}
"xapi-log" {= version}
"xapi-stdext-date" {= version}
"xapi-stdext-pervasives" {= version}
"xapi-stdext-threads" {= version}
"xapi-tracing" {= version}
"xml-light2" {= version}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
synopsis: "Library required by xapi"
description: """
These libraries are provided for backwards compatibility only.
No new code should use these libraries."""
url {
src:
"https://github.com/xapi-project/xen-api/archive/master.tar.gz"
}
dev-repo: "git+https://github.com/xapi-project/xen-api.git"
40 changes: 0 additions & 40 deletions http-lib.opam.template

This file was deleted.

2 changes: 0 additions & 2 deletions ocaml/libs/http-lib/dune
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
(libraries
dune-build-info
http_lib
ounit2
safe-resources
stunnel
threads.posix
Expand All @@ -85,7 +84,6 @@
dune-build-info
http_lib
httpsvr
ounit2
safe-resources
threads.posix
xapi-stdext-threads
Expand Down
2 changes: 1 addition & 1 deletion ocaml/libs/vhd/vhd_format_lwt_test/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(test
(name parse_test)
(package vhd-format-lwt)
(libraries cstruct disk io-page lwt lwt.unix ounit2 vhd-format
(libraries alcotest alcotest-lwt cstruct disk io-page lwt lwt.unix vhd-format
vhd_format_lwt))
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,25 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*)
open OUnit
open Lwt
module IO = Vhd_format_lwt.IO
module Impl = Vhd_format.F.From_file (IO)
module F = Vhd_format.F
module Field = F.Vhd.Field
open Impl

let header =
Alcotest.testable (Fmt.of_to_string F.Header.to_string) F.Header.equal

let footer = Alcotest.testable (Fmt.of_to_string F.Footer.to_string) ( = )

let bat = Alcotest.testable (Fmt.of_to_string F.BAT.to_string) F.BAT.equal

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

let cstruct =
Alcotest.testable (Fmt.of_to_string cstruct_to_string) F.cstruct_equal

module Memory = struct
let alloc bytes =
if bytes = 0 then
Expand Down Expand Up @@ -76,8 +87,6 @@ let _absolute_sector_of vhd _position {Vhd_format.Patterns.block; sector} =
(of_int relative_sector)
)

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

(* Verify that vhd [t] contains the sectors [expected] *)
let check_written_sectors t expected =
let y = Memory.alloc 512 in
Expand All @@ -90,7 +99,7 @@ let check_written_sectors t expected =
| false ->
fail (Failure "read empty sector, expected data")
| true ->
assert_equal ~printer:cstruct_to_string ~cmp:F.cstruct_equal data y ;
Alcotest.check cstruct __LOC__ data y ;
return ()
)
>>= fun () -> loop xs
Expand Down Expand Up @@ -130,12 +139,10 @@ let check_raw_stream_contents t expected =
let actual = Cstruct.sub data (i * 512) 512 in

( if not (List.mem_assoc sector expected) then
assert_equal ~printer:cstruct_to_string ~cmp:F.cstruct_equal
empty_sector actual
Alcotest.check cstruct __LOC__ empty_sector actual
else
let expected = List.assoc sector expected in
assert_equal ~printer:cstruct_to_string ~cmp:F.cstruct_equal
expected actual
Alcotest.check cstruct __LOC__ expected actual
) ;
check (i + 1)
in
Expand All @@ -156,8 +163,7 @@ let check_raw_stream_contents t expected =
else
let expected = List.assoc offset expected in
let actual = Cstruct.sub remaining 0 F.sector_size in
assert_equal ~printer:cstruct_to_string ~cmp:F.cstruct_equal
expected actual ;
Alcotest.check cstruct __LOC__ expected actual ;
loop Int64.(add offset 1L) (Cstruct.shift remaining F.sector_size)
in
loop offset data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
* GNU Lesser General Public License for more details.
*)

val header : Vhd_format.F.Header.t Alcotest.testable

val footer : Vhd_format.F.Footer.t Alcotest.testable

val bat : Vhd_format.F.BAT.t Alcotest.testable

val cstruct : Cstruct.t Alcotest.testable

val verify :
Vhd_format_lwt.IO.fd Vhd_format.F.Vhd.t
-> (int64 * Cstruct.t) list
Expand Down
Loading

0 comments on commit b944326

Please sign in to comment.