[Pkg-ocaml-maint-commits] [SCM] ocamlviz packaging branch, ocamlbuild, updated. upstream/1.01-6-g0cba9c8
Mehdi Dogguy
mehdi at debian.org
Thu Mar 25 23:19:55 UTC 2010
The following commit has been merged in the ocamlbuild branch:
commit b4d3edd74f1b197c382704a128cad4d123e45425
Author: Mehdi Dogguy <mehdi at debian.org>
Date: Fri Mar 26 00:12:48 2010 +0100
Use substitutions in test rules
diff --git a/myocamlbuild.ml b/myocamlbuild.ml
index 02e38c5..b781d4d 100644
--- a/myocamlbuild.ml
+++ b/myocamlbuild.ml
@@ -143,46 +143,35 @@ let _ =
virtual_rule "final" & [ "all"; "ocamlviz-gui"; "ocamlviz-ascii" ];
(* Tests *)
- let tests = Sys.readdir ("tests/") in
-
- (* Native tests *)
- let test_cmd _bin _gui =
- (fun _ _ ->
- Cmd (Sh (__ "xterm -e \"./%s 100\" & (sleep 1 ; ./%s)" _bin _gui))
+ let test_cmd mode client =
+ (fun env _ ->
+ let bin = env (__ "tests/%%.%s" mode) in
+ Cmd (Sh (__ "xterm -e \"./%s 100\" & (sleep 1 ; ./%s)" bin client))
)
in
- Array.iter
- (fun test ->
- let name = Filename.chop_suffix test ".ml" in
- let id = __ "tests/%s" test in
-
- let rule_native = __ "test-%s.native" name in
- let bin_native = test_path "native" name in
-
- let rule_byte = __ "test-%s.byte" name in
- let bin_byte = test_path "byte" name in
-
- let ascii_native_rule = __ "ascii-%s.native" name in
- let ascii_byte_rule = __ "ascii-%s.byte" name in
-
- rule rule_native ~stamp:rule_native ~deps:([cmxa; gui_native; bin_native])
- (test_cmd bin_native gui_native);
-
- rule rule_byte ~stamp:rule_byte ~deps:([cma; gui_byte; bin_byte])
- (test_cmd bin_byte gui_byte);
-
- rule ascii_native_rule ~stamp:ascii_native_rule ~deps:([cmxa; ascii_native; bin_native])
- (test_cmd bin_native ascii_native);
-
- rule ascii_byte_rule ~stamp:ascii_byte_rule ~deps:([cmxa; ascii_byte; bin_byte])
- (test_cmd bin_byte ascii_byte);
-
- let pa_test = __ "tests/pa-%s" test in
- rule pa_test ~stamp:pa_test ~deps:([ id; pa_ocamlviz ])
- (fun _ _ ->
- Cmd (Sh (__ "camlp4 pa_o.cmo str.cma camlp4/pa_ocamlviz.cmo pr_o.cmo %s -o %s" id pa_test))
- )
- ) tests;
+ let test = "tests/%.ml" in
+ let rule_native = "test-%.native" in
+ let rule_byte = "test-%.byte" in
+ let bin_native = "tests/%.native" in
+ let bin_byte = "tests/%.byte" in
+ let a_rule_native = "ascii-%.native" in
+ let a_rule_byte = "ascii-%.byte" in
+ let pa_test = "tests/pa-%.ml" in
+
+ rule rule_native ~stamp:rule_native ~deps:([cmxa; gui_native; bin_native])
+ (test_cmd "native" gui_native);
+ rule rule_byte ~stamp:rule_byte ~deps:([cma; gui_byte; bin_byte])
+ (test_cmd "byte" gui_byte);
+ rule a_rule_native ~stamp:a_rule_native ~deps:([cmxa; ascii_native; bin_native])
+ (test_cmd "native" ascii_native);
+ rule a_rule_byte ~stamp:a_rule_byte ~deps:([cmxa; ascii_byte; bin_byte])
+ (test_cmd "byte" ascii_byte);
+ rule pa_test ~stamp:pa_test ~deps:([ test; pa_ocamlviz ])
+ (fun env _ ->
+ let test = env "tests/%.ml" in
+ let pa_test = env "tests/pa-%.ml" in
+ Cmd (Sh (__ "camlp4 pa_o.cmo str.cma camlp4/pa_ocamlviz.cmo pr_o.cmo %s -o %s" test pa_test))
+ );
(* META file *)
rule "META" ~deps:["META.in"; "VERSION"] ~prod:"META"
--
ocamlviz packaging
More information about the Pkg-ocaml-maint-commits
mailing list