> On 02/20/2018 09:44 AM, Michael Davidsaver wrote: >> On 02/18/2018 11:39 PM, Thomas Huth wrote: ... >> That magic (together with patch 1/5) is IMHO a little bit ugly. I've hit >> the same problem with the m48t59 test recently, and I solved it by >> moving the qtest_start() and qtest_end() calls from the main() function >> into the single tests instead, so that each test starts with a clean state: >> >> https://git.qemu.org/?p=qemu.git;a=commitdiff;h=9c29830c90d82f27f >> >> Could you maybe try whether that approach works for your test cases >> here, too? Then you could do this without the "0xff" hack here... > > Your right, this looks clearer. I'll try this approach.
I ultimately decided not to go with this approach as test failures didn't call qtest_quit(), and the process under test is left running after gtester exits. Instead I split the current time test off into a second executable. This avoids all of the magic. FYI. I also looked at using g_test_add(), keeping the QTestState* in a Fixture struct, and using setup and teardown functions to call qtest_start()/qtest_quit(). This works, but seemed to me like too much effort in this case.