diff options
author | Pavel Labath <pavel@labath.sk> | 2021-10-18 14:45:57 +0200 |
---|---|---|
committer | Pavel Labath <pavel@labath.sk> | 2021-10-19 12:09:41 +0200 |
commit | 8bac18be0e45adc7b096375bf4f65635fb994df0 (patch) | |
tree | 43bd3deeb4c38c6b9b00f81291f2f51e846ebf84 /lldb/docs/testsuite/a-detailed-walkthrough.txt | |
parent | 9a57d1e52680ac05c29d6d0d2cfbaf3b05a5cbce (diff) | |
download | llvm-8bac18be0e45adc7b096375bf4f65635fb994df0.zip llvm-8bac18be0e45adc7b096375bf4f65635fb994df0.tar.gz llvm-8bac18be0e45adc7b096375bf4f65635fb994df0.tar.bz2 |
[lldb] Reduce code duplication around inferior building
We had two sets of build<flavour> methods, whose bodies were largely
identical. This makes any kind of modification in their vicinity
repetitive and error-prone.
Replace each set with a single method taking an optional debug_info
parameter.
Differential Revision: https://reviews.llvm.org/D111989
Diffstat (limited to 'lldb/docs/testsuite/a-detailed-walkthrough.txt')
-rw-r--r-- | lldb/docs/testsuite/a-detailed-walkthrough.txt | 51 |
1 files changed, 7 insertions, 44 deletions
diff --git a/lldb/docs/testsuite/a-detailed-walkthrough.txt b/lldb/docs/testsuite/a-detailed-walkthrough.txt index fff5a40..8d374d5 100644 --- a/lldb/docs/testsuite/a-detailed-walkthrough.txt +++ b/lldb/docs/testsuite/a-detailed-walkthrough.txt @@ -73,7 +73,7 @@ Now let's look inside the test method: def test_set_output_path(self): """Test that setting target.process.output-path for the launched process works.""" - self.buildDefault() + self.build() exe = os.path.join(os.getcwd(), "a.out") self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) @@ -96,49 +96,12 @@ Now let's look inside the test method: self.expect(output, exe=False, startstr = "This message should go to standard out.") -The self.buildDefault() statement is used to build a default binary for this -test instance. For this particular test case, since we don't really care what -debugging format is used, we instruct the build subsystem to build the default -binary for us. The base class TestBase has defined three instance methods: - - def buildDefault(self, architecture=None, compiler=None, dictionary=None): - """Platform specific way to build the default binaries.""" - module = __import__(sys.platform) - if not module.buildDefault(self, architecture, compiler, dictionary): - raise Exception("Don't know how to build default binary") - - def buildDsym(self, architecture=None, compiler=None, dictionary=None): - """Platform specific way to build binaries with dsym info.""" - module = __import__(sys.platform) - if not module.buildDsym(self, architecture, compiler, dictionary): - raise Exception("Don't know how to build binary with dsym") - - def buildDwarf(self, architecture=None, compiler=None, dictionary=None): - """Platform specific way to build binaries with dwarf maps.""" - module = __import__(sys.platform) - if not module.buildDwarf(self, architecture, compiler, dictionary): - raise Exception("Don't know how to build binary with dwarf") - -And the test/plugins/darwin.py provides the implementation for all three build -methods using the makefile mechanism. We envision that linux plugin can use a -similar approach to accomplish the task of building the binaries. - -macOS provides an additional way to manipulate archived DWARF debug symbol -files and produces dSYM files. The buildDsym() instance method is used by the -test method to build the binary with dsym info. For an example of this, -see test/array_types/TestArrayTypes.py: - - @unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin") - def test_with_dsym_and_run_command(self): - """Test 'frame variable var_name' on some variables with array types.""" - self.buildDsym() - self.array_types() - -This method is decorated with a skipUnless decorator so that it will only gets -included into the test suite if the platform it is running on is 'darwin', a.k.a. -macOS. - -Type 'man dsymutil' for more details. +The self.build() statement is used to build a binary for this +test instance. This will build the binary for the current debug info format. If +we wanted to avoid running the test for every supported debug info format we +could annotate it with @no_debug_info_test. The test would then only be run for +the default format. The logic for building a test binary resides in the builder +modules (packages/Python/lldbsuite/test/builders/builder.py) After the binary is built, it is time to specify the file to be used as the main executable by lldb: |