blob: bf6d8a1570cc840c679c152922493f39af62b9d1 [file] [log] [blame]
[email protected]6faeb202012-12-06 15:43:051#!/usr/bin/env python
2# Copyright (c) 2012 The Chromium Authors. All rights reserved.
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6""" Test runner for IDL Generator changes """
7
8import subprocess
9import sys
10
11def TestIDL(testname, args):
12 print '\nRunning unit tests for %s.' % testname
13 try:
14 args = [sys.executable, testname] + args
15 subprocess.check_call(args)
16 return 0
17 except subprocess.CalledProcessError as err:
18 print 'Failed with %s.' % str(err)
19 return 1
20
21def main(args):
22 errors = 0
23 errors += TestIDL('idl_lexer.py', ['--test'])
24 assert errors == 0
25 errors += TestIDL('idl_parser.py', ['--test'])
26 assert errors == 0
27 errors += TestIDL('idl_c_header.py', [])
28 assert errors == 0
29 errors += TestIDL('idl_c_proto.py', ['--wnone', '--test'])
30 assert errors == 0
31 errors += TestIDL('idl_gen_pnacl.py', ['--wnone', '--test'])
32 assert errors == 0
[email protected]d88b7b52013-12-04 16:54:2633 errors += TestIDL('idl_namespace.py', [])
34 assert errors == 0
35 errors += TestIDL('idl_node.py', [])
36 assert errors == 0
[email protected]6faeb202012-12-06 15:43:0537
38 if errors:
39 print '\nFailed tests.'
40 return errors
41
42
43if __name__ == '__main__':
44 sys.exit(main(sys.argv[1:]))
45