scons: Ensure dictionary iteration is sorted by key
This patch adds sorting based on the SimObject name or parameter name for all situations where we iterate over dictionaries. This should ensure a deterministic and consistent order across the host systems and hopefully avoid regression results differing across python versions.
This commit is contained in:
parent
5d22250845
commit
966c3f4bc5
3 changed files with 9 additions and 9 deletions
|
@ -216,7 +216,7 @@ use_prefixes = [
|
||||||
]
|
]
|
||||||
|
|
||||||
use_env = {}
|
use_env = {}
|
||||||
for key,val in os.environ.iteritems():
|
for key,val in sorted(os.environ.iteritems()):
|
||||||
if key in use_vars or \
|
if key in use_vars or \
|
||||||
any([key.startswith(prefix) for prefix in use_prefixes]):
|
any([key.startswith(prefix) for prefix in use_prefixes]):
|
||||||
use_env[key] = val
|
use_env[key] = val
|
||||||
|
|
|
@ -528,6 +528,7 @@ for name,obj in sorted(sim_objects.iteritems()):
|
||||||
#
|
#
|
||||||
module_depends = ["m5", "m5.SimObject", "m5.params"]
|
module_depends = ["m5", "m5.SimObject", "m5.params"]
|
||||||
depends = [ PySource.modules[dep].snode for dep in module_depends ]
|
depends = [ PySource.modules[dep].snode for dep in module_depends ]
|
||||||
|
depends.sort(key = lambda x: x.name)
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
#
|
#
|
||||||
|
@ -717,7 +718,7 @@ if GetOption('with_cxx_config'):
|
||||||
env.Command(cxx_config_init_cc_file, Value(name),
|
env.Command(cxx_config_init_cc_file, Value(name),
|
||||||
MakeAction(createCxxConfigInitCC, Transform("CXXCINIT")))
|
MakeAction(createCxxConfigInitCC, Transform("CXXCINIT")))
|
||||||
cxx_param_hh_files = ["cxx_config/%s.hh" % simobj
|
cxx_param_hh_files = ["cxx_config/%s.hh" % simobj
|
||||||
for simobj in sorted(sim_objects.itervalues())
|
for name,simobj in sorted(sim_objects.iteritems())
|
||||||
if not hasattr(simobj, 'abstract') or not simobj.abstract]
|
if not hasattr(simobj, 'abstract') or not simobj.abstract]
|
||||||
Depends(cxx_config_init_cc_file, cxx_param_hh_files +
|
Depends(cxx_config_init_cc_file, cxx_param_hh_files +
|
||||||
[File('sim/cxx_config.hh')])
|
[File('sim/cxx_config.hh')])
|
||||||
|
@ -725,7 +726,7 @@ if GetOption('with_cxx_config'):
|
||||||
|
|
||||||
# Generate any needed param SWIG wrapper files
|
# Generate any needed param SWIG wrapper files
|
||||||
params_i_files = []
|
params_i_files = []
|
||||||
for name,param in params_to_swig.iteritems():
|
for name,param in sorted(params_to_swig.iteritems()):
|
||||||
i_file = File('python/m5/internal/%s.i' % (param.swig_module_name()))
|
i_file = File('python/m5/internal/%s.i' % (param.swig_module_name()))
|
||||||
params_i_files.append(i_file)
|
params_i_files.append(i_file)
|
||||||
env.Command(i_file, Value(name),
|
env.Command(i_file, Value(name),
|
||||||
|
@ -760,10 +761,9 @@ for name,enum in sorted(all_enums.iteritems()):
|
||||||
SwigSource('m5.internal', i_file)
|
SwigSource('m5.internal', i_file)
|
||||||
|
|
||||||
# Generate SimObject SWIG wrapper files
|
# Generate SimObject SWIG wrapper files
|
||||||
for name,simobj in sim_objects.iteritems():
|
for name,simobj in sorted(sim_objects.iteritems()):
|
||||||
py_source = PySource.modules[simobj.__module__]
|
py_source = PySource.modules[simobj.__module__]
|
||||||
extra_deps = [ py_source.tnode ]
|
extra_deps = [ py_source.tnode ]
|
||||||
|
|
||||||
i_file = File('python/m5/internal/param_%s.i' % name)
|
i_file = File('python/m5/internal/param_%s.i' % name)
|
||||||
env.Command(i_file, Value(name),
|
env.Command(i_file, Value(name),
|
||||||
MakeAction(createSimObjectSwigWrapper, Transform("SO SWIG")))
|
MakeAction(createSimObjectSwigWrapper, Transform("SO SWIG")))
|
||||||
|
|
|
@ -691,8 +691,8 @@ class MetaSimObject(type):
|
||||||
# The 'local' attribute restricts us to the params declared in
|
# The 'local' attribute restricts us to the params declared in
|
||||||
# the object itself, not including inherited params (which
|
# the object itself, not including inherited params (which
|
||||||
# will also be inherited from the base class's param struct
|
# will also be inherited from the base class's param struct
|
||||||
# here).
|
# here). Sort the params based on their key
|
||||||
params = cls._params.local.values()
|
params = map(lambda (k, v): v, sorted(cls._params.local.items()))
|
||||||
ports = cls._ports.local
|
ports = cls._ports.local
|
||||||
|
|
||||||
code('%module(package="m5.internal") param_$cls')
|
code('%module(package="m5.internal") param_$cls')
|
||||||
|
@ -772,8 +772,8 @@ using std::ptrdiff_t;
|
||||||
# The 'local' attribute restricts us to the params declared in
|
# The 'local' attribute restricts us to the params declared in
|
||||||
# the object itself, not including inherited params (which
|
# the object itself, not including inherited params (which
|
||||||
# will also be inherited from the base class's param struct
|
# will also be inherited from the base class's param struct
|
||||||
# here).
|
# here). Sort the params based on their key
|
||||||
params = cls._params.local.values()
|
params = map(lambda (k, v): v, sorted(cls._params.local.items()))
|
||||||
ports = cls._ports.local
|
ports = cls._ports.local
|
||||||
try:
|
try:
|
||||||
ptypes = [p.ptype for p in params]
|
ptypes = [p.ptype for p in params]
|
||||||
|
|
Loading…
Reference in a new issue