Compare commits
3 commits
6c7d43916c
...
1834696290
Author | SHA1 | Date | |
---|---|---|---|
1834696290 | |||
5ca486bf0a | |||
ead1eb35a7 |
5 changed files with 19 additions and 18 deletions
|
@ -134,8 +134,8 @@ jobs:
|
||||||
-GNinja -DCMAKE_BUILD_TYPE=Release \
|
-GNinja -DCMAKE_BUILD_TYPE=Release \
|
||||||
-DENABLE_EXAMPLES=ON \
|
-DENABLE_EXAMPLES=ON \
|
||||||
-DENABLE_TESTS=ON \
|
-DENABLE_TESTS=ON \
|
||||||
-DMAX_LOG_LEVEL=0 \
|
-DMAX_LOG_LEVEL=0 \
|
||||||
-DTEST_MAX_LOG_LEVEL=0 \
|
-DTEST_MAX_LOG_LEVEL=0 \
|
||||||
-DCMAKE_CXX_FLAGS="-ftemplate-backtrace-limit=0"
|
-DCMAKE_CXX_FLAGS="-ftemplate-backtrace-limit=0"
|
||||||
cmake --build ${{ github.workspace }}/build_gcc --parallel `nproc`
|
cmake --build ${{ github.workspace }}/build_gcc --parallel `nproc`
|
||||||
|
|
||||||
|
@ -162,8 +162,8 @@ jobs:
|
||||||
-GNinja -DCMAKE_BUILD_TYPE=Release \
|
-GNinja -DCMAKE_BUILD_TYPE=Release \
|
||||||
-DENABLE_EXAMPLES=ON \
|
-DENABLE_EXAMPLES=ON \
|
||||||
-DENABLE_TESTS=ON \
|
-DENABLE_TESTS=ON \
|
||||||
-DMAX_LOG_LEVEL=0 \
|
-DMAX_LOG_LEVEL=0 \
|
||||||
-DTEST_MAX_LOG_LEVEL=0 \
|
-DTEST_MAX_LOG_LEVEL=0 \
|
||||||
-DCMAKE_CXX_FLAGS="-stdlib=libc++ -I/home/LLVM-${LLVM_VER}/include/c++/v1 -fno-modules"
|
-DCMAKE_CXX_FLAGS="-stdlib=libc++ -I/home/LLVM-${LLVM_VER}/include/c++/v1 -fno-modules"
|
||||||
|
|
||||||
echo "::group::compile_commands.json content"
|
echo "::group::compile_commands.json content"
|
||||||
|
@ -204,4 +204,4 @@ jobs:
|
||||||
# export LLVM_VER=19.1.3
|
# export LLVM_VER=19.1.3
|
||||||
# export PATH="/home/LLVM-${LLVM_VER}/bin:${PATH}"
|
# export PATH="/home/LLVM-${LLVM_VER}/bin:${PATH}"
|
||||||
# cd ${{ github.workspace }}/build_clang
|
# cd ${{ github.workspace }}/build_clang
|
||||||
# ASAN_SYMBOLIZER_PATH=llvm-symbolizer ASAN_OPTIONS=detect_stack_use_after_return=1:check_initialization_order=1:detect_leaks=1:atexit=1:abort_on_error=1 ./larra_xmpp_tests
|
# ASAN_SYMBOLIZER_PATH=llvm-symbolizer ASAN_OPTIONS=detect_stack_use_after_return=1:check_initialization_order=1:detect_leaks=1:atexit=1:abort_on_error=1 ./larra_xmpp_tests --log_level=0
|
||||||
|
|
14
.vscode/tasks.json
vendored
14
.vscode/tasks.json
vendored
|
@ -80,7 +80,7 @@
|
||||||
"cd ${workspaceFolder} &&",
|
"cd ${workspaceFolder} &&",
|
||||||
"mkdir -p build && cd build &&",
|
"mkdir -p build && cd build &&",
|
||||||
"cmake -Wno-dev ",
|
"cmake -Wno-dev ",
|
||||||
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON -DLOG_LEVEL=0 -DTEST_LOG_LEVEL=0 .."
|
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON -DMAX_LOG_LEVEL=0 -DTEST_MAX_LOG_LEVEL=0 .."
|
||||||
],
|
],
|
||||||
"options": {
|
"options": {
|
||||||
"env": {
|
"env": {
|
||||||
|
@ -138,7 +138,7 @@
|
||||||
"mkdir -p build_clang && cd build_clang &&",
|
"mkdir -p build_clang && cd build_clang &&",
|
||||||
"cmake -Wno-dev ",
|
"cmake -Wno-dev ",
|
||||||
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON ",
|
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON ",
|
||||||
" -DLOG_LEVEL=0 -DTEST_LOG_LEVEL=0",
|
" -DMAX_LOG_LEVEL=0 -DTEST_MAX_LOG_LEVEL=0",
|
||||||
" -DCMAKE_CXX_FLAGS=\"-stdlib=libstdc++\"",
|
" -DCMAKE_CXX_FLAGS=\"-stdlib=libstdc++\"",
|
||||||
" -DCMAKE_EXE_LINKER_FLAGS=\"-L/usr/lib/x86_64-linux-gnu -lstdc++\" .."
|
" -DCMAKE_EXE_LINKER_FLAGS=\"-L/usr/lib/x86_64-linux-gnu -lstdc++\" .."
|
||||||
],
|
],
|
||||||
|
@ -161,7 +161,7 @@
|
||||||
"mkdir -p build_clang && cd build_clang &&",
|
"mkdir -p build_clang && cd build_clang &&",
|
||||||
"cmake -Wno-dev ",
|
"cmake -Wno-dev ",
|
||||||
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON",
|
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON",
|
||||||
" -DLOG_LEVEL=0 -DTEST_LOG_LEVEL=0"
|
" -DMAX_LOG_LEVEL=0 -DTEST_MAX_LOG_LEVEL=0",
|
||||||
//
|
//
|
||||||
// Uncomment for GCC standart library: libstdc++
|
// Uncomment for GCC standart library: libstdc++
|
||||||
//" -DCMAKE_CXX_FLAGS=\"-stdlib=libstdc++ -fno-omit-frame-pointer -g -fsanitize=address,undefined,leak,function,nullability,vptr\"",
|
//" -DCMAKE_CXX_FLAGS=\"-stdlib=libstdc++ -fno-omit-frame-pointer -g -fsanitize=address,undefined,leak,function,nullability,vptr\"",
|
||||||
|
@ -193,7 +193,7 @@
|
||||||
"command": [
|
"command": [
|
||||||
"cd ${workspaceFolder} &&",
|
"cd ${workspaceFolder} &&",
|
||||||
"mkdir -p build_clang && cd build_clang &&",
|
"mkdir -p build_clang && cd build_clang &&",
|
||||||
"ASAN_SYMBOLIZER_PATH=llvm-symbolizer ASAN_OPTIONS=detect_stack_use_after_return=1:check_initialization_order=1:detect_leaks=1:atexit=1:abort_on_error=1 ./larra_xmpp_tests ; echo \"exit code: $?\"",
|
"ASAN_SYMBOLIZER_PATH=llvm-symbolizer ASAN_OPTIONS=detect_stack_use_after_return=1:check_initialization_order=1:detect_leaks=1:atexit=1:abort_on_error=1 ./larra_xmpp_tests --log_level=0 ; echo \"exit code: $?\"",
|
||||||
],
|
],
|
||||||
"presentation": {
|
"presentation": {
|
||||||
"clear": true
|
"clear": true
|
||||||
|
@ -213,7 +213,7 @@
|
||||||
"mkdir -p build_clang && cd build_clang &&",
|
"mkdir -p build_clang && cd build_clang &&",
|
||||||
"cmake -Wno-dev ",
|
"cmake -Wno-dev ",
|
||||||
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON ",
|
" -DCMAKE_BUILD_TYPE=Debug -DENABLE_EXAMPLES=ON -DENABLE_TESTS=ON ",
|
||||||
" -DLOG_LEVEL=0 -DTEST_LOG_LEVEL=0",
|
" -DMAX_LOG_LEVEL=0 -DTEST_MAX_LOG_LEVEL=0",
|
||||||
" -DCMAKE_CXX_FLAGS=\"-stdlib=libstdc++ -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -fsanitize=memory\"",
|
" -DCMAKE_CXX_FLAGS=\"-stdlib=libstdc++ -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -fsanitize=memory\"",
|
||||||
" -DCMAKE_EXE_LINKER_FLAGS=\"-L/usr/lib/x86_64-linux-gnu -lstdc++ -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -fsanitize=memory\" ..",
|
" -DCMAKE_EXE_LINKER_FLAGS=\"-L/usr/lib/x86_64-linux-gnu -lstdc++ -fsanitize-memory-track-origins=2 -fno-omit-frame-pointer -fno-optimize-sibling-calls -g -fsanitize=memory\" ..",
|
||||||
],
|
],
|
||||||
|
@ -239,7 +239,7 @@
|
||||||
"command": [
|
"command": [
|
||||||
"cd ${workspaceFolder} &&",
|
"cd ${workspaceFolder} &&",
|
||||||
"mkdir -p build_clang && cd build_clang &&",
|
"mkdir -p build_clang && cd build_clang &&",
|
||||||
"MSAN_SYMBOLIZER_PATH=llvm-symbolizer MSAN_OPTIONS=abort_on_error=1 ./larra_xmpp_tests ; echo \"exit code: $?\"",
|
"MSAN_SYMBOLIZER_PATH=llvm-symbolizer MSAN_OPTIONS=abort_on_error=1 ./larra_xmpp_tests --log_level=0 ; echo \"exit code: $?\"",
|
||||||
],
|
],
|
||||||
"presentation": {
|
"presentation": {
|
||||||
"clear": true
|
"clear": true
|
||||||
|
@ -273,7 +273,7 @@
|
||||||
"command": [
|
"command": [
|
||||||
"cd ${workspaceFolder} &&",
|
"cd ${workspaceFolder} &&",
|
||||||
"mkdir -p build_clang && cd build_clang &&",
|
"mkdir -p build_clang && cd build_clang &&",
|
||||||
"MSAN_SYMBOLIZER_PATH=llvm-symbolizer MSAN_OPTIONS=abort_on_error=1 ./larra_xmpp_tests ; echo \"exit code: $?\"",
|
"MSAN_SYMBOLIZER_PATH=llvm-symbolizer MSAN_OPTIONS=abort_on_error=1 ./larra_xmpp_tests --log_level=0 ; echo \"exit code: $?\"",
|
||||||
],
|
],
|
||||||
"presentation": {
|
"presentation": {
|
||||||
"clear": true
|
"clear": true
|
||||||
|
|
|
@ -88,7 +88,7 @@ struct Client {
|
||||||
jid.resource = std::move(r.payload.jid->resource);
|
jid.resource = std::move(r.payload.jid->resource);
|
||||||
SPDLOG_INFO("Allocated resource: {}", jid.resource);
|
SPDLOG_INFO("Allocated resource: {}", jid.resource);
|
||||||
},
|
},
|
||||||
IqErrThrowVisitor<::iq::Bind>{"Error response on IQ: Set::Bind"}),
|
IqErrThrowVisitor{"Error response on IQ: Set::Bind"}),
|
||||||
std::move(set_bind_response));
|
std::move(set_bind_response));
|
||||||
co_return;
|
co_return;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ struct Client {
|
||||||
roster = std::move(r.payload);
|
roster = std::move(r.payload);
|
||||||
SPDLOG_INFO("New roster: {}", ToString(roster));
|
SPDLOG_INFO("New roster: {}", ToString(roster));
|
||||||
},
|
},
|
||||||
IqErrThrowVisitor<::iq::Roster>{"Error response on IQ: Get::Roster"}),
|
IqErrThrowVisitor{"Error response on IQ: Get::Roster"}),
|
||||||
std::move(get_roster_response));
|
std::move(get_roster_response));
|
||||||
co_return;
|
co_return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -123,11 +123,11 @@ using IqError = iq::Error<stanza::error::StanzaError>;
|
||||||
template <typename Payload>
|
template <typename Payload>
|
||||||
using Iq = std::variant<iq::Get<Payload>, iq::Set<Payload>, iq::Result<Payload>, IqError>;
|
using Iq = std::variant<iq::Get<Payload>, iq::Set<Payload>, iq::Result<Payload>, IqError>;
|
||||||
|
|
||||||
template <typename Payload>
|
|
||||||
struct IqErrThrowVisitor {
|
struct IqErrThrowVisitor {
|
||||||
constexpr IqErrThrowVisitor(std::string_view baseErrorMsg) : baseErrorMsg(baseErrorMsg) {
|
constexpr IqErrThrowVisitor(std::string_view baseErrorMsg) : baseErrorMsg(baseErrorMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename Payload>
|
||||||
void operator()(const iq::Get<Payload>&) {
|
void operator()(const iq::Get<Payload>&) {
|
||||||
static constexpr std::string_view getErrorMsg = ": 'Get' is an invalid type for IQ result. Expected 'Result' or 'Error'";
|
static constexpr std::string_view getErrorMsg = ": 'Get' is an invalid type for IQ result. Expected 'Result' or 'Error'";
|
||||||
|
|
||||||
|
@ -135,6 +135,7 @@ struct IqErrThrowVisitor {
|
||||||
SPDLOG_ERROR(finalErrorMsg);
|
SPDLOG_ERROR(finalErrorMsg);
|
||||||
throw std::runtime_error{finalErrorMsg};
|
throw std::runtime_error{finalErrorMsg};
|
||||||
}
|
}
|
||||||
|
template <typename Payload>
|
||||||
void operator()(const iq::Set<Payload>&) {
|
void operator()(const iq::Set<Payload>&) {
|
||||||
static constexpr std::string_view getErrorMsg = ": 'Set' is an invalid type for IQ result. Expected 'Result' or 'Error'";
|
static constexpr std::string_view getErrorMsg = ": 'Set' is an invalid type for IQ result. Expected 'Result' or 'Error'";
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ TEST(IQ, IqErrThrowVisitorThrow) {
|
||||||
static constexpr auto visitorErrMsg = "Test Error";
|
static constexpr auto visitorErrMsg = "Test Error";
|
||||||
static constexpr auto throwErrMsg = "Stanza IQ Error: Forbidden";
|
static constexpr auto throwErrMsg = "Stanza IQ Error: Forbidden";
|
||||||
try {
|
try {
|
||||||
std::visit(utempl::Overloaded([](iq::Result<SomeStruct> r) {}, IqErrThrowVisitor<SomeStruct>{visitorErrMsg}), std::move(iqRes));
|
std::visit(utempl::Overloaded([](iq::Result<SomeStruct> r) {}, IqErrThrowVisitor{visitorErrMsg}), std::move(iqRes));
|
||||||
} catch(const stanza::error::StanzaBaseError& err) {
|
} catch(const stanza::error::StanzaBaseError& err) {
|
||||||
ASSERT_STREQ(throwErrMsg, err.what());
|
ASSERT_STREQ(throwErrMsg, err.what());
|
||||||
return;
|
return;
|
||||||
|
@ -113,7 +113,7 @@ TEST(IQ, IqErrThrowVisitorThrowGet) {
|
||||||
static constexpr auto visitorErrMsg = "Test Error";
|
static constexpr auto visitorErrMsg = "Test Error";
|
||||||
static constexpr auto throwErrMsg = "Test Error: 'Get' is an invalid type for IQ result. Expected 'Result' or 'Error'";
|
static constexpr auto throwErrMsg = "Test Error: 'Get' is an invalid type for IQ result. Expected 'Result' or 'Error'";
|
||||||
try {
|
try {
|
||||||
std::visit(utempl::Overloaded([](iq::Result<SomeStruct> r) {}, IqErrThrowVisitor<SomeStruct>{"Test Error"}), std::move(iqRes));
|
std::visit(utempl::Overloaded([](iq::Result<SomeStruct> r) {}, IqErrThrowVisitor{"Test Error"}), std::move(iqRes));
|
||||||
} catch(const stanza::error::StanzaBaseError& err) {
|
} catch(const stanza::error::StanzaBaseError& err) {
|
||||||
ASSERT_TRUE(false) << "\tERROR: Invalid throw type throw";
|
ASSERT_TRUE(false) << "\tERROR: Invalid throw type throw";
|
||||||
} catch(const std::runtime_error& err) {
|
} catch(const std::runtime_error& err) {
|
||||||
|
@ -140,7 +140,7 @@ TEST(IQ, IqErrThrowVisitorThrowSet) {
|
||||||
static constexpr auto visitorErrMsg = "Test Error";
|
static constexpr auto visitorErrMsg = "Test Error";
|
||||||
static constexpr auto throwErrMsg = "Test Error: 'Set' is an invalid type for IQ result. Expected 'Result' or 'Error'";
|
static constexpr auto throwErrMsg = "Test Error: 'Set' is an invalid type for IQ result. Expected 'Result' or 'Error'";
|
||||||
try {
|
try {
|
||||||
std::visit(utempl::Overloaded([](iq::Result<SomeStruct> r) {}, IqErrThrowVisitor<SomeStruct>{"Test Error"}), std::move(iqRes));
|
std::visit(utempl::Overloaded([](iq::Result<SomeStruct> r) {}, IqErrThrowVisitor{"Test Error"}), std::move(iqRes));
|
||||||
} catch(const stanza::error::StanzaBaseError& err) {
|
} catch(const stanza::error::StanzaBaseError& err) {
|
||||||
ASSERT_TRUE(false) << "\tERROR: Invalid throw type throw";
|
ASSERT_TRUE(false) << "\tERROR: Invalid throw type throw";
|
||||||
} catch(const std::runtime_error& err) {
|
} catch(const std::runtime_error& err) {
|
||||||
|
|
Loading…
Reference in a new issue