1""" 2Test that using a non-existent architecture name does not crash LLDB. 3""" 4 5 6import lldb 7from lldbsuite.test.lldbtest import * 8import lldbsuite.test.lldbutil as lldbutil 9 10 11class NoSuchArchTestCase(TestBase): 12 13 mydir = TestBase.compute_mydir(__file__) 14 NO_DEBUG_INFO_TESTCASE = True 15 16 def test(self): 17 self.build() 18 exe = self.getBuildArtifact("a.out") 19 20 # Check that passing an invalid arch via the command-line fails but 21 # doesn't crash 22 self.expect( 23 "target create --arch nothingtoseehere %s" % 24 (exe), error=True, substrs=["error: invalid triple 'nothingtoseehere'"]) 25 26 # Check that passing an invalid arch via the SB API fails but doesn't 27 # crash 28 target = self.dbg.CreateTargetWithFileAndArch(exe, "nothingtoseehere") 29 self.assertFalse(target.IsValid(), "This target should not be valid") 30 31 # Now just create the target with the default arch and check it's fine 32 target = self.dbg.CreateTarget(exe) 33 self.assertTrue(target.IsValid(), "This target should now be valid") 34