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

Add pthread to unit tests in UNIX #396

Merged
merged 2 commits into from
May 3, 2018
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
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ addons:
- unzip
- gcc-4.8
- g++-4.8
- python-pip
- python3-pip

before_install:
- export TRAVIS=scripts/travis
- source ${TRAVIS}/travis_setup_env.sh
- ${TRAVIS}/travis_osx_install.sh

install:
- pip install --user cpplint pylint
- pip3 install --user cpplint pylint

script: ${TRAVIS}/travis_script.sh

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ $(ALIB):
$(AR) cr $@ $+

lint:
python scripts/lint.py dmlc ${LINT_LANG} include src scripts $(NOLINT_FILES)
scripts/lint.py dmlc ${LINT_LANG} include src scripts $(NOLINT_FILES)

pylint:
python scripts/lint.py dmlc ${LINT_LANG} tracker/dmlc_tracker
scripts/lint.py dmlc ${LINT_LANG} tracker/dmlc_tracker

doxygen:
doxygen doc/Doxyfile
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# pylint: disable=protected-access, unused-variable, locally-disabled, len-as-condition
"""Lint helper to generate lint summary of source.

Expand Down
2 changes: 2 additions & 0 deletions scripts/travis/travis_osx_install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
set -e
set -x

if [ ${TRAVIS_OS_NAME} != "osx" ]; then
exit 0
Expand Down
11 changes: 7 additions & 4 deletions scripts/travis/travis_script.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/bin/bash

set -e
set -x

# main script of travis
if [ ${TASK} == "lint" ]; then
make lint || exit -1
make lint
make doxygen 2>log.txt
(cat log.txt| grep -v ENABLE_PREPROCESSING |grep -v "unsupported tag" |grep warning) && exit -1
(cat log.txt| grep -v ENABLE_PREPROCESSING |grep -v "unsupported tag" |grep warning) && exit 1
exit 0
fi

Expand All @@ -24,6 +27,6 @@ if [ ${TASK} == "unittest_gtest" ]; then
fi
echo "GTEST_PATH="${CACHE_PREFIX} >> config.mk
echo "BUILD_TEST=1" >> config.mk
make all || exit -1
test/unittest/dmlc_unittest || exit -1
make all
test/unittest/dmlc_unittest
fi
3 changes: 3 additions & 0 deletions test/unittest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ if(NOT GTEST_ROOT)
endif()

if(GTEST_FOUND)
if (UNIX)
SET(CMAKE_EXE_LINKER_FLAGS "-pthread")
endif(UNIX)
enable_testing()
find_package(Threads REQUIRED)
file(GLOB_RECURSE UNIT_TEST_SOURCE "*.cc")
Expand Down