2014-07-23 18:18:38 +00:00
|
|
|
"""
|
|
|
|
Test that using a non-existent architecture name does not crash LLDB.
|
|
|
|
"""
|
2015-10-23 17:04:29 +00:00
|
|
|
from __future__ import print_function
|
|
|
|
|
2015-11-03 19:20:39 +00:00
|
|
|
|
2014-07-23 18:18:38 +00:00
|
|
|
import lldb
|
2015-11-03 02:06:18 +00:00
|
|
|
from lldbsuite.test.lldbtest import *
|
|
|
|
import lldbsuite.test.lldbutil as lldbutil
|
2014-07-23 18:18:38 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
|
2014-07-23 18:18:38 +00:00
|
|
|
class NoSuchArchTestCase(TestBase):
|
|
|
|
|
|
|
|
mydir = TestBase.compute_mydir(__file__)
|
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
def test(self):
|
2015-09-30 10:12:40 +00:00
|
|
|
self.build()
|
2016-09-06 20:57:50 +00:00
|
|
|
exe = os.path.join(os.getcwd(), "a.out")
|
2015-09-30 10:12:40 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
# Check that passing an invalid arch via the command-line fails but
|
|
|
|
# doesn't crash
|
|
|
|
self.expect(
|
|
|
|
"target crete --arch nothingtoseehere %s" %
|
|
|
|
(exe), error=True)
|
2015-09-30 10:12:40 +00:00
|
|
|
|
2016-09-06 20:57:50 +00:00
|
|
|
# Check that passing an invalid arch via the SB API fails but doesn't
|
|
|
|
# crash
|
|
|
|
target = self.dbg.CreateTargetWithFileAndArch(exe, "nothingtoseehere")
|
2014-07-23 18:18:38 +00:00
|
|
|
self.assertFalse(target.IsValid(), "This target should not be valid")
|
2015-09-30 10:12:40 +00:00
|
|
|
|
2014-07-23 18:18:38 +00:00
|
|
|
# Now just create the target with the default arch and check it's fine
|
|
|
|
target = self.dbg.CreateTarget(exe)
|
|
|
|
self.assertTrue(target.IsValid(), "This target should now be valid")
|