1"""
2Test lldb settings command.
3"""
4
5
6
7import os
8import re
9import lldb
10from lldbsuite.test.decorators import *
11from lldbsuite.test.lldbtest import *
12from lldbsuite.test import lldbutil
13
14
15class SettingsCommandTestCase(TestBase):
16
17    mydir = TestBase.compute_mydir(__file__)
18    NO_DEBUG_INFO_TESTCASE = True
19
20    def test_apropos_should_also_search_settings_description(self):
21        """Test that 'apropos' command should also search descriptions for the settings variables."""
22
23        self.expect("apropos 'environment variable'",
24                    substrs=["target.env-vars",
25                             "environment variables",
26                             "executable's environment"])
27
28    def test_append_target_env_vars(self):
29        """Test that 'append target.run-args' works."""
30        # Append the env-vars.
31        self.runCmd('settings append target.env-vars MY_ENV_VAR=YES')
32        # And add hooks to restore the settings during tearDown().
33        self.addTearDownHook(
34            lambda: self.runCmd("settings clear target.env-vars"))
35
36        # Check it immediately!
37        self.expect('settings show target.env-vars',
38                    substrs=['MY_ENV_VAR=YES'])
39
40    def test_insert_before_and_after_target_run_args(self):
41        """Test that 'insert-before/after target.run-args' works."""
42        # Set the run-args first.
43        self.runCmd('settings set target.run-args a b c')
44        # And add hooks to restore the settings during tearDown().
45        self.addTearDownHook(
46            lambda: self.runCmd("settings clear target.run-args"))
47
48        # Now insert-before the index-0 element with '__a__'.
49        self.runCmd('settings insert-before target.run-args 0 __a__')
50        # And insert-after the index-1 element with '__A__'.
51        self.runCmd('settings insert-after target.run-args 1 __A__')
52        # Check it immediately!
53        self.expect('settings show target.run-args',
54                    substrs=['target.run-args',
55                             '[0]: "__a__"',
56                             '[1]: "a"',
57                             '[2]: "__A__"',
58                             '[3]: "b"',
59                             '[4]: "c"'])
60
61    @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr44430")
62    def test_replace_target_run_args(self):
63        """Test that 'replace target.run-args' works."""
64        # Set the run-args and then replace the index-0 element.
65        self.runCmd('settings set target.run-args a b c')
66        # And add hooks to restore the settings during tearDown().
67        self.addTearDownHook(
68            lambda: self.runCmd("settings clear target.run-args"))
69
70        # Now replace the index-0 element with 'A', instead.
71        self.runCmd('settings replace target.run-args 0 A')
72        # Check it immediately!
73        self.expect('settings show target.run-args',
74                    substrs=['target.run-args (arguments) =',
75                             '[0]: "A"',
76                             '[1]: "b"',
77                             '[2]: "c"'])
78
79    def test_set_prompt(self):
80        """Test that 'set prompt' actually changes the prompt."""
81
82        # Set prompt to 'lldb2'.
83        self.runCmd("settings set prompt 'lldb2 '")
84
85        # Immediately test the setting.
86        self.expect("settings show prompt", SETTING_MSG("prompt"),
87                    startstr='prompt (string) = "lldb2 "')
88
89        # The overall display should also reflect the new setting.
90        self.expect("settings show", SETTING_MSG("prompt"),
91                    substrs=['prompt (string) = "lldb2 "'])
92
93        # Use '-r' option to reset to the original default prompt.
94        self.runCmd("settings clear prompt")
95
96    def test_set_term_width(self):
97        """Test that 'set term-width' actually changes the term-width."""
98
99        self.runCmd("settings set term-width 70")
100
101        # Immediately test the setting.
102        self.expect("settings show term-width", SETTING_MSG("term-width"),
103                    startstr="term-width (int) = 70")
104
105        # The overall display should also reflect the new setting.
106        self.expect("settings show", SETTING_MSG("term-width"),
107                    substrs=["term-width (int) = 70"])
108
109    # rdar://problem/10712130
110    @skipIf(oslist=["windows"], bugnumber="llvm.org/pr44431")
111    def test_set_frame_format(self):
112        """Test that 'set frame-format' with a backtick char in the format string works as well as fullpath."""
113        self.build()
114
115        exe = self.getBuildArtifact("a.out")
116        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
117
118        def cleanup():
119            self.runCmd(
120                "settings set frame-format %s" %
121                self.format_string, check=False)
122
123        # Execute the cleanup function during test case tear down.
124        self.addTearDownHook(cleanup)
125
126        self.runCmd("settings show frame-format")
127        m = re.match(
128            '^frame-format \(format-string\) = "(.*)\"$',
129            self.res.GetOutput())
130        self.assertTrue(m, "Bad settings string")
131        self.format_string = m.group(1)
132
133        # Change the default format to print function.name rather than
134        # function.name-with-args
135        format_string = "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}\`${function.name}{${function.pc-offset}}}{ at ${line.file.fullpath}:${line.number}}{, lang=${language}}\n"
136        self.runCmd("settings set frame-format %s" % format_string)
137
138        # Immediately test the setting.
139        self.expect("settings show frame-format", SETTING_MSG("frame-format"),
140                    substrs=[format_string])
141
142        self.runCmd("breakpoint set -n main")
143        self.runCmd("process launch --working-dir '{0}'".format(self.get_process_working_directory()),
144                RUN_SUCCEEDED)
145        self.expect("thread backtrace",
146                    substrs=["`main", self.getSourceDir()])
147
148    def test_set_auto_confirm(self):
149        """Test that after 'set auto-confirm true', manual confirmation should not kick in."""
150        self.build()
151
152        exe = self.getBuildArtifact("a.out")
153        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
154
155        self.runCmd("settings set auto-confirm true")
156
157        # Immediately test the setting.
158        self.expect("settings show auto-confirm", SETTING_MSG("auto-confirm"),
159                    startstr="auto-confirm (boolean) = true")
160
161        # Now 'breakpoint delete' should just work fine without confirmation
162        # prompt from the command interpreter.
163        self.runCmd("breakpoint set -n main")
164        self.expect("breakpoint delete",
165                    startstr="All breakpoints removed")
166
167        # Restore the original setting of auto-confirm.
168        self.runCmd("settings clear auto-confirm")
169        self.expect("settings show auto-confirm", SETTING_MSG("auto-confirm"),
170                    startstr="auto-confirm (boolean) = false")
171
172    @skipIf(archs=no_match(['x86_64', 'i386', 'i686']))
173    def test_disassembler_settings(self):
174        """Test that user options for the disassembler take effect."""
175        self.build()
176
177        exe = self.getBuildArtifact("a.out")
178        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
179
180        # AT&T syntax
181        self.runCmd("settings set target.x86-disassembly-flavor att")
182        self.runCmd("settings set target.use-hex-immediates false")
183        self.expect("disassemble -n numberfn",
184                    substrs=["$90"])
185        self.runCmd("settings set target.use-hex-immediates true")
186        self.runCmd("settings set target.hex-immediate-style c")
187        self.expect("disassemble -n numberfn",
188                    substrs=["$0x5a"])
189        self.runCmd("settings set target.hex-immediate-style asm")
190        self.expect("disassemble -n numberfn",
191                    substrs=["$5ah"])
192
193        # Intel syntax
194        self.runCmd("settings set target.x86-disassembly-flavor intel")
195        self.runCmd("settings set target.use-hex-immediates false")
196        self.expect("disassemble -n numberfn",
197                    substrs=["90"])
198        self.runCmd("settings set target.use-hex-immediates true")
199        self.runCmd("settings set target.hex-immediate-style c")
200        self.expect("disassemble -n numberfn",
201                    substrs=["0x5a"])
202        self.runCmd("settings set target.hex-immediate-style asm")
203        self.expect("disassemble -n numberfn",
204                    substrs=["5ah"])
205
206    @skipIfDarwinEmbedded   # <rdar://problem/34446098> debugserver on ios etc can't write files
207    def test_run_args_and_env_vars(self):
208        """Test that run-args and env-vars are passed to the launched process."""
209        self.build()
210        exe = self.getBuildArtifact("a.out")
211        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
212
213        # Set the run-args and the env-vars.
214        # And add hooks to restore the settings during tearDown().
215        self.runCmd('settings set target.run-args A B C')
216        self.addTearDownHook(
217            lambda: self.runCmd("settings clear target.run-args"))
218        self.runCmd('settings set target.env-vars ["MY_ENV_VAR"]=YES')
219        self.addTearDownHook(
220            lambda: self.runCmd("settings clear target.env-vars"))
221
222        self.runCmd("process launch --working-dir '{0}'".format(self.get_process_working_directory()),
223                RUN_SUCCEEDED)
224
225        # Read the output file produced by running the program.
226        output = lldbutil.read_file_from_process_wd(self, "output2.txt")
227
228        self.expect(
229            output,
230            exe=False,
231            substrs=[
232                "argv[1] matches",
233                "argv[2] matches",
234                "argv[3] matches",
235                "Environment variable 'MY_ENV_VAR' successfully passed."])
236
237    @skipIfRemote  # it doesn't make sense to send host env to remote target
238    def test_pass_host_env_vars(self):
239        """Test that the host env vars are passed to the launched process."""
240        self.build()
241
242        exe = self.getBuildArtifact("a.out")
243        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
244
245        # By default, inherit-env is 'true'.
246        self.expect(
247            'settings show target.inherit-env',
248            "Default inherit-env is 'true'",
249            startstr="target.inherit-env (boolean) = true")
250
251        # Set some host environment variables now.
252        os.environ["MY_HOST_ENV_VAR1"] = "VAR1"
253        os.environ["MY_HOST_ENV_VAR2"] = "VAR2"
254
255        # This is the function to unset the two env variables set above.
256        def unset_env_variables():
257            os.environ.pop("MY_HOST_ENV_VAR1")
258            os.environ.pop("MY_HOST_ENV_VAR2")
259
260        self.addTearDownHook(unset_env_variables)
261        self.runCmd("process launch --working-dir '{0}'".format(self.get_process_working_directory()),
262                RUN_SUCCEEDED)
263
264        # Read the output file produced by running the program.
265        output = lldbutil.read_file_from_process_wd(self, "output1.txt")
266
267        self.expect(
268            output,
269            exe=False,
270            substrs=[
271                "The host environment variable 'MY_HOST_ENV_VAR1' successfully passed.",
272                "The host environment variable 'MY_HOST_ENV_VAR2' successfully passed."])
273
274    @skipIfDarwinEmbedded   # <rdar://problem/34446098> debugserver on ios etc can't write files
275    def test_set_error_output_path(self):
276        """Test that setting target.error/output-path for the launched process works."""
277        self.build()
278
279        exe = self.getBuildArtifact("a.out")
280        self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
281
282        # Set the error-path and output-path and verify both are set.
283        self.runCmd("settings set target.error-path '{0}'".format(
284            lldbutil.append_to_process_working_directory(self, "stderr.txt")))
285        self.runCmd("settings set target.output-path '{0}".format(
286            lldbutil.append_to_process_working_directory(self, "stdout.txt")))
287        # And add hooks to restore the original settings during tearDown().
288        self.addTearDownHook(
289            lambda: self.runCmd("settings clear target.output-path"))
290        self.addTearDownHook(
291            lambda: self.runCmd("settings clear target.error-path"))
292
293        self.expect("settings show target.error-path",
294                    SETTING_MSG("target.error-path"),
295                    substrs=['target.error-path (file)', 'stderr.txt"'])
296
297        self.expect("settings show target.output-path",
298                    SETTING_MSG("target.output-path"),
299                    substrs=['target.output-path (file)', 'stdout.txt"'])
300
301        self.runCmd("process launch --working-dir '{0}'".format(self.get_process_working_directory()),
302                RUN_SUCCEEDED)
303
304        output = lldbutil.read_file_from_process_wd(self, "stderr.txt")
305        message = "This message should go to standard error."
306        if lldbplatformutil.hasChattyStderr(self):
307            self.expect(output, exe=False, substrs=[message])
308        else:
309            self.expect(output, exe=False, startstr=message)
310
311        output = lldbutil.read_file_from_process_wd(self, "stdout.txt")
312        self.expect(output, exe=False,
313                    startstr="This message should go to standard out.")
314
315    def test_print_dictionary_setting(self):
316        self.runCmd("settings clear target.env-vars")
317        self.runCmd("settings set target.env-vars [\"MY_VAR\"]=some-value")
318        self.expect("settings show target.env-vars",
319                    substrs=["MY_VAR=some-value"])
320        self.runCmd("settings clear target.env-vars")
321
322    def test_print_array_setting(self):
323        self.runCmd("settings clear target.run-args")
324        self.runCmd("settings set target.run-args gobbledy-gook")
325        self.expect("settings show target.run-args",
326                    substrs=['[0]: "gobbledy-gook"'])
327        self.runCmd("settings clear target.run-args")
328
329    def test_settings_with_quotes(self):
330        self.runCmd("settings clear target.run-args")
331        self.runCmd("settings set target.run-args a b c")
332        self.expect("settings show target.run-args",
333                    substrs=['[0]: "a"',
334                             '[1]: "b"',
335                             '[2]: "c"'])
336        self.runCmd("settings set target.run-args 'a b c'")
337        self.expect("settings show target.run-args",
338                    substrs=['[0]: "a b c"'])
339        self.runCmd("settings clear target.run-args")
340        self.runCmd("settings clear target.env-vars")
341        self.runCmd(
342            'settings set target.env-vars ["MY_FILE"]="this is a file name with spaces.txt"')
343        self.expect("settings show target.env-vars",
344                    substrs=['MY_FILE=this is a file name with spaces.txt'])
345        self.runCmd("settings clear target.env-vars")
346        # Test and make sure that setting "format-string" settings obeys quotes
347        # if they are provided
348        self.runCmd("settings set thread-format    'abc def'   ")
349        self.expect("settings show thread-format",
350                    'thread-format (format-string) = "abc def"')
351        self.runCmd('settings set thread-format    "abc def"   ')
352        self.expect("settings show thread-format",
353                    'thread-format (format-string) = "abc def"')
354        # Make sure when no quotes are provided that we maintain any trailing
355        # spaces
356        self.runCmd('settings set thread-format abc def   ')
357        self.expect("settings show thread-format",
358                    'thread-format (format-string) = "abc def   "')
359        self.runCmd('settings clear thread-format')
360
361    @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr44430")
362    def test_settings_with_trailing_whitespace(self):
363
364        # boolean
365        # Set to known value
366        self.runCmd("settings set target.skip-prologue true")
367        # Set to new value with trailing whitespace
368        self.runCmd("settings set target.skip-prologue false ")
369        # Make sure the setting was correctly set to "false"
370        self.expect(
371            "settings show target.skip-prologue",
372            SETTING_MSG("target.skip-prologue"),
373            startstr="target.skip-prologue (boolean) = false")
374        self.runCmd("settings clear target.skip-prologue", check=False)
375        # integer
376        self.runCmd("settings set term-width 70")      # Set to known value
377        # Set to new value with trailing whitespaces
378        self.runCmd("settings set term-width 60 \t")
379        self.expect("settings show term-width", SETTING_MSG("term-width"),
380                    startstr="term-width (int) = 60")
381        self.runCmd("settings clear term-width", check=False)
382        # string
383        self.runCmd("settings set target.arg0 abc")    # Set to known value
384        # Set to new value with trailing whitespaces
385        self.runCmd("settings set target.arg0 cde\t ")
386        self.expect("settings show target.arg0", SETTING_MSG("target.arg0"),
387                    startstr='target.arg0 (string) = "cde"')
388        self.runCmd("settings clear target.arg0", check=False)
389        # file
390        path1 = self.getBuildArtifact("path1.txt")
391        path2 = self.getBuildArtifact("path2.txt")
392        self.runCmd(
393            "settings set target.output-path %s" %
394            path1)   # Set to known value
395        self.expect(
396            "settings show target.output-path",
397            SETTING_MSG("target.output-path"),
398            startstr='target.output-path (file) = ',
399            substrs=[path1])
400        self.runCmd("settings set target.output-path %s " %
401                    path2)  # Set to new value with trailing whitespaces
402        self.expect(
403            "settings show target.output-path",
404            SETTING_MSG("target.output-path"),
405            startstr='target.output-path (file) = ',
406            substrs=[path2])
407        self.runCmd("settings clear target.output-path", check=False)
408        # enum
409        # Set to known value
410        self.runCmd("settings set stop-disassembly-display never")
411        # Set to new value with trailing whitespaces
412        self.runCmd("settings set stop-disassembly-display always ")
413        self.expect(
414            "settings show stop-disassembly-display",
415            SETTING_MSG("stop-disassembly-display"),
416            startstr='stop-disassembly-display (enum) = always')
417        self.runCmd("settings clear stop-disassembly-display", check=False)
418        # language
419        # Set to known value
420        self.runCmd("settings set target.language c89")
421        # Set to new value with trailing whitespace
422        self.runCmd("settings set target.language c11 ")
423        self.expect(
424            "settings show target.language",
425            SETTING_MSG("target.language"),
426            startstr="target.language (language) = c11")
427        self.runCmd("settings clear target.language", check=False)
428        # arguments
429        self.runCmd("settings set target.run-args 1 2 3")  # Set to known value
430        # Set to new value with trailing whitespaces
431        self.runCmd("settings set target.run-args 3 4 5 ")
432        self.expect(
433            "settings show target.run-args",
434            SETTING_MSG("target.run-args"),
435            substrs=[
436                'target.run-args (arguments) =',
437                '[0]: "3"',
438                '[1]: "4"',
439                '[2]: "5"'])
440        self.runCmd("settings set target.run-args 1 2 3")  # Set to known value
441        # Set to new value with trailing whitespaces
442        self.runCmd("settings set target.run-args 3 \  \ ")
443        self.expect(
444            "settings show target.run-args",
445            SETTING_MSG("target.run-args"),
446            substrs=[
447                'target.run-args (arguments) =',
448                '[0]: "3"',
449                '[1]: " "',
450                '[2]: " "'])
451        self.runCmd("settings clear target.run-args", check=False)
452        # dictionaries
453        self.runCmd("settings clear target.env-vars")  # Set to known value
454        # Set to new value with trailing whitespaces
455        self.runCmd("settings set target.env-vars A=B C=D\t ")
456        self.expect(
457            "settings show target.env-vars",
458            SETTING_MSG("target.env-vars"),
459            substrs=[
460                'target.env-vars (dictionary of strings) =',
461                'A=B',
462                'C=D'])
463        self.runCmd("settings clear target.env-vars", check=False)
464        # regex
465        # Set to known value
466        self.runCmd("settings clear target.process.thread.step-avoid-regexp")
467        # Set to new value with trailing whitespaces
468        self.runCmd(
469            "settings set target.process.thread.step-avoid-regexp foo\\ ")
470        self.expect(
471            "settings show target.process.thread.step-avoid-regexp",
472            SETTING_MSG("target.process.thread.step-avoid-regexp"),
473            substrs=['target.process.thread.step-avoid-regexp (regex) = foo\\ '])
474        self.runCmd(
475            "settings clear target.process.thread.step-avoid-regexp",
476            check=False)
477        # format-string
478        self.runCmd("settings clear disassembly-format")  # Set to known value
479        # Set to new value with trailing whitespaces
480        self.runCmd("settings set disassembly-format foo ")
481        self.expect("settings show disassembly-format",
482                    SETTING_MSG("disassembly-format"),
483                    substrs=['disassembly-format (format-string) = "foo "'])
484        self.runCmd("settings clear disassembly-format", check=False)
485
486    def test_settings_list(self):
487        # List settings (and optionally test the filter to only show 'target' settings).
488        self.expect("settings list target", substrs=["arg0", "detach-on-error", "language"])
489        self.expect("settings list target", matching=False, substrs=["packet-timeout"])
490        self.expect("settings list", substrs=["language", "arg0", "detach-on-error", "packet-timeout"])
491
492    def test_settings_remove_single(self):
493        # Set some environment variables and use 'remove' to delete them.
494        self.runCmd("settings set target.env-vars a=b c=d")
495        self.expect("settings show target.env-vars", substrs=["a=b", "c=d"])
496        self.runCmd("settings remove target.env-vars a")
497        self.expect("settings show target.env-vars", matching=False, substrs=["a=b"])
498        self.expect("settings show target.env-vars", substrs=["c=d"])
499        self.runCmd("settings remove target.env-vars c")
500        self.expect("settings show target.env-vars", matching=False, substrs=["a=b", "c=d"])
501
502    def test_settings_remove_multiple(self):
503        self.runCmd("settings set target.env-vars a=b c=d e=f")
504        self.expect("settings show target.env-vars", substrs=["a=b", "c=d", "e=f"])
505        self.runCmd("settings remove target.env-vars a e")
506        self.expect("settings show target.env-vars", matching=False, substrs=["a=b", "e=f"])
507        self.expect("settings show target.env-vars", substrs=["c=d"])
508
509    def test_settings_remove_nonexistent_value(self):
510        self.expect("settings remove target.env-vars doesntexist", error=True,
511                    substrs=["no value found named 'doesntexist'"])
512
513    def test_settings_remove_nonexistent_settings(self):
514        self.expect("settings remove doesntexist alsodoesntexist", error=True,
515                    substrs=["error: invalid value path 'doesntexist'"])
516
517    def test_settings_remove_missing_arg(self):
518        self.expect("settings remove", error=True,
519                    substrs=["'settings remove' takes an array or dictionary item, or"])
520
521    def test_settings_remove_empty_arg(self):
522        self.expect("settings remove ''", error=True,
523                    substrs=["'settings remove' command requires a valid variable name"])
524
525    def test_all_settings_exist(self):
526        self.expect("settings show",
527                    substrs=["auto-confirm",
528                             "frame-format",
529                             "notify-void",
530                             "prompt",
531                             "script-lang",
532                             "stop-disassembly-count",
533                             "stop-disassembly-display",
534                             "stop-line-count-after",
535                             "stop-line-count-before",
536                             "stop-show-column",
537                             "term-width",
538                             "thread-format",
539                             "use-external-editor",
540                             "target.breakpoints-use-platform-avoid-list",
541                             "target.default-arch",
542                             "target.disable-aslr",
543                             "target.disable-stdio",
544                             "target.x86-disassembly-flavor",
545                             "target.enable-synthetic-value",
546                             "target.env-vars",
547                             "target.error-path",
548                             "target.exec-search-paths",
549                             "target.expr-prefix",
550                             "target.hex-immediate-style",
551                             "target.inherit-env",
552                             "target.input-path",
553                             "target.language",
554                             "target.max-children-count",
555                             "target.max-string-summary-length",
556                             "target.move-to-nearest-code",
557                             "target.output-path",
558                             "target.prefer-dynamic-value",
559                             "target.run-args",
560                             "target.skip-prologue",
561                             "target.source-map",
562                             "target.use-hex-immediates",
563                             "target.process.disable-memory-cache",
564                             "target.process.extra-startup-command",
565                             "target.process.thread.trace-thread",
566                             "target.process.thread.step-avoid-regexp",
567                             ])
568
569    # settings under an ".experimental" domain should have two properties:
570    #   1. If the name does not exist with "experimental" in the name path,
571    #      the name lookup should try to find it without "experimental".  So
572    #      a previously-experimental setting that has been promoted to a
573    #      "real" setting will still be set by the original name.
574    #   2. Changing a setting with .experimental., name, where the setting
575    #      does not exist either with ".experimental." or without, should
576    #      not generate an error.  So if an experimental setting is removed,
577    #      people who may have that in their ~/.lldbinit files should not see
578    #      any errors.
579    def test_experimental_settings(self):
580        cmdinterp = self.dbg.GetCommandInterpreter()
581        result = lldb.SBCommandReturnObject()
582
583        # Set target.arg0 to a known value, check that we can retrieve it via
584        # the actual name and via .experimental.
585        self.expect('settings set target.arg0 first-value')
586        self.expect('settings show target.arg0', substrs=['first-value'])
587        self.expect('settings show target.experimental.arg0', substrs=['first-value'], error=False)
588
589        # Set target.arg0 to a new value via a target.experimental.arg0 name,
590        # verify that we can read it back via both .experimental., and not.
591        self.expect('settings set target.experimental.arg0 second-value', error=False)
592        self.expect('settings show target.arg0', substrs=['second-value'])
593        self.expect('settings show target.experimental.arg0', substrs=['second-value'], error=False)
594
595        # showing & setting an undefined .experimental. setting should generate no errors.
596        self.expect('settings show target.experimental.setting-which-does-not-exist', patterns=['^\s$'], error=False)
597        self.expect('settings set target.experimental.setting-which-does-not-exist true', error=False)
598
599        # A domain component before .experimental. which does not exist should give an error
600        # But the code does not yet do that.
601        # self.expect('settings set target.setting-which-does-not-exist.experimental.arg0 true', error=True)
602
603        # finally, confirm that trying to set a setting that does not exist still fails.
604        # (SHOWING a setting that does not exist does not currently yield an error.)
605        self.expect('settings set target.setting-which-does-not-exist true', error=True)
606