Explorar o código

Adds tests to Travis CI build

CapXilinx %!s(int64=9) %!d(string=hai) anos
pai
achega
5428ed130a

+ 10 - 1
.travis.yml

@@ -1,5 +1,7 @@
 # This will run on Travis' 'new' container-based infrastructure
 sudo: false
+os: linux
+dist: precise
 
 language: c
 
@@ -26,11 +28,18 @@ addons:
       - doxygen-gui
       - graphviz
 
+#Prepare CppUTest from source, as package is not available
+before_script:
+  - cd $TRAVIS_BUILD_DIR/source
+  - chmod +x $TRAVIS_BUILD_DIR/travis_scripts/installCppUTestDependency.sh
+  - $TRAVIS_BUILD_DIR/travis_scripts/installCppUTestDependency.sh
+
 # Build your code e.g. by calling make
 script:
   - cd $TRAVIS_BUILD_DIR/bin/posix
-  - ./setup_posix.sh
+  - cmake -DOpENer_PLATFORM:STRING="POSIX" -DCMAKE_BUILD_TYPE:STRING="" -DOpENer_64_BIT_DATA_TYPES_ENABLED:BOOL=ON -DOpENer_TESTS:BOOL=ON -DCPPUTEST_HOME:PATH=$TRAVIS_BUILD_DIR/source/dependencies/cpputest -DCPPUTEST_LIBRARY:FILEPATH=$TRAVIS_BUILD_DIR/source/dependencies/cpputest/src/CppUTest/libCppUTest.a -DCPPUTESTEXT_LIBRARY:FILEPATH=$TRAVIS_BUILD_DIR/source/dependencies/cpputest/src/CppUTestExt/libCppUTestExt.a ../../source
   - make
+  - make test
 
 # Generate and deploy documentation
 after_success:

+ 2 - 2
source/tests/CMakeLists.txt

@@ -11,7 +11,7 @@ add_test_includes()
 ###################################################
 # Copy custom test output file to binary location #
 ###################################################
-configure_file( CTestCustom.cmake ${PROJECT_BINARY_DIR}/CTestCustom.cmake )
+#configure_file( CTestCustom.cmake ${PROJECT_BINARY_DIR}/CTestCustom.cmake )
 
 add_subdirectory( utils )
 add_subdirectory( enet_encap )
@@ -27,4 +27,4 @@ target_link_libraries( OpENer_Tests EthernetEncapsulationTest ENET_ENCAP )
 ########################################
 # Adds test to CTest environment       #
 ########################################
-add_test(OpENer_Tests ${EXECUTABLE_OUTPUT_PATH}/OpENer_Tests)
+add_test(OpENer_Tests ${EXECUTABLE_OUTPUT_PATH}/OpENer_Tests -v -c)

+ 0 - 1
source/tests/CTestCustom.cmake

@@ -1 +0,0 @@
-set( CTEST_CUSTOM_POST_TEST ${CTEST_CUSTOM_POST_TEST} "cat Testing/Temporary/LastTest.log" )

+ 16 - 0
travis_scripts/installCppUTestDependency.sh

@@ -0,0 +1,16 @@
+#!/bin/sh
+
+echo 'Setting up the CppUTest script...'
+# Exit with nonzero exit code if anything fails
+set -e
+
+mkdir dependencies
+cd dependencies
+
+git clone https://github.com/cpputest/cpputest.git
+
+cd cpputest
+git checkout v3.8
+cmake CMakeLists.txt
+make
+cd ../..