[PATCH rtems-libbsd 6-freebsd-12 2/2] testsuite/nfs: Check the path returned by getcwd

chrisj at rtems.org chrisj at rtems.org
Sun Aug 6 05:54:17 UTC 2023


From: Chris Johns <chrisj at rtems.org>

---
 testsuite/nfs01/test_main.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/testsuite/nfs01/test_main.c b/testsuite/nfs01/test_main.c
index cdcbb1cd..a3d75ddd 100644
--- a/testsuite/nfs01/test_main.c
+++ b/testsuite/nfs01/test_main.c
@@ -317,21 +317,28 @@ static void
 test_path_eval(const char *base, int depth)
 {
 	char path[MAXPATHLEN];
+	char curpath[MAXPATHLEN];
+	char getpath[MAXPATHLEN];
 	int l;
 
-	printf("test path eval\n");
+	printf("test path eval: %s\n", base);
 
 	test_setup(base);
 
+	sprintf(curpath, "%s/%s", base, test_top);
+
 	for (l = 1; l <= depth; ++l) {
 		snprintf(path, sizeof(path), "%d", l);
-		printf("test: nfs: mkdir: %s\n", path);
+		strcat(curpath, "/");
+		strcat(curpath, path);
+		printf("test: nfs: mkdir: %s (%s)\n", path, curpath);
 		rtems_test_errno_assert(mkdir(path, 0777) == 0);
-		printf("test: nfs: chdir: %s\n", path);
+		printf("test: nfs: chdir: %s (%s)\n", path, curpath);
 		rtems_test_errno_assert(chdir(path) == 0);
-		printf("test: nfs: getcwd: %s\n", path);
-		assert(getcwd(path, sizeof(path)) != NULL);
-		printf("test: nfs: getcwd: %s\n", path);
+		printf("test: nfs: getcwd: %s (%s)\n", path, curpath);
+		assert(getcwd(getpath, sizeof(getpath)) != NULL);
+		printf("test: nfs: getcwd: %s (want: %s)\n", getpath, curpath);
+		assert(strcmp(curpath, getpath) == 0);
 	}
 
 	test_cleanup(base);
-- 
2.37.1



More information about the devel mailing list