[Lldb-commits] [PATCH] D29215: [LLDB][MIPS] Fix TestMiniDumpNew

2017-02-07 Thread Nitesh Jain via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294415: [LLDB][MIPS] Fix TestMiniDumpNew (authored by 
nitesh.jain).

Changed prior to commit:
  https://reviews.llvm.org/D29215?vs=86268=87598#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29215

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py


Index: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
@@ -23,6 +23,14 @@
 _linux_x86_64_not_crashed_pid = 29939
 _linux_x86_64_not_crashed_pid_offset = 0xD967
 
+def setUp(self):
+super(MiniDumpNewTestCase, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(MiniDumpNewTestCase, self).tearDown()
+
 def test_process_info_in_minidump(self):
 """Test that lldb can read the process information from the 
Minidump."""
 # target create -c linux-x86_64.dmp


Index: lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
@@ -23,6 +23,14 @@
 _linux_x86_64_not_crashed_pid = 29939
 _linux_x86_64_not_crashed_pid_offset = 0xD967
 
+def setUp(self):
+super(MiniDumpNewTestCase, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(MiniDumpNewTestCase, self).tearDown()
+
 def test_process_info_in_minidump(self):
 """Test that lldb can read the process information from the Minidump."""
 # target create -c linux-x86_64.dmp
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29215: [LLDB][MIPS] Fix TestMiniDumpNew

2017-01-30 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

I am glad we could come closer to the cause of the problem. At one point we 
should have a common base class for all core tests, so that we don't have to do 
this manually (and also avoid doing things that don't make sense for core 
files), but this will do for now.


https://reviews.llvm.org/D29215



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29215: [LLDB][MIPS] Fix TestMiniDumpNew

2017-01-30 Thread Nitesh Jain via Phabricator via lldb-commits
nitesh.jain updated this revision to Diff 86268.
nitesh.jain added a comment.

Added setUp/tearDown code, which saves and restores the original platform after 
each run. Thanks


https://reviews.llvm.org/D29215

Files:
  
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py


Index: 
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
===
--- 
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
+++ 
packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
@@ -23,6 +23,14 @@
 _linux_x86_64_not_crashed_pid = 29939
 _linux_x86_64_not_crashed_pid_offset = 0xD967
 
+def setUp(self):
+super(MiniDumpNewTestCase, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(MiniDumpNewTestCase, self).tearDown()
+
 def test_process_info_in_minidump(self):
 """Test that lldb can read the process information from the 
Minidump."""
 # target create -c linux-x86_64.dmp


Index: packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
===
--- packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
+++ packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
@@ -23,6 +23,14 @@
 _linux_x86_64_not_crashed_pid = 29939
 _linux_x86_64_not_crashed_pid_offset = 0xD967
 
+def setUp(self):
+super(MiniDumpNewTestCase, self).setUp()
+self._initial_platform = lldb.DBG.GetSelectedPlatform()
+
+def tearDown(self):
+lldb.DBG.SetSelectedPlatform(self._initial_platform)
+super(MiniDumpNewTestCase, self).tearDown()
+
 def test_process_info_in_minidump(self):
 """Test that lldb can read the process information from the Minidump."""
 # target create -c linux-x86_64.dmp
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29215: [LLDB][MIPS] Fix TestMiniDumpNew

2017-01-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Ok, I've just checked and this does not happen on windows. It does however 
happen (GetTriple() returning None) when we try to open the s390x core file 
(functionalities/postmortem/elf-core/linux-s390x.out). The test suite seems to 
be handling it fine.

The only difference I see there is that the other test has a bit of 
setUp/tearDown code which saves and restores the original platform after each 
run. Can you check whether that will make things work for you ? (It's still not 
ideal, but at least it will be consistent with the other test).

As an alternative fix -- the checking of the *target* platform in the code 
which is throwing this exception seems to be a bug. "Whether we have an 
LLDB.framework" is a property of the host, not the target. Changing that would 
probably allow you to make progress here. (although it won't fix the underlying 
problem).


Repository:
  rL LLVM

https://reviews.llvm.org/D29215



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29215: [LLDB][MIPS] Fix TestMiniDumpNew

2017-01-27 Thread Nitesh Jain via Phabricator via lldb-commits
nitesh.jain added a comment.

ERROR: test_two_cores_same_pid (TestMiniDumpNew.MiniDumpNewTestCase)

  Test that we handle the situation if we have two core files with the same PID

--

Traceback (most recent call last):

  File 
"/export/tmp/nin/LLVM/llvm/tools/lldb/packages/Python/lldbsuite/test/lldbtest.py",
 line 1884, in setUp
Base.setUp(self)
  File 
"/export/tmp/nin/LLVM/llvm/tools/lldb/packages/Python/lldbsuite/test/lldbtest.py",
 line 835, in setUp
self.darwinWithFramework = self.platformIsDarwin()
  File 
"/export/tmp/nin/LLVM/llvm/tools/lldb/packages/Python/lldbsuite/test/lldbtest.py",
 line 1300, in platformIsDarwin
return lldbplatformutil.platformIsDarwin()
  File 
"/export/tmp/nin/LLVM/llvm/tools/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py",
 line 140, in platformIsDarwin
return getPlatform() in getDarwinOSTriples()
  File 
"/export/tmp/nin/LLVM/llvm/tools/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py",
 line 130, in getPlatform
platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]

AttributeError: 'NoneType' object has no attribute 'split'


Repository:
  rL LLVM

https://reviews.llvm.org/D29215



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29215: [LLDB][MIPS] Fix TestMiniDumpNew

2017-01-27 Thread Pavel Labath via Phabricator via lldb-commits
labath requested changes to this revision.
labath added a comment.
This revision now requires changes to proceed.

This seems like it's fixing the problem in the wrong place. Also, the 
assumption that the platform == host_platform is not correct (what about when 
the test is run on windows?)

I think we should either fix SBPlatform::GetTriple to return a correct triple 
(lldb already knows the triple since it has the core file. Whether that triple 
should be returned by the platform is a somewhat different question though) or 
make the test suite not depend on that.

I am confused as to why would this behavior occur only on mips hosts. I've seen 
the platform being set to remote-linux when the test is run from windows, and 
it works fine there. What is the actual error message you are getting?


Repository:
  rL LLVM

https://reviews.llvm.org/D29215



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D29215: [LLDB][MIPS] Fix TestMiniDumpNew

2017-01-27 Thread Nitesh Jain via Phabricator via lldb-commits
nitesh.jain created this revision.

In case of a core file, if the core file architecture(like x86_64) is 
incompatible with that of Host architecture(like Mips64) then platform is set 
to remote-platform. If the remote-platform is not connected then 
SBPlatform::GetTriple() will return none. Hence we assume target platform is 
same as the host platform.

(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.

>>> import lldb
>>>  dbg = lldb.SBDebugger.Create()
>>>  print dbg.GetSelectedPlatform().GetName()

host

>>> print dbg.GetSelectedPlatform().GetTriple()

mips64el--linux-gnu

>>> dbg.CreateTarget("linux-x86_64")



>>> print dbg.GetSelectedPlatform().GetName()

remote-linux

>>> print dbg.GetSelectedPlatform().GetTriple()

None

>>> print dbg.GetSelectedPlatform().IsConnected()

False

>>> 




Repository:
  rL LLVM

https://reviews.llvm.org/D29215

Files:
  packages/Python/lldbsuite/test/lldbplatformutil.py


Index: packages/Python/lldbsuite/test/lldbplatformutil.py
===
--- packages/Python/lldbsuite/test/lldbplatformutil.py
+++ packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -127,7 +127,15 @@
 
 def getPlatform():
 """Returns the target platform which the tests are running on."""
-platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
+if lldb.DBG.GetSelectedPlatform().GetTriple():
+platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
+else:
+# In case of a core file, if the core file architecture(like x86_64)
+# is incompatible with that of Host architecture(like Mips64)
+# then platform is set to remote-platform. If the remote-platform is
+# not connected then SBPlatform::GetTriple() will return none.
+# Hence we assume target platform is same as the host platform.
+platform = sys.platform
 if platform.startswith('freebsd'):
 platform = 'freebsd'
 elif platform.startswith('netbsd'):


Index: packages/Python/lldbsuite/test/lldbplatformutil.py
===
--- packages/Python/lldbsuite/test/lldbplatformutil.py
+++ packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -127,7 +127,15 @@
 
 def getPlatform():
 """Returns the target platform which the tests are running on."""
-platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
+if lldb.DBG.GetSelectedPlatform().GetTriple():
+platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
+else:
+# In case of a core file, if the core file architecture(like x86_64)
+# is incompatible with that of Host architecture(like Mips64)
+# then platform is set to remote-platform. If the remote-platform is
+# not connected then SBPlatform::GetTriple() will return none.
+# Hence we assume target platform is same as the host platform.
+platform = sys.platform
 if platform.startswith('freebsd'):
 platform = 'freebsd'
 elif platform.startswith('netbsd'):
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits