[Reproducers] Fix reproducer unittest
authorJonas Devlieghere <jonas@devlieghere.com>
Wed, 8 May 2019 22:59:35 +0000 (22:59 +0000)
committerJonas Devlieghere <jonas@devlieghere.com>
Wed, 8 May 2019 22:59:35 +0000 (22:59 +0000)
I think the recent change to flush the SB API recording uncovered a real
issue on the Windows bot. Although I couldn't make much sense of the
error message "unknown file: error: SEH exception with code 0x3221225477
thrown in the test body.", it prompted me to look at the test. In the
unit test we were recording during replay, which is obviously not
correct. I think we didn't see this issue before because we flushed once
after the recording was done. This patch unsets the recording  logic
during the replay part of the test.

Hopefully this fixed the Windows bot.

llvm-svn: 360298

lldb/unittests/Utility/ReproducerInstrumentationTest.cpp

index b1690e5..fef0ab9 100644 (file)
@@ -54,7 +54,7 @@ static llvm::Optional<Serializer> g_serializer;
 static llvm::Optional<TestingRegistry> g_registry;
 
 #define LLDB_GET_INSTRUMENTATION_DATA()                                        \
-  InstrumentationData(*g_serializer, *g_registry)
+  g_serializer ? InstrumentationData(*g_serializer, *g_registry) : InstrumentationData()
 
 class InstrumentedFoo {
 public:
@@ -109,6 +109,8 @@ static std::vector<InstrumentedFoo *> g_foos;
 static std::vector<InstrumentedBar *> g_bars;
 
 void ClearObjects() {
+  g_registry.reset();
+  g_serializer.reset();
   g_foos.clear();
   g_bars.clear();
 }