- # make sure target files are all gone
- for t in target:
- if os.path.exists(t.abspath):
- Execute(Delete(t.abspath))
- # Run diff on output & ref directories to find differences.
- # Exclude m5stats.txt since we will use diff-out on that.
- Execute(env.subst('diff -ubr ${SOURCES[0].dir} ${SOURCES[1].dir} ' +
- '-I "^command line:" ' + # for stdout file
- '-I "^M5 compiled " ' + # for stderr file
- '-I "^M5 started " ' + # for stderr file
- '-I "^M5 executing on " ' + # for stderr file
- '-I "^Simulation complete at" ' + # for stderr file
- '-I "^Listening for" ' + # for stderr file
- '-I "listening for remote gdb" ' + # for stderr file
- '--exclude=m5stats.txt --exclude=SCCS ' +
- '--exclude=${TARGETS[0].file} ' +
- '> ${TARGETS[0]}', target=target, source=source), None)
- print "===== Output differences ====="
- print contents(target[0])
- # Run diff-out on m5stats.txt file
- status = Execute(env.subst('$DIFFOUT $SOURCES > ${TARGETS[1]}',
- target=target, source=source),
- strfunction=None)
- print "===== Statistics differences ====="
- print contents(target[1])
- # Generate status file contents based on exit status of diff-out
- if status == 0:
- status_str = "passed."
- else:
- status_str = "FAILED!"
- f = file(str(target[2]), 'w')
- print >>f, env.subst('${TARGETS[2].dir}', target=target, source=source), \
- status_str
- f.close()
- # done
+ tgt_dir = os.path.dirname(str(target[0]))
+ config = tests.ClassicConfig(*tgt_dir.split('/')[-6:])
+ test = tests.ClassicTest(source[0].abspath, tgt_dir, config,
+ timeout=5*60*60,
+ skip_diff_out=True)
+
+ for ref in test.ref_files():
+ out_file = os.path.join(tgt_dir, ref)
+ if os.path.exists(out_file):
+ env.Execute(Delete(out_file))
+
+ with open(target[0].abspath, "wb") as fout:
+ formatter = results.Pickle(fout=fout)
+ formatter.dump_suites([ test.run() ])
+