Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Beyond Protocol
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Beyond AKA
Beyond Protocol
Commits
b052dc8e
Commit
b052dc8e
authored
3 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Add code quality CI
parent
71ee0d5c
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab-ci.yml
+7
-2
7 additions, 2 deletions
.gitlab-ci.yml
.vscode/settings.json
+63
-1
63 additions, 1 deletion
.vscode/settings.json
test/net_integration.cpp
+19
-14
19 additions, 14 deletions
test/net_integration.cpp
with
89 additions
and
17 deletions
.gitlab-ci.yml
+
7
−
2
View file @
b052dc8e
...
...
@@ -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=
FALS
E -DCMAKE_BUILD_TYPE=Release -DCPACK_GENERATOR=DEB
-
cmake $CI_PROJECT_DIR -GNinja -DCMAKE_CXX_FLAGS="-fdiagnostics-color" -DUSE_CPPCHECK=
TRU
E -DCMAKE_BUILD_TYPE=Release -DCPACK_GENERATOR=DEB
-
ninja
#cache:
...
...
This diff is collapsed.
Click to expand it.
.vscode/settings.json
+
63
−
1
View file @
b052dc8e
...
...
@@ -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
This diff is collapsed.
Click to expand it.
test/net_integration.cpp
+
19
−
14
View file @
b052dc8e
...
...
@@ -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
) {
a
uto
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;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment