[Lldb-commits] [lldb] r229763 - Fix SettingsCommandTestCase.test_set_error_output_path

Vince Harron vharron at google.com
Wed Feb 18 15:12:26 PST 2015


Author: vharron
Date: Wed Feb 18 17:12:26 2015
New Revision: 229763

URL: http://llvm.org/viewvc/llvm-project?rev=229763&view=rev
Log:
Fix SettingsCommandTestCase.test_set_error_output_path

target.error-path (and output-path) were getting resolved on the
local file system, which doesn't make any sense for remote targets

So this patch prevents file paths from being resolved on the host
system.


Modified:
    lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h
    lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
    lldb/trunk/source/Interpreter/Property.cpp
    lldb/trunk/test/settings/TestSettings.py

Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h?rev=229763&r1=229762&r2=229763&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h Wed Feb 18 17:12:26 2015
@@ -22,12 +22,14 @@ namespace lldb_private {
 class OptionValueFileSpec : public OptionValue
 {
 public:
-    OptionValueFileSpec ();
+    OptionValueFileSpec (bool resolve = true);
     
-    OptionValueFileSpec (const FileSpec &value);
+    OptionValueFileSpec (const FileSpec &value,
+                         bool resolve = true);
     
     OptionValueFileSpec (const FileSpec &current_value, 
-                         const FileSpec &default_value);
+                         const FileSpec &default_value,
+                         bool resolve = true);
     
     virtual 
     ~OptionValueFileSpec()
@@ -122,6 +124,7 @@ protected:
     FileSpec m_default_value;
     lldb::DataBufferSP m_data_sp;
     uint32_t m_completion_mask;
+    bool m_resolve;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp?rev=229763&r1=229762&r2=229763&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp (original)
+++ lldb/trunk/source/Interpreter/OptionValueFileSpec.cpp Wed Feb 18 17:12:26 2015
@@ -24,31 +24,36 @@ using namespace lldb;
 using namespace lldb_private;
 
 
-OptionValueFileSpec::OptionValueFileSpec () :
+OptionValueFileSpec::OptionValueFileSpec (bool resolve) :
     OptionValue(),
     m_current_value (),
     m_default_value (),
     m_data_sp(),
-    m_completion_mask (CommandCompletions::eDiskFileCompletion)
+    m_completion_mask (CommandCompletions::eDiskFileCompletion),
+    m_resolve (resolve)
 {
 }
 
-OptionValueFileSpec::OptionValueFileSpec (const FileSpec &value) :
+OptionValueFileSpec::OptionValueFileSpec (const FileSpec &value,
+                                          bool resolve) :
     OptionValue(),
     m_current_value (value),
     m_default_value (value),
     m_data_sp(),
-    m_completion_mask (CommandCompletions::eDiskFileCompletion)
+    m_completion_mask (CommandCompletions::eDiskFileCompletion),
+    m_resolve (resolve)
 {
 }
 
 OptionValueFileSpec::OptionValueFileSpec (const FileSpec &current_value,
-                                          const FileSpec &default_value) :
+                                          const FileSpec &default_value,
+                                          bool resolve) :
     OptionValue(),
     m_current_value (current_value),
     m_default_value (default_value),
     m_data_sp(),
-    m_completion_mask (CommandCompletions::eDiskFileCompletion)
+    m_completion_mask (CommandCompletions::eDiskFileCompletion),
+    m_resolve (resolve)
 {
 }
 
@@ -99,7 +104,7 @@ OptionValueFileSpec::SetValueFromCString
                 filepath.erase (suffix_chars_to_trim + 1);
 
             m_value_was_set = true;
-            m_current_value.SetFile(filepath.c_str(), true);
+            m_current_value.SetFile(filepath.c_str(), m_resolve);
             m_data_sp.reset();
             NotifyValueChanged();
         }

Modified: lldb/trunk/source/Interpreter/Property.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/Property.cpp?rev=229763&r1=229762&r2=229763&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/Property.cpp (original)
+++ lldb/trunk/source/Interpreter/Property.cpp Wed Feb 18 17:12:26 2015
@@ -94,10 +94,13 @@ Property::Property (const PropertyDefini
             break;
             
         case OptionValue::eTypeFileSpec:
+        {
             // "definition.default_uint_value" represents if the "definition.default_cstr_value" should
             // be resolved or not
-            m_value_sp.reset (new OptionValueFileSpec(FileSpec(definition.default_cstr_value, definition.default_uint_value != 0)));
+            const bool resolve = definition.default_uint_value != 0;
+            m_value_sp.reset (new OptionValueFileSpec(FileSpec(definition.default_cstr_value, resolve), resolve));
             break;
+        }
             
         case OptionValue::eTypeFileSpecList:
             // "definition.default_uint_value" is not used for a OptionValue::eTypeFileSpecList

Modified: lldb/trunk/test/settings/TestSettings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/settings/TestSettings.py?rev=229763&r1=229762&r2=229763&view=diff
==============================================================================
--- lldb/trunk/test/settings/TestSettings.py (original)
+++ lldb/trunk/test/settings/TestSettings.py Wed Feb 18 17:12:26 2015
@@ -290,14 +290,19 @@ class SettingsCommandTestCase(TestBase):
 
         self.expect("settings show target.error-path",
                     SETTING_MSG("target.error-path"),
-                    substrs = ['target.error-path (file) = ', 'stderr.txt"'])
+                    substrs = ['target.error-path (file) = "stderr.txt"'])
 
         self.expect("settings show target.output-path",
                     SETTING_MSG("target.output-path"),
-                    substrs = ['target.output-path (file) = ', 'stdout.txt"'])
+                    substrs = ['target.output-path (file) = "stdout.txt"'])
 
         self.runCmd("run", RUN_SUCCEEDED)
 
+        if lldb.remote_platform:
+            self.runCmd('platform get-file "stderr.txt" "stderr.txt"')
+            self.runCmd('platform get-file "stdout.txt" "stdout.txt"')
+
+
         # The 'stderr.txt' file should now exist.
         self.assertTrue(os.path.isfile("stderr.txt"),
                         "'stderr.txt' exists due to target.error-path.")





More information about the lldb-commits mailing list