[lldb/Reproducers] Print more info for reproducer status

Reproducer status now prints the capture/replay path. It will also print
the status of auto generation when enabled.
This commit is contained in:
Jonas Devlieghere 2020-01-15 20:22:20 -08:00
parent cc5efa213d
commit 982a77b694
4 changed files with 21 additions and 2 deletions

View File

@ -234,6 +234,9 @@ public:
/// Enable or disable auto generate.
void SetAutoGenerate(bool b);
/// Return whether auto generate is enabled.
bool IsAutoGenerate() const;
/// Create and register a new provider.
template <typename T> T *Create() {
std::unique_ptr<ProviderBase> provider = std::make_unique<T>(m_root);

View File

@ -258,6 +258,18 @@ protected:
result.GetOutputStream() << "Reproducer is off.\n";
}
if (r.IsCapturing() || r.IsReplaying()) {
result.GetOutputStream()
<< "Path: " << r.GetReproducerPath().GetPath() << '\n';
}
// Auto generate is hidden unless enabled because this is mostly for
// development and testing.
if (Generator *g = r.GetGenerator()) {
if (g->IsAutoGenerate())
result.GetOutputStream() << "Auto generate: on\n";
}
result.SetStatus(eReturnStatusSuccessFinishResult);
return result.Succeeded();
}

View File

@ -205,6 +205,8 @@ void Generator::Discard() {
void Generator::SetAutoGenerate(bool b) { m_auto_generate = b; }
bool Generator::IsAutoGenerate() const { return m_auto_generate; }
const FileSpec &Generator::GetRoot() const { return m_root; }
void Generator::AddProvidersToIndex() {

View File

@ -10,15 +10,17 @@
#
# RUN: %lldb --capture --capture-path %t.repro -b -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix NO-WARNING --check-prefix STATUS-CAPTURE
# RUN: %lldb --capture -b -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix NO-WARNING --check-prefix STATUS-CAPTURE
# RUN: %lldb --capture-path %t.repro -b -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix WARNING --check-prefix STATUS-CAPTURE
# RUN: %lldb --capture-path %t.repro -b -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix WARNING --check-prefix STATUS-CAPTURE --check-prefix NOAUTOGEN
# RUN: %lldb --capture-path %t.repro -b -o 'reproducer status' --reproducer-auto-generate 2>&1 | FileCheck %s --check-prefix WARNING2
#
# NO-WARNING-NOT: warning: -capture-path specified without -capture
# WARNING: warning: -capture-path specified without -capture
# WARNING2: warning: -reproducer-auto-generate specified without -capture
# STATUS-CAPTURE: Reproducer is in capture mode.
# NOAUTOGEN-NOT: Auto generate
# Check auto generate.
# RUN: rm -rf %t.repro
# RUN: %lldb --capture --capture-path %t.repro -b --reproducer-auto-generate -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix NO-WARNING
# RUN: %lldb --capture --capture-path %t.repro -b --reproducer-auto-generate -o 'reproducer status' 2>&1 | FileCheck %s --check-prefix NO-WARNING --check-prefix AUTOGEN
# RUN: cat %t.repro/index.yaml
# AUTOGEN: Auto generate: on