Merge pull request #26 from pocoproject/develop

Sync 7.2.2016
This commit is contained in:
Marian Krivoš
2016-02-07 11:28:32 +01:00
148 changed files with 956 additions and 374 deletions

View File

@@ -3,113 +3,140 @@ language: cpp
cache: cache:
- apt - apt
branches:
except:
- /*?pp?eyor*/
before_install: before_install:
# we need a recent version of CMake # we need a recent version of CMake
# - sudo add-apt-repository -y ppa:andykimpe/cmake3 # - sudo add-apt-repository -y ppa:andykimpe/cmake3
# linux prereqisite packages # linux prereqisite packages
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then wget --no-check-certificate https://www.cmake.org/files/v3.2/cmake-3.2.3-Linux-x86_64.tar.gz; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then wget --no-check-certificate https://www.cmake.org/files/v3.2/cmake-3.2.3-Linux-x86_64.tar.gz; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then tar -xzf cmake-3.2.3-Linux-x86_64.tar.gz -C ..; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then tar -xzvf cmake-3.2.3-Linux-x86_64.tar.gz; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export PATH=$PWD/../cmake-3.2.3-Linux-x86_64/bin:$PATH; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then export PATH=$PWD/cmake-3.2.3-Linux-x86_64/bin:$PATH; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq -y unixodbc-dev libmysqlclient-dev libsqlite3-dev; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq -y unixodbc-dev libmysqlclient-dev libsqlite3-dev; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq -y g++-arm-linux-gnueabi g++-arm-linux-gnueabihf clang-3.5; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq -y g++-arm-linux-gnueabi g++-arm-linux-gnueabihf clang-3.5; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq -y sloccount cppcheck; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq -y sloccount cppcheck; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get update -qq; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then sudo apt-get install -qq -y g++-4.8; fi
services: services:
- mongodb - mongodb
- redis-server - redis-server
- mysql
notifications: notifications:
slack: slack:
rooms: rooms:
- pocoproject:4iwY1QpB8fdU2WqpcZ6PpZhz#travis - pocoproject:ItIUZvs8aJGyPdaKxIKMnS1t#travis
- kampbell:v4ARuptk0ETzwUsKDdV6Gspb#poco
env: env:
global: TEST_NAME="" global:
TEST_NAME=""
before_script: before_script:
- echo ${TEST_NAME} - echo ${TEST_NAME}
- sqlite3 -version - sqlite3 -version
- chmod 755 ./travis/Linux/runtests.sh
- chmod 755 ./travis/OSX/runtests.sh
matrix: matrix:
include: include:
- env: TEST_NAME="OSX clang (make) bundled" - env: TEST_NAME="OSX clang (make) bundled"
compiler: clang
os: osx os: osx
compiler: clang
script: script:
- ./configure --everything --omit=Data/ODBC,Data/MySQL,Data/SQLite && make -j2 - export CC="clang"
- cat config.* - export CXX="clang++"
- clang++ -x c++ /dev/null -dM -E
- ./configure --everything --omit=Data/ODBC,Data/MySQL,Data/SQLite && make -s -j2
- sudo make install - sudo make install
- ls -l /usr/local/lib/*Poco* - ./travis/OSX/runtests.sh
- find . -name "*testrunner*"
- ./travis/runtests.sh
- env: TEST_NAME="Linux gcc (make) bundled" - env: TEST_NAME="Linux gcc 4.6 (make) bundled"
compiler: gcc compiler: gcc
script: script:
- export CC="gcc"
- export CXX="g++"
- ./configure --everything && make -s -j2 - ./configure --everything && make -s -j2
- sudo make install - ./travis/Linux/runtests.sh
- ./travis/runtests.sh
- env: TEST_NAME="Linux gcc (make) unbundled" - env: TEST_NAME="Linux gcc 4.8 (make) bundled"
compiler: gcc
script:
- export CC="gcc-4.8"
- export CXX="g++-4.8"
- ./configure --everything && make -s -j2
- ./travis/Linux/runtests.sh
- env: TEST_NAME="Linux gcc 4.6 (make) unbundled"
compiler: gcc
script:
- export CC="gcc"
- export CXX="g++"
- sudo apt-get install -qq -y libpcre3-dev libssl-dev libexpat1-dev
- ./configure --everything --unbundled && make -s -j2
- ./travis/Linux/runtests.sh
- env: TEST_NAME="Linux gcc 4.8 (make) unbundled"
compiler: gcc compiler: gcc
script: script:
- sudo apt-get install -qq -y libpcre3-dev libssl-dev libexpat1-dev - sudo apt-get install -qq -y libpcre3-dev libssl-dev libexpat1-dev
- export CC="gcc-4.8"
- export CXX="g++-4.8"
- ./configure --everything --unbundled && make -s -j2 - ./configure --everything --unbundled && make -s -j2
- sudo make install - ./travis/Linux/runtests.sh
- ./travis/runtests.sh
- env: TEST_NAME="Linux clang (make)" - env: TEST_NAME="Linux clang 3.4 (make)"
compiler: clang compiler: clang
script: script:
- ./configure --everything --config=Linux-clang && make -s -j2 - ./configure --everything --config=Linux-clang && make -s -j2
- sudo make install - ./travis/Linux/runtests.sh
- ./travis/runtests.sh
- env: TEST_NAME="Linux arm-linux-gnueabi- (make)" #FIXME the -m64 option bring by the Linux config is not supported by arm-linux-gnueabi-g++ which makes this test failing
script: #FIXME - env: TEST_NAME="arm-linux-gnueabi- (make)"
- ./configure --omit=Data/ODBC,Data/MySQL,Crypto,NetSSL,PageCompiler && make -s -j2 CROSS_COMPILE=arm-linux-gnueabi- POCO_TARGET_OSARCH=armv7l #FIXME script:
#FIXME - ./configure --omit=Data/ODBC,Data/MySQL,Crypto,NetSSL,PageCompiler && make -s -j2 CROSS_COMPILE=arm-linux-gnueabi- POCO_TARGET_OSARCH=armv7l
- env: TEST_NAME="Linux gcc (CMake)" - env: TEST_NAME="Linux gcc 4.6 (CMake)"
compiler: gcc compiler: gcc
script: script:
# disable tests, gcc-4.6 gets an internal compiler error - export CC="gcc"
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_TESTS=OFF .. && make -j2 && cd .. - export CXX="g++"
- source ./travis/ignored.sh
- export POCO_BASE=`pwd`
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_TESTS=ON .. && make -s -j2 && ctest -VV -E Data && cd ..
- env: TEST_NAME="gcc-4.8 (CMake)" - env: TEST_NAME="Linux gcc 4.8 (CMake)"
compiler: gcc compiler: gcc
script: script:
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- sudo apt-get update -qq
- sudo apt-get install -qq -y g++-4.8
- export CC="gcc-4.8" - export CC="gcc-4.8"
- export CXX="g++-4.8" - export CXX="g++-4.8"
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_TESTS=ON .. && make -j2 && cd .. - source ./travis/ignored.sh
- export POCO_BASE=`pwd`
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_TESTS=ON .. && make -s -j2 && ctest -VV -E Data && cd ..
- env: TEST_NAME="Linux clang (CMake)" - env: TEST_NAME="clang 3.4 (CMake)"
compiler: clang compiler: clang
script: script:
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_TESTS=ON .. && make -j2 && cd .. - source ./travis/ignored.sh
- export POCO_BASE=`pwd`
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_TESTS=ON .. && make -s -j2 && ctest -VV -E Data && cd ..
- env: TEST_NAME="Linux arm-linux-gnueabi-g++ (CMake)" - env: TEST_NAME="Linux arm-linux-gnueabi-g++ (CMake)"
script: script:
- export CC="arm-linux-gnueabi-gcc" - export CC="arm-linux-gnueabi-gcc"
- export CXX="arm-linux-gnueabi-g++" - export CXX="arm-linux-gnueabi-g++"
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_TESTS=OFF .. && make -j2 && cd .. - source ./travis/ignored.sh
- export POCO_BASE=`pwd`
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_TESTS=ON ..
- make -s -j2 && cd ..
- env: TEST_NAME="Linux arm-linux-gnueabihf-g++ (CMake)" - env: TEST_NAME="Linux arm-linux-gnueabihf-g++ (CMake)"
script: script:
- export CC="arm-linux-gnueabihf-gcc" - export CC="arm-linux-gnueabihf-gcc"
- export CXX="arm-linux-gnueabihf-g++" - export CXX="arm-linux-gnueabihf-g++"
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_TESTS=OFF .. && make -j2 && cd .. - source ./travis/ignored.sh
- export POCO_BASE=`pwd`
- mkdir cmake-build && cd cmake-build && cmake -DENABLE_NETSSL=OFF -DENABLE_CRYPTO=OFF -DENABLE_TESTS=ON ..
- make -s -j2 && cd ..
# TODO osx build # TODO osx build
# TODO run test suite # TODO run test suite
@@ -123,9 +150,11 @@ matrix:
# QA jobs for code analytics and metrics # QA jobs for code analytics and metrics
# build documentation and release # build documentation and release
- env: TEST_NAME="documentation & release" - env: TEST_NAME="Linux documentation & release"
compiler: gcc compiler: gcc
script: script:
- export CC="gcc"
- export CXX="g++"
- . env.sh && mkdoc all && mkrel all - . env.sh && mkdoc all && mkrel all
# static code analysis with cppcheck (we can add --enable=all later) # static code analysis with cppcheck (we can add --enable=all later)

View File

@@ -68,17 +68,17 @@ inline CppUnitException::CppUnitException(const CppUnitException& other): except
} }
inline CppUnitException::CppUnitException (const std::string& message, long lineNumber, const std::string& fileName): _message(message), _lineNumber(lineNumber), _data1lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _data2lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _fileName(fileName) inline CppUnitException::CppUnitException (const std::string& message, long exceptionLineNumber, const std::string& rFileName): _message(message), _lineNumber(exceptionLineNumber), _data1lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _data2lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _fileName(rFileName)
{ {
} }
inline CppUnitException::CppUnitException (const std::string& message, long lineNumber, long data1lineNumber, const std::string& fileName): _message(message), _lineNumber(lineNumber), _data1lineNumber(data1lineNumber), _data2lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _fileName(fileName) inline CppUnitException::CppUnitException (const std::string& message, long exceptionLineNumber, long data1lineNumber, const std::string& rFileName): _message(message), _lineNumber(exceptionLineNumber), _data1lineNumber(data1lineNumber), _data2lineNumber(CPPUNIT_UNKNOWNLINENUMBER), _fileName(rFileName)
{ {
} }
inline CppUnitException::CppUnitException (const std::string& message, long lineNumber, long data1lineNumber, long data2lineNumber, const std::string& fileName): _message(message), _lineNumber(lineNumber), _data1lineNumber(data1lineNumber), _data2lineNumber(data2lineNumber), _fileName(fileName) inline CppUnitException::CppUnitException (const std::string& message, long exceptionLineNumber, long data1lineNumber, long data2lineNumber, const std::string& rFileName): _message(message), _lineNumber(exceptionLineNumber), _data1lineNumber(data1lineNumber), _data2lineNumber(data2lineNumber), _fileName(rFileName)
{ {
} }

View File

@@ -56,10 +56,10 @@ class TestCaller: public TestCase
typedef void (Fixture::*TestMethod)(); typedef void (Fixture::*TestMethod)();
public: public:
TestCaller(const std::string& name, TestMethod test): TestCaller(const std::string& rName, TestMethod test):
TestCase(name), TestCase(rName),
_test(test), _test(test),
_fixture(new Fixture(name)) _fixture(new Fixture(rName))
{ {
} }

View File

@@ -173,7 +173,7 @@ protected:
// Constructs a test case // Constructs a test case
inline TestCase::TestCase(const std::string& name): _name (name) inline TestCase::TestCase(const std::string& rName): _name (rName)
{ {
} }

View File

@@ -52,7 +52,7 @@ protected:
// Constructs a TestFailure with the given test and exception. // Constructs a TestFailure with the given test and exception.
inline TestFailure::TestFailure(Test* failedTest, CppUnitException* thrownException): _failedTest(failedTest), _thrownException(thrownException) inline TestFailure::TestFailure(Test* pFailedTest, CppUnitException* pThrownException): _failedTest(pFailedTest), _thrownException(pThrownException)
{ {
} }

View File

@@ -21,21 +21,21 @@ namespace Poco {
namespace Crypto { namespace Crypto {
CipherKey::CipherKey(const std::string& name, const std::string& passphrase, const std::string& salt, int iterationCount, CipherKey::CipherKey(const std::string& rName, const std::string& passphrase, const std::string& salt, int iterationCount,
const std::string &digest): const std::string & rDigest):
_pImpl(new CipherKeyImpl(name, passphrase, salt, iterationCount, digest)) _pImpl(new CipherKeyImpl(rName, passphrase, salt, iterationCount, rDigest))
{ {
} }
CipherKey::CipherKey(const std::string& name, const ByteVec& key, const ByteVec& iv): CipherKey::CipherKey(const std::string& rName, const ByteVec& key, const ByteVec& iv):
_pImpl(new CipherKeyImpl(name, key, iv)) _pImpl(new CipherKeyImpl(rName, key, iv))
{ {
} }
CipherKey::CipherKey(const std::string& name): CipherKey::CipherKey(const std::string& rName):
_pImpl(new CipherKeyImpl(name)) _pImpl(new CipherKeyImpl(rName))
{ {
} }

View File

@@ -27,28 +27,28 @@ namespace Poco {
namespace Crypto { namespace Crypto {
CipherKeyImpl::CipherKeyImpl(const std::string& name, CipherKeyImpl::CipherKeyImpl(const std::string& rName,
const std::string& passphrase, const std::string& passphrase,
const std::string& salt, const std::string& salt,
int iterationCount, int iterationCount,
const std::string& digest): const std::string& rDigest):
_pCipher(0), _pCipher(0),
_pDigest(0), _pDigest(0),
_name(name), _name(rName),
_key(), _key(),
_iv() _iv()
{ {
// dummy access to Cipherfactory so that the EVP lib is initilaized // dummy access to Cipherfactory so that the EVP lib is initilaized
CipherFactory::defaultFactory(); CipherFactory::defaultFactory();
_pCipher = EVP_get_cipherbyname(name.c_str()); _pCipher = EVP_get_cipherbyname(rName.c_str());
if (!_pCipher) if (!_pCipher)
throw Poco::NotFoundException("Cipher " + name + " was not found"); throw Poco::NotFoundException("Cipher " + rName + " was not found");
_pDigest = EVP_get_digestbyname(digest.c_str()); _pDigest = EVP_get_digestbyname(rDigest.c_str());
if (!_pDigest) if (!_pDigest)
throw Poco::NotFoundException("Digest " + name + " was not found"); throw Poco::NotFoundException("Digest " + rName + " was not found");
_key = ByteVec(keySize()); _key = ByteVec(keySize());
@@ -57,35 +57,35 @@ CipherKeyImpl::CipherKeyImpl(const std::string& name,
} }
CipherKeyImpl::CipherKeyImpl(const std::string& name, CipherKeyImpl::CipherKeyImpl(const std::string& rName,
const ByteVec& key, const ByteVec& key,
const ByteVec& iv): const ByteVec& iv):
_pCipher(0), _pCipher(0),
_name(name), _name(rName),
_key(key), _key(key),
_iv(iv) _iv(iv)
{ {
// dummy access to Cipherfactory so that the EVP lib is initilaized // dummy access to Cipherfactory so that the EVP lib is initilaized
CipherFactory::defaultFactory(); CipherFactory::defaultFactory();
_pCipher = EVP_get_cipherbyname(name.c_str()); _pCipher = EVP_get_cipherbyname(rName.c_str());
if (!_pCipher) if (!_pCipher)
throw Poco::NotFoundException("Cipher " + name + " was not found"); throw Poco::NotFoundException("Cipher " + rName + " was not found");
} }
CipherKeyImpl::CipherKeyImpl(const std::string& name): CipherKeyImpl::CipherKeyImpl(const std::string& rName):
_pCipher(0), _pCipher(0),
_name(name), _name(rName),
_key(), _key(),
_iv() _iv()
{ {
// dummy access to Cipherfactory so that the EVP lib is initilaized // dummy access to Cipherfactory so that the EVP lib is initilaized
CipherFactory::defaultFactory(); CipherFactory::defaultFactory();
_pCipher = EVP_get_cipherbyname(name.c_str()); _pCipher = EVP_get_cipherbyname(rName.c_str());
if (!_pCipher) if (!_pCipher)
throw Poco::NotFoundException("Cipher " + name + " was not found"); throw Poco::NotFoundException("Cipher " + rName + " was not found");
_key = ByteVec(keySize()); _key = ByteVec(keySize());
_iv = ByteVec(ivSize()); _iv = ByteVec(ivSize());
generateKey(); generateKey();
@@ -165,7 +165,7 @@ void CipherKeyImpl::generateKey(
} }
// Now create the key and IV, using the digest set in the constructor. // Now create the key and IV, using the digest set in the constructor.
int keySize = EVP_BytesToKey( int cipherKeySize = EVP_BytesToKey(
_pCipher, _pCipher,
_pDigest, _pDigest,
(salt.empty() ? 0 : saltBytes), (salt.empty() ? 0 : saltBytes),
@@ -176,7 +176,7 @@ void CipherKeyImpl::generateKey(
ivBytes); ivBytes);
// Copy the buffers to our member byte vectors. // Copy the buffers to our member byte vectors.
_key.assign(keyBytes, keyBytes + keySize); _key.assign(keyBytes, keyBytes + cipherKeySize);
if (ivSize() == 0) if (ivSize() == 0)
_iv.clear(); _iv.clear();

View File

@@ -87,10 +87,10 @@ RSAKeyImpl::RSAKeyImpl(
RSA* pubKey = PEM_read_bio_RSAPublicKey(bio, &_pRSA, 0, 0); RSA* pubKey = PEM_read_bio_RSAPublicKey(bio, &_pRSA, 0, 0);
if (!pubKey) if (!pubKey)
{ {
int rc = BIO_reset(bio); int ret = BIO_reset(bio);
// BIO_reset() normally returns 1 for success and 0 or -1 for failure. // BIO_reset() normally returns 1 for success and 0 or -1 for failure.
// File BIOs are an exception, they return 0 for success and -1 for failure. // File BIOs are an exception, they return 0 for success and -1 for failure.
if (rc != 0) throw Poco::FileException("Failed to load public key", publicKeyFile); if (ret != 0) throw Poco::FileException("Failed to load public key", publicKeyFile);
pubKey = PEM_read_bio_RSA_PUBKEY(bio, &_pRSA, 0, 0); pubKey = PEM_read_bio_RSA_PUBKEY(bio, &_pRSA, 0, 0);
} }
BIO_free(bio); BIO_free(bio);
@@ -287,8 +287,8 @@ void RSAKeyImpl::save(std::ostream* pPublicKeyStream, std::ostream* pPrivateKeyS
throw Poco::WriteFileException("Failed to write public key to stream"); throw Poco::WriteFileException("Failed to write public key to stream");
} }
char* pData; char* pData;
long size = BIO_get_mem_data(bio, &pData); long keySize = BIO_get_mem_data(bio, &pData);
pPublicKeyStream->write(pData, static_cast<std::streamsize>(size)); pPublicKeyStream->write(pData, static_cast<std::streamsize>(keySize));
BIO_free(bio); BIO_free(bio);
} }
@@ -309,8 +309,8 @@ void RSAKeyImpl::save(std::ostream* pPublicKeyStream, std::ostream* pPrivateKeyS
throw Poco::FileException("Failed to write private key to stream"); throw Poco::FileException("Failed to write private key to stream");
} }
char* pData; char* pData;
long size = BIO_get_mem_data(bio, &pData); long keySize = BIO_get_mem_data(bio, &pData);
pPrivateKeyStream->write(pData, static_cast<std::streamsize>(size)); pPrivateKeyStream->write(pData, static_cast<std::streamsize>(keySize));
BIO_free(bio); BIO_free(bio);
} }
} }

View File

@@ -168,7 +168,9 @@ void Utility::throwException(int rc, const std::string& addErrMsg)
throw ExecutionAbortedException(std::string("Callback routine requested an abort"), addErrMsg); throw ExecutionAbortedException(std::string("Callback routine requested an abort"), addErrMsg);
case SQLITE_BUSY: case SQLITE_BUSY:
case SQLITE_BUSY_RECOVERY: case SQLITE_BUSY_RECOVERY:
#if defined(SQLITE_BUSY_SNAPSHOT)
case SQLITE_BUSY_SNAPSHOT: case SQLITE_BUSY_SNAPSHOT:
#endif
throw DBLockedException(std::string("The database file is locked"), addErrMsg); throw DBLockedException(std::string("The database file is locked"), addErrMsg);
case SQLITE_LOCKED: case SQLITE_LOCKED:
throw TableLockedException(std::string("A table in the database is locked"), addErrMsg); throw TableLockedException(std::string("A table in the database is locked"), addErrMsg);

View File

@@ -42,11 +42,12 @@ class Foundation_API Path
public: public:
enum Style enum Style
{ {
PATH_UNIX, /// Unix-style path PATH_UNIX, /// Unix-style path
PATH_WINDOWS, /// Windows-style path PATH_URI = PATH_UNIX, /// URI-style path, same as Unix-style
PATH_VMS, /// VMS-style path PATH_WINDOWS, /// Windows-style path
PATH_NATIVE, /// The current platform's native style PATH_VMS, /// VMS-style path
PATH_GUESS /// Guess the style by examining the path PATH_NATIVE, /// The current platform's native style
PATH_GUESS /// Guess the style by examining the path
}; };
typedef std::vector<std::string> StringVec; typedef std::vector<std::string> StringVec;

View File

@@ -166,7 +166,11 @@
#elif defined(__PPC) || defined(__POWERPC__) || defined(__powerpc) || defined(__PPC__) || \ #elif defined(__PPC) || defined(__POWERPC__) || defined(__powerpc) || defined(__PPC__) || \
defined(__powerpc__) || defined(__ppc__) || defined(__ppc) || defined(_ARCH_PPC) || defined(_M_PPC) defined(__powerpc__) || defined(__ppc__) || defined(__ppc) || defined(_ARCH_PPC) || defined(_M_PPC)
#define POCO_ARCH POCO_ARCH_PPC #define POCO_ARCH POCO_ARCH_PPC
#define POCO_ARCH_BIG_ENDIAN 1 #if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define POCO_ARCH_LITTLE_ENDIAN 1
#else
#define POCO_ARCH_BIG_ENDIAN 1
#endif
#elif defined(_POWER) || defined(_ARCH_PWR) || defined(_ARCH_PWR2) || defined(_ARCH_PWR3) || \ #elif defined(_POWER) || defined(_ARCH_PWR) || defined(_ARCH_PWR2) || defined(_ARCH_PWR3) || \
defined(_ARCH_PWR4) || defined(__THW_RS6000) defined(_ARCH_PWR4) || defined(__THW_RS6000)
#define POCO_ARCH POCO_ARCH_POWER #define POCO_ARCH POCO_ARCH_POWER

View File

@@ -21,6 +21,9 @@
#include "Poco/Foundation.h" #include "Poco/Foundation.h"
#include "Poco/Event.h"
#include "Poco/Mutex.h"
#include "Poco/Optional.h"
#include "Poco/RefCountedObject.h" #include "Poco/RefCountedObject.h"
#include <unistd.h> #include <unistd.h>
#include <vector> #include <vector>
@@ -41,9 +44,13 @@ public:
pid_t id() const; pid_t id() const;
int wait() const; int wait() const;
int wait(int options) const;
private: private:
pid_t _pid; const pid_t _pid;
mutable FastMutex _mutex;
mutable Event _event;
mutable Optional<int> _status;
}; };

View File

@@ -39,8 +39,8 @@ class WorkNotification: public Notification
public: public:
typedef AutoPtr<WorkNotification> Ptr; typedef AutoPtr<WorkNotification> Ptr;
WorkNotification(int data): WorkNotification(int workData):
_data(data) _data(workData)
{ {
} }

View File

@@ -18,6 +18,7 @@
#include "Poco/Exception.h" #include "Poco/Exception.h"
#include "Poco/NumberFormatter.h" #include "Poco/NumberFormatter.h"
#include "Poco/Pipe.h" #include "Poco/Pipe.h"
#include "Poco/Thread.h"
#include <limits> #include <limits>
#include <errno.h> #include <errno.h>
#include <signal.h> #include <signal.h>
@@ -42,7 +43,10 @@ namespace Poco {
// ProcessHandleImpl // ProcessHandleImpl
// //
ProcessHandleImpl::ProcessHandleImpl(pid_t pid): ProcessHandleImpl::ProcessHandleImpl(pid_t pid):
_pid(pid) _pid(pid),
_mutex(),
_event(Event::EVENT_MANUALRESET),
_status()
{ {
} }
@@ -60,24 +64,60 @@ pid_t ProcessHandleImpl::id() const
int ProcessHandleImpl::wait() const int ProcessHandleImpl::wait() const
{ {
int status; if (wait(0) != _pid)
int rc;
do
{
rc = waitpid(_pid, &status, 0);
}
while (rc < 0 && errno == EINTR);
if (rc != _pid)
throw SystemException("Cannot wait for process", NumberFormatter::format(_pid)); throw SystemException("Cannot wait for process", NumberFormatter::format(_pid));
const int status = _status.value();
if (WIFEXITED(status)) if (WIFEXITED(status))
return WEXITSTATUS(status); return WEXITSTATUS(status);
if (WIFSIGNALED(status)) if (WIFSIGNALED(status))
return -WTERMSIG(status); return -WTERMSIG(status);
// This line should never be reached. // This line should never be reached.
return std::numeric_limits<int>::max(); return std::numeric_limits<int>::max();
} }
int ProcessHandleImpl::wait(int options) const
{
{
FastMutex::ScopedLock lock(_mutex);
if (_status.isSpecified())
{
return _pid;
}
}
int status;
int rc;
do
{
rc = waitpid(_pid, &status, options);
}
while (rc < 0 && errno == EINTR);
if (rc == _pid)
{
FastMutex::ScopedLock lock(_mutex);
_status = status;
_event.set();
}
else if (rc < 0 && errno == ECHILD)
{
// Looks like another thread was lucky and it should update the status for us shortly
_event.wait();
FastMutex::ScopedLock lock(_mutex);
if (_status.isSpecified())
{
rc = _pid;
}
}
return rc;
}
// //
// ProcessImpl // ProcessImpl
// //
@@ -251,7 +291,7 @@ void ProcessImpl::killImpl(PIDImpl pid)
bool ProcessImpl::isRunningImpl(const ProcessHandleImpl& handle) bool ProcessImpl::isRunningImpl(const ProcessHandleImpl& handle)
{ {
return isRunningImpl(handle.id()); return handle.wait(WNOHANG) == 0;
} }

View File

@@ -90,7 +90,7 @@ namespace
} }
ActiveDispatcherTest::ActiveDispatcherTest(const std::string& name): CppUnit::TestCase(name) ActiveDispatcherTest::ActiveDispatcherTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -92,7 +92,7 @@ namespace
} }
ActiveMethodTest::ActiveMethodTest(const std::string& name): CppUnit::TestCase(name) ActiveMethodTest::ActiveMethodTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -60,7 +60,7 @@ namespace
} }
ActivityTest::ActivityTest(const std::string& name): CppUnit::TestCase(name) ActivityTest::ActivityTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -42,7 +42,7 @@ public:
}; };
AnyTest::AnyTest(const std::string& name): CppUnit::TestCase(name) AnyTest::AnyTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -18,7 +18,7 @@
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
ArrayTest::ArrayTest(const std::string& name): CppUnit::TestCase(name) ArrayTest::ArrayTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -67,7 +67,7 @@ namespace
} }
AutoPtrTest::AutoPtrTest(const std::string& name): CppUnit::TestCase(name) AutoPtrTest::AutoPtrTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -65,7 +65,7 @@ namespace
} }
AutoReleasePoolTest::AutoReleasePoolTest(const std::string& name): CppUnit::TestCase(name) AutoReleasePoolTest::AutoReleasePoolTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -24,7 +24,7 @@ using Poco::Base32Decoder;
using Poco::DataFormatException; using Poco::DataFormatException;
Base32Test::Base32Test(const std::string& name): CppUnit::TestCase(name) Base32Test::Base32Test(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -24,7 +24,7 @@ using Poco::Base64Decoder;
using Poco::DataFormatException; using Poco::DataFormatException;
Base64Test::Base64Test(const std::string& name): CppUnit::TestCase(name) Base64Test::Base64Test(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -27,7 +27,7 @@ using namespace Poco;
#define LARGEINC 100 #define LARGEINC 100
BasicEventTest::BasicEventTest(const std::string& name): CppUnit::TestCase(name) BasicEventTest::BasicEventTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -30,7 +30,7 @@ using Poco::Int64;
using Poco::UInt64; using Poco::UInt64;
BinaryReaderWriterTest::BinaryReaderWriterTest(const std::string& name): CppUnit::TestCase(name) BinaryReaderWriterTest::BinaryReaderWriterTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -27,7 +27,7 @@ using Poco::UInt64;
#endif #endif
ByteOrderTest::ByteOrderTest(const std::string& name): CppUnit::TestCase(name) ByteOrderTest::ByteOrderTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -47,7 +47,7 @@ public:
}; };
ChannelTest::ChannelTest(const std::string& name): CppUnit::TestCase(name) ChannelTest::ChannelTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -27,7 +27,7 @@ using Poco::NotFoundException;
using Poco::InvalidAccessException; using Poco::InvalidAccessException;
ClassLoaderTest::ClassLoaderTest(const std::string& name): CppUnit::TestCase(name) ClassLoaderTest::ClassLoaderTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -22,7 +22,7 @@ using Poco::Clock;
using Poco::Thread; using Poco::Thread;
ClockTest::ClockTest(const std::string& name): CppUnit::TestCase(name) ClockTest::ClockTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -92,7 +92,7 @@ namespace
} }
ConditionTest::ConditionTest(const std::string& name): CppUnit::TestCase(name) ConditionTest::ConditionTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -112,7 +112,7 @@ struct Large
#define ENABLE_BUGCHECK_TEST 0 #define ENABLE_BUGCHECK_TEST 0
CoreTest::CoreTest(const std::string& name): CppUnit::TestCase(name) CoreTest::CoreTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -21,7 +21,7 @@ using Poco::CountingInputStream;
using Poco::CountingOutputStream; using Poco::CountingOutputStream;
CountingStreamTest::CountingStreamTest(const std::string& name): CppUnit::TestCase(name) CountingStreamTest::CountingStreamTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -25,8 +25,8 @@ using Poco::DateTimeFormat;
using Poco::DateTimeFormatter; using Poco::DateTimeFormatter;
DateTimeFormatterTest::DateTimeFormatterTest(const std::string& name) DateTimeFormatterTest::DateTimeFormatterTest(const std::string& rName)
: CppUnit::TestCase(name) : CppUnit::TestCase(rName)
{ {
// Linker regresion SF #3288584 // Linker regresion SF #3288584
std::string message; std::string message;

View File

@@ -27,7 +27,7 @@ using Poco::Timestamp;
using Poco::SyntaxException; using Poco::SyntaxException;
DateTimeParserTest::DateTimeParserTest(const std::string& name): CppUnit::TestCase(name) DateTimeParserTest::DateTimeParserTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -25,7 +25,7 @@ using Poco::Timespan;
using Poco::AssertionViolationException; using Poco::AssertionViolationException;
DateTimeTest::DateTimeTest(const std::string& name): CppUnit::TestCase(name) DateTimeTest::DateTimeTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -25,7 +25,7 @@ using Poco::DigestEngine;
using Poco::MD5Engine; using Poco::MD5Engine;
DigestStreamTest::DigestStreamTest(const std::string& name): CppUnit::TestCase(name) DigestStreamTest::DigestStreamTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -23,8 +23,8 @@
using namespace Poco; using namespace Poco;
DirectoryIteratorsTest::DirectoryIteratorsTest(const std::string& name): DirectoryIteratorsTest::DirectoryIteratorsTest(const std::string& rName):
CppUnit::TestCase(name) CppUnit::TestCase(rName)
{ {
} }

View File

@@ -26,8 +26,8 @@
using Poco::DirectoryWatcher; using Poco::DirectoryWatcher;
DirectoryWatcherTest::DirectoryWatcherTest(const std::string& name): DirectoryWatcherTest::DirectoryWatcherTest(const std::string& rName):
CppUnit::TestCase(name), CppUnit::TestCase(rName),
_error(false) _error(false)
{ {
} }

View File

@@ -46,7 +46,7 @@ namespace
} }
DynamicFactoryTest::DynamicFactoryTest(const std::string& name): CppUnit::TestCase(name) DynamicFactoryTest::DynamicFactoryTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -28,7 +28,7 @@ using namespace Poco;
#define DURWAIT 300 #define DURWAIT 300
ExpireCacheTest::ExpireCacheTest(const std::string& name): CppUnit::TestCase(name) ExpireCacheTest::ExpireCacheTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -28,7 +28,7 @@ using namespace Poco;
#define DURWAIT 300 #define DURWAIT 300
ExpireLRUCacheTest::ExpireLRUCacheTest(const std::string& name): CppUnit::TestCase(name) ExpireLRUCacheTest::ExpireLRUCacheTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -23,7 +23,7 @@ using Poco::FIFOBufferStream;
using Poco::delegate; using Poco::delegate;
FIFOBufferStreamTest::FIFOBufferStreamTest(const std::string& name): CppUnit::TestCase(name) FIFOBufferStreamTest::FIFOBufferStreamTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -31,8 +31,8 @@ using Poco::delegate;
using std::memcpy; using std::memcpy;
FIFOBufferTest::FIFOBufferTest(const std::string& name): FIFOBufferTest::FIFOBufferTest(const std::string& rName):
CppUnit::TestCase(name), CppUnit::TestCase(rName),
_notToReadable(0), _notToReadable(0),
_notToWritable(0), _notToWritable(0),
_readableToNot(0), _readableToNot(0),

View File

@@ -26,7 +26,7 @@ using namespace Poco;
#define LARGEINC 100 #define LARGEINC 100
FIFOEventTest::FIFOEventTest(const std::string& name): CppUnit::TestCase(name) FIFOEventTest::FIFOEventTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -19,7 +19,7 @@
using Poco::FPE; using Poco::FPE;
FPETest::FPETest(const std::string& name): CppUnit::TestCase(name) FPETest::FPETest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -48,7 +48,7 @@ using Poco::DirectoryIterator;
using Poco::InvalidArgumentException; using Poco::InvalidArgumentException;
FileChannelTest::FileChannelTest(const std::string& name): CppUnit::TestCase(name) FileChannelTest::FileChannelTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -19,7 +19,7 @@
#include "Poco/Exception.h" #include "Poco/Exception.h"
FileStreamTest::FileStreamTest(const std::string& name): CppUnit::TestCase(name) FileStreamTest::FileStreamTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -30,7 +30,7 @@ using Poco::Timestamp;
using Poco::Thread; using Poco::Thread;
FileTest::FileTest(const std::string& name): CppUnit::TestCase(name) FileTest::FileTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -24,7 +24,7 @@ using Poco::Int64;
using Poco::UInt64; using Poco::UInt64;
FormatTest::FormatTest(const std::string& name): CppUnit::TestCase(name) FormatTest::FormatTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -24,7 +24,7 @@ using Poco::File;
using Poco::Path; using Poco::Path;
GlobTest::GlobTest(const std::string& name): CppUnit::TestCase(name) GlobTest::GlobTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -22,7 +22,7 @@ using Poco::MD5Engine;
using Poco::DigestEngine; using Poco::DigestEngine;
HMACEngineTest::HMACEngineTest(const std::string& name): CppUnit::TestCase(name) HMACEngineTest::HMACEngineTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -21,7 +21,7 @@
using Poco::HashMap; using Poco::HashMap;
HashMapTest::HashMapTest(const std::string& name): CppUnit::TestCase(name) HashMapTest::HashMapTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -21,7 +21,7 @@ using Poco::Hash;
using Poco::HashSet; using Poco::HashSet;
HashSetTest::HashSetTest(const std::string& name): CppUnit::TestCase(name) HashSetTest::HashSetTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -20,7 +20,7 @@
using namespace Poco; using namespace Poco;
HashTableTest::HashTableTest(const std::string& name): CppUnit::TestCase(name) HashTableTest::HashTableTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -24,7 +24,7 @@ using Poco::HexBinaryDecoder;
using Poco::DataFormatException; using Poco::DataFormatException;
HexBinaryTest::HexBinaryTest(const std::string& name): CppUnit::TestCase(name) HexBinaryTest::HexBinaryTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -22,7 +22,7 @@
using namespace Poco; using namespace Poco;
LRUCacheTest::LRUCacheTest(const std::string& name): CppUnit::TestCase(name) LRUCacheTest::LRUCacheTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -24,7 +24,7 @@ using Poco::OutputLineEndingConverter;
using Poco::StreamCopier; using Poco::StreamCopier;
LineEndingConverterTest::LineEndingConverterTest(const std::string& name): CppUnit::TestCase(name) LineEndingConverterTest::LineEndingConverterTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -28,7 +28,7 @@ using Poco::Stopwatch;
using Poco::NumberFormatter; using Poco::NumberFormatter;
LinearHashTableTest::LinearHashTableTest(const std::string& name): CppUnit::TestCase(name) LinearHashTableTest::LinearHashTableTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -21,7 +21,7 @@
using Poco::ListMap; using Poco::ListMap;
ListMapTest::ListMapTest(const std::string& name): CppUnit::TestCase(name) ListMapTest::ListMapTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -36,7 +36,7 @@ using std::strftime;
#endif #endif
LocalDateTimeTest::LocalDateTimeTest(const std::string& name): CppUnit::TestCase(name) LocalDateTimeTest::LocalDateTimeTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -26,7 +26,7 @@ using Poco::Message;
using Poco::AutoPtr; using Poco::AutoPtr;
LogStreamTest::LogStreamTest(const std::string& name): CppUnit::TestCase(name) LogStreamTest::LogStreamTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -24,7 +24,7 @@ using Poco::Message;
using Poco::AutoPtr; using Poco::AutoPtr;
LoggerTest::LoggerTest(const std::string& name): CppUnit::TestCase(name) LoggerTest::LoggerTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -61,7 +61,7 @@ namespace
} }
LoggingFactoryTest::LoggingFactoryTest(const std::string& name): CppUnit::TestCase(name) LoggingFactoryTest::LoggingFactoryTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -27,7 +27,7 @@ using Poco::PatternFormatter;
using Poco::AutoPtr; using Poco::AutoPtr;
LoggingRegistryTest::LoggingRegistryTest(const std::string& name): CppUnit::TestCase(name) LoggingRegistryTest::LoggingRegistryTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -20,7 +20,7 @@ using Poco::MD4Engine;
using Poco::DigestEngine; using Poco::DigestEngine;
MD4EngineTest::MD4EngineTest(const std::string& name): CppUnit::TestCase(name) MD4EngineTest::MD4EngineTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -20,7 +20,7 @@ using Poco::MD5Engine;
using Poco::DigestEngine; using Poco::DigestEngine;
MD5EngineTest::MD5EngineTest(const std::string& name): CppUnit::TestCase(name) MD5EngineTest::MD5EngineTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -32,7 +32,7 @@ class MfTestObject: public MfTestBase
}; };
ManifestTest::ManifestTest(const std::string& name): CppUnit::TestCase(name) ManifestTest::ManifestTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -20,7 +20,7 @@
using Poco::MemoryPool; using Poco::MemoryPool;
MemoryPoolTest::MemoryPoolTest(const std::string& name): CppUnit::TestCase(name) MemoryPoolTest::MemoryPoolTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -22,7 +22,7 @@ using Poco::MemoryInputStream;
using Poco::MemoryOutputStream; using Poco::MemoryOutputStream;
MemoryStreamTest::MemoryStreamTest(const std::string& name): CppUnit::TestCase(name) MemoryStreamTest::MemoryStreamTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -62,7 +62,7 @@ namespace
} }
MutexTest::MutexTest(const std::string& name): CppUnit::TestCase(name) MutexTest::MutexTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -20,7 +20,7 @@
using Poco::NDC; using Poco::NDC;
NDCTest::NDCTest(const std::string& name): CppUnit::TestCase(name) NDCTest::NDCTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -51,7 +51,7 @@ namespace
} }
NamedEventTest::NamedEventTest(const std::string& name): CppUnit::TestCase(name) NamedEventTest::NamedEventTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -77,7 +77,7 @@ namespace
} }
NamedMutexTest::NamedMutexTest(const std::string& name): CppUnit::TestCase(name) NamedMutexTest::NamedMutexTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -34,7 +34,7 @@ using Poco::NotFoundException;
using Poco::InvalidArgumentException; using Poco::InvalidArgumentException;
NamedTuplesTest::NamedTuplesTest(const std::string& name): CppUnit::TestCase(name) NamedTuplesTest::NamedTuplesTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -31,7 +31,7 @@ class TestNotification: public Notification
}; };
NotificationCenterTest::NotificationCenterTest(const std::string& name): CppUnit::TestCase(name) NotificationCenterTest::NotificationCenterTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -49,7 +49,7 @@ namespace
} }
NotificationQueueTest::NotificationQueueTest(const std::string& name): CppUnit::TestCase(name) NotificationQueueTest::NotificationQueueTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -20,7 +20,7 @@ using Poco::NullInputStream;
using Poco::NullOutputStream; using Poco::NullOutputStream;
NullStreamTest::NullStreamTest(const std::string& name): CppUnit::TestCase(name) NullStreamTest::NullStreamTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -21,7 +21,7 @@ using Poco::Int64;
using Poco::UInt64; using Poco::UInt64;
NumberFormatterTest::NumberFormatterTest(const std::string& name): CppUnit::TestCase(name) NumberFormatterTest::NumberFormatterTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -42,7 +42,7 @@ using Poco::decimalSeparator;
using Poco::thousandSeparator; using Poco::thousandSeparator;
NumberParserTest::NumberParserTest(const std::string& name): CppUnit::TestCase(name) NumberParserTest::NumberParserTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -20,7 +20,7 @@
using Poco::ObjectPool; using Poco::ObjectPool;
ObjectPoolTest::ObjectPoolTest(const std::string& name): CppUnit::TestCase(name) ObjectPoolTest::ObjectPoolTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -24,7 +24,7 @@ using Poco::SHA1Engine;
using Poco::DigestEngine; using Poco::DigestEngine;
PBKDF2EngineTest::PBKDF2EngineTest(const std::string& name): CppUnit::TestCase(name) PBKDF2EngineTest::PBKDF2EngineTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -34,7 +34,7 @@ using Poco::PathSyntaxException;
using Poco::Environment; using Poco::Environment;
PathTest::PathTest(const std::string& name): CppUnit::TestCase(name) PathTest::PathTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }
@@ -1511,15 +1511,15 @@ void PathTest::testForDirectory()
void PathTest::testExpand() void PathTest::testExpand()
{ {
#if defined(POCO_OS_FAMILY_UNIX) #if defined(POCO_OS_FAMILY_UNIX)
std::string s = Path::expand("~/.bashrc"); std::string s = Path::expand("~/.profile");
assert (s == Path::expand("$HOME/.bashrc")); assert (s == Path::expand("$HOME/.profile"));
assert (s == Environment::get("HOME") + "/.bashrc" || assert (s == Environment::get("HOME") + "/.profile" ||
s == Environment::get("HOME") + "//.bashrc"); s == Environment::get("HOME") + "//.profile");
Path p(s); Path p(s);
s = Path::expand("$HOME/.bashrc"); s = Path::expand("$HOME/.profile");
assert (s == Path::expand("~/.bashrc")); assert (s == Path::expand("~/.profile"));
s = Path::expand("${HOME}/.bashrc"); s = Path::expand("${HOME}/.profile");
assert (s == Path::expand("~/.bashrc")); assert (s == Path::expand("~/.profile"));
#elif defined(POCO_OS_FAMILY_WINDOWS) #elif defined(POCO_OS_FAMILY_WINDOWS)
std::string s = Path::expand("%TMP%\\foo"); std::string s = Path::expand("%TMP%\\foo");
assert (s == Environment::get("TMP") + "\\foo"); assert (s == Environment::get("TMP") + "\\foo");

View File

@@ -23,7 +23,7 @@ using Poco::Message;
using Poco::DateTime; using Poco::DateTime;
PatternFormatterTest::PatternFormatterTest(const std::string& name): CppUnit::TestCase(name) PatternFormatterTest::PatternFormatterTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -26,7 +26,7 @@ using namespace Poco;
#define LARGEINC 100 #define LARGEINC 100
PriorityEventTest::PriorityEventTest(const std::string& name): CppUnit::TestCase(name) PriorityEventTest::PriorityEventTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -49,7 +49,7 @@ namespace
} }
PriorityNotificationQueueTest::PriorityNotificationQueueTest(const std::string& name): CppUnit::TestCase(name) PriorityNotificationQueueTest::PriorityNotificationQueueTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -16,6 +16,7 @@
#include "Poco/Process.h" #include "Poco/Process.h"
#include "Poco/Pipe.h" #include "Poco/Pipe.h"
#include "Poco/PipeStream.h" #include "Poco/PipeStream.h"
#include "Poco/Thread.h"
#include <csignal> #include <csignal>
@@ -26,7 +27,7 @@ using Poco::PipeInputStream;
using Poco::PipeOutputStream; using Poco::PipeOutputStream;
ProcessTest::ProcessTest(const std::string& name): CppUnit::TestCase(name) ProcessTest::ProcessTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }
@@ -176,6 +177,27 @@ void ProcessTest::testIsRunning()
} }
void ProcessTest::testIsRunningAllowsForTermination()
{
#if !defined(_WIN32_WCE)
std::string name("TestApp");
std::string cmd;
#if defined(POCO_OS_FAMILY_UNIX)
cmd = "./";
cmd += name;
#else
cmd = name;
#endif
std::vector<std::string> args;
ProcessHandle ph = Process::launch(cmd, args, 0, 0, 0);
while (Process::isRunning(ph))
Poco::Thread::sleep(100);
#endif // !defined(_WIN32_WCE)
}
void ProcessTest::testSignalExitCode() void ProcessTest::testSignalExitCode()
{ {
#if defined(POCO_OS_FAMILY_UNIX) #if defined(POCO_OS_FAMILY_UNIX)
@@ -213,6 +235,7 @@ CppUnit::Test* ProcessTest::suite()
CppUnit_addTest(pSuite, ProcessTest, testLaunchRedirectOut); CppUnit_addTest(pSuite, ProcessTest, testLaunchRedirectOut);
CppUnit_addTest(pSuite, ProcessTest, testLaunchEnv); CppUnit_addTest(pSuite, ProcessTest, testLaunchEnv);
CppUnit_addTest(pSuite, ProcessTest, testIsRunning); CppUnit_addTest(pSuite, ProcessTest, testIsRunning);
CppUnit_addTest(pSuite, ProcessTest, testIsRunningAllowsForTermination);
CppUnit_addTest(pSuite, ProcessTest, testSignalExitCode); CppUnit_addTest(pSuite, ProcessTest, testSignalExitCode);
return pSuite; return pSuite;

View File

@@ -31,6 +31,7 @@ public:
void testLaunchRedirectOut(); void testLaunchRedirectOut();
void testLaunchEnv(); void testLaunchEnv();
void testIsRunning(); void testIsRunning();
void testIsRunningAllowsForTermination();
void testSignalExitCode(); void testSignalExitCode();
void setUp(); void setUp();

View File

@@ -121,7 +121,7 @@ private:
}; };
RWLockTest::RWLockTest(const std::string& name): CppUnit::TestCase(name) RWLockTest::RWLockTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -21,7 +21,7 @@
using Poco::RandomInputStream; using Poco::RandomInputStream;
RandomStreamTest::RandomStreamTest(const std::string& name): CppUnit::TestCase(name) RandomStreamTest::RandomStreamTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -21,7 +21,7 @@
using Poco::UInt32; using Poco::UInt32;
RandomTest::RandomTest(const std::string& name): CppUnit::TestCase(name) RandomTest::RandomTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -21,7 +21,7 @@ using Poco::RegularExpression;
using Poco::RegularExpressionException; using Poco::RegularExpressionException;
RegularExpressionTest::RegularExpressionTest(const std::string& name): CppUnit::TestCase(name) RegularExpressionTest::RegularExpressionTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -20,7 +20,7 @@ using Poco::SHA1Engine;
using Poco::DigestEngine; using Poco::DigestEngine;
SHA1EngineTest::SHA1EngineTest(const std::string& name): CppUnit::TestCase(name) SHA1EngineTest::SHA1EngineTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -69,7 +69,7 @@ private:
}; };
SemaphoreTest::SemaphoreTest(const std::string& name): CppUnit::TestCase(name) SemaphoreTest::SemaphoreTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -26,7 +26,7 @@ using Poco::LibraryAlreadyLoadedException;
typedef int (*GimmeFiveFunc)(); typedef int (*GimmeFiveFunc)();
SharedLibraryTest::SharedLibraryTest(const std::string& name): CppUnit::TestCase(name) SharedLibraryTest::SharedLibraryTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -25,7 +25,7 @@
using Poco::SharedMemory; using Poco::SharedMemory;
SharedMemoryTest::SharedMemoryTest(const std::string& name): CppUnit::TestCase(name) SharedMemoryTest::SharedMemoryTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -26,7 +26,7 @@ namespace
class TestObject class TestObject
{ {
public: public:
TestObject(const std::string& data): _data(data) TestObject(const std::string& rData): _data(rData)
{ {
++_count; ++_count;
} }
@@ -71,7 +71,7 @@ namespace
} }
SharedPtrTest::SharedPtrTest(const std::string& name): CppUnit::TestCase(name) SharedPtrTest::SharedPtrTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -33,7 +33,7 @@ using Poco::DateTimeFormatter;
using Poco::AutoPtr; using Poco::AutoPtr;
SimpleFileChannelTest::SimpleFileChannelTest(const std::string& name): CppUnit::TestCase(name) SimpleFileChannelTest::SimpleFileChannelTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -20,7 +20,7 @@
using namespace Poco; using namespace Poco;
SimpleHashTableTest::SimpleHashTableTest(const std::string& name): CppUnit::TestCase(name) SimpleHashTableTest::SimpleHashTableTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -23,7 +23,7 @@ using Poco::Timestamp;
using Poco::Thread; using Poco::Thread;
StopwatchTest::StopwatchTest(const std::string& name): CppUnit::TestCase(name) StopwatchTest::StopwatchTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

View File

@@ -29,7 +29,7 @@ using Poco::ASCIIEncoding;
using Poco::StreamCopier; using Poco::StreamCopier;
StreamConverterTest::StreamConverterTest(const std::string& name): CppUnit::TestCase(name) StreamConverterTest::StreamConverterTest(const std::string& rName): CppUnit::TestCase(rName)
{ {
} }

Some files were not shown because too many files have changed in this diff Show More