From d795491c487cb0626641821cfa1452666dbf94be Mon Sep 17 00:00:00 2001 From: abma Date: Mon, 18 Aug 2014 00:34:45 +0200 Subject: [PATCH] fix unittests on linux / enable on travis-ci --- .travis.yml | 10 ++++++---- CMakeLists.txt | 16 +++++++--------- code/GenVertexNormalsProcess.h | 2 +- code/JoinVerticesProcess.h | 2 +- test/CMakeLists.txt | 8 +++++--- test/unit/Main.cpp | 7 +++---- test/unit/utImporter.cpp | 4 ++-- test/unit/utNoBoostTest.h | 4 ++-- 8 files changed, 27 insertions(+), 26 deletions(-) diff --git a/.travis.yml b/.travis.yml index aa07c4f75..e0c0788ae 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ before_install: - - sudo apt-get install cmake + - sudo apt-get install cmake libcppunit-dev env: - TRAVIS_NO_EXPORT=YES @@ -13,7 +13,9 @@ compiler: - gcc - clang -script: cmake -G "Unix Makefiles" -DASSIMP_ENABLE_BOOST_WORKAROUND=YES -DASSIMP_NO_EXPORT=$TRAVIS_NO_EXPORT -STATIC_BUILD=$TRAVIS_STATIC_BUILD && make - - +script: + - cmake -G "Unix Makefiles" -DASSIMP_ENABLE_BOOST_WORKAROUND=YES -DASSIMP_NO_EXPORT=$TRAVIS_NO_EXPORT -STATIC_BUILD=$TRAVIS_STATIC_BUILD + - make + - cd test/unit + - ../../bin/unit diff --git a/CMakeLists.txt b/CMakeLists.txt index c5bbfdb1f..e32afb166 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -210,16 +210,14 @@ IF ( ASSIMP_BUILD_SAMPLES) ADD_SUBDIRECTORY( samples/SimpleOpenGL/ ) ENDIF ( ASSIMP_BUILD_SAMPLES ) -IF ( WIN32 ) - option ( ASSIMP_BUILD_TESTS - "If the test suite for Assimp is built in addition to the library." - ON - ) +option ( ASSIMP_BUILD_TESTS + "If the test suite for Assimp is built in addition to the library." + ON +) - IF ( ASSIMP_BUILD_TESTS ) - ADD_SUBDIRECTORY( test/ ) - ENDIF ( ASSIMP_BUILD_TESTS ) -ENDIF ( WIN32 ) +IF ( ASSIMP_BUILD_TESTS ) + ADD_SUBDIRECTORY( test/ ) +ENDIF ( ASSIMP_BUILD_TESTS ) IF(MSVC) option ( ASSIMP_INSTALL_PDB diff --git a/code/GenVertexNormalsProcess.h b/code/GenVertexNormalsProcess.h index 9b103892c..e77e71e59 100644 --- a/code/GenVertexNormalsProcess.h +++ b/code/GenVertexNormalsProcess.h @@ -53,7 +53,7 @@ namespace Assimp { // --------------------------------------------------------------------------- /** The GenFaceNormalsProcess computes vertex normals for all vertizes */ -class ASSIMP_API_WINONLY GenVertexNormalsProcess : public BaseProcess +class ASSIMP_API GenVertexNormalsProcess : public BaseProcess { public: diff --git a/code/JoinVerticesProcess.h b/code/JoinVerticesProcess.h index a004b2528..0195c0168 100644 --- a/code/JoinVerticesProcess.h +++ b/code/JoinVerticesProcess.h @@ -59,7 +59,7 @@ class JoinVerticesTest; * erases all but one of the copies. This usually reduces the number of vertices * in a mesh by a serious amount and is the standard form to render a mesh. */ -class ASSIMP_API_WINONLY JoinVerticesProcess : public BaseProcess +class ASSIMP_API JoinVerticesProcess : public BaseProcess { public: diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 544b57a57..92b618558 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -15,7 +15,7 @@ SOURCE_GROUP( unit FILES unit/BoostWorkaround/tupletest.cpp ) - +if(WIN32) SET( CPPUNIT_SRCS ../contrib/cppunit-1.12.1/src/cppunit/AdditionalMessage.cpp ../contrib/cppunit-1.12.1/src/cppunit/Asserter.cpp @@ -72,7 +72,9 @@ SET( CPPUNIT_SRCS ../contrib/cppunit-1.12.1/src/cppunit/XmlOutputterHook.cpp ) SOURCE_GROUP(cppunit FILES ${CPPUNIT_SRCS}) - +else() + find_library(CPPUNIT_LIBRARY cppunit) +endif() SET( TEST_SRCS unit/utFindDegenerates.cpp @@ -133,4 +135,4 @@ add_executable( unit SET_PROPERTY(TARGET assimp PROPERTY DEBUG_POSTFIX ${ASSIMP_DEBUG_POSTFIX}) -target_link_libraries ( unit assimp ) +target_link_libraries ( unit assimp ${CPPUNIT_LIBRARY} ) diff --git a/test/unit/Main.cpp b/test/unit/Main.cpp index 5c7bb60fb..33840a3c0 100644 --- a/test/unit/Main.cpp +++ b/test/unit/Main.cpp @@ -26,9 +26,8 @@ int main (int argc, char* argv[]) // .. and C. They should smoothly work together aiEnableVerboseLogging(AI_TRUE); - aiAttachLogStream(&aiGetPredefinedLogStream( - aiDefaultLogStream_FILE, - "AssimpLog_C.txt")); + aiLogStream logstream= aiGetPredefinedLogStream(aiDefaultLogStream_FILE, "AssimpLog_C.txt"); + aiAttachLogStream(&logstream); // ............................................................................ @@ -66,4 +65,4 @@ int main (int argc, char* argv[]) // Rueckmeldung, ob Tests erfolgreich waren return collectedresults.wasSuccessful () ? 0 : 1; -} \ No newline at end of file +} diff --git a/test/unit/utImporter.cpp b/test/unit/utImporter.cpp index 702bb7978..51b7764dd 100644 --- a/test/unit/utImporter.cpp +++ b/test/unit/utImporter.cpp @@ -208,11 +208,11 @@ void ImporterTest :: testMultipleReads (void) CPPUNIT_ASSERT(pImp->ReadFile("../../test/models/X/test.x",flags)); //CPPUNIT_ASSERT(pImp->ReadFile("../../test/models/X/dwarf.x",flags)); # is in nonbsd - CPPUNIT_ASSERT(pImp->ReadFile("../../test/models/X/Testwuson.x",flags)); + CPPUNIT_ASSERT(pImp->ReadFile("../../test/models/X/Testwuson.X",flags)); CPPUNIT_ASSERT(pImp->ReadFile("../../test/models/X/anim_test.x",flags)); //CPPUNIT_ASSERT(pImp->ReadFile("../../test/models/X/dwarf.x",flags)); # is in nonbsd CPPUNIT_ASSERT(pImp->ReadFile("../../test/models/X/anim_test.x",flags)); - CPPUNIT_ASSERT(pImp->ReadFile("../../test/models/X/bcn_epileptic.x",flags)); + CPPUNIT_ASSERT(pImp->ReadFile("../../test/models/X/BCN_Epileptic.X",flags)); //CPPUNIT_ASSERT(pImp->ReadFile("../../test/models/X/dwarf.x",flags)); # is in nonbsd } diff --git a/test/unit/utNoBoostTest.h b/test/unit/utNoBoostTest.h index 5fe3ceabd..6fbff7dff 100644 --- a/test/unit/utNoBoostTest.h +++ b/test/unit/utNoBoostTest.h @@ -4,7 +4,7 @@ namespace noboost { #define ASSIMP_FORCE_NOBOOST -#include "..\..\code\BoostWorkaround\boost\format.hpp" +#include "../../code/BoostWorkaround/boost/format.hpp" using boost::format; using boost::str; @@ -34,4 +34,4 @@ class NoBoostTest : public CPPUNIT_NS :: TestFixture }; -#endif \ No newline at end of file +#endif