summaryrefslogtreecommitdiff
path: root/tests/nop_node.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2007-11-20 13:35:46 +1100
committerJon Loeliger <jdl@freescale.com>2007-11-20 09:00:37 -0600
commit9521dc5ecc66c158cd6853cabba2c29f545780f6 (patch)
tree066c76f58e756bc166b2ed9d670c8975ecc04961 /tests/nop_node.c
parent682576d85bd159fc25ef99ab35a997fda172592e (diff)
downloaddevice-tree-compiler-9521dc5ecc66c158cd6853cabba2c29f545780f6.tar.gz
libfdt: Abolish _typed() variants, add _cell() variants
In a number of places through libfdt and its tests, we have *_typed() macro variants on functions which use gcc's typeof and statement expression extensions to allow passing literals where the underlying function takes a buffer and size. These seemed like a good idea at the time, but in fact they have some problems. They use typeof and statement expressions, extensions I'd prefer to avoid for portability. Plus, they have potential gotchas - although they'll deal with the size of the thing passed, they won't deal with other representation issues (like endianness) and results could be very strange if the type of the expression passed isn't what you think it is. In fact, the only users of these _typed() macros were when the value passed is a single cell (32-bit integer). Therefore, this patch removes all these _typed() macros and replaces them with explicit _cell() variants which handle a single 32-bit integer, and which also perform endian convesions as appropriate. With this in place, it now becomes easy to use standardized big-endian representation for integer valued properties in the testcases, regardless of the platform we're running on. We therefore do that, which has the additional advantage that all the example trees created during a test run are now byte-for-byte identical regardless of platform. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests/nop_node.c')
-rw-r--r--tests/nop_node.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/nop_node.c b/tests/nop_node.c
index ab487a4..ea3a18f 100644
--- a/tests/nop_node.c
+++ b/tests/nop_node.c
@@ -43,19 +43,19 @@ int main(int argc, char *argv[])
if (subnode1_offset < 0)
FAIL("Couldn't find \"/subnode1\": %s",
fdt_strerror(subnode1_offset));
- check_getprop_typed(fdt, subnode1_offset, "prop-int", TEST_VALUE_1);
+ check_getprop_cell(fdt, subnode1_offset, "prop-int", TEST_VALUE_1);
subnode2_offset = fdt_path_offset(fdt, "/subnode@2");
if (subnode2_offset < 0)
FAIL("Couldn't find \"/subnode2\": %s",
fdt_strerror(subnode2_offset));
- check_getprop_typed(fdt, subnode2_offset, "prop-int", TEST_VALUE_2);
+ check_getprop_cell(fdt, subnode2_offset, "prop-int", TEST_VALUE_2);
subsubnode2_offset = fdt_path_offset(fdt, "/subnode@2/subsubnode");
if (subsubnode2_offset < 0)
FAIL("Couldn't find \"/subnode@2/subsubnode\": %s",
fdt_strerror(subsubnode2_offset));
- check_getprop_typed(fdt, subsubnode2_offset, "prop-int", TEST_VALUE_2);
+ check_getprop_cell(fdt, subsubnode2_offset, "prop-int", TEST_VALUE_2);
err = fdt_nop_node(fdt, subnode1_offset);
if (err)
@@ -71,13 +71,13 @@ int main(int argc, char *argv[])
if (subnode2_offset < 0)
FAIL("Couldn't find \"/subnode2\": %s",
fdt_strerror(subnode2_offset));
- check_getprop_typed(fdt, subnode2_offset, "prop-int", TEST_VALUE_2);
+ check_getprop_cell(fdt, subnode2_offset, "prop-int", TEST_VALUE_2);
subsubnode2_offset = fdt_path_offset(fdt, "/subnode@2/subsubnode");
if (subsubnode2_offset < 0)
FAIL("Couldn't find \"/subnode@2/subsubnode\": %s",
fdt_strerror(subsubnode2_offset));
- check_getprop_typed(fdt, subsubnode2_offset, "prop-int", TEST_VALUE_2);
+ check_getprop_cell(fdt, subsubnode2_offset, "prop-int", TEST_VALUE_2);
err = fdt_nop_node(fdt, subnode2_offset);
if (err)