Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add an all-in-one latex_to_pdf() function and sweet testing infrastructure #252
This should be helpful for people who want to embed the engine as a library. Tests and higher-level API exposure coming soon.
Along with the existing options, add a mode where output files simply aren't written to disk. Once again, tests forthcoming.
It was linked to TermcolorStatusBackend because of the note_highlighted method, but it is straightforward and reasonable to make that a trait function with a sensible default impl.
…files I *always* have trouble doing this, so here's a function that does something along the lines of what I usually want.
This gives us a nice concise example for the very top of the Tectonic API documentation. And hopefully it is actually useful for people! The testing infrastructure got a big revamp to allow us to actually execute the doctest on the new API docs. Doctest and integration-test executables are linked against the standard build of the main crate, so the supporting test infrastructure has to live in that crate and can't be gated behind a `#[cfg(test)]` attribute. I figured out a way to make this happen that I'm happy with — it makes these tests possible, but should only bloat the crate by a small amount. Importantly, this approach means that we can also make it so that the tests in `tests/executable.rs`, which launch the build `tectonic` binary, leverage the same test mode. This is a nice win — before, these tests would go to the network and pull down assets into the local user's cache. Now they use the same set of test assets as everybody else.
Hmmm, the Circle CI test failed on the new doctests:
This looks pretty clearly to not be a problem with the actual implementation. I'll try rerunning; maybe it was transient ...
@@ Coverage Diff @@ ## master #252 +/- ## ========================================== + Coverage 41.12% 41.32% +0.19% ========================================== Files 134 135 +1 Lines 60364 60952 +588 ========================================== + Hits 24827 25188 +361 - Misses 35537 35764 +227
Because the C/C++ engines use a ton of shared global state, they are not thread-safe. Up to this point, the `tectonic` crate didn't do anything about this: callers needed to use their own mutex to prevent engines from stomping all over each other's toes. Upon further thought and discussion, I think this approach was a bit silly. In particular, I was afraid of creating a situation where callers might find that their processes mysteriously deadlocked, but I don't think that's actually possible. We just have one mutex, and it is acquired and released in a totally straightforward manner. I have trouble seeing how any trouble might arise. ... Famous last words?
OK, this PR now adds an internal mutex in the Tectonic crate as well as the other changes building up to the all-in-one function.
The Circle CI build failed again due to the same error as before, which was transient the first time. I've relaunched it. If this failure happen frequently we'll need to figure out some way to mitigate it.
Any final comments?