[rtems-libbsd commit] testsuite/nfs: Check the path returned by getcwd

Chris Johns chrisj at rtems.org
Wed Aug 9 13:30:32 UTC 2023


Module:    rtems-libbsd
Branch:    6-freebsd-12
Commit:    afc6ad0525bd90659cbadaa4dffd29c86db18929
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=afc6ad0525bd90659cbadaa4dffd29c86db18929

Author:    Chris Johns <chrisj at rtems.org>
Date:      Sun Aug  6 15:49:31 2023 +1000

testsuite/nfs: Check the path returned by getcwd

---

 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);



More information about the vc mailing list