lokinet/test/check_main.cpp
Jeff Becker 4103908a8d
system layer manager (llarp::sys::service_manager)
the win32 and sd_notify components provided a disjointed set of
similar high level functionality so we consolidate these duplicate
code paths into one that has the same lifecycle regardless of platform
to reduce complexity of this feature.

this new component is responsible for reporting state changes to the
system layer and optionally propagating state change to lokinet
requested by the system layer (used by windows service).
2022-11-01 11:04:58 -04:00

41 lines
652 B
C++

#define CATCH_CONFIG_RUNNER
#include <catch2/catch.hpp>
#include <util/logging.hpp>
#include <util/service_manager.hpp>
#ifdef _WIN32
#include <winsock2.h>
int
startWinsock()
{
WSADATA wsockd;
int err;
err = ::WSAStartup(MAKEWORD(2, 2), &wsockd);
if (err)
{
perror("Failed to start Windows Sockets");
return err;
}
return 0;
}
#endif
int
main(int argc, char* argv[])
{
llarp::sys::service_manager->disable();
llarp::log::reset_level(llarp::log::Level::off);
#ifdef _WIN32
if (startWinsock())
return -1;
#endif
int result = Catch::Session().run(argc, argv);
#ifdef _WIN32
WSACleanup();
#endif
return result;
}