1
0
Fork 0
mirror of https://gitlab.com/niansa/libcrosscoro.git synced 2025-03-06 20:53:32 +01:00
libcrosscoro/test/main.cpp
Josh Baldwin 5de38b2d60
Issue 88/opensuse ci (#92)
* fix up g++ 11 warnings for unused return values
* Add opensuse/leap:15.2 CI build
* Add __attribute__((used)) for template functions

openSUSE/leap gcc on Release build seems to be aggressively
removing templates that are actually required, the used attribute
will force the compiler to leave them in.
2021-07-25 15:27:51 -06:00

32 lines
917 B
C++

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include <signal.h>
/**
* This structure invokes a constructor to setup some global test settings that are needed prior
* to executing the tests.
*/
struct test_setup
{
test_setup()
{
// Ignore SIGPIPE, the library should be handling these gracefully.
signal(SIGPIPE, SIG_IGN);
// For SSL/TLS tests create a localhost cert.pem and key.pem, tests expected these files
// to be generated into the same directory that the tests are running in.
auto unused = system(
"openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -subj '/CN=localhost' -nodes");
(void)unused;
}
~test_setup()
{
// Cleanup the temporary key.pem and cert.pem files.
auto unused = system("rm key.pem cert.pem");
(void)unused;
}
};
static test_setup g_test_setup{};