This commit adds three new commands for managing plugins. The `list` command will show which plugins are currently registered and their enabled state. The `enable` and `disable` commands can be used to enable or disable plugins. A disabled plugin will not show up to the PluginManager when it iterates over available plugins of a particular type. The purpose of these commands is to provide more visibility into registered plugins and allow users to disable plugins for experimental perf reasons. There are a few limitations to the current implementation 1. Only SystemRuntime and InstrumentationRuntime plugins are currently supported. We can easily extend the existing implementation to support more types. The scope was limited to these plugins to keep the PR size manageable. 2. Only "statically" know plugin types are supported (i.e. those managed by the PluginManager and not from `plugin load`). It is possibly we could support dynamic plugins as well, but I have not looked into it yet.
83 lines
3.3 KiB
Plaintext
83 lines
3.3 KiB
Plaintext
# This test validates the plugin list command.
|
|
# Currently it works only for system-runtime plugins and we only have one
|
|
# system runtime plugin so testing is a bit limited.
|
|
#
|
|
# Note that commands that return errors will stop running a script, so we
|
|
# have new RUN lines for any command that is expected to return an error.
|
|
|
|
# RUN: %lldb -s %s -o exit 2>&1 | FileCheck %s
|
|
|
|
# Test plugin list without an argument will list all plugins.
|
|
plugin list
|
|
# CHECK-LABEL: plugin list
|
|
# CHECK: system-runtime
|
|
# CHECK: [+] systemruntime-macosx System runtime plugin for Mac OS X native libraries
|
|
# CHECK: instrumentation-runtime
|
|
# CHECK: [+] AddressSanitizer AddressSanitizer instrumentation runtime plugin.
|
|
|
|
# Test plugin list works with fully qualified name.
|
|
plugin list system-runtime.systemruntime-macosx
|
|
# CHECK-LABEL: plugin list system-runtime.systemruntime-macosx
|
|
# CHECK: system-runtime
|
|
# CHECK: [+] systemruntime-macosx System runtime plugin for Mac OS X native libraries
|
|
|
|
# Test plugin list on plugin namespace works.
|
|
plugin list system-runtime
|
|
# CHECK-LABEL: plugin list system-runtime
|
|
# CHECK: system-runtime
|
|
# CHECK: [+] systemruntime-macosx System runtime plugin for Mac OS X native libraries
|
|
|
|
# Test plugin list on multiple args works.
|
|
plugin list system-runtime instrumentation-runtime.AddressSanitizer
|
|
# CHECK-LABEL: plugin list system-runtime instrumentation-runtime.AddressSanitizer
|
|
# CHECK: system-runtime
|
|
# CHECK: [+] systemruntime-macosx System runtime plugin for Mac OS X native libraries
|
|
# CHECK: instrumentation-runtime
|
|
# CHECK: [+] AddressSanitizer AddressSanitizer instrumentation runtime plugin.
|
|
|
|
# Test json output for plugin list.
|
|
plugin list --json
|
|
# CHECK-LABEL plugin list --json
|
|
# CHECK: {
|
|
# CHECK-DAG: "instrumentation-runtime":
|
|
# CHECK-DAG: "system-runtime":
|
|
# CHECK: }
|
|
|
|
# Test json output for plugin list with a namespace
|
|
plugin list system-runtime --json
|
|
# CHECK-LABEL plugin list --json
|
|
# CHECK: {
|
|
# CHECK: "system-runtime": [
|
|
# CHECK: {
|
|
# CHECK-DAG: "enabled": true
|
|
# CHECK-DAG: "name": "systemruntime-macosx"
|
|
# CHECK: }
|
|
# CHECK: ]
|
|
# CHECK: }
|
|
|
|
# Test json output for listing multiple plugins
|
|
plugin list --json system-runtime instrumentation-runtime.AddressSanitizer
|
|
# CHECK-LABEL plugin list --json system-runtime instrumentation-runtime.AddressSanitizer
|
|
# CHECK: {
|
|
# CHECK-DAG: "instrumentation-runtime":
|
|
# CHECK-DAG: "name": "AddressSanitizer"
|
|
# CHECK-DAG: "system-runtime":
|
|
# CHECK: }
|
|
|
|
|
|
# Test plugin list does not match a plugin name by substring.
|
|
# RUN: %lldb -o "plugin list macosx" 2>&1 | FileCheck %s --check-prefix=ERROR_PLUGIN_NOT_FOUND
|
|
|
|
# Test plugin list does not match a plugin namespace by substring.
|
|
# RUN: %lldb -o "plugin list system-runtime." 2>&1 | FileCheck %s --check-prefix=ERROR_PLUGIN_NOT_FOUND
|
|
|
|
# Test plugin list returns an error for unknown second argument
|
|
# RUN: %lldb -o "plugin list system-runtime foo" 2>&1 | FileCheck %s --check-prefix=ERROR_PLUGIN_NOT_FOUND
|
|
|
|
# Test plugin list returns an error for unknown second argument
|
|
# RUN: %lldb -o "plugin list --json system-runtime foo" 2>&1 | FileCheck %s --check-prefix=ERROR_PLUGIN_NOT_FOUND
|
|
|
|
# Test plugin list for unknown plugin returns an error.
|
|
# RUN: %lldb -o "plugin list some-plugin-that-does-not-exist" 2>&1 | FileCheck %s --check-prefix=ERROR_PLUGIN_NOT_FOUND
|
|
# ERROR_PLUGIN_NOT_FOUND: error: Found no matching plugins
|