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