Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: tests/callingconv/generate.py

Issue 8366024: Add pnacl-gcc generated code back into the callingconv test mix (Closed) Base URL: svn://svn.chromium.org/native_client/trunk/src/native_client/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/callingconv/callingconv.c ('k') | tests/callingconv/nacl.scons » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python2.6 1 #!/usr/bin/python2.6
2 # Copyright (c) 2011 The Native Client Authors. All rights reserved. 2 # Copyright (c) 2011 The Native Client Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 LICENSE = ( 6 LICENSE = (
7 "/*", 7 "/*",
8 " * Copyright (c) 2011 The Native Client Authors. All rights reserved.", 8 " * Copyright (c) 2011 The Native Client Authors. All rights reserved.",
9 " * Use of this source code is governed by a BSD-style license that can be", 9 " * Use of this source code is governed by a BSD-style license that can be",
10 " * found in the LICENSE file.", 10 " * found in the LICENSE file.",
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 lines.append(line) 311 lines.append(line)
312 return lines 312 return lines
313 313
314 def GenerateTest(settings): 314 def GenerateTest(settings):
315 random.seed(settings.seed) 315 random.seed(settings.seed)
316 316
317 functions = [ TestFunction(settings, i) 317 functions = [ TestFunction(settings, i)
318 for i in xrange(settings.num_functions) ] 318 for i in xrange(settings.num_functions) ]
319 319
320 calls = [ ] 320 calls = [ ]
321 callcount = 0
321 for f in functions: 322 for f in functions:
322 calls += [ TestCall(settings, i, f) 323 for i in xrange(settings.calls_per_func):
323 for i in xrange(settings.calls_per_func) ] 324 calls.append(TestCall(settings, callcount, f))
325 callcount += 1
324 326
325 num_asserts = sum([ c.num_asserts for c in calls ]) 327 num_asserts = sum([ c.num_asserts for c in calls ])
326 return (functions, calls, num_asserts) 328 return (functions, calls, num_asserts)
327 329
328 330
329 class TestCall(object): 331 class TestCall(object):
330 def __init__(self, settings, test_id, function): 332 def __init__(self, settings, call_id, function):
331 self.settings = settings 333 self.settings = settings
332 self.id = test_id 334 self.id = call_id
333 self.f = function 335 self.f = function
334 336
335 self.num_var_args = random.randint(0, self.settings.max_args_per_func - 337 self.num_var_args = random.randint(0, self.settings.max_args_per_func -
336 self.f.num_fixed_args) 338 self.f.num_fixed_args)
337 339
338 # Generate argument inputs 340 # Generate argument inputs
339 self.num_args = self.f.num_fixed_args + self.num_var_args 341 self.num_args = self.f.num_fixed_args + self.num_var_args
340 args = [] 342 args = []
341 fmtstr = '' 343 fmtstr = ''
342 for i in xrange(self.num_args): 344 for i in xrange(self.num_args):
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 i = make_int() 543 i = make_int()
542 j = make_char() 544 j = make_char()
543 k = make_short() 545 k = make_short()
544 l = make_char() 546 l = make_char()
545 m = make_char() 547 m = make_char()
546 return "%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s" % \ 548 return "%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s" % \
547 (a,b,c,d,e,f,g,h,i,j,k,l,m) 549 (a,b,c,d,e,f,g,h,i,j,k,l,m)
548 550
549 if __name__ == "__main__": 551 if __name__ == "__main__":
550 sys.exit(main(sys.argv[1:])) 552 sys.exit(main(sys.argv[1:]))
OLDNEW
« no previous file with comments | « tests/callingconv/callingconv.c ('k') | tests/callingconv/nacl.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698