Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007827OCamltools (ocaml{lex,yacc,dep,debug,...})public2018-07-19 22:092018-07-19 23:15
Reportergasche 
Assigned Togasche 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusresolvedResolutionno change required 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0007827: testsuite: allow to use expect-tests and Compilerlibs at the same time
DescriptionIt would be nice to use expect-tests, which currently are the nicer way of writing small library tests in the testsuite, in conjunction with Compilerlibs -- this comes from a real need I felt while implementing a recent PR.

My understanding is that this is made difficult by the fact that expect-tests uses the toplevel machinery, and that combining the toplevel with compiler-libs is difficult as most compiler-libs libraries are already linked with the toplevel, but hidden from the user code through a non-trivial mechanism.

Would there be a way to add some logic to the toplevel so that at least some of compiler-libs, for example ocamlcommon.cma (not ocamltoplevel.cma), can be accessed from the toplevel user? It doesn't need to be exposed to the "ocaml" toplevel, but somewhere in Toploop that tools/expect_test.ml could use.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0019263)
octachron (developer)
2018-07-19 22:26

What is lacking in the current support? For instance, the following test behaves as expected:

(* TEST
   flags = "-I ${ocamlsrcdir}/parsing -I ${ocamlsrcdir}/typing"
   include ocamlcommon
   * expect
*)

let () = Oprint.out_value := (fun _ -> ignore);;
let () = Oprint.out_type := (fun _ -> ignore);;
let x = Ast_helper.Exp.ident;;
[%%expect{|
val x : =
|}]
(0019264)
gasche (administrator)
2018-07-19 22:48

I think that I didn't know about the "${ocamlsrcdir}" syntax, I only tried `include ocamlcommon`, and looked for existing test headers containing ocamlcommon.

Now we need to commit an example using your proposal, so that it is found again when people look for it.
(0019265)
gasche (administrator)
2018-07-19 23:15

Trying it in practice, it looks that this doesn't actually work correctly for my attempt, due to Misc.fatal_error mixing its output with the testsuite reports. I'm discussing this with octachron over at

  https://github.com/ocaml/ocaml/pull/1918#issuecomment-406414981 [^]

- Issue History
Date Modified Username Field Change
2018-07-19 22:09 gasche New Issue
2018-07-19 22:26 octachron Note Added: 0019263
2018-07-19 22:48 gasche Note Added: 0019264
2018-07-19 22:48 gasche Status new => resolved
2018-07-19 22:48 gasche Resolution open => no change required
2018-07-19 22:48 gasche Assigned To => gasche
2018-07-19 23:15 gasche Note Added: 0019265


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker