SConscript (4936:b05a404dce16) SConscript (4937:04ace9ab855e)
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

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

97testAction = env.Action(check_test, check_test_string)
98
99def print_test(target, source, env):
100 print '***** ' + contents(source[0])
101 return 0
102
103printAction = env.Action(print_test, strfunction = None)
104
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

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

97testAction = env.Action(check_test, check_test_string)
98
99def print_test(target, source, env):
100 print '***** ' + contents(source[0])
101 return 0
102
103printAction = env.Action(print_test, strfunction = None)
104
105# Static vars for update_test:
106# - long-winded message about ignored sources
107ignore_msg = '''
108Note: The following file(s) will not be copied. New non-standard
109 output files must be copied manually once before update_ref will
110 recognize them as outputs. Otherwise they are assumed to be
111 inputs and are ignored.
112'''
113# - reference files always needed
114needed_files = set(['stdout', 'stderr', 'm5stats.txt', 'config.ini'])
115# - source files we always want to ignore
116known_ignores = set(['status', 'outdiff', 'statsdiff'])
117
105def update_test(target, source, env):
106 """Update reference test outputs.
107
108 Target is phony. First two sources are the ref & new m5stats.txt
109 files, respectively. We actually copy everything in the
110 respective directories except the status & diff output files.
111
112 """
113 dest_dir = str(source[0].get_dir())
114 src_dir = str(source[1].get_dir())
118def update_test(target, source, env):
119 """Update reference test outputs.
120
121 Target is phony. First two sources are the ref & new m5stats.txt
122 files, respectively. We actually copy everything in the
123 respective directories except the status & diff output files.
124
125 """
126 dest_dir = str(source[0].get_dir())
127 src_dir = str(source[1].get_dir())
115 dest_files = os.listdir(dest_dir)
116 src_files = os.listdir(src_dir)
117 for f in ('stdout', 'stderr', 'm5stats.txt', 'config.ini'):
128 dest_files = set(os.listdir(dest_dir))
129 src_files = set(os.listdir(src_dir))
130 # Copy all of the required files plus any existing dest files.
131 wanted_files = needed_files | dest_files
132 missing_files = wanted_files - src_files
133 if len(missing_files) > 0:
134 print " WARNING: the following file(s) are missing " \
135 "and will not be updated:"
136 print " ", " ,".join(missing_files)
137 copy_files = wanted_files - missing_files
138 warn_ignored_files = (src_files - copy_files) - known_ignores
139 if len(warn_ignored_files) > 0:
140 print ignore_msg,
141 print " ", ", ".join(warn_ignored_files)
142 for f in copy_files:
118 if f in dest_files:
119 print " Replacing file", f
120 dest_files.remove(f)
121 else:
122 print " Creating new file", f
123 copyAction = Copy(os.path.join(dest_dir, f), os.path.join(src_dir, f))
124 copyAction.strfunction = None
125 Execute(copyAction)
143 if f in dest_files:
144 print " Replacing file", f
145 dest_files.remove(f)
146 else:
147 print " Creating new file", f
148 copyAction = Copy(os.path.join(dest_dir, f), os.path.join(src_dir, f))
149 copyAction.strfunction = None
150 Execute(copyAction)
126 # warn about any files in dest not overwritten (other than SCCS dir)
127 if 'SCCS' in dest_files:
128 dest_files.remove('SCCS')
129 if dest_files:
130 print "Warning: file(s) in", dest_dir, "not updated:",
131 print ', '.join(dest_files)
132 return 0
133
134def update_test_string(target, source, env):
135 return env.subst("Updating ${SOURCES[0].dir} from ${SOURCES[1].dir}",
136 target=target, source=source)
137
138updateAction = env.Action(update_test, update_test_string)
139

--- 80 unchanged lines hidden ---
151 return 0
152
153def update_test_string(target, source, env):
154 return env.subst("Updating ${SOURCES[0].dir} from ${SOURCES[1].dir}",
155 target=target, source=source)
156
157updateAction = env.Action(update_test, update_test_string)
158

--- 80 unchanged lines hidden ---