Added tests for the file system
This commit is contained in:
parent
046d7269da
commit
e0fecab3ed
8
include/test_fs.h
Normal file
8
include/test_fs.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef __TEST_FS_H
|
||||
#define __TEST_FS_H
|
||||
|
||||
#include <aos/aos.h>
|
||||
|
||||
void do_test_fs(void);
|
||||
|
||||
#endif /* __TEST_SPAWN_H */
|
||||
@ -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;
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
"test_paging.c",
|
||||
"test_spawn.c",
|
||||
"test_ipc.c",
|
||||
"test_fs.c",
|
||||
"test_threads.c",
|
||||
"test_stackoverflow.c"
|
||||
],
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
#include <test_paging.h>
|
||||
#include <test_spawn.h>
|
||||
#include <test_ipc.h>
|
||||
#include <test_fs.h>
|
||||
#include <test_threads.h>
|
||||
#include <test_stackoverflow.h>
|
||||
|
||||
@ -52,5 +53,6 @@ void
|
||||
grading_test_late(void) {
|
||||
if (my_core_id == 0) {
|
||||
do_test_spawn();
|
||||
do_test_fs();
|
||||
}
|
||||
}
|
||||
|
||||
10
lib/grading/test_fs.c
Normal file
10
lib/grading/test_fs.c
Normal file
@ -0,0 +1,10 @@
|
||||
#include <test_helper.h>
|
||||
#include <test_fs.h>
|
||||
#include <spawn/spawn.h>
|
||||
|
||||
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));
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user