Commit 9e240bd2 by Patrick Steinhardt

generate.py: enable overriding path of generated clar.suite

The generate.py script will currently always write the generated
clar.suite file into the scanned directory, breaking out-of-tree builds
with read-only source directories. Fix this issue by adding another
option to allow overriding the output path of the generated file.
parent 0a513a94
......@@ -128,8 +128,9 @@ class Module(object):
class TestSuite(object):
def __init__(self, path):
def __init__(self, path, output):
self.path = path
self.output = output
def should_generate(self, path):
if not os.path.isfile(path):
......@@ -200,7 +201,7 @@ class TestSuite(object):
return sum(len(module.callbacks) for module in self.modules.values())
def write(self):
output = os.path.join(self.path, 'clar.suite')
output = os.path.join(self.output, 'clar.suite')
if not self.should_generate(output):
return False
......@@ -232,6 +233,7 @@ if __name__ == '__main__':
parser = OptionParser()
parser.add_option('-f', '--force', action="store_true", dest='force', default=False)
parser.add_option('-x', '--exclude', dest='excluded', action='append', default=[])
parser.add_option('-o', '--output', dest='output')
options, args = parser.parse_args()
if len(args) > 1:
......@@ -239,7 +241,8 @@ if __name__ == '__main__':
sys.exit(1)
path = args.pop() if args else '.'
suite = TestSuite(path)
output = options.output or path
suite = TestSuite(path, output)
suite.load(options.force)
suite.disable(options.excluded)
if suite.write():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment