Change mocked filesystem implementation, used in unit tests.

This commit is contained in:
Vreixo Formoso
2008-01-08 21:23:24 +01:00
parent 2464455fea
commit 758e2654f8
3 changed files with 107 additions and 142 deletions

View File

@ -5,19 +5,27 @@
#ifndef MOCKED_FSRC_H_
#define MOCKED_FSRC_H_
struct mock_file {
IsoFilesystem *fs;
struct mock_file *parent;
struct stat atts;
char *name;
/* for links, link dest. For dirs, children */
void *content;
};
/**
* A mocked fs with a registry of files, that you can add via
* test_mocked_fs_add_fsrc().
* A mocked fs.
*/
int test_mocked_filesystem_new(IsoFilesystem **fs);
int test_mocked_fs_add_file(IsoFilesystem *fs, const char *path,
struct stat info);
struct mock_file *test_mocked_fs_get_root(IsoFilesystem *fs);
int test_mocked_fs_add_dir(IsoFilesystem *fs, const char *path,
struct stat info);
int test_mocked_fs_add_dir(const char *name, struct mock_file *parent,
struct stat atts, struct mock_file **dir);
int test_mocked_fs_add_symlink(IsoFilesystem *fs, const char *path,
struct stat info, const char *dest);
int test_mocked_fs_add_symlink(const char *name, struct mock_file *p,
struct stat atts, const char *dest, struct mock_file **node);
#endif /*MOCKED_FSRC_H_*/