Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cmake] Fix tests (/ static initialization order) #9146

Merged
merged 4 commits into from
Feb 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.


#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;
}