mirror of
https://github.com/pocoproject/poco.git
synced 2025-12-07 08:49:12 +01:00
fix(misc): add pdjson links to gitignore, remove unused var in SharedLibrary, harden TaskManagerTest
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -205,3 +205,5 @@ Foundation/src/zconf.h
|
|||||||
Foundation/src/zlib.h
|
Foundation/src/zlib.h
|
||||||
Foundation/src/zutil.c
|
Foundation/src/zutil.c
|
||||||
Foundation/src/zutil.h
|
Foundation/src/zutil.h
|
||||||
|
Foundation/pdjson.c
|
||||||
|
Foundation/pdjson.h
|
||||||
|
|||||||
@@ -180,7 +180,6 @@ std::vector<std::string> SharedLibraryImpl::findMissingDependenciesImpl(const st
|
|||||||
if (!file)
|
if (!file)
|
||||||
return missingDeps;
|
return missingDeps;
|
||||||
|
|
||||||
bool is64 = false;
|
|
||||||
bool needsSwap = false;
|
bool needsSwap = false;
|
||||||
uint32_t ncmds = 0;
|
uint32_t ncmds = 0;
|
||||||
uint32_t sizeofcmds = 0;
|
uint32_t sizeofcmds = 0;
|
||||||
@@ -213,7 +212,6 @@ std::vector<std::string> SharedLibraryImpl::findMissingDependenciesImpl(const st
|
|||||||
|
|
||||||
if (magic == MH_MAGIC_64 || magic == MH_CIGAM_64)
|
if (magic == MH_MAGIC_64 || magic == MH_CIGAM_64)
|
||||||
{
|
{
|
||||||
is64 = true;
|
|
||||||
needsSwap = (magic == MH_CIGAM_64);
|
needsSwap = (magic == MH_CIGAM_64);
|
||||||
file.seekg(-static_cast<std::streamoff>(sizeof(magic)), std::ios::cur);
|
file.seekg(-static_cast<std::streamoff>(sizeof(magic)), std::ios::cur);
|
||||||
mach_header_64 header;
|
mach_header_64 header;
|
||||||
@@ -225,7 +223,6 @@ std::vector<std::string> SharedLibraryImpl::findMissingDependenciesImpl(const st
|
|||||||
}
|
}
|
||||||
else if (magic == MH_MAGIC || magic == MH_CIGAM)
|
else if (magic == MH_MAGIC || magic == MH_CIGAM)
|
||||||
{
|
{
|
||||||
is64 = false;
|
|
||||||
needsSwap = (magic == MH_CIGAM);
|
needsSwap = (magic == MH_CIGAM);
|
||||||
file.seekg(-static_cast<std::streamoff>(sizeof(magic)), std::ios::cur);
|
file.seekg(-static_cast<std::streamoff>(sizeof(magic)), std::ios::cur);
|
||||||
mach_header header;
|
mach_header header;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
#include "Poco/Thread.h"
|
#include "Poco/Thread.h"
|
||||||
#include "Poco/ThreadPool.h"
|
#include "Poco/ThreadPool.h"
|
||||||
#include "Poco/Event.h"
|
#include "Poco/Event.h"
|
||||||
|
#include "Poco/Stopwatch.h"
|
||||||
#include "Poco/NObserver.h"
|
#include "Poco/NObserver.h"
|
||||||
#include "Poco/Exception.h"
|
#include "Poco/Exception.h"
|
||||||
#include "Poco/AutoPtr.h"
|
#include "Poco/AutoPtr.h"
|
||||||
@@ -43,6 +44,7 @@ using Poco::NoThreadAvailableException;
|
|||||||
using Poco::SystemException;
|
using Poco::SystemException;
|
||||||
using Poco::NullPointerException;
|
using Poco::NullPointerException;
|
||||||
using Poco::AutoPtr;
|
using Poco::AutoPtr;
|
||||||
|
using Poco::Stopwatch;
|
||||||
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
@@ -340,12 +342,23 @@ void TaskManagerTest::testError()
|
|||||||
tm.addObserver(NObserver<TaskObserver, TaskProgressNotification>(to, &TaskObserver::taskProgress));
|
tm.addObserver(NObserver<TaskObserver, TaskProgressNotification>(to, &TaskObserver::taskProgress));
|
||||||
AutoPtr<TestTask> pTT = new TestTask;
|
AutoPtr<TestTask> pTT = new TestTask;
|
||||||
assertTrue (tm.start(pTT.duplicate()));
|
assertTrue (tm.start(pTT.duplicate()));
|
||||||
while (pTT->state() < Task::TASK_RUNNING) Thread::sleep(50);
|
Stopwatch sw;
|
||||||
|
sw.start();
|
||||||
|
while (pTT->state() < Task::TASK_RUNNING)
|
||||||
|
{
|
||||||
|
Thread::sleep(50);
|
||||||
|
assertTrue (sw.elapsed() < 5000000); // 5 second timeout
|
||||||
|
}
|
||||||
assertTrue (pTT->progress() == 0);
|
assertTrue (pTT->progress() == 0);
|
||||||
Thread::sleep(200);
|
Thread::sleep(200);
|
||||||
pTT->cont();
|
pTT->cont();
|
||||||
while (pTT->progress() != 0.5) Thread::sleep(50);
|
sw.restart();
|
||||||
assertTrue (to.progress() == 0.5);
|
while (to.progress() < 0.5)
|
||||||
|
{
|
||||||
|
Thread::sleep(50);
|
||||||
|
assertTrue (sw.elapsed() < 5000000); // 5 second timeout
|
||||||
|
}
|
||||||
|
assertTrue (to.progress() >= 0.5);
|
||||||
assertTrue (to.started());
|
assertTrue (to.started());
|
||||||
assertTrue (pTT->state() == Task::TASK_RUNNING);
|
assertTrue (pTT->state() == Task::TASK_RUNNING);
|
||||||
TaskManager::TaskList list = tm.taskList();
|
TaskManager::TaskList list = tm.taskList();
|
||||||
@@ -353,14 +366,34 @@ void TaskManagerTest::testError()
|
|||||||
assertTrue (tm.count() == 1);
|
assertTrue (tm.count() == 1);
|
||||||
pTT->fail();
|
pTT->fail();
|
||||||
pTT->cont();
|
pTT->cont();
|
||||||
while (pTT->state() != Task::TASK_FINISHED) Thread::sleep(50);
|
sw.restart();
|
||||||
|
while (pTT->state() != Task::TASK_FINISHED)
|
||||||
|
{
|
||||||
|
Thread::sleep(50);
|
||||||
|
assertTrue (sw.elapsed() < 5000000); // 5 second timeout
|
||||||
|
}
|
||||||
pTT->cont();
|
pTT->cont();
|
||||||
while (pTT->state() != Task::TASK_FINISHED) Thread::sleep(50);
|
sw.restart();
|
||||||
|
while (pTT->state() != Task::TASK_FINISHED)
|
||||||
|
{
|
||||||
|
Thread::sleep(50);
|
||||||
|
assertTrue (sw.elapsed() < 5000000); // 5 second timeout
|
||||||
|
}
|
||||||
assertTrue (pTT->state() == Task::TASK_FINISHED);
|
assertTrue (pTT->state() == Task::TASK_FINISHED);
|
||||||
while (!to.finished()) Thread::sleep(50);
|
sw.restart();
|
||||||
|
while (!to.finished())
|
||||||
|
{
|
||||||
|
Thread::sleep(50);
|
||||||
|
assertTrue (sw.elapsed() < 5000000); // 5 second timeout
|
||||||
|
}
|
||||||
assertTrue (to.finished());
|
assertTrue (to.finished());
|
||||||
assertTrue (to.error() != nullptr);
|
assertTrue (to.error() != nullptr);
|
||||||
while (tm.count() == 1) Thread::sleep(50);
|
sw.restart();
|
||||||
|
while (tm.count() == 1)
|
||||||
|
{
|
||||||
|
Thread::sleep(50);
|
||||||
|
assertTrue (sw.elapsed() < 5000000); // 5 second timeout
|
||||||
|
}
|
||||||
list = tm.taskList();
|
list = tm.taskList();
|
||||||
assertTrue (list.empty());
|
assertTrue (list.empty());
|
||||||
tm.cancelAll();
|
tm.cancelAll();
|
||||||
|
|||||||
1
JSON/src/pdjson.c
Symbolic link
1
JSON/src/pdjson.c
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/Users/alex/Claude/poco/dependencies/pdjson/src/pdjson.c
|
||||||
1
JSON/src/pdjson.h
Symbolic link
1
JSON/src/pdjson.h
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
/Users/alex/Claude/poco/dependencies/pdjson/src/pdjson.h
|
||||||
Reference in New Issue
Block a user