1 /* Creates directories /0/0/0 through /3/2/2 and files in the
2 leaf directories, then removes them. */
7 #include "tests/filesys/extended/mk-tree.h"
9 #include "tests/main.h"
11 static void remove_tree (int at, int bt, int ct, int dt);
16 make_tree (4, 3, 3, 4);
17 remove_tree (4, 3, 3, 4);
20 static void do_remove (const char *format, ...) PRINTF_FORMAT (1, 2);
23 remove_tree (int at, int bt, int ct, int dt)
28 msg ("removing /0/0/0/0 through /%d/%d/%d/%d...",
29 at - 1, bt - 1, ct - 1, dt - 1);
31 for (a = 0; a < at; a++)
33 for (b = 0; b < bt; b++)
35 for (c = 0; c < ct; c++)
37 for (d = 0; d < dt; d++)
38 do_remove ("/%d/%d/%d/%d", a, b, c, d);
39 do_remove ("/%d/%d/%d", a, b, c);
41 do_remove ("/%d/%d", a, b);
47 snprintf (try, sizeof (try), "/%d/%d/%d/%d", at - 1, 0, ct - 1, 0);
48 CHECK (open (try) == -1, "open \"%s\" (must return -1)", try);
52 do_remove (const char *format, ...)
57 va_start (args, format);
58 vsnprintf (name, sizeof name, format, args);
61 CHECK (remove (name), "remove \"%s\"", name);