This is an archive of the discontinued LLVM Phabricator instance.

Clear all settings during a test's setUp
ClosedPublic

Authored by tatyana-krasnukha on Mar 3 2020, 9:08 AM.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

labath added a subscriber: jingham.

Clearing all settings is a reasonable operation, so I don't have any problem with it per se. I'm just wondering, given that this is not something that one would want to do very often (and it can have catastrophic results), whether this operation should not be more explicit. "settings clear --all" for instance ? Adding @jingham for the interface aspects.

It would also be nice to add a test case for the new command.

Added --all property to settings clear + added a test

Removed TestFixIts.py as those changes relate to the parent revision.

labath added inline comments.Mar 9 2020, 5:49 AM
lldb/source/Commands/CommandObjectSettings.cpp
1119–1122

What will happen if I pass both --all and an actual setting argument. I think that should be an error.

lldb/test/API/commands/settings/TestSettings.py
543–546

This dependence on setUpCommands looks weird. Any way we can get rid of that? Maybe if we check the exact four settings that you modified before clear --all and verifying they have the correct (hardcoded) value? (and maybe not use the term-width setting, since the default value of that is unpredictable)

Addressed comments

labath accepted this revision.Mar 12 2020, 5:27 AM

Awesome, thanks.

This revision is now accepted and ready to land.Mar 12 2020, 5:27 AM
This revision was automatically updated to reflect the committed changes.

Somehow this broke the macOS LLDB bot:

Failing Tests (2):
    lldb-api :: functionalities/inline-stepping/TestInlineStepping.py
    lldb-api :: lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py

I guess now all the shady hacks are coming out. The following settings change their value after calling settings clear after startup in the test:

target.process.thread.step-avoid-regexp (regex) -> from '^std::' to empty string
platform.module-cache-directory (file) -> from '"/Users/teemperor/.lldb/module_cache"' to empty string
script-lang (enum) -> from 'default' to 'python'

Thank you for details, I'm looking at these failures, however, I'm not able to debug on the macOS.

Sure, I can take care of it. It seems OptionValueRegex::Clear is always resetting to an empty regex. I guess the same goes for the other option values that are failing.

platform.module-cache-directory should be fixed by rGfe74df01a909.

Regarding script-lang, its default value is eScriptLanguagePython in CoreProperties.td and I'm not sure that I should change it.