Permalink
Browse files

Hook up the Re_posix test via OASIS

  • Loading branch information...
1 parent 430d800 commit b8e484a8034eb0bc41413066c6936dd08d17e670 @avsm avsm committed Jan 7, 2012
Showing with 287 additions and 22 deletions.
  1. +5 −2 .gitignore
  2. +25 −11 Makefile
  3. +19 −2 _oasis
  4. +5 −1 _tags
  5. +2 −1 lib/re.mllib
  6. +231 −5 setup.ml
View
@@ -1,6 +1,9 @@
.*.swp
_build/
+*.bak
setup.data
setup.log
-*.bak
-CVS/
+setup.bin
+*.native
+*.byte
+*.docdir
View
@@ -1,19 +1,33 @@
.PHONY: all clean install build
-all: build
+all: build doc
-setup.data:
- ocaml setup.ml -configure
+NAME=re
-build: setup.data
- ocaml setup.ml -build
+export OCAMLRUNPARAM=b
-install:
- ocaml setup.ml -install
+setup.bin: setup.ml
+ ocamlopt.opt -o $@ $< || ocamlopt -o $@ $< || ocamlc -o $@ $<
+ rm -f setup.cmx setup.cmi setup.o setup.cmo
-reinstall:
- ocamlfind -remove regexp || true
- ocaml setup.ml -reinstall
+setup.data: setup.bin
+ ./setup.bin -configure
+
+build: setup.data setup.bin
+ ./setup.bin -build
+
+doc: setup.data setup.bin
+ ./setup.bin -doc
+
+install: setup.bin
+ ./setup.bin -install
+
+test: setup.bin build
+ ./setup.bin -test
+
+reinstall: setup.bin
+ ocamlfind remove $(NAME) || true
+ ./setup.bin -reinstall
clean:
ocamlbuild -clean
- rm -f setup.data setup.log
+ rm -f setup.data setup.log setup.bin
View
21 _oasis
@@ -5,9 +5,26 @@ Synopsis: Pure OCaml regular expression library
Authors: Jerome Vouillon
License: LGPL-2.0 with OCaml linking exception
Plugins: META (0.2)
+BuildTools: ocamlbuild
Library re
Path: lib
- BuildTools: ocamlbuild
- Modules: Re,Cset,Automata,Re_posix,Re_perl,Re_glob,Re_str
+ Modules: Re,Cset,Automata,Re_emacs,Re_posix,Re_perl,Re_glob,Re_str
+Flag tests
+ Description: Build and run tests
+ Default: true
+
+Executable re_match
+ Path: lib_test
+ MainIs: re_match.ml
+ Build$: flag(tests)
+ Custom: true
+ CompiledObject: best
+ Install: false
+ BuildDepends: re
+
+Test re_match
+ Run$: flag(tests)
+ Command: $re_match
+ WorkingDirectory: lib_test
View
6 _tags
@@ -1,5 +1,5 @@
# OASIS_START
-# DO NOT EDIT (digest: ecd10cf2b97824384a608da0dc44c060)
+# DO NOT EDIT (digest: ae3e45a771ffb399bcf8dff9394bc3ed)
# Ignore VCS directories, you can use the same kind of rule outside
# OASIS_START/STOP if you want to exclude directories that contains
# useless stuff for the build process
@@ -15,4 +15,8 @@
"_darcs": not_hygienic
# Library re
"lib": include
+# Executable re_match
+<lib_test/re_match.{native,byte}>: use_re
+<lib_test/*.ml{,i}>: use_re
+<lib_test/re_match.{native,byte}>: custom
# OASIS_STOP
View
@@ -1,8 +1,9 @@
# OASIS_START
-# DO NOT EDIT (digest: db3e05d0568bfbd5227f0a2c226b2475)
+# DO NOT EDIT (digest: cf0653c0003392f5ff2d8315cdefdb3f)
Re
Cset
Automata
+Re_emacs
Re_posix
Re_perl
Re_glob
View
236 setup.ml
@@ -1,7 +1,7 @@
(* setup.ml generated for the first time by OASIS v0.2.1~alpha1 *)
(* OASIS_START *)
-(* DO NOT EDIT (digest: 80bc7ba8b5738316bd9146ee6fe9a7c1) *)
+(* DO NOT EDIT (digest: 7157148bd13965b50766f3fb3b9a90f6) *)
(*
Regenerated by OASIS v0.2.1~alpha1
Visit http://oasis.forge.ocamlcore.org for more information and
@@ -4981,21 +4981,186 @@ module OCamlbuildDocPlugin = struct
end
+module CustomPlugin = struct
+# 21 "/Users/avsm/src/darcs/oasis/src/plugins/custom/CustomPlugin.ml"
+
+ (** Generate custom configure/build/doc/test/install system
+ @author
+ *)
+
+ open BaseEnv
+ open OASISGettext
+ open OASISTypes
+
+
+
+ type t =
+ {
+ cmd_main: command_line conditional;
+ cmd_clean: (command_line option) conditional;
+ cmd_distclean: (command_line option) conditional;
+ }
+
+ let run = BaseCustom.run
+
+ let main t _ extra_args =
+ let cmd, args =
+ var_choose
+ ~name:(s_ "main command")
+ t.cmd_main
+ in
+ run cmd args extra_args
+
+ let clean t pkg extra_args =
+ match var_choose t.cmd_clean with
+ | Some (cmd, args) ->
+ run cmd args extra_args
+ | _ ->
+ ()
+
+ let distclean t pkg extra_args =
+ match var_choose t.cmd_distclean with
+ | Some (cmd, args) ->
+ run cmd args extra_args
+ | _ ->
+ ()
+
+ module Build =
+ struct
+ let main t pkg extra_args =
+ main t pkg extra_args;
+ List.iter
+ (fun sct ->
+ let evs =
+ match sct with
+ | Library (cs, bs, lib) when var_choose bs.bs_build ->
+ begin
+ let evs, _ =
+ BaseBuilt.of_library
+ BaseFilePath.of_unix
+ (cs, bs, lib)
+ in
+ evs
+ end
+ | Executable (cs, bs, exec) when var_choose bs.bs_build ->
+ begin
+ let evs, _, _ =
+ BaseBuilt.of_executable
+ BaseFilePath.of_unix
+ (cs, bs, exec)
+ in
+ evs
+ end
+ | _ ->
+ []
+ in
+ List.iter
+ (fun (bt, bnm, lst) -> BaseBuilt.register bt bnm lst)
+ evs)
+ pkg.sections
+
+ let clean t pkg extra_args =
+ clean t pkg extra_args;
+ (* TODO: this seems to be pretty generic (at least wrt to ocamlbuild
+ * considering moving this to BaseSetup?
+ *)
+ List.iter
+ (function
+ | Library (cs, _, _) ->
+ BaseBuilt.unregister BaseBuilt.BLib cs.cs_name
+ | Executable (cs, _, _) ->
+ BaseBuilt.unregister BaseBuilt.BExec cs.cs_name;
+ BaseBuilt.unregister BaseBuilt.BExecLib cs.cs_name
+ | _ ->
+ ())
+ pkg.sections
+
+ let distclean t pkg extra_args =
+ distclean t pkg extra_args
+ end
+
+ module Test =
+ struct
+ let main t pkg (cs, test) extra_args =
+ try
+ main t pkg extra_args;
+ 0.0
+ with Failure s ->
+ BaseMessage.warning
+ (f_ "Test '%s' fails: %s")
+ cs.cs_name
+ s;
+ 1.0
+
+ let clean t pkg (cs, test) extra_args =
+ clean t pkg extra_args
+
+ let distclean t pkg (cs, test) extra_args =
+ distclean t pkg extra_args
+ end
+
+ module Doc =
+ struct
+ let main t pkg (cs, _) extra_args =
+ main t pkg extra_args;
+ BaseBuilt.register BaseBuilt.BDoc cs.cs_name []
+
+ let clean t pkg (cs, _) extra_args =
+ clean t pkg extra_args;
+ BaseBuilt.unregister BaseBuilt.BDoc cs.cs_name
+
+ let distclean t pkg (cs, _) extra_args =
+ distclean t pkg extra_args
+ end
+
+end
+
+
open OASISTypes;;
let setup_t =
{
BaseSetup.configure = InternalConfigurePlugin.configure;
build = OCamlbuildPlugin.build;
- test = [];
+ test =
+ [
+ ("re_match",
+ CustomPlugin.Test.main
+ {
+ CustomPlugin.cmd_main =
+ [(OASISExpr.EBool true, ("$re_match", []))];
+ cmd_clean = [(OASISExpr.EBool true, None)];
+ cmd_distclean = [(OASISExpr.EBool true, None)];
+ })
+ ];
doc = [];
install = InternalInstallPlugin.install;
uninstall = InternalInstallPlugin.uninstall;
clean = [OCamlbuildPlugin.clean];
- clean_test = [];
+ clean_test =
+ [
+ ("re_match",
+ CustomPlugin.Test.clean
+ {
+ CustomPlugin.cmd_main =
+ [(OASISExpr.EBool true, ("$re_match", []))];
+ cmd_clean = [(OASISExpr.EBool true, None)];
+ cmd_distclean = [(OASISExpr.EBool true, None)];
+ })
+ ];
clean_doc = [];
distclean = [];
- distclean_test = [];
+ distclean_test =
+ [
+ ("re_match",
+ CustomPlugin.Test.distclean
+ {
+ CustomPlugin.cmd_main =
+ [(OASISExpr.EBool true, ("$re_match", []))];
+ cmd_clean = [(OASISExpr.EBool true, None)];
+ cmd_distclean = [(OASISExpr.EBool true, None)];
+ })
+ ];
distclean_doc = [];
package =
{
@@ -5083,6 +5248,7 @@ let setup_t =
"Re";
"Cset";
"Automata";
+ "Re_emacs";
"Re_posix";
"Re_perl";
"Re_glob";
@@ -5093,6 +5259,66 @@ let setup_t =
lib_findlib_parent = None;
lib_findlib_name = None;
lib_findlib_containers = [];
+ });
+ Test
+ ({
+ cs_name = "re_match";
+ cs_data = PropList.Data.create ();
+ cs_plugin_data = [];
+ },
+ {
+ test_type = (`Test, "custom", Some "0.2");
+ test_command =
+ [(OASISExpr.EBool true, ("$re_match", []))];
+ test_custom =
+ {
+ pre_command = [(OASISExpr.EBool true, None)];
+ post_command = [(OASISExpr.EBool true, None)];
+ };
+ test_working_directory = Some "lib_test";
+ test_run =
+ [
+ (OASISExpr.EBool true, false);
+ (OASISExpr.EFlag "tests", true)
+ ];
+ test_tools = [ExternalTool "ocamlbuild"];
+ });
+ Executable
+ ({
+ cs_name = "re_match";
+ cs_data = PropList.Data.create ();
+ cs_plugin_data = [];
+ },
+ {
+ bs_build =
+ [
+ (OASISExpr.EBool true, false);
+ (OASISExpr.EFlag "tests", true)
+ ];
+ bs_install = [(OASISExpr.EBool true, false)];
+ bs_path = "lib_test";
+ bs_compiled_object = Best;
+ bs_build_depends = [InternalLibrary "re"];
+ bs_build_tools = [ExternalTool "ocamlbuild"];
+ bs_c_sources = [];
+ bs_data_files = [];
+ bs_ccopt = [(OASISExpr.EBool true, [])];
+ bs_cclib = [(OASISExpr.EBool true, [])];
+ bs_dlllib = [(OASISExpr.EBool true, [])];
+ bs_dllpath = [(OASISExpr.EBool true, [])];
+ bs_byteopt = [(OASISExpr.EBool true, [])];
+ bs_nativeopt = [(OASISExpr.EBool true, [])];
+ },
+ {exec_custom = true; exec_main_is = "re_match.ml"; });
+ Flag
+ ({
+ cs_name = "tests";
+ cs_data = PropList.Data.create ();
+ cs_plugin_data = [];
+ },
+ {
+ flag_description = Some "Build and run tests";
+ flag_default = [(OASISExpr.EBool true, true)];
})
];
plugins = [(`Extra, "META", Some "0.2")];
@@ -5104,6 +5330,6 @@ let setup_t =
let setup () = BaseSetup.setup setup_t;;
-# 5108 "setup.ml"
+# 5334 "setup.ml"
(* OASIS_STOP *)
let () = setup ();;

0 comments on commit b8e484a

Please sign in to comment.