Skip to content

Commit

Permalink
use docker-compose for travis tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atimin committed Dec 23, 2018
1 parent 066b33b commit a3fdb0c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 16 deletions.
13 changes: 5 additions & 8 deletions .travis.yml
Expand Up @@ -5,13 +5,10 @@ services:
- docker

before_install:
- docker build -t asneg/opcuastack:test .
- docker run --name test_container asneg/opcuastack:test sh build.sh -t tst -j 2 -B Release --test-with-server
- docker commit test_container asneg/opcuastack:test
- docker run -d -p 127.0.0.1:8889:8889 asneg/asneg-demo:latest
- docker ps -a
- docker-compose run --name test_container stack sh build.sh -t tst -j 4 -B Release --test-with-server opc.tcp://demo_server:8889
- docker commit test_container opcuastack_stack

script:
- docker run -w /OpcUaStack/build_tst_Release asneg/opcuastack:test ./OpcUaStackCoreTest
- docker run -w /OpcUaStack/build_tst_Release asneg/opcuastack:test ./OpcUaStackServerTest
- docker run -w /OpcUaStack/build_tst_Release asneg/opcuastack:test ./OpcUaStackClientTest
- docker-compose run -w /OpcUaStack/build_tst_Release stack ./OpcUaStackCoreTest
- docker-compose run -w /OpcUaStack/build_tst_Release stack ./OpcUaStackServerTest
- docker-compose run -w /OpcUaStack/build_tst_Release stack ./OpcUaStackClientTest
10 changes: 5 additions & 5 deletions build.sh
Expand Up @@ -31,7 +31,7 @@ usage()
echo "--jobs, -j JOB_COUNT: sets the number of the jobs of make"
echo ""
echo "--build-type, -B BUILD_TYPE: set the build types (Debug | Release). By default, it is Debug type"
echo "--test-with-server: build client test for real OPC UA server. By default, turned off "
echo "--test-with-server URI: build client test for real OPC UA server. By default, empty "
}


Expand Down Expand Up @@ -312,7 +312,7 @@ build_tst()
cmake ../tst \
"${CMAKE_GENERATOR_LOCAL}" \
-DOPCUASTACK_INSTALL_PREFIX="${STACK_PREFIX}" \
${REAL_SERVER_FLAG} \
-DTEST_SERVER_URI=${TEST_SERVER_URI} \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}"
RESULT=$?
if [ ${RESULT} -ne 0 ] ;
Expand Down Expand Up @@ -383,7 +383,7 @@ INSTALL_PREFIX="${HOME}/.ASNeG"
STACK_PREFIX="/"
JOBS=1
BUILD_TYPE="Debug"
REAL_SERVER_FLAG="-DREAL_SERVER=OFF"
TEST_SERVER_URI=""

while [ $# -gt 0 ];
do
Expand Down Expand Up @@ -416,10 +416,10 @@ case $key in
shift # past value
;;

#flags
--test-with-server)
REAL_SERVER_FLAG="-DREAL_SERVER=ON"
TEST_SERVER_URI="$2"
shift # past flag
shift # past value
;;
*) # unknown option
shift # past argument
Expand Down
11 changes: 11 additions & 0 deletions docker-compose.yml
@@ -0,0 +1,11 @@
version: '2'
services:
demo_server:
image: asneg/asneg-demo:latest
ports:
- 127.0.0.1:8889:8889
stack:
depends_on:
- demo_server
build: .

4 changes: 2 additions & 2 deletions tst/CMakeLists.txt
Expand Up @@ -53,8 +53,8 @@ option(
ON
)

if (REAL_SERVER)
add_definitions(-DREAL_SERVER)
if (TEST_SERVER_URI)
add_definitions(-DREAL_SERVER -DREAL_SERVER_URI="${TEST_SERVER_URI}")
endif()

#add_definitions(-DBOOST_ALL_DYN_LINK)
Expand Down
2 changes: 1 addition & 1 deletion tst/unittest.h
Expand Up @@ -4,7 +4,7 @@
#include <stdio.h>
#include "os.h"

#define REAL_SERVER_URI "opt.tcp://127.0.0.1:8889"
//#define REAL_SERVER_URI "opt.tcp://127.0.0.1:8889"
//#define REAL_SERVER_URI "opt.tcp://192.168.0.142:48010"
//#define REAL_SERVER_URI "opt.tcp://192.168.129.1:48010"
//#define REAL_SESSION_NAME "urn:127.0.0.1:ASNeG.de:ASNeG-Client
Expand Down

0 comments on commit a3fdb0c

Please sign in to comment.