diff options
author | 2015-01-20 09:00:45 -0800 | |
---|---|---|
committer | 2015-01-20 09:00:45 -0800 | |
commit | 5ac1c141dd7dc5c0f9d572697a2c816acd059f2f (patch) | |
tree | 7c2559370a6740c085ca0ecbb47823c100543deb /tools/buildgen | |
parent | e82e9b3315d643134d518c01274f8de12cead294 (diff) | |
parent | d4eeff8a2d7722e231ab38b5c33f6d1ff9646b09 (diff) |
Merge pull request #110 from ctiller/test
Add ability to test build.json is clean
Diffstat (limited to 'tools/buildgen')
-rwxr-xr-x | tools/buildgen/build-cleaner.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/buildgen/build-cleaner.py b/tools/buildgen/build-cleaner.py index 00821cc9cc..f9307360c3 100755 --- a/tools/buildgen/build-cleaner.py +++ b/tools/buildgen/build-cleaner.py @@ -6,6 +6,8 @@ import json import os import sys +TEST = (os.environ.get('TEST', 'false') == 'true') + _TOP_LEVEL_KEYS = ['settings', 'filegroups', 'libs', 'targets'] _VERSION_KEYS = ['major', 'minor', 'micro', 'build'] _ELEM_KEYS = [ @@ -51,6 +53,11 @@ for filename in sys.argv[1:]: lines = [] for line in output.splitlines(): lines.append(line.rstrip() + '\n') - with open(filename, 'w') as f: - f.write(''.join(lines)) + output = ''.join(lines) + if TEST: + with open(filename) as f: + assert f.read() == output + else: + with open(filename, 'w') as f: + f.write(output) |