diff --git a/include/test_fs.h b/include/test_fs.h new file mode 100644 index 0000000..747d882 --- /dev/null +++ b/include/test_fs.h @@ -0,0 +1,8 @@ +#ifndef __TEST_FS_H +#define __TEST_FS_H + +#include + +void do_test_fs(void); + +#endif /* __TEST_SPAWN_H */ diff --git a/lib/fs/fat32.c b/lib/fs/fat32.c index 36e27e7..7f75327 100644 --- a/lib/fs/fat32.c +++ b/lib/fs/fat32.c @@ -1326,6 +1326,11 @@ static errval_t _fat32_rmdir(struct fat32 *fat32, const char *path) { return FS_ERR_NOTDIR; } + // we don't allow deleting the root directory + if (path_resolve_result.directory_entry_ref.sector_number == UINT32_MAX || path_resolve_result.directory_entry_ref.index_in_sector == UINT32_MAX) { + return FS_ERR_NOTEMPTY; + } + // we refuse to delete non-empty directories err = fat32_check_directory_empty(fat32, &path_resolve_result.directory_entry); if (err_is_fail(err)) return err; diff --git a/lib/grading/Hakefile b/lib/grading/Hakefile index 96e668f..eef5b7d 100644 --- a/lib/grading/Hakefile +++ b/lib/grading/Hakefile @@ -21,6 +21,7 @@ "test_paging.c", "test_spawn.c", "test_ipc.c", + "test_fs.c", "test_threads.c", "test_stackoverflow.c" ], diff --git a/lib/grading/grading.c b/lib/grading/grading.c index 1d4adf0..9fb136d 100644 --- a/lib/grading/grading.c +++ b/lib/grading/grading.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -52,5 +53,6 @@ void grading_test_late(void) { if (my_core_id == 0) { do_test_spawn(); + do_test_fs(); } } diff --git a/lib/grading/test_fs.c b/lib/grading/test_fs.c new file mode 100644 index 0000000..8efcecf --- /dev/null +++ b/lib/grading/test_fs.c @@ -0,0 +1,10 @@ +#include +#include +#include + +void do_test_fs(void) { + // spawn the filereader process that contains all the tests + struct spawninfo *si = malloc(sizeof(struct spawninfo)); + domainid_t *pid = malloc(sizeof(domainid_t)); + CHECK_ERR(spawn_load_by_name("filereader", si, pid)); +}