dtoc: Sort platdata output from dtoc
At present the order of struct field emitted by this tool depends on the internal workings of a Python dictionary. Sort the fields to remove this uncertainty, so that tests are deterministic. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
90a8132f4d
commit
1953ce7531
@ -464,7 +464,8 @@ class DtbPlatdata(object):
|
||||
var_name = conv_name_to_c(node.name)
|
||||
self.buf('static const struct %s%s %s%s = {\n' %
|
||||
(STRUCT_PREFIX, struct_name, VAL_PREFIX, var_name))
|
||||
for pname, prop in node.props.items():
|
||||
for pname in sorted(node.props):
|
||||
prop = node.props[pname]
|
||||
if pname in PROP_IGNORE_LIST or pname[0] == '#':
|
||||
continue
|
||||
member_name = conv_name_to_c(prop.name)
|
||||
|
@ -199,16 +199,16 @@ struct dtd_sandbox_spl_test_2 {
|
||||
data = infile.read()
|
||||
self._CheckStrings(C_HEADER + '''
|
||||
static const struct dtd_sandbox_spl_test dtv_spl_test = {
|
||||
\t.boolval\t\t= true,
|
||||
\t.bytearray\t\t= {0x6, 0x0, 0x0},
|
||||
\t.byteval\t\t= 0x5,
|
||||
\t.intarray\t\t= {0x2, 0x3, 0x4, 0x0},
|
||||
\t.intval\t\t\t= 0x1,
|
||||
\t.notstring\t\t= {0x20, 0x21, 0x22, 0x10, 0x0},
|
||||
\t.longbytearray\t\t= {0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0x10,
|
||||
\t\t0x11},
|
||||
\t.stringval\t\t= "message",
|
||||
\t.boolval\t\t= true,
|
||||
\t.intarray\t\t= {0x2, 0x3, 0x4, 0x0},
|
||||
\t.notstring\t\t= {0x20, 0x21, 0x22, 0x10, 0x0},
|
||||
\t.stringarray\t\t= {"multi-word", "message", ""},
|
||||
\t.stringval\t\t= "message",
|
||||
};
|
||||
U_BOOT_DEVICE(spl_test) = {
|
||||
\t.name\t\t= "sandbox_spl_test",
|
||||
@ -219,12 +219,12 @@ U_BOOT_DEVICE(spl_test) = {
|
||||
static const struct dtd_sandbox_spl_test dtv_spl_test2 = {
|
||||
\t.bytearray\t\t= {0x1, 0x23, 0x34},
|
||||
\t.byteval\t\t= 0x8,
|
||||
\t.intarray\t\t= {0x5, 0x0, 0x0, 0x0},
|
||||
\t.intval\t\t\t= 0x3,
|
||||
\t.longbytearray\t\t= {0x9, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
|
||||
\t\t0x0},
|
||||
\t.stringval\t\t= "message2",
|
||||
\t.intarray\t\t= {0x5, 0x0, 0x0, 0x0},
|
||||
\t.stringarray\t\t= {"another", "multi-word", "message"},
|
||||
\t.stringval\t\t= "message2",
|
||||
};
|
||||
U_BOOT_DEVICE(spl_test2) = {
|
||||
\t.name\t\t= "sandbox_spl_test",
|
||||
|
Loading…
Reference in New Issue
Block a user