Skip to content

Commit

Permalink
chore(ci): add logging for task test #4205
Browse files Browse the repository at this point in the history
  • Loading branch information
cunj123 committed Oct 30, 2023
1 parent 6619f5a commit 8d9e5dd
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
- run: ./configure --everything --no-samples --omit=CppParser,Encodings,Data/MySQL,Data/ODBC,Data/PostgreSQL,MongoDB,PageCompiler,PDF,PocoDoc,ProGen,Redis,SevenZip && make all -s -j4 SANITIZEFLAGS=-fsanitize=thread && sudo make install
- uses: nick-fields/[email protected]
with:
timeout_minutes: 90
timeout_minutes: 20
max_attempts: 3
retry_on: any
command: >-
Expand Down
43 changes: 33 additions & 10 deletions Foundation/testsuite/src/TaskTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "Poco/Thread.h"
#include "Poco/Event.h"
#include "Poco/AutoPtr.h"
#include <iostream>


using Poco::Task;
Expand All @@ -34,20 +35,42 @@ namespace

void runTask()
{
_event.wait();
if (sleep(10))
return;
setProgress(0.5);
_event.wait();
if (isCancelled())
return;
setProgress(1.0);
_event.wait();
try
{
_event.wait();
if (sleep(10))
return;
setProgress(0.5);
_event.wait();
if (isCancelled())
return;
setProgress(1.0);
_event.wait();
}
catch(const Poco::Exception& e)
{
std::cerr << "TestTask::run(): " << e.displayText() << '\n';
}
catch(const std::exception& e)
{
std::cerr << "TestTask::run(): " << e.what() << '\n';
}
catch(...)
{
std::cerr << "TestTask::run(): unknown exception." << '\n';
}
}

void cont()
{
_event.set();
try
{
_event.set();
}
catch(const Poco::SystemException& e)
{
std::cerr << "TestTask::cont(): " << e.displayText() << '\n';
}
}

private:
Expand Down

0 comments on commit 8d9e5dd

Please sign in to comment.