1
0
mirror of https://github.com/falk-werner/webfuse synced 2024-10-27 20:34:10 +00:00
falk-werner_webfuse/test-src/webfuse/test_app.cpp

38 lines
809 B
C++
Raw Normal View History

2022-11-12 11:29:30 +00:00
#include "webfuse/webfuse.hpp"
2022-12-30 18:43:45 +00:00
#include "webfuse/test/thread.hpp"
#include "webfuse/test/tempdir.hpp"
2022-11-12 11:29:30 +00:00
#include <gtest/gtest.h>
2022-12-30 18:43:45 +00:00
#include <csignal>
#include <cstring>
#include <cstdlib>
#include <chrono>
#include <thread>
extern "C" void * run(void * args)
{
webfuse::app * app = reinterpret_cast<webfuse::app*>(args);
return nullptr;
}
2022-11-12 11:29:30 +00:00
TEST(app, init)
{
2022-11-13 17:18:44 +00:00
webfuse::app app;
2022-12-30 18:43:45 +00:00
}
TEST(app, run)
{
webfuse::tempdir dir;
webfuse::thread thread([&dir](){
webfuse::app app;
char arg0[] = "webfuse";
char arg1[] = "-f";
char* arg2 = strdup(dir.name().c_str());
char* argv[] = { arg0, arg1, arg2, nullptr};
int rc = app.run(3, argv);
free(arg2);
});
std::this_thread::sleep_for(std::chrono::seconds(1));
thread.kill(SIGINT);
2022-11-12 11:29:30 +00:00
}