Browse Source

travis ci required fixes

Rob Parolin 6 years ago
parent
commit
de20aed437
3 changed files with 19 additions and 5 deletions
  1. 6 4
      .travis.yml
  2. 9 0
      test/CMakeLists.txt
  3. 4 1
      test/source/TestBitTricks.cpp

+ 6 - 4
.travis.yml

@@ -19,12 +19,12 @@ addons:
     sources:
       - ubuntu-toolchain-r-test
       - george-edison55-precise-backports
-      - llvm-toolchain-trusty-5.0
+      - llvm-toolchain-trusty-7
     packages:
       - cmake
       - cmake-data
       - g++-7
-      - clang-5.0
+      - clang-7
 
 matrix:
     exclude:
@@ -49,8 +49,10 @@ before_install:
     - git submodule update --init 
 
 install:
-  - if [[ "$CXX" == "g++" ]]; then export CC="gcc-7"  ;fi
-  - if [[ "$CXX" == "g++" ]]; then export CXX="g++-7" ;fi
+  - if [[ "$CXX" == "g++" ]];     then export CC="gcc-7"      ;fi
+  - if [[ "$CXX" == "g++" ]];     then export CXX="g++-7"     ;fi
+  - if [[ "$CXX" == "clang++" && "${TRAVIS_OS_NAME}" != "osx" ]]; then export CC="clang-7"    ;fi
+  - if [[ "$CXX" == "clang++" && "${TRAVIS_OS_NAME}" != "osx" ]]; then export CXX="clang++-7" ;fi
 
 # Universal Setup
 before_script:

+ 9 - 0
test/CMakeLists.txt

@@ -56,6 +56,15 @@ target_link_libraries(EAStdCTest EASTL)
 target_link_libraries(EAStdCTest EATest)
 target_link_libraries(EAStdCTest EAThread)
 
+set(THREADS_PREFER_PTHREAD_FLAG ON)
+find_package(Threads REQUIRED)
+
+if((NOT APPLE) AND (NOT WIN32))
+    target_link_libraries(EAStdCTest ${EASTLTest_Libraries} Threads::Threads rt)
+else()
+    target_link_libraries(EAStdCTest ${EASTLTest_Libraries} Threads::Threads)
+endif()
+
 #-------------------------------------------------------------------------------------------
 # Run Unit tests and verify the results.
 #-------------------------------------------------------------------------------------------

+ 4 - 1
test/source/TestBitTricks.cpp

@@ -1289,7 +1289,10 @@ int TestBitTricks()
 	// EAOffsetOf
 	size_t o = EAOffsetOf(OffsetofTest, x1);
 	EATEST_VERIFY(o == 4);
-	EA_COMPILETIME_ASSERT(EAOffsetOf(OffsetofTest, x1) == 4); // Verify that this works at compile-time.
+	#ifndef EA_COMPILER_GNUC
+		// GCC correctly throws an error that the EAOffsetOf implementation used reinterpret_cast which isn't constexpr.
+		EA_COMPILETIME_ASSERT(EAOffsetOf(OffsetofTest, x1) == 4); // Verify that this works at compile-time.
+	#endif
 
 	int ind = 1;
 	o = EAOffsetOf(OffsetofTest1, x[ind]);