- (category, name, _ref, isa, opsys, config) = ref_dir.split('/')
- assert(_ref == 'ref')
-
- # target path (where test output goes) is the same except without
- # the 'ref' component
- tgt_dir = os.path.join(category, name, isa, opsys, config)
-
- # prepend file name with tgt_dir
- def tgt(f):
- return os.path.join(tgt_dir, f)
-
- ref_stats = os.path.join(ref_dir, 'm5stats.txt')
- new_stats = tgt('m5stats.txt')
- status_file = tgt('status')
-
- # Base command for running test. We mess around with indirectly
- # referring to files via SOURCES and TARGETS so that scons can
- # mess with paths all it wants to and we still get the right
- # files.
- base_cmd = '${SOURCES[0]} -d $TARGET.dir ${SOURCES[1]} %s' % tgt_dir
- # stdout and stderr files
- cmd_stdout = '${TARGETS[0]}'
- cmd_stderr = '${TARGETS[1]}'
-
- # Prefix test run with batch job submission command if appropriate.
- # Output redirection is also different for batch runs.
- # Batch command also supports timeout arg (in seconds, not minutes).
- timeout = 15 # used to be a param, probably should be again
- if env['BATCH']:
- cmd = [env['BATCH_CMD'], '-t', str(timeout * 60),
- '-o', cmd_stdout, '-e', cmd_stderr, base_cmd]
- else:
- cmd = [base_cmd, '>', cmd_stdout, '2>', cmd_stderr]
-
- env.Command([tgt('stdout'), tgt('stderr'), new_stats],
- [env.M5Binary, 'run.py'], ' '.join(cmd))