summaryrefslogtreecommitdiffstats
path: root/tests/site_scons/site_init.py
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-09-10 17:44:32 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2013-09-10 17:53:07 +0300
commitf04ab838abd90fb70f7d6ef77fdacdf07f09ba4d (patch)
tree00d3d7834953f6ca2b7a804fe02bfd95f795c6e6 /tests/site_scons/site_init.py
parente681dd0d75a4b6a7974cc898477f3a138f7872c2 (diff)
Build fixes for Windows/Visual C++
Diffstat (limited to 'tests/site_scons/site_init.py')
-rw-r--r--tests/site_scons/site_init.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/tests/site_scons/site_init.py b/tests/site_scons/site_init.py
index 1383067d..b69db646 100644
--- a/tests/site_scons/site_init.py
+++ b/tests/site_scons/site_init.py
@@ -1,6 +1,13 @@
import subprocess
import sys
+try:
+ # Make terminal colors work on windows
+ import colorama
+ colorama.init()
+except ImportError:
+ pass
+
def add_nanopb_builders(env):
'''Add the necessary builder commands for nanopb tests.'''
@@ -14,6 +21,7 @@ def add_nanopb_builders(env):
src_suffix = '.proto')
env.Append(BUILDERS = {'Proto': proto_file_builder})
env.SetDefault(PROTOC = 'protoc')
+ env.SetDefault(PROTOCPATH = ['.'])
# Build command for running nanopb generator
import os.path
@@ -50,9 +58,9 @@ def add_nanopb_builders(env):
stderr = sys.stderr)
result = pipe.wait()
if result == 0:
- print '\033[92m[ OK ]\033[0m Ran ' + str(source[0])
+ print '\033[32m[ OK ]\033[0m Ran ' + str(source[0])
else:
- print '\033[91m[FAIL]\033[0m Program ' + str(source[0]) + ' returned ' + str(result)
+ print '\033[31m[FAIL]\033[0m Program ' + str(source[0]) + ' returned ' + str(result)
return result
run_test_builder = Builder(action = run_test,
@@ -73,10 +81,10 @@ def add_nanopb_builders(env):
data1 = open(str(source[0]), 'rb').read()
data2 = open(str(source[1]), 'rb').read()
if data1 == data2:
- print '\033[92m[ OK ]\033[0m Files equal: ' + str(source[0]) + ' and ' + str(source[1])
+ print '\033[32m[ OK ]\033[0m Files equal: ' + str(source[0]) + ' and ' + str(source[1])
return 0
else:
- print '\033[91m[FAIL]\033[0m Files differ: ' + str(source[0]) + ' and ' + str(source[1])
+ print '\033[31m[FAIL]\033[0m Files differ: ' + str(source[0]) + ' and ' + str(source[1])
return 1
compare_builder = Builder(action = compare_files,