SConscript (12246:9ffa51416f39) SConscript (12563:8d59ed22ae79)
1# -*- mode:python -*-
2#
3# Copyright (c) 2016 ARM Limited
4# All rights reserved
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating

--- 28 unchanged lines hidden (view full) ---

37# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40#
41# Authors: Steve Reinhardt
42# Kevin Lim
43# Andreas Sandberg
44
1# -*- mode:python -*-
2#
3# Copyright (c) 2016 ARM Limited
4# All rights reserved
5#
6# The license below extends only to copyright in the software and shall
7# not be construed as granting a license to any other intellectual
8# property including but not limited to intellectual property relating

--- 28 unchanged lines hidden (view full) ---

37# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40#
41# Authors: Steve Reinhardt
42# Kevin Lim
43# Andreas Sandberg
44
45from __future__ import print_function
46
45from SCons.Script.SConscript import SConsEnvironment
46import os
47import pickle
48import sys
49
50sys.path.insert(0, Dir(".").srcnode().abspath)
51import testing.tests as tests
52import testing.results as results

--- 78 unchanged lines hidden (view full) ---

131 status = color_message(termcap.Green, "passed.")
132 else:
133 status = color_message(termcap.Red, "FAILED!")
134 formatter = results.Text()
135
136 if formatter:
137 formatter.dump_suites([result])
138
47from SCons.Script.SConscript import SConsEnvironment
48import os
49import pickle
50import sys
51
52sys.path.insert(0, Dir(".").srcnode().abspath)
53import testing.tests as tests
54import testing.results as results

--- 78 unchanged lines hidden (view full) ---

133 status = color_message(termcap.Green, "passed.")
134 else:
135 status = color_message(termcap.Red, "FAILED!")
136 formatter = results.Text()
137
138 if formatter:
139 formatter.dump_suites([result])
140
139 print "***** %s: %s" % (source[0].dir, status)
141 print("***** %s: %s" % (source[0].dir, status))
140 return 0
141
142printAction = env.Action(print_test, strfunction=None)
143
144def update_test(target, source, env):
145 """Update test reference data
146
147 Targets are as follows:

--- 10 unchanged lines hidden (view full) ---

158
159 with open(source[0].abspath, "rb") as fin:
160 result = pickle.load(fin)
161
162 assert len(result) == 1
163 result = result[0]
164
165 if result.skipped():
142 return 0
143
144printAction = env.Action(print_test, strfunction=None)
145
146def update_test(target, source, env):
147 """Update test reference data
148
149 Targets are as follows:

--- 10 unchanged lines hidden (view full) ---

160
161 with open(source[0].abspath, "rb") as fin:
162 result = pickle.load(fin)
163
164 assert len(result) == 1
165 result = result[0]
166
167 if result.skipped():
166 print "*** %s: %s: Test skipped, not updating." % (
167 source[0].dir, color_message(termcap.Yellow, "WARNING"), )
168 print("*** %s: %s: Test skipped, not updating." %
169 (source[0].dir, color_message(termcap.Yellow, "WARNING")))
168 return 0
169 elif result:
170 return 0
171 elif result:
170 print "*** %s: %s: Test successful, not updating." % (
171 source[0].dir, color_message(termcap.Green, "skipped"), )
172 print("*** %s: %s: Test successful, not updating." %
173 (source[0].dir, color_message(termcap.Green, "skipped")))
172 return 0
173 elif result.failed_run():
174 return 0
175 elif result.failed_run():
174 print "*** %s: %s: Test failed, not updating." % (
175 source[0].dir, color_message(termcap.Red, "ERROR"), )
176 print("*** %s: %s: Test failed, not updating." %
177 (source[0].dir, color_message(termcap.Red, "ERROR")))
176 return 1
177
178 return 1
179
178 print "** Updating %s" % (test, )
180 print("** Updating %s" % test)
179 test.update_ref()
180
181 return 0
182
183def update_test_string(target, source, env):
184 return env.subst("Updating ${SOURCES[0].dir}",
185 target=target, source=source)
186

--- 44 unchanged lines hidden (view full) ---

231
232 tgt_name = os.path.basename(str(target[0]))
233 base, ext = os.path.splitext(tgt_name)
234 categories = tests.all_categories if base == "all" else (base, )
235
236 with open(target[0].abspath, "w") as fout:
237 for cat in categories:
238 for test in env.Tests[cat]:
181 test.update_ref()
182
183 return 0
184
185def update_test_string(target, source, env):
186 return env.subst("Updating ${SOURCES[0].dir}",
187 target=target, source=source)
188

--- 44 unchanged lines hidden (view full) ---

233
234 tgt_name = os.path.basename(str(target[0]))
235 base, ext = os.path.splitext(tgt_name)
236 categories = tests.all_categories if base == "all" else (base, )
237
238 with open(target[0].abspath, "w") as fout:
239 for cat in categories:
240 for test in env.Tests[cat]:
239 print >> fout,"/".join(test)
241 print("/".join(test), file=fout)
240
241 return 0
242
243testListAction = env.Action(list_tests, strfunction=None)
244
245env.Command("all.list", tuple(), testListAction)
246for cat, test_list in env.Tests.items():
247 env.Command("%s.list" % cat, tuple(), testListAction)
248 for test in test_list:
249 test_builder(test)
242
243 return 0
244
245testListAction = env.Action(list_tests, strfunction=None)
246
247env.Command("all.list", tuple(), testListAction)
248for cat, test_list in env.Tests.items():
249 env.Command("%s.list" % cat, tuple(), testListAction)
250 for test in test_list:
251 test_builder(test)