verify.py (13540:da30e62884ee) verify.py (13705:2a84d8051414)
1#!/usr/bin/env python2.7
2#
3# Copyright 2018 Google, Inc.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

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

40import os
41import re
42import subprocess
43import sys
44
45script_path = os.path.abspath(inspect.getfile(inspect.currentframe()))
46script_dir = os.path.dirname(script_path)
47config_path = os.path.join(script_dir, 'config.py')
1#!/usr/bin/env python2.7
2#
3# Copyright 2018 Google, Inc.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

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

40import os
41import re
42import subprocess
43import sys
44
45script_path = os.path.abspath(inspect.getfile(inspect.currentframe()))
46script_dir = os.path.dirname(script_path)
47config_path = os.path.join(script_dir, 'config.py')
48# Parent directories if checked out as part of gem5.
49systemc_dir = os.path.dirname(script_dir)
50src_dir = os.path.dirname(systemc_dir)
51checkout_dir = os.path.dirname(src_dir)
48
49systemc_rel_path = 'systemc'
50tests_rel_path = os.path.join(systemc_rel_path, 'tests')
51json_rel_path = os.path.join(tests_rel_path, 'tests.json')
52
53
54
55def scons(*args):

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

126 targets = list([test.full_path() for test in tests])
127
128 parser = argparse.ArgumentParser()
129 parser.add_argument('-j', type=int, default=0)
130 args, leftovers = parser.parse_known_args(self.args)
131 if args.j == 0:
132 self.args = ('-j', str(self.main_args.j)) + self.args
133
52
53systemc_rel_path = 'systemc'
54tests_rel_path = os.path.join(systemc_rel_path, 'tests')
55json_rel_path = os.path.join(tests_rel_path, 'tests.json')
56
57
58
59def scons(*args):

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

130 targets = list([test.full_path() for test in tests])
131
132 parser = argparse.ArgumentParser()
133 parser.add_argument('-j', type=int, default=0)
134 args, leftovers = parser.parse_known_args(self.args)
135 if args.j == 0:
136 self.args = ('-j', str(self.main_args.j)) + self.args
137
134 scons_args = [ 'USE_SYSTEMC=1' ] + list(self.args) + targets
138 scons_args = [ '--directory', self.main_args.scons_dir,
139 'USE_SYSTEMC=1' ] + list(self.args) + targets
135 scons(*scons_args)
136
137class RunPhase(TestPhaseBase):
138 name = 'execute'
139 number = 2
140
141 def run(self, tests):
142 parser = argparse.ArgumentParser()

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

507
508parser.add_argument('--list', action='store_true',
509 help='List the available tests')
510
511parser.add_argument('-j', type=int, default=1,
512 help='Default level of parallelism, can be overriden '
513 'for individual stages')
514
140 scons(*scons_args)
141
142class RunPhase(TestPhaseBase):
143 name = 'execute'
144 number = 2
145
146 def run(self, tests):
147 parser = argparse.ArgumentParser()

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

512
513parser.add_argument('--list', action='store_true',
514 help='List the available tests')
515
516parser.add_argument('-j', type=int, default=1,
517 help='Default level of parallelism, can be overriden '
518 'for individual stages')
519
520parser.add_argument('-C', '--scons-dir', metavar='SCONS_DIR',
521 default=checkout_dir,
522 help='Directory to run scons from')
523
515filter_opts = parser.add_mutually_exclusive_group()
516filter_opts.add_argument('--filter', default='True',
517 help='Python expression which filters tests based '
518 'on their properties')
519filter_opts.add_argument('--filter-file', default=None,
520 type=argparse.FileType('r'),
521 help='Same as --filter, but read from a file')
522

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

544 VerifyPhase(main_args)
545 ]
546
547
548
549json_path = os.path.join(main_args.build_dir, json_rel_path)
550
551if main_args.update_json:
524filter_opts = parser.add_mutually_exclusive_group()
525filter_opts.add_argument('--filter', default='True',
526 help='Python expression which filters tests based '
527 'on their properties')
528filter_opts.add_argument('--filter-file', default=None,
529 type=argparse.FileType('r'),
530 help='Same as --filter, but read from a file')
531

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

553 VerifyPhase(main_args)
554 ]
555
556
557
558json_path = os.path.join(main_args.build_dir, json_rel_path)
559
560if main_args.update_json:
552 scons(os.path.join(json_path))
561 scons('--directory', main_args.scons_dir, os.path.join(json_path))
553
554with open(json_path) as f:
555 test_data = json.load(f)
556
557 if main_args.filter_file:
558 f = main_args.filter_file
559 filt = compile(f.read(), f.name, 'eval')
560 else:

--- 25 unchanged lines hidden ---
562
563with open(json_path) as f:
564 test_data = json.load(f)
565
566 if main_args.filter_file:
567 f = main_args.filter_file
568 filt = compile(f.read(), f.name, 'eval')
569 else:

--- 25 unchanged lines hidden ---