Skip to content

Commit

Permalink
CP-47001: [xapi-fd-test]: dune plumbing for a new test framework
Browse files Browse the repository at this point in the history
This will be a test framework providing QCheck generators and properties for
testing file descriptor operations.
It will try to generate:
* different kinds of file descriptors
* actual data written/read on the other end of pipes and socket pairs
* different speeds and delays on the other end to find buffering bugs
* file descriptors that are >1024 to find bugs with select

Signed-off-by: Edwin Török <[email protected]>
  • Loading branch information
edwintorok committed Dec 14, 2023
1 parent 6f655c1 commit 6ec758d
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/ocaml-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
name: Ocaml tests
runs-on: ubuntu-20.04
env:
package: "xapi-stdext-date xapi-stdext-encodings xapi-stdext-pervasives xapi-stdext-std xapi-stdext-threads xapi-stdext-unix xapi-stdext-zerocheck"
package: "xapi-stdext-date xapi-stdext-encodings xapi-stdext-pervasives xapi-stdext-std xapi-stdext-threads xapi-stdext-unix xapi-stdext-zerocheck xapi-fdcaps xapi-fd-test"

steps:
- name: Checkout code
Expand Down
15 changes: 15 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
(xapi-stdext-threads (= :version))
(xapi-stdext-unix (= :version))
(xapi-stdext-zerocheck (= :version))
(xapi-fdcaps (= :version))
(xapi-fdcaps-test (and (= :version) :with-test))
)
)

Expand Down Expand Up @@ -115,3 +117,16 @@
fmt
)
)

(package
(name xapi-fd-test)
(synopsis "Test framework for file descriptor operations")
(depends
(alcotest :with-test)
base-unix
fmt
(mtime (>= 2.0.0))
logs
(qcheck-core (>= 0.21.2))
)
)
6 changes: 6 additions & 0 deletions lib/xapi-fd-test/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
; This will be used to test stdext itself, so do not depend on stdext here
(library
(public_name xapi-fd-test)
(name xapi_fd_test)
(libraries xapi-fdcaps unix qcheck-core logs fmt mtime mtime.clock.os)
)
6 changes: 6 additions & 0 deletions lib/xapi-fd-test/test/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
; This is a test framework, but we still need to test it
(test
(package xapi-fd-test)
(name test_xapi_fd_test)
(libraries xapi_fd_test alcotest)
)
Empty file.
33 changes: 33 additions & 0 deletions xapi-fd-test.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "Test framework for file descriptor operations"
maintainer: ["Xapi project maintainers"]
authors: ["Jonathan Ludlam"]
license: "LGPL-2.1-only WITH OCaml-LGPL-linking-exception"
homepage: "https://github.com/xapi-project/stdext"
bug-reports: "https://github.com/xapi-project/stdext/issues"
depends: [
"dune" {>= "2.7"}
"alcotest" {with-test}
"base-unix"
"fmt"
"mtime" {>= "2.0.0"}
"logs"
"qcheck-core" {>= "0.21.2"}
"odoc" {with-doc}
]
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/stdext.git"
2 changes: 2 additions & 0 deletions xapi-stdext.opam
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ depends: [
"xapi-stdext-threads" {= version}
"xapi-stdext-unix" {= version}
"xapi-stdext-zerocheck" {= version}
"xapi-fdcaps" {= version}
"xapi-fdcaps-test" {= version & with-test}
"odoc" {with-doc}
]
build: [
Expand Down

0 comments on commit 6ec758d

Please sign in to comment.