Skip to content
Snippets Groups Projects
Commit b052dc8e authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Add code quality CI

parent 71ee0d5c
No related branches found
No related tags found
No related merge requests found
......@@ -12,9 +12,14 @@ stages:
sast:
stage: test
include:
- template: Security/SAST.gitlab-ci.yml
include:
- template: Code-Quality.gitlab-ci.yml
image: ubuntu:jammy
linux:build:
......@@ -27,9 +32,9 @@ linux:build:
- docker
script:
- DEBIAN_FRONTEND=noninteractive apt update && apt install -y build-essential uuid-dev git libmsgpack-dev liburiparser-dev libgnutls28-dev cmake ninja-build
- DEBIAN_FRONTEND=noninteractive apt update && apt install -y build-essential uuid-dev git libmsgpack-dev liburiparser-dev libgnutls28-dev cmake ninja-build cppcheck
- mkdir build && cd build
- cmake $CI_PROJECT_DIR -GNinja -DCMAKE_CXX_FLAGS="-fdiagnostics-color" -DUSE_CPPCHECK=FALSE -DCMAKE_BUILD_TYPE=Release -DCPACK_GENERATOR=DEB
- cmake $CI_PROJECT_DIR -GNinja -DCMAKE_CXX_FLAGS="-fdiagnostics-color" -DUSE_CPPCHECK=TRUE -DCMAKE_BUILD_TYPE=Release -DCPACK_GENERATOR=DEB
- ninja
#cache:
......
......@@ -2,6 +2,68 @@
"files.associations": {
"deque": "cpp",
"string": "cpp",
"vector": "cpp"
"vector": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"cinttypes": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"forward_list": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"ostream": "cpp",
"shared_mutex": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp"
}
}
\ No newline at end of file
......@@ -13,14 +13,14 @@ using std::chrono::milliseconds;
// --- Support -----------------------------------------------------------------
/*static bool try_for(int count, const std::function<bool()> &f) {
static bool try_for(int count, const std::function<bool()> &f) {
int i=count;
while (i-- > 0) {
if (f()) return true;
sleep_for(milliseconds(10));
}
return false;
}*/
}
// --- Tests -------------------------------------------------------------------
......@@ -126,39 +126,44 @@ TEST_CASE("Listen and Connect", "[net]") {
}
}
/*TEST_CASE("Universe::onConnect()", "[net]") {
Universe a;
Universe b;
TEST_CASE("Self::onConnect()", "[net]") {
ftl::protocol::reset();
a.listen(ftl::URI("tcp://localhost:0"));
auto uri = "tcp://localhost:" + std::to_string(a.getListeningURIs().front().getPort());
auto self = ftl::createDummySelf();
self->listen(ftl::URI("tcp://localhost:0"));
auto uri = "tcp://localhost:" + std::to_string(self->getListeningURIs().front().getPort());
SECTION("single valid remote init connection") {
bool done = false;
a.onConnect([&done](Peer *p) {
auto h = self->onConnect([&](const std::shared_ptr<ftl::protocol::Node> &p_listening) {
done = true;
return true;
});
b.connect(uri)->waitConnection();
auto n = ftl::createNode(uri)->waitConnection();
REQUIRE( try_for(20, [&done]{ return done; }) );
bool result = try_for(20, [&done]{ return done; });
REQUIRE( result );
}
SECTION("single valid init connection") {
bool done = false;
b.onConnect([&done](Peer *p) {
auto h = ftl::getSelf()->onConnect([&](const std::shared_ptr<ftl::protocol::Node> &p_listening) {
done = true;
return true;
});
b.connect(uri)->waitConnection();
//sleep_for(milliseconds(100));
auto n = ftl::createNode(uri)->waitConnection();
REQUIRE( done );
}
}
TEST_CASE("Universe::onDisconnect()", "[net]") {
/*TEST_CASE("Universe::onDisconnect()", "[net]") {
Universe a;
Universe b;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment