summaryrefslogtreecommitdiffstats
path: root/lldb/test/Shell/Reproducer
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-12-03 07:53:23 -0800
committerJonas Devlieghere <jonas@devlieghere.com>2019-12-03 07:54:42 -0800
commit62827737acd878af6cd8930758b0d6f297173f40 (patch)
tree126b0cb5ef3db51cf8702002cce68aabda05242d /lldb/test/Shell/Reproducer
parentf2e7de81c625413a7f682c757ab64e7b63b48800 (diff)
downloadbcm5719-llvm-62827737acd878af6cd8930758b0d6f297173f40.tar.gz
bcm5719-llvm-62827737acd878af6cd8930758b0d6f297173f40.zip
[lldb/Reproducer] Add version check
To ensure a reproducer works correctly, the version of LLDB used for capture and replay must match. Right now the reproducer already contains the LLDB version. However, this is purely informative. LLDB will happily replay a reproducer generated with a different version of LLDB, which can cause subtle differences. This patch adds a version check which compares the current LLDB version with the one in the reproducer. If the version doesn't match, LLDB will refuse to replay. It also adds an escape hatch to make it possible to still replay the reproducer without having to mess with the recorded version. This might prove useful when you know two versions of LLDB match, even though the version string doesn't. This behavior is triggered by passing a new flag -reproducer-skip-version-check to the lldb driver. Differential revision: https://reviews.llvm.org/D70934
Diffstat (limited to 'lldb/test/Shell/Reproducer')
-rw-r--r--lldb/test/Shell/Reproducer/TestVersionCheck.test29
1 files changed, 29 insertions, 0 deletions
diff --git a/lldb/test/Shell/Reproducer/TestVersionCheck.test b/lldb/test/Shell/Reproducer/TestVersionCheck.test
new file mode 100644
index 00000000000..e3fb60367ce
--- /dev/null
+++ b/lldb/test/Shell/Reproducer/TestVersionCheck.test
@@ -0,0 +1,29 @@
+# REQUIRES: system-darwin
+
+# This tests the reproducer version check.
+
+# RUN: rm -rf %t.repro
+# RUN: %clang_host %S/Inputs/simple.c -g -o %t.out
+# RUN: %lldb -x -b -s %S/Inputs/FileCapture.in --capture --capture-path %t.repro %t.out | FileCheck %s --check-prefix CHECK --check-prefix CAPTURE
+
+# Make sure that replay works.
+# RUN: %lldb --replay %t.repro | FileCheck %s --check-prefix CHECK --check-prefix REPLAY
+
+# Change the reproducer version.
+# RUN: echo "bogus" >> %t.repro/version.txt
+
+# Make sure that replay works.
+# RUN: not %lldb --replay %t.repro 2>&1 | FileCheck %s --check-prefix ERROR
+
+# Make sure that we can circumvent the version check with -reproducer-skip-version-check.
+# RUN: %lldb --replay %t.repro -reproducer-skip-version-check | FileCheck %s --check-prefix CHECK --check-prefix REPLAY
+
+# CAPTURE: testing
+# REPLAY-NOT: testing
+
+# CHECK: Process {{.*}} exited
+
+# CAPTURE: Reproducer is in capture mode.
+# CAPTURE: Reproducer written
+
+# ERROR: error: reproducer replay failed: reproducer capture and replay version don't match
OpenPOWER on IntegriCloud