- static const char s[] = "This is a test string.";
- struct file *file;
- char s2[sizeof s];
-
- ASSERT (filesys_create ("foo"));
- ASSERT ((file = filesys_open ("foo")) != NULL);
- ASSERT (file_write (file, s, sizeof s) == sizeof s);
- ASSERT (file_tell (file) == sizeof s);
- ASSERT (file_length (file) == sizeof s);
- file_close (file);
-
- ASSERT ((file = filesys_open ("foo")) != NULL);
- ASSERT (file_read (file, s2, sizeof s2) == sizeof s2);
- ASSERT (memcmp (s, s2, sizeof s) == 0);
- ASSERT (file_tell (file) == sizeof s2);
- ASSERT (file_length (file) == sizeof s2);
- file_close (file);
-
- ASSERT (filesys_remove ("foo"));
+ printf ("Formatting file system...");
+ free_map_create ();
+ if (!dir_create (ROOT_DIR_SECTOR, 16))
+ PANIC ("root directory creation failed");
+ free_map_close ();
+ printf ("done.\n");