SConscript (6008:fb50ea61a226) SConscript (6011:27836c06d13d)
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2006 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

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

82 source[0] : M5 binary
83 source[1] : tests/run.py script
84 source[2] : reference stats file
85
86 """
87 # make sure target files are all gone
88 for t in target:
89 if os.path.exists(t.abspath):
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2006 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

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

82 source[0] : M5 binary
83 source[1] : tests/run.py script
84 source[2] : reference stats file
85
86 """
87 # make sure target files are all gone
88 for t in target:
89 if os.path.exists(t.abspath):
90 Execute(Delete(t.abspath))
90 env.Execute(Delete(t.abspath))
91
92 tgt_dir = os.path.dirname(str(target[0]))
93
94 # Base command for running test. We mess around with indirectly
95 # referring to files via SOURCES and TARGETS so that scons can mess
96 # with paths all it wants to and we still get the right files.
97 cmd = '${SOURCES[0]} -d %s -re ${SOURCES[1]} %s' % (tgt_dir, tgt_dir)
98
99 # Prefix test run with batch job submission command if appropriate.
100 # Batch command also supports timeout arg (in seconds, not minutes).
101 timeout = 15 * 60 # used to be a param, probably should be again
102 if env['BATCH']:
103 cmd = '%s -t %d %s' % (env['BATCH_CMD'], timeout, cmd)
104
91
92 tgt_dir = os.path.dirname(str(target[0]))
93
94 # Base command for running test. We mess around with indirectly
95 # referring to files via SOURCES and TARGETS so that scons can mess
96 # with paths all it wants to and we still get the right files.
97 cmd = '${SOURCES[0]} -d %s -re ${SOURCES[1]} %s' % (tgt_dir, tgt_dir)
98
99 # Prefix test run with batch job submission command if appropriate.
100 # Batch command also supports timeout arg (in seconds, not minutes).
101 timeout = 15 * 60 # used to be a param, probably should be again
102 if env['BATCH']:
103 cmd = '%s -t %d %s' % (env['BATCH_CMD'], timeout, cmd)
104
105 status = Execute(env.subst(cmd, target=target, source=source))
105 status = env.Execute(env.subst(cmd, target=target, source=source))
106 if status == 0:
107 # M5 terminated normally.
108 # Run diff on output & ref directories to find differences.
109 # Exclude the stats file since we will use diff-out on that.
110 outdiff = os.path.join(tgt_dir, 'outdiff')
111 diffcmd = 'diff -ubr %s ${SOURCES[2].dir} %s > %s' \
112 % (output_ignore_args, tgt_dir, outdiff)
106 if status == 0:
107 # M5 terminated normally.
108 # Run diff on output & ref directories to find differences.
109 # Exclude the stats file since we will use diff-out on that.
110 outdiff = os.path.join(tgt_dir, 'outdiff')
111 diffcmd = 'diff -ubr %s ${SOURCES[2].dir} %s > %s' \
112 % (output_ignore_args, tgt_dir, outdiff)
113 Execute(env.subst(diffcmd, target=target, source=source))
113 env.Execute(env.subst(diffcmd, target=target, source=source))
114 print "===== Output differences ====="
115 print contents(outdiff)
116 # Run diff-out on stats.txt file
117 statsdiff = os.path.join(tgt_dir, 'statsdiff')
118 diffcmd = '$DIFFOUT ${SOURCES[2]} %s > %s' \
119 % (os.path.join(tgt_dir, 'stats.txt'), statsdiff)
120 diffcmd = env.subst(diffcmd, target=target, source=source)
114 print "===== Output differences ====="
115 print contents(outdiff)
116 # Run diff-out on stats.txt file
117 statsdiff = os.path.join(tgt_dir, 'statsdiff')
118 diffcmd = '$DIFFOUT ${SOURCES[2]} %s > %s' \
119 % (os.path.join(tgt_dir, 'stats.txt'), statsdiff)
120 diffcmd = env.subst(diffcmd, target=target, source=source)
121 status = Execute(diffcmd, strfunction=None)
121 status = env.Execute(diffcmd, strfunction=None)
122 print "===== Statistics differences ====="
123 print contents(statsdiff)
124
125 else: # m5 exit status != 0
126 # M5 did not terminate properly, so no need to check the output
127 if signaled(status):
128 print 'M5 terminated with signal', signum(status)
129 if signum(status) in retry_signals:

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

200 for f in copy_files:
201 if f in dest_files:
202 print " Replacing file", f
203 dest_files.remove(f)
204 else:
205 print " Creating new file", f
206 copyAction = Copy(os.path.join(dest_dir, f), os.path.join(src_dir, f))
207 copyAction.strfunction = None
122 print "===== Statistics differences ====="
123 print contents(statsdiff)
124
125 else: # m5 exit status != 0
126 # M5 did not terminate properly, so no need to check the output
127 if signaled(status):
128 print 'M5 terminated with signal', signum(status)
129 if signum(status) in retry_signals:

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

200 for f in copy_files:
201 if f in dest_files:
202 print " Replacing file", f
203 dest_files.remove(f)
204 else:
205 print " Creating new file", f
206 copyAction = Copy(os.path.join(dest_dir, f), os.path.join(src_dir, f))
207 copyAction.strfunction = None
208 Execute(copyAction)
208 env.Execute(copyAction)
209 return 0
210
211def update_test_string(target, source, env):
212 return env.subst("Updating ${SOURCES[0].dir} from ${SOURCES[1].dir}",
213 target=target, source=source)
214
215updateAction = env.Action(update_test, update_test_string)
216

--- 59 unchanged lines hidden ---
209 return 0
210
211def update_test_string(target, source, env):
212 return env.subst("Updating ${SOURCES[0].dir} from ${SOURCES[1].dir}",
213 target=target, source=source)
214
215updateAction = env.Action(update_test, update_test_string)
216

--- 59 unchanged lines hidden ---