Stream: t-compiler/const-eval

Topic: miri-testing

Andrew Poelstra (Oct 18 2018 at 17:45, on Zulip):

Hi all. In my spare time I've been thinking about how to update cargo miri for the new test framework. We had been scanning functions for #[test] attributes and then running them, but now #[test] is a macro that puts a pointer to the actual test inside a test::TestDescAndFn structure. see . This means for miri to run it, it needs to pull the struct apart to find the function pointer then run that. with the existing APIs that i'm aware of, this is pretty difficult to do programmatically without deeply-nested matches or something

Andrew Poelstra (Oct 18 2018 at 17:47, on Zulip):

I wonder if I should work on some enormous syntax ext to allow creating (or manipulating, or matching) Mir objects from a DSL, or if that's overkill. is there a simpler way?

oli (Oct 18 2018 at 18:48, on Zulip):

Well.. we have which suggests to give us the ability to generate MIR from code. An initial version could be a convenience function that takes a string and produces MIR that we then can interpret to take apart these constants in the desired way

Andrew Poelstra (Oct 18 2018 at 20:12, on Zulip):

Thanks Oli! If there are other uses for an ast-to-mir converter then I'll hack on it this weekend and see where I get

RalfJ (Oct 18 2018 at 20:15, on Zulip):

alternatively, why can't we compile the thing that would usually inspect the TestDescAndFn and run that? I mean, rustc produces a binary interpreting that stuff, so there's MIR for it somewhere

Andrew Poelstra (Oct 18 2018 at 20:16, on Zulip):

We could - the thing is that it runs every test function in a row (like the old test runner) so it would be harder to emit the "Running test::whatever" diagnostics.

Andrew Poelstra (Oct 18 2018 at 20:17, on Zulip):

Well, the program itself will output diagnostics; but it would be harder for us to introspect and determine which test we were in the middle of

RalfJ (Oct 18 2018 at 20:18, on Zulip):

we'll need a libstd with MIR

RalfJ (Oct 18 2018 at 20:19, on Zulip):

but then printing to stdout/stderr should work

Andrew Poelstra (Oct 18 2018 at 20:21, on Zulip):

What about multithreading?

oli (Oct 18 2018 at 20:47, on Zulip):

that won't work, but does that happen by default?

Last update: Nov 15 2019 at 20:35UTC