Files
clang-p2996/lldb/test/Shell/Reproducer/TestVersionCheck.test
Jonas Devlieghere 62827737ac [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
2019-12-03 07:54:42 -08:00

30 lines
1.0 KiB
Plaintext

# 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