ut_assertok(console_record_reset_enable());
ut_assertok(run_commandf("fdt get value var %s %s %s",
node, prop, idx ? : ""));
- if (strres) {
+ if (strres)
ut_asserteq_str(strres, env_get("var"));
- } else {
+ else
ut_asserteq(intres, env_get_hex("var", 0x1234));
- }
ut_assertok(ut_check_console_end(uts));
return 0;
const char *node)
{
/* Test getting default element of $node node clock-names property */
- fdt_test_get_value_string(uts, node, "clock-names", NULL, "fixed", 0);
+ ut_assertok(fdt_test_get_value_string(uts, node, "clock-names", NULL,
+ "fixed", 0));
/* Test getting 0th element of $node node clock-names property */
- fdt_test_get_value_string(uts, node, "clock-names", "0", "fixed", 0);
+ ut_assertok(fdt_test_get_value_string(uts, node, "clock-names", "0",
+ "fixed", 0));
/* Test getting 1st element of $node node clock-names property */
- fdt_test_get_value_string(uts, node, "clock-names", "1", "i2c", 0);
+ ut_assertok(fdt_test_get_value_string(uts, node, "clock-names", "1",
+ "i2c", 0));
/* Test getting 2nd element of $node node clock-names property */
- fdt_test_get_value_string(uts, node, "clock-names", "2", "spi", 0);
+ ut_assertok(fdt_test_get_value_string(uts, node, "clock-names", "2",
+ "spi", 0));
/*
* Test getting default element of $node node regs property.
* but only if the array is shorter than 40 characters. Anything
* longer is an error. This is a special case for handling hashes.
*/
- fdt_test_get_value_string(uts, node, "regs", NULL, "3412000000100000", 0);
+ ut_assertok(fdt_test_get_value_string(uts, node, "regs", NULL,
+ "3412000000100000", 0));
/* Test getting 0th element of $node node regs property */
- fdt_test_get_value_string(uts, node, "regs", "0", NULL, 0x1234);
+ ut_assertok(fdt_test_get_value_string(uts, node, "regs", "0", NULL,
+ 0x1234));
/* Test getting 1st element of $node node regs property */
- fdt_test_get_value_string(uts, node, "regs", "1", NULL, 0x1000);
+ ut_assertok(fdt_test_get_value_string(uts, node, "regs", "1", NULL,
+ 0x1000));
/* Test missing 10th element of $node node clock-names property */
ut_assertok(console_record_reset_enable());
{
char fdt[4096];
ulong addr;
- int ret;
ut_assertok(make_fuller_fdt(uts, fdt, sizeof(fdt)));
addr = map_to_sysmem(fdt);
set_working_fdt_addr(addr);
- ret = fdt_test_get_value_common(uts, "/test-node@1234");
- if (!ret)
- ret = fdt_test_get_value_common(uts, "testnodealias");
- if (ret)
- return ret;
+ ut_assertok(fdt_test_get_value_common(uts, "/test-node@1234"));
+ ut_assertok(fdt_test_get_value_common(uts, "testnodealias"));
/* Test getting default element of /nonexistent node */
ut_assertok(console_record_reset_enable());
set_working_fdt_addr(addr);
/* Test getting address of root node / string property "compatible" */
- fdt_test_get_addr_common(uts, fdt, "/", "compatible");
+ ut_assertok(fdt_test_get_addr_common(uts, fdt, "/", "compatible"));
/* Test getting address of node /test-node@1234 stringlist property "clock-names" */
- fdt_test_get_addr_common(uts, fdt, "/test-node@1234", "clock-names");
- fdt_test_get_addr_common(uts, fdt, "testnodealias", "clock-names");
+ ut_assertok(fdt_test_get_addr_common(uts, fdt, "/test-node@1234",
+ "clock-names"));
+ ut_assertok(fdt_test_get_addr_common(uts, fdt, "testnodealias",
+ "clock-names"));
/* Test getting address of node /test-node@1234 u32 property "clock-frequency" */
- fdt_test_get_addr_common(uts, fdt, "/test-node@1234", "clock-frequency");
- fdt_test_get_addr_common(uts, fdt, "testnodealias", "clock-frequency");
+ ut_assertok(fdt_test_get_addr_common(uts, fdt, "/test-node@1234",
+ "clock-frequency"));
+ ut_assertok(fdt_test_get_addr_common(uts, fdt, "testnodealias",
+ "clock-frequency"));
/* Test getting address of node /test-node@1234 empty property "u-boot,empty-property" */
- fdt_test_get_addr_common(uts, fdt, "/test-node@1234", "u-boot,empty-property");
- fdt_test_get_addr_common(uts, fdt, "testnodealias", "u-boot,empty-property");
+ ut_assertok(fdt_test_get_addr_common(uts, fdt, "/test-node@1234",
+ "u-boot,empty-property"));
+ ut_assertok(fdt_test_get_addr_common(uts, fdt, "testnodealias",
+ "u-boot,empty-property"));
/* Test getting address of node /test-node@1234 array property "regs" */
- fdt_test_get_addr_common(uts, fdt, "/test-node@1234", "regs");
- fdt_test_get_addr_common(uts, fdt, "testnodealias", "regs");
+ ut_assertok(fdt_test_get_addr_common(uts, fdt, "/test-node@1234",
+ "regs"));
+ ut_assertok(fdt_test_get_addr_common(uts, fdt, "testnodealias",
+ "regs"));
/* Test getting address of node /test-node@1234/subnode non-existent property "noprop" */
ut_assertok(console_record_reset_enable());
set_working_fdt_addr(addr);
/* Test getting size of root node / string property "compatible" */
- fdt_test_get_size_common(uts, "/", "compatible", 16);
+ ut_assertok(fdt_test_get_size_common(uts, "/", "compatible", 16));
/* Test getting size of node /test-node@1234 stringlist property "clock-names" */
- fdt_test_get_size_common(uts, "/test-node@1234", "clock-names", 26);
- fdt_test_get_size_common(uts, "testnodealias", "clock-names", 26);
+ ut_assertok(fdt_test_get_size_common(uts, "/test-node@1234",
+ "clock-names", 26));
+ ut_assertok(fdt_test_get_size_common(uts, "testnodealias",
+ "clock-names", 26));
/* Test getting size of node /test-node@1234 u32 property "clock-frequency" */
- fdt_test_get_size_common(uts, "/test-node@1234", "clock-frequency", 4);
- fdt_test_get_size_common(uts, "testnodealias", "clock-frequency", 4);
+ ut_assertok(fdt_test_get_size_common(uts, "/test-node@1234",
+ "clock-frequency", 4));
+ ut_assertok(fdt_test_get_size_common(uts, "testnodealias",
+ "clock-frequency", 4));
/* Test getting size of node /test-node@1234 empty property "u-boot,empty-property" */
- fdt_test_get_size_common(uts, "/test-node@1234", "u-boot,empty-property", 0);
- fdt_test_get_size_common(uts, "testnodealias", "u-boot,empty-property", 0);
+ ut_assertok(fdt_test_get_size_common(uts, "/test-node@1234",
+ "u-boot,empty-property", 0));
+ ut_assertok(fdt_test_get_size_common(uts, "testnodealias",
+ "u-boot,empty-property", 0));
/* Test getting size of node /test-node@1234 array property "regs" */
- fdt_test_get_size_common(uts, "/test-node@1234", "regs", 8);
- fdt_test_get_size_common(uts, "testnodealias", "regs", 8);
+ ut_assertok(fdt_test_get_size_common(uts, "/test-node@1234", "regs",
+ 8));
+ ut_assertok(fdt_test_get_size_common(uts, "testnodealias", "regs", 8));
/* Test getting node count of node / */
- fdt_test_get_size_common(uts, "/", NULL, 2);
+ ut_assertok(fdt_test_get_size_common(uts, "/", NULL, 2));
/* Test getting node count of node /test-node@1234/subnode */
- fdt_test_get_size_common(uts, "/test-node@1234/subnode", NULL, 0);
- fdt_test_get_size_common(uts, "subnodealias", NULL, 0);
+ ut_assertok(fdt_test_get_size_common(uts, "/test-node@1234/subnode",
+ NULL, 0));
+ ut_assertok(fdt_test_get_size_common(uts, "subnodealias", NULL, 0));
/* Test getting size of node /test-node@1234/subnode non-existent property "noprop" */
ut_assertok(console_record_reset_enable());
static int fdt_test_set_node(struct unit_test_state *uts,
const char *path, const char *prop)
{
- fdt_test_set_single(uts, path, prop, "new", 0, false);
- fdt_test_set_single(uts, path, prop, "rewrite", 0, false);
- fdt_test_set_single(uts, path, prop, NULL, 42, true);
- fdt_test_set_single(uts, path, prop, NULL, 0, false);
- fdt_test_set_multi(uts, path, prop, NULL, NULL, 42, 1701);
- fdt_test_set_multi(uts, path, prop, NULL, NULL, 74656, 9);
- fdt_test_set_multi(uts, path, prop, "42", "1701", 0, 0);
- fdt_test_set_multi(uts, path, prop, "74656", "9", 0, 0);
+ ut_assertok(fdt_test_set_single(uts, path, prop, "new", 0, false));
+ ut_assertok(fdt_test_set_single(uts, path, prop, "rewrite", 0, false));
+ ut_assertok(fdt_test_set_single(uts, path, prop, NULL, 42, true));
+ ut_assertok(fdt_test_set_single(uts, path, prop, NULL, 0, false));
+ ut_assertok(fdt_test_set_multi(uts, path, prop, NULL, NULL, 42, 1701));
+ ut_assertok(fdt_test_set_multi(uts, path, prop, NULL, NULL, 74656, 9));
+ ut_assertok(fdt_test_set_multi(uts, path, prop, "42", "1701", 0, 0));
+ ut_assertok(fdt_test_set_multi(uts, path, prop, "74656", "9", 0, 0));
return 0;
}
set_working_fdt_addr(addr);
/* Test setting of root node / existing property "compatible" */
- fdt_test_set_node(uts, "/", "compatible");
+ ut_assertok(fdt_test_set_node(uts, "/", "compatible"));
/* Test setting of root node / new property "newproperty" */
- fdt_test_set_node(uts, "/", "newproperty");
+ ut_assertok(fdt_test_set_node(uts, "/", "newproperty"));
/* Test setting of subnode existing property "compatible" */
- fdt_test_set_node(uts, "/test-node@1234/subnode", "compatible");
- fdt_test_set_node(uts, "subnodealias", "compatible");
+ ut_assertok(fdt_test_set_node(uts, "/test-node@1234/subnode",
+ "compatible"));
+ ut_assertok(fdt_test_set_node(uts, "subnodealias", "compatible"));
/* Test setting of subnode new property "newproperty" */
- fdt_test_set_node(uts, "/test-node@1234/subnode", "newproperty");
- fdt_test_set_node(uts, "subnodealias", "newproperty");
+ ut_assertok(fdt_test_set_node(uts, "/test-node@1234/subnode",
+ "newproperty"));
+ ut_assertok(fdt_test_set_node(uts, "subnodealias", "newproperty"));
/* Test setting property of non-existent node */
ut_assertok(console_record_reset_enable());
ut_assertok(ut_check_console_end(uts));
/* Test header get */
- fdt_test_header_get(uts, "magic", fdt_magic(fdt));
- fdt_test_header_get(uts, "totalsize", fdt_totalsize(fdt));
- fdt_test_header_get(uts, "off_dt_struct", fdt_off_dt_struct(fdt));
- fdt_test_header_get(uts, "off_dt_strings", fdt_off_dt_strings(fdt));
- fdt_test_header_get(uts, "off_mem_rsvmap", fdt_off_mem_rsvmap(fdt));
- fdt_test_header_get(uts, "version", fdt_version(fdt));
- fdt_test_header_get(uts, "last_comp_version", fdt_last_comp_version(fdt));
- fdt_test_header_get(uts, "boot_cpuid_phys", fdt_boot_cpuid_phys(fdt));
- fdt_test_header_get(uts, "size_dt_strings", fdt_size_dt_strings(fdt));
- fdt_test_header_get(uts, "size_dt_struct", fdt_size_dt_struct(fdt));
+ ut_assertok(fdt_test_header_get(uts, "magic", fdt_magic(fdt)));
+ ut_assertok(fdt_test_header_get(uts, "totalsize", fdt_totalsize(fdt)));
+ ut_assertok(fdt_test_header_get(uts, "off_dt_struct",
+ fdt_off_dt_struct(fdt)));
+ ut_assertok(fdt_test_header_get(uts, "off_dt_strings",
+ fdt_off_dt_strings(fdt)));
+ ut_assertok(fdt_test_header_get(uts, "off_mem_rsvmap",
+ fdt_off_mem_rsvmap(fdt)));
+ ut_assertok(fdt_test_header_get(uts, "version", fdt_version(fdt)));
+ ut_assertok(fdt_test_header_get(uts, "last_comp_version",
+ fdt_last_comp_version(fdt)));
+ ut_assertok(fdt_test_header_get(uts, "boot_cpuid_phys",
+ fdt_boot_cpuid_phys(fdt)));
+ ut_assertok(fdt_test_header_get(uts, "size_dt_strings",
+ fdt_size_dt_strings(fdt)));
+ ut_assertok(fdt_test_header_get(uts, "size_dt_struct",
+ fdt_size_dt_struct(fdt)));
return 0;
}
* so far unsupported and fails because of simple_stroull() being
* 64bit tops in the 'fdt memory' command implementation.
*/
- fdt_test_memory_cells(uts, 1);
- fdt_test_memory_cells(uts, 2);
+ ut_assertok(fdt_test_memory_cells(uts, 1));
+ ut_assertok(fdt_test_memory_cells(uts, 2));
/*
* The 'fdt memory' command is limited to /memory node, it does