mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-10-15 03:17:56 +08:00
testsuite/nfs: Check the path returned by getcwd
This commit is contained in:
@@ -317,21 +317,28 @@ static void
|
|||||||
test_path_eval(const char *base, int depth)
|
test_path_eval(const char *base, int depth)
|
||||||
{
|
{
|
||||||
char path[MAXPATHLEN];
|
char path[MAXPATHLEN];
|
||||||
|
char curpath[MAXPATHLEN];
|
||||||
|
char getpath[MAXPATHLEN];
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
printf("test path eval\n");
|
printf("test path eval: %s\n", base);
|
||||||
|
|
||||||
test_setup(base);
|
test_setup(base);
|
||||||
|
|
||||||
|
sprintf(curpath, "%s/%s", base, test_top);
|
||||||
|
|
||||||
for (l = 1; l <= depth; ++l) {
|
for (l = 1; l <= depth; ++l) {
|
||||||
snprintf(path, sizeof(path), "%d", 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);
|
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);
|
rtems_test_errno_assert(chdir(path) == 0);
|
||||||
printf("test: nfs: getcwd: %s\n", path);
|
printf("test: nfs: getcwd: %s (%s)\n", path, curpath);
|
||||||
assert(getcwd(path, sizeof(path)) != NULL);
|
assert(getcwd(getpath, sizeof(getpath)) != NULL);
|
||||||
printf("test: nfs: getcwd: %s\n", path);
|
printf("test: nfs: getcwd: %s (want: %s)\n", getpath, curpath);
|
||||||
|
assert(strcmp(curpath, getpath) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
test_cleanup(base);
|
test_cleanup(base);
|
||||||
|
Reference in New Issue
Block a user