1# This tests writing and reading settings from LLDB.
2
3# Check that the settings can be written to file and read again without
4# altering the values.
5# RUN: %lldb -b -o 'settings write -f %t.foo' -o 'settings read -f %t.foo' -o 'settings write -f %t.bar' -o 'settings read -f %t.bar' 2>&1 | FileCheck %s --check-prefix SUCCESS
6# RUN: diff -w %t.foo %t.bar
7# SUCCESS-NOT: error:
8
9# Check that exporting target settings only export target settings and nothing else.
10# RUN: %lldb -b -o 'settings write -f %t.target target' 2>&1 | FileCheck %s --check-prefix SUCCESS
11# RUN: cat %t.target | FileCheck %s --check-prefix TARGET
12# TARGET: settings set -f target
13# TARGET-NOT: settings set -f platform
14# TARGET-NOT: settings set -f symbols
15# TARGET-NOT: settings set -f interpreter
16# TARGET-NOT: settings set -f plugin
17
18# Check that settings appear twice when appending.
19# RUN: %lldb -b -o 'settings write -a -f %t.append target' -o 'settings write -a -f %t.append target' 2>&1 | FileCheck %s --check-prefix SUCCESS
20# RUN: cat %t.append | FileCheck %s --check-prefix APPEND
21# APPEND: settings set -f target.language
22# APPEND: settings set -f target.language
23
24# Check that an error is printed for non-existing setting.
25# RUN: echo "settings set -f bogus" > %t.bogus_setting
26# RUN: %lldb -b -o 'settings read -f %t.bogus_setting' 2>&1 | FileCheck %s --check-prefix BOGUS-SETTING
27# BOGUS-SETTING: error: invalid value path
28
29# Check that an error is printed for invalid value.
30# RUN: echo "settings set -f target.language bogus" > %t.bogus_value
31# RUN: %lldb -b -o 'settings read -f %t.bogus_value' 2>&1 | FileCheck %s --check-prefix BOGUS-VALUE
32# BOGUS-VALUE: error: invalid language type
33