Clear the load path for expectation tests#1621
Conversation
|
I'm not sure I quite understand how this works. It also seems like there is no call to Apparently it doesn't matter, but it might come back to bite us in the future. |
Yes. Looking at the code they were already ignored before actually.
Where is it? I guess that's the one responsible for adding the stdlib dir |
|
I meant "except for the one at toplevel in |
|
Ah, I missed the |
|
So, I think you might want to remove the clearing of List.iter [ "stdlib" ] ~f:(fun s ->
Topdirs.dir_directory (Filename.concat !repo_root s));and instead want to call Compmisc.init_path ~dir:(Filename.concat !repo_root "stdlib") <some boolean>at that point. Does that sound right to you? |
|
That seems OK, with a |
|
Indeed, then I guess you want to add it to |
|
(sorry if I'm irrelevant here)
Wold it make sense that exepct_tool correctly interprets the -nostdlib
and -I flags?
That way, it would become agnostic on where the stdlib is and the
control will rely on the caller.
What do you think?
Btw what I have in mind is what I said this morning about the fact that
one may want to test both the freshly compiled sources AND the freshly
installed ones.
|
|
Yes, that seems more in line with the rest of the tools. What should I modify to pass these flags to the expect_test tool? |
|
Jérémie Dimino (2018/02/20 07:06 -0800):
Yes, that seems more in line with the rest of the tools. What should I
modify to pass these flags to the expect_test tool?
Well if the tools accepts them I can deal withe the "passing" part.
Now if you wish to do the modification of ocamltest, see
the run_expect_once funciton in ocamltest/ocaml_actions.ml
An expression like `Ocaml_flags.stdlib ocamlsrcdir` will produce what
you need to include the stdlib from the sources.
|
|
Note that all ways to invoke except_test already honor the |
|
@gasche: "Note that all ways to invoke except_test already honor the EXPECT_FLAGS environment |
$ git grep EXPECT_FLAGS | cat
ocamltest/ocaml_actions.ml: let expect_flags = try Sys.getenv "EXPECT_FLAGS" with Not_found -> "" in
testsuite/makefiles/Makefile.expect: TERM=dumb $(EXPECT_TEST) $(EXPECT_FLAGS) -repo-root $(OTOPDIR) $$file && \
testsuite/makefiles/Makefile.expect: TERM=dumb $(EXPECT_TEST) $(EXPECT_FLAGS) -repo-root $(OTOPDIR) -principal \ |
|
$EXPECT_FLAGS is passed to expect_test by both the Makefile and ocamltest. |
|
Gabriel Scherer (2018/02/20 08:11 -0800):
```shell
$ git grep EXPECT_FLAGS | cat
ocamltest/ocaml_actions.ml: let expect_flags = try Sys.getenv "EXPECT_FLAGS" with Not_found -> "" in
testsuite/makefiles/Makefile.expect: TERM=dumb $(EXPECT_TEST) $(EXPECT_FLAGS) -repo-root $(OTOPDIR) $$file && \
testsuite/makefiles/Makefile.expect: TERM=dumb $(EXPECT_TEST) $(EXPECT_FLAGS) -repo-root $(OTOPDIR) -principal \
```
Yeah that's what I said: "testsuite/makefiles/Makefile.expect" is no
longer used. It could be removed.
|
|
Gabriel Scherer (2018/02/20 16:12 +0000):
$EXPECT_FLAGS is passed to expect_test by both the Makefile and
ocamltest.
Btw: shouldn't it be the tool itself that reads the variable directly?
|
|
Passing the flag on the command-line when invoking the tool means that the content is parsed by the shell. If the tool wanted to interpret this variable themselves it would have to implement shell-style command-line parsing itself, which is painful -- this is why the OCaml compiler for example implements a different format in OCAMLPARAM, OCAMLRUNPARAM etc. On the other hand, ocamltest supports (Note that honoring EXPECT_FLAGS is useful for cross-cutting concerns such as the one we are presently discussing here: it lets Jérémie experiment more easily without requiring ocamltest-side changes, before a long-term solution which doesn't use EXPECT_FLAGS is implemented.) |
|
Yeah I can confirm it wouldn't be a big deal to let expect-style tests
use the flags variable, or another one.
|
|
Gentle Monday ping: unit tests are still broken on trunk. |
|
Ah, I thought this was just an improvement... |
|
The test breakage only shows up if you don't install the system before testing (not installing is standard) and you have a meaningful installation path that already contains stuff (from a previous install test, for example; this may be non-standard workflow). This means that there is a workaround (always install the distribution before testing), so this is not critical; but it breaks assumptions that some people's workflow (typically mine) rely on. I wouldn't mind fixing it myself, but I figured that you (@diml) would be more familiar with the toplevel codebase so that it would probably be sensibly easier for you. If you don't have resources to work on it now, I don't mind giving it a try later in the week. |
|
Ok, that's annoying indeed. I pushed another commit that does the following:
So this should fix the issue, we should be able to pass arbitrary flags to the tool and we don't need to modify anything else at this point. Moving forward, I think one thing what would be even better is to push this feature in the toplevel itself, this way it wouldn't be a second class tool that we might forget to update. Though that's a bit more work. |
trefis
left a comment
There was a problem hiding this comment.
LGTM.
(Do you want to add a Changes entry?)
done |
|
Thanks! With this PR merged and a stale install-directory on my machine, all tests now pass. (I observed a transient failure with |
|
The failure with |
|
If it needs to be fixed soon, the test could be rewritten to define its own functor rather than use |
|
I think we can wait for you (or someone else) to have time to look at it. |
To make sure the typer doesn't try to load installed cmi files.