From 074c591a7e9b366582dfc8dc127dd8df2ab1ac99 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 19 Aug 2020 09:25:41 -0700 Subject: [PATCH] [lldb] Add getExtraMakeArgs to Builder (NFC) Instead of a new method for each variable any subclass might want to set, have a method getExtraMakeArgs that each subclass can use to return whatever extra Make arguments it wants. As per Pavel's suggestion in D85539. --- .../Python/lldbsuite/test/builders/builder.py | 24 ++++++++++------------ .../Python/lldbsuite/test/builders/darwin.py | 19 ++++++++++++++++- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py index 659e619..160bafb 100644 --- a/lldb/packages/Python/lldbsuite/test/builders/builder.py +++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py @@ -20,6 +20,13 @@ class Builder: compiler = lldbutil.which(compiler) return os.path.abspath(compiler) + def getExtraMakeArgs(self): + """ + Helper function to return extra argumentsfor the make system. This + method is meant to be overridden by platform specific builders. + """ + return "" + def getMake(self, test_subdir, test_name): """Returns the invocation for GNU make. The first argument is a tuple of the relative path to the testcase @@ -101,15 +108,6 @@ class Builder: else: return "" - def getDsymutilSpec(self): - """ - Helper function to return the key-value string to specify the dsymutil - used for the make system. - """ - if configuration.dsymutil: - return "DSYMUTIL={}".format(configuration.dsymutil) - return "" - def getSDKRootSpec(self): """ Helper function to return the key-value string to specify the SDK root @@ -143,7 +141,7 @@ class Builder: "all", self.getArchSpec(architecture), self.getCCSpec(compiler), - self.getDsymutilSpec(), + self.getExtraMakeArgs(), self.getSDKRootSpec(), self.getModuleCacheSpec(), self.getCmdLine(dictionary) @@ -168,7 +166,7 @@ class Builder: "MAKE_DSYM=NO", self.getArchSpec(architecture), self.getCCSpec(compiler), - self.getDsymutilSpec(), + self.getExtraMakeArgs(), self.getSDKRootSpec(), self.getModuleCacheSpec(), self.getCmdLine(dictionary) @@ -192,7 +190,7 @@ class Builder: "MAKE_DSYM=NO", "MAKE_DWO=YES", self.getArchSpec(architecture), self.getCCSpec(compiler), - self.getDsymutilSpec(), + self.getExtraMakeArgs(), self.getSDKRootSpec(), self.getModuleCacheSpec(), self.getCmdLine(dictionary) @@ -216,7 +214,7 @@ class Builder: "MAKE_DSYM=NO", "MAKE_GMODULES=YES", self.getArchSpec(architecture), self.getCCSpec(compiler), - self.getDsymutilSpec(), + self.getExtraMakeArgs(), self.getSDKRootSpec(), self.getModuleCacheSpec(), self.getCmdLine(dictionary) diff --git a/lldb/packages/Python/lldbsuite/test/builders/darwin.py b/lldb/packages/Python/lldbsuite/test/builders/darwin.py index 826a3b4..ce0aa0b 100644 --- a/lldb/packages/Python/lldbsuite/test/builders/darwin.py +++ b/lldb/packages/Python/lldbsuite/test/builders/darwin.py @@ -1,7 +1,24 @@ from .builder import Builder +from lldbsuite.test import configuration + class BuilderDarwin(Builder): + def getExtraMakeArgs(self): + """ + Helper function to return extra argumentsfor the make system. This + method is meant to be overridden by platform specific builders. + """ + args = dict() + + if configuration.dsymutil: + args['DSYMUTIL'] = configuration.dsymutil + + # Return extra args as a formatted string. + return ' '.join( + {'{}="{}"'.format(key, value) + for key, value in args.items()}) + def buildDsym(self, sender=None, architecture=None, @@ -16,7 +33,7 @@ class BuilderDarwin(Builder): "MAKE_DSYM=YES", self.getArchSpec(architecture), self.getCCSpec(compiler), - self.getDsymutilSpec(), + self.getExtraMakeArgs(), self.getSDKRootSpec(), self.getModuleCacheSpec(), "all", self.getCmdLine(dictionary) -- 2.7.4