Skip to content

Commit

Permalink
Merge pull request grpc#110 from ctiller/test
Browse files Browse the repository at this point in the history
Add ability to test build.json is clean
  • Loading branch information
nicolasnoble committed Jan 20, 2015
2 parents e82e9b3 + d4eeff8 commit 5ac1c14
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tools/buildgen/build-cleaner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
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 = [
Expand Down Expand Up @@ -51,6 +53,11 @@ def clean_elem(indict):
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)

0 comments on commit 5ac1c14

Please sign in to comment.