1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2026-03-02 04:09:18 +00:00

removed uuid mountpoint and factory

This commit is contained in:
Falk Werner
2020-03-21 09:11:18 +01:00
parent 428c192910
commit 43c989e7af
25 changed files with 65 additions and 512 deletions

View File

@@ -4,11 +4,43 @@
#include <cstdlib>
#include <cstring>
#include <unistd.h>
#include <sys/stat.h>
#include "webfuse_adapter.h"
#include "webfuse/adapter/impl/server.h"
#define WF_PATH_MAX (100)
extern "C"
{
static void webfuse_test_server_cleanup_mountpoint(
void * user_data)
{
char * path = reinterpret_cast<char*>(user_data);
rmdir(path);
free(path);
}
static struct wf_mountpoint *
webfuse_test_server_create_mountpoint(
char const * filesystem,
void * user_data)
{
char const * base_dir = reinterpret_cast<char const*>(user_data);
char path[WF_PATH_MAX];
snprintf(path, WF_PATH_MAX, "%s/%s", base_dir, filesystem);
mkdir(path, 0755);
struct wf_mountpoint * mountpoint = wf_mountpoint_create(path);
wf_mountpoint_set_userdata(
mountpoint,
reinterpret_cast<void*>(strdup(path)),
&webfuse_test_server_cleanup_mountpoint);
return mountpoint;
}
}
namespace webfuse_test
{
@@ -28,7 +60,9 @@ public:
config = wf_server_config_create();
wf_server_config_set_port(config, 8080);
wf_server_config_set_mountpoint(config, base_dir);
wf_server_config_set_mountpoint_factory(config,
&webfuse_test_server_create_mountpoint,
reinterpret_cast<void*>(base_dir));
server = wf_server_create(config);

View File

@@ -68,7 +68,7 @@ TEST_F(IntegrationTest, HasMountpoint)
TEST_F(IntegrationTest, ProvidesTextFile)
{
std::string file_name = std::string(GetBaseDir()) + "/cprovider/default/hello.txt";
std::string file_name = std::string(GetBaseDir()) + "/cprovider/hello.txt";
ASSERT_EXIT({
struct stat buffer;
@@ -85,7 +85,7 @@ TEST_F(IntegrationTest, ProvidesTextFile)
TEST_F(IntegrationTest, ReadTextFile)
{
std::string file_name = std::string(GetBaseDir()) + "/cprovider/default/hello.txt";
std::string file_name = std::string(GetBaseDir()) + "/cprovider/hello.txt";
ASSERT_EXIT({
FILE * file = fopen(file_name.c_str(), "rb");
@@ -106,7 +106,7 @@ TEST_F(IntegrationTest, ReadTextFile)
TEST_F(IntegrationTest, ReadDir)
{
std::string dir_name = std::string(GetBaseDir()) + "/cprovider/default";
std::string dir_name = std::string(GetBaseDir()) + "/cprovider";
ASSERT_EXIT({