140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen#ifndef FS_TEST_H
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen#define FS_TEST_H
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen#include "fs-api-private.h"
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainenstruct test_fs {
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen struct fs fs;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen enum fs_properties properties;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen ARRAY_TYPE(const_string) iter_files;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen};
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainenstruct test_fs_file {
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen struct fs_file file;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen enum fs_open_mode mode;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen fs_file_async_callback_t *async_callback;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen void *async_context;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen buffer_t *contents;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen struct istream *input;
b162e16ade1e0d9bfae62e366caf57a3132f5963Timo Sirainen struct test_fs_file *copy_src;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen bool prefetched;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen bool locked;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen bool exists;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen bool seekable;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen bool closed;
b162e16ade1e0d9bfae62e366caf57a3132f5963Timo Sirainen bool io_failure;
b162e16ade1e0d9bfae62e366caf57a3132f5963Timo Sirainen bool wait_async;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen};
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainenstruct test_fs_iter {
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen struct fs_iter iter;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen char *prefix, *prev_dir;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen unsigned int prefix_len, idx;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen bool failed;
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen};
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen
b162e16ade1e0d9bfae62e366caf57a3132f5963Timo Sirainenstruct test_fs *test_fs_get(struct fs *fs);
b162e16ade1e0d9bfae62e366caf57a3132f5963Timo Sirainenstruct test_fs_file *test_fs_file_get(struct fs *fs, const char *path);
b162e16ade1e0d9bfae62e366caf57a3132f5963Timo Sirainen
b162e16ade1e0d9bfae62e366caf57a3132f5963Timo Sirainenvoid test_fs_async(const char *test_name, enum fs_properties properties,
b162e16ade1e0d9bfae62e366caf57a3132f5963Timo Sirainen const char *driver, const char *args);
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen
140afad728d78c56fb4c0256f94eb81a213688dbTimo Sirainen#endif