]>
git.saurik.com Git - apple/hfs.git/blob - tests/cases/test-deep-rm.c
fcea66412670c9ecacd86bfcf6b4f70ac67d8a0e
6 #include "test-utils.h"
7 #include "disk-image.h"
11 static disk_image_t
*di
;
13 static void rm_all(const char *path
)
15 char *p
= strdup(path
);
18 assert_no_err(posix_spawn(&pid
, "/bin/rm", NULL
, NULL
,
19 (char *[]){ "rm", "-rf", p
, NULL
}, NULL
));
24 assert_with_errno(waitpid(pid
, &stat
, 0) == pid
);
27 int run_deep_rm(__unused test_ctx_t
*ctx
)
29 di
= disk_image_get();
32 asprintf(&dir
, "%s/deep-rm-test", di
->mount_point
);
36 assert_no_err(mkdir(dir
, 0777));
41 char *end
= path
+ strlen(path
);
43 for (int i
= 0; i
< 100; ++i
) {
44 memcpy(end
, "/dir", 5);
45 assert_no_err(mkdir(path
, 0777));
49 assert_no_err(chdir(path
));
53 assert_no_err(chdir(di
->mount_point
));