diff options
author | Patrick Steinhardt <ps@pks.im> | 2017-05-10 12:02:03 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2017-06-23 15:17:44 +0200 |
commit | 9e240bd2c496353ffafdaa7fadd4301abd424c4c (patch) | |
tree | 514dc433462a8048f9af21e054e89fd74c8bb52b | |
parent | 0a513a947133bc65ee76870f9e7354cc03c16712 (diff) | |
download | libgit2-9e240bd2c496353ffafdaa7fadd4301abd424c4c.tar.gz |
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.
-rw-r--r-- | tests/generate.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/generate.py b/tests/generate.py index 5d1a8e66d..b1562fa0c 100644 --- a/tests/generate.py +++ b/tests/generate.py @@ -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(): |