HomePhabricator

[lldb/Test] Rewrite ReproducerInstrumentationTest

Authored by JDevlieghere on Apr 10 2020, 3:42 PM.

Description

[lldb/Test] Rewrite ReproducerInstrumentationTest

The instrumentation unit tests' current implementation uses global
variables to track constructor calls for the instrumented classes during
replay. This is suboptimal because it indirectly relies on how the
reproducer instrumentation is implemented. I found out when adding
support for passive replay and the test broke because we made an extra
(temporary) copy of the instrumented objects.

Additionally, the old approach wasn't very self-explanatory. It took me
a bit of time to understand why we were expecting the number of objects
in the test.

This patch rewrites the test and uses the index-to-object-mapping to
verify the objects created during replay. You can now specify the
expected objects, in order, and whether they should be valid or not. I
find that it makes the tests much easier to understand. More
importantly, this approach is resilient to implementation detail changes
in the instrumentation.

Details

Committed
JDevlieghereApr 10 2020, 4:50 PM
Parents
rG16206ee07d35: [WebAssembly] Minor cleanup to WebAssemblySubtarget. NFC.
Branches
Unknown
Tags
Unknown