(library
 (name fiber)
 (modules fiber)
 (libraries fmt logs lwt.unix unix))

(executable
 (name simple_server)
 (modules simple_server)
 (libraries logs.fmt fmt.tty mirage-crypto-rng.unix tcpip.stack-socket
   paf.mirage))

(library
 (name simple_client)
 (modules simple_client)
 (libraries lwt.unix logs.fmt fmt.tty uri mirage-crypto-rng.unix
   tcpip.stack-socket paf.mirage))

(executable
 (name clients)
 (modules clients)
 (foreign_stubs
  (language c)
  (names mclock))
 (libraries fiber simple_client))

(executable
 (name test)
 (modules test)
 (libraries uri unix))

(executable
 (name test_alpn)
 (modules test_alpn)
 (libraries fmt.tty logs.fmt alcotest-lwt tcpip.stack-socket paf.alpn
   paf.mirage mirage-crypto-rng.unix))

(executable
 (name test_cohttp)
 (modules test_cohttp)
 (libraries fmt.tty logs.fmt alcotest-lwt tcpip.stack-socket cohttp-lwt
   paf-cohttp paf.mirage mirage-crypto-rng.unix astring))

(rule
 (alias runtest)
 (package paf)
 (deps server.pem server.key %{exe:test_alpn.exe})
 (enabled_if %{arch_sixtyfour})
 (action
  (run ./test_alpn.exe --color=always)))

(rule
 (alias runtest)
 (package paf)
 (locks m)
 (deps server.pem server.key file.txt %{exe:clients.exe}
   %{exe:simple_server.exe})
 (action
  (run ./test.exe -c 50 -n 200)))

(rule
 (alias runtest)
 (locks m)
 (package paf-cohttp)
 (deps server.pem server.key %{exe:test_cohttp.exe})
 (action
  (run ./test_cohttp.exe --color=always)))
