aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/buildgen
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-01-20 09:00:45 -0800
committerGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-01-20 09:00:45 -0800
commit5ac1c141dd7dc5c0f9d572697a2c816acd059f2f (patch)
tree7c2559370a6740c085ca0ecbb47823c100543deb /tools/buildgen
parente82e9b3315d643134d518c01274f8de12cead294 (diff)
parentd4eeff8a2d7722e231ab38b5c33f6d1ff9646b09 (diff)
Merge pull request #110 from ctiller/test
Add ability to test build.json is clean
Diffstat (limited to 'tools/buildgen')
-rwxr-xr-xtools/buildgen/build-cleaner.py11
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)