mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
Extend path_offset testcase for handling of duplicated separators
Paths with multiple '/' characters in a row (e.g. //somenode//somsubnode), or trailing '/' characters (e.g. '/somenode/somesubnode/') should be handled by fdt_path_offset(), and treated as equivalent to /somenode/somesubnode. Our current path_offset testcase doesn't check for these cases, so extend it so it does. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
5fa047f498
commit
ecd4f9d125
1 changed files with 10 additions and 0 deletions
|
@ -58,6 +58,8 @@ static void check_path_offset(void *fdt, char *path, int offset)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
verbose_printf("Checking offset of \"%s\" is %d...\n", path, offset);
|
||||||
|
|
||||||
rc = fdt_path_offset(fdt, path);
|
rc = fdt_path_offset(fdt, path);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
FAIL("fdt_path_offset(\"%s\") failed: %s",
|
FAIL("fdt_path_offset(\"%s\") failed: %s",
|
||||||
|
@ -92,5 +94,13 @@ int main(int argc, char *argv[])
|
||||||
check_path_offset(fdt, "/subnode@2/subsubnode@0", subsubnode2_offset);
|
check_path_offset(fdt, "/subnode@2/subsubnode@0", subsubnode2_offset);
|
||||||
check_path_offset(fdt, "/subnode@2/subsubnode", subsubnode2_offset2);
|
check_path_offset(fdt, "/subnode@2/subsubnode", subsubnode2_offset2);
|
||||||
|
|
||||||
|
/* Test paths with extraneous separators */
|
||||||
|
check_path_offset(fdt, "//", 0);
|
||||||
|
check_path_offset(fdt, "///", 0);
|
||||||
|
check_path_offset(fdt, "//subnode@1", subnode1_offset);
|
||||||
|
check_path_offset(fdt, "/subnode@1/", subnode1_offset);
|
||||||
|
check_path_offset(fdt, "//subnode@1///", subnode1_offset);
|
||||||
|
check_path_offset(fdt, "/subnode@2////subsubnode", subsubnode2_offset2);
|
||||||
|
|
||||||
PASS();
|
PASS();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue