From cc70aeb3f11121085b9dff7f3c59462ba991147e Mon Sep 17 00:00:00 2001 From: Romain Calascibetta Date: Wed, 2 Nov 2022 15:46:53 +0100 Subject: [PATCH] Check if git-daemon exists and execute tests then --- test/dune | 11 +++++++++++ test/git_daemon_exists.ml | 9 +++++++++ 2 files changed, 20 insertions(+) create mode 100644 test/git_daemon_exists.ml diff --git a/test/dune b/test/dune index 26ad0c9..e5b7386 100644 --- a/test/dune +++ b/test/dune @@ -2,10 +2,21 @@ (package git-kv) (applies_to simple) (locks p9418) + (enabled_if (= "true" {%read:git-daemon})) (deps %{bin:mgit})) (cram (package git-kv) (applies_to fold) (locks p9418) + (enabled_if (= "true" {%read:git-daemon})) (deps %{bin:mgit})) + +(executable + (name git_daemon_exists) + (libraries unix)) + +(rule + (with-stdout-to + git-daemon + (run ./git_daemon_exists.exe))) diff --git a/test/git_daemon_exists.ml b/test/git_daemon_exists.ml new file mode 100644 index 0000000..851540f --- /dev/null +++ b/test/git_daemon_exists.ml @@ -0,0 +1,9 @@ +let git_daemon_exists () = + match Unix.create_process "git" [| "git"; "daemon" |] Unix.stdin Unix.stdout Unix.stderr with + | pid -> + Unix.kill pid Sys.sigint ; true + | exception Unix.Unix_error _ -> false + +let () = + let v = git_daemon_exists () in + Format.printf "%b" v