[Crosstoolchain-logs] [device-tree-compiler] 150/198: Extend path_offset testcase for handling of duplicated separators

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:07:03 UTC 2016


This is an automated email from the git hooks/post-receive script.

zumbi pushed a commit to branch upstream/1.4.x
in repository device-tree-compiler.

commit ecd4f9d125fa58898dd7c4811e854e3d52146d1f
Author: David Gibson <david at gibson.dropbear.id.au>
Date:   Tue Apr 7 14:25:39 2015 +1000

    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 at gibson.dropbear.id.au>
---
 tests/path_offset.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/tests/path_offset.c b/tests/path_offset.c
index 0ff710d..af53daf 100644
--- a/tests/path_offset.c
+++ b/tests/path_offset.c
@@ -58,6 +58,8 @@ static void check_path_offset(void *fdt, char *path, int offset)
 {
 	int rc;
 
+	verbose_printf("Checking offset of \"%s\" is %d...\n", path, offset);
+
 	rc = fdt_path_offset(fdt, path);
 	if (rc < 0)
 		FAIL("fdt_path_offset(\"%s\") failed: %s",
@@ -92,5 +94,13 @@ int main(int argc, char *argv[])
 	check_path_offset(fdt, "/subnode at 2/subsubnode at 0", subsubnode2_offset);
 	check_path_offset(fdt, "/subnode at 2/subsubnode", subsubnode2_offset2);
 
+	/* Test paths with extraneous separators */
+	check_path_offset(fdt, "//", 0);
+	check_path_offset(fdt, "///", 0);
+	check_path_offset(fdt, "//subnode at 1", subnode1_offset);
+	check_path_offset(fdt, "/subnode at 1/", subnode1_offset);
+	check_path_offset(fdt, "//subnode at 1///", subnode1_offset);
+	check_path_offset(fdt, "/subnode at 2////subsubnode", subsubnode2_offset2);
+
 	PASS();
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list