brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · ae30d3d Raw
34 lines · python
1"""2Test that using a non-existent architecture name does not crash LLDB.3"""4 5 6import lldb7from lldbsuite.test.lldbtest import *8import lldbsuite.test.lldbutil as lldbutil9 10 11class NoSuchArchTestCase(TestBase):12    NO_DEBUG_INFO_TESTCASE = True13 14    def test(self):15        self.build()16        exe = self.getBuildArtifact("a.out")17 18        # Check that passing an invalid arch via the command-line fails but19        # doesn't crash20        self.expect(21            "target create --arch nothingtoseehere %s" % (exe),22            error=True,23            substrs=["error: invalid triple 'nothingtoseehere'"],24        )25 26        # Check that passing an invalid arch via the SB API fails but doesn't27        # crash28        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 fine32        target = self.dbg.CreateTarget(exe)33        self.assertTrue(target.IsValid(), "This target should now be valid")34