On Thu, Mar 15, 2018, at 9:07 AM, Henri Sivonen wrote: > On Thu, Mar 15, 2018 at 2:51 PM, Ted Mielczarek <t...@mielczarek.org> wrote: > > On Thu, Mar 15, 2018, at 7:22 AM, Henri Sivonen wrote: > >> Do we have a way to read the prerequisite data for MOZ_GTEST_BENCH > >> outside MOZ_GTEST_BENCH so that the disk IO doesn't get timed? > > > > I don't know that we have any stock way to do this. I can offer three > > plausible solutions: > > 1) If putting the data in a Rust crate is feasible, use `include_bytes!` in > > the toolkit/library/gtest/rust crate[1], which gets linked into the gtest > > libxul. > > 2) Write a `GENERATED_FILES` script that takes the data file and outputs a > > header with a C array of bytes and #include that in the GTest. > > 3) Not the best solution, but for ICU data I have yasm / gas assembly > > files[2] that include the ICU .dat as a symbol. > > All of these involve putting the data inside libxul somehow. The > reason why the data isn't there already is that the data is under a > license that's prohibited in Gecko code. Maybe we just need a policy > opinion that while such data must not be baked into Gecko that gets > distributed but that baking it into a gtest-only binaries is actually > harmless. I'll try to get such a policy opinion.
Oh, it completely slipped my mind, but froydnj just added what you need very recently: `MOZ_GTEST_BENCH_F`: https://dxr.mozilla.org/mozilla-central/rev/6ff60a083701d08c52702daf50f28e8f46ae3a1c/testing/gtest/mozilla/MozGTestBench.h#22 It's essentially just exposing Google Test's `TEST_F` to have a test with a fixture, which lets you implement a `SetUp` method to do work before running the test, which for a benchmark will happen outside of the measurement. There aren't any uses of it in the tree yet, but it should look identical to using `TEST_F`, which you can see an example of here: https://dxr.mozilla.org/mozilla-central/rev/6ff60a083701d08c52702daf50f28e8f46ae3a1c/dom/media/gtest/TestMP3Demuxer.cpp#83 -Ted _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform