Skip to content

Commit

Permalink
Merge pull request #9146 from fetzerch/cmake-fix-tests
Browse files Browse the repository at this point in the history
[cmake] Fix tests (/ static initialization order)
  • Loading branch information
fetzerch committed Feb 21, 2016
2 parents 94e0fe3 + 9f6aa55 commit 41cbc6f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
13 changes: 10 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ install:
# Linux dependencies
#
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$BUILD" == "Kodi" ]]; then
sudo apt-get install -qq automake autopoint build-essential cmake curl dcadec-dev default-jre gawk gdc
sudo apt-get install -qq automake autopoint build-essential cmake curl dcadec-dev default-jre gawk gdb gdc
gettext git-core gperf libasound2-dev libass-dev libbz2-dev libcap-dev libcdio-dev libcrossguid-dev libcurl3
libcurl4-openssl-dev libdbus-1-dev libfontconfig-dev libegl1-mesa-dev libfreetype6-dev libfribidi-dev libgif-dev
libiso9660-dev libjpeg-dev libltdl-dev liblzo2-dev libmicrohttpd-dev libmodplug-dev libmysqlclient-dev libnfs-dev
Expand All @@ -86,6 +86,7 @@ before_script:
# Linux
#
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$BUILD" == "Kodi" ]]; then
ulimit -c unlimited -S;
if [[ "$TOOLS" == "Autotools" ]]; then
cd $TRAVIS_BUILD_DIR &&
./bootstrap;
Expand All @@ -96,9 +97,9 @@ before_script:
fi
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$BUILD" == "Kodi" && "$CXX" == "g++" ]]; then
if [[ "$TOOLS" == "Autotools" ]]; then
./configure;
./configure --enable-debug;
elif [[ "$TOOLS" == "CMake" ]]; then
cmake ../project/cmake;
cmake -DCMAKE_BUILD_TYPE=Debug ../project/cmake;
fi
fi
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$BUILD" == "Kodi" && "$CXX" == "clang++" ]]; then
Expand Down Expand Up @@ -138,6 +139,12 @@ script:
make -j3;
fi

after_failure:
- COREFILE=$(find . -maxdepth 1 -name "core*" | head -n 1)
- if [[ -f "$COREFILE" ]]; then
gdb -c "$COREFILE" kodi-test -ex "thread apply all bt" -ex "set pagination 0" -batch;
fi

# Disable annoying emails
#
notifications:
Expand Down
4 changes: 4 additions & 0 deletions xbmc/SystemGlobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
#include "interfaces/python/XBPython.h"
#endif

// Guarantee that CSpecialProtocol is initialized before and uninitialized after RarManager
#include "filesystem/SpecialProtocol.h"
std::map<std::string, std::string> CSpecialProtocol::m_pathMap;

#if defined(HAS_FILESYSTEM_RAR)
#include "filesystem/RarManager.h"
#endif
Expand Down
2 changes: 0 additions & 2 deletions xbmc/filesystem/SpecialProtocol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
#include "utils/StringUtils.h"
#endif

std::map<std::string, std::string> CSpecialProtocol::m_pathMap;

void CSpecialProtocol::SetProfilePath(const std::string &dir)
{
SetPath("profile", dir);
Expand Down
12 changes: 0 additions & 12 deletions xbmc/test/xbmc-test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,17 @@
#include <cstdio>
#include <cstdlib>

class NullLogger : public XbmcCommons::ILogger
{
public:
void log(int loglevel, const char* message) {}
};

int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
CXBMCTestUtils::Instance().ParseArgs(argc, argv);

// we need to configure CThread to use a dummy logger
NullLogger* nullLogger = new NullLogger();
CThread::SetLogger(nullLogger);

if (!testing::AddGlobalTestEnvironment(new TestBasicEnvironment()))
{
fprintf(stderr, "Unable to add basic test environment.\n");
exit(EXIT_FAILURE);
}
int ret = RUN_ALL_TESTS();

delete nullLogger;

return ret;
}

0 comments on commit 41cbc6f

Please sign in to comment.