From 142155551d1a7e4db6737ad4a43c6113c55c5329 Mon Sep 17 00:00:00 2001 From: Jeremie Dimino Date: Fri, 11 Aug 2017 11:09:23 +0100 Subject: [PATCH] Switch examples testing to cram --- example/jbuild | 32 +++++++------------ example/sample-projects/hello_world/run.t | 13 ++++++++ .../sample-projects/with-configure-step/run.t | 8 +++++ 3 files changed, 33 insertions(+), 20 deletions(-) create mode 100644 example/sample-projects/hello_world/run.t create mode 100644 example/sample-projects/with-configure-step/run.t diff --git a/example/jbuild b/example/jbuild index 161e9a80..509f2453 100644 --- a/example/jbuild +++ b/example/jbuild @@ -1,27 +1,19 @@ -(* -*- tuareg -*- *) +(jbuild_version 1) -module J = Jbuild_plugin.V1 - -let example_dir = "sample-projects" - -let buf = Buffer.create 1024 -let () = Buffer.add_string buf "(jbuild_version 1)\n" - -let gen_example example = - let dir = Printf.sprintf "%s/%s" example_dir example in - Printf.bprintf buf {| (alias ((name runtest) - (deps ((files_recursively_in %s))) + (deps ((files_recursively_in sample-projects/hello_world))) (action - (chdir %s - (ignore-outputs (run ${bin:jbuilder} build -j1 --root . @install @runtest)))))) -|} - dir dir + (chdir sample-projects/hello_world + (setenv JBUILDER ${bin:jbuilder} + (run ${exe:../test/blackbox-tests/cram.exe} run.t)))))) -let () = - Array.iter gen_example (Sys.readdir "sample-projects") - -let () = J.send (Buffer.contents buf) +(alias + ((name runtest) + (deps ((files_recursively_in sample-projects/with-configure-step))) + (action + (chdir sample-projects/with-configure-step + (setenv JBUILDER ${bin:jbuilder} + (run ${exe:../test/blackbox-tests/cram.exe} run.t)))))) diff --git a/example/sample-projects/hello_world/run.t b/example/sample-projects/hello_world/run.t new file mode 100644 index 00000000..6189747d --- /dev/null +++ b/example/sample-projects/hello_world/run.t @@ -0,0 +1,13 @@ + $ $JBUILDER build -j1 --root . @install @runtest + ocamldep bin/main.depends.ocamldep-output + ocamldep lib/hello_world.depends.ocamldep-output + ocamlc lib/hello_world.{cmi,cmo,cmt} + ocamlopt lib/hello_world.{cmx,o} + ocamlc bin/main.{cmi,cmo,cmt} + ocamlc lib/hello_world.cma + ocamlopt lib/hello_world.{a,cmxa} + ocamlopt bin/main.{cmx,o} + ocamlopt lib/hello_world.cmxs + ocamlopt bin/main.exe + hello_world test/hello_world.output + diff alias test/runtest diff --git a/example/sample-projects/with-configure-step/run.t b/example/sample-projects/with-configure-step/run.t new file mode 100644 index 00000000..e0ac978c --- /dev/null +++ b/example/sample-projects/with-configure-step/run.t @@ -0,0 +1,8 @@ + $ $JBUILDER build -j1 --root . @install @runtest + ocaml config.full + ocamldep src/plop.depends.ocamldep-output + ocamlc src/config.{cmi,cmo,cmt} + ocamlopt src/config.{cmx,o} + ocamlc src/plop.{cmi,cmo,cmt} + ocamlopt src/plop.{cmx,o} + ocamlopt src/plop.exe