Last sync 2016.04.01
[deliverable/titan.core.git] / titan_executor_api / TITAN_Executor_API_test / build_and_run_test.sh
CommitLineData
3abe9331 1###############################################################################
48a86384 2# Copyright (c) 2000-2016 Ericsson Telecom AB
3abe9331 3# All rights reserved. This program and the accompanying materials
4# are made available under the terms of the Eclipse Public License v1.0
5# which accompanies this distribution, and is available at
6# http://www.eclipse.org/legal/epl-v10.html
48a86384 7#
8# Contributors:
d44e3c4f 9# Balasko, Jeno
10# Lovassy, Arpad
48a86384 11#
3abe9331 12###############################################################################
13
14# EDIT THESE LINES TO SET CORRECT JAR LOCATIONS
15
48a86384 16JUNIT_FULL=$HOME/lib/org.junit_4.11.0.v201303080030/junit.jar
17HAMCREST_FULL=$HOME/lib/org.hamcrest.core_1.3.0.v201303031735.jar
3abe9331 18
19#---------------------------------------------------------------------
20# DO NOT EDIT AFTER THIS LINE
21
22# check if JAVA exists
23# http://stackoverflow.com/questions/7334754/correct-way-to-check-java-version-from-bash-script
24if type -p java; then
25 echo found java executable in PATH
26 _java=java
27elif [[ -n "$JAVA_HOME" ]] && [[ -x "$JAVA_HOME/bin/java" ]]; then
28 echo found java executable in JAVA_HOME
29 _java="$JAVA_HOME/bin/java"
30else
31 echo "no java, exiting"; exit 1;
32fi
33
34# check java version (>=1.7)
35if [[ "$_java" ]]; then
36 version=$("$_java" -version 2>&1 | awk -F '"' '/version/ {print $2}')
37 echo version "$version"
38 if [[ "$version" > "1.7" ]]; then
39 echo "version is at least 1.7, OK";
40 else
41 echo "version is less than 1.7, NOT OK, exiting"; exit 1;
42 fi
43fi
44
45# check java version (>=1.7) in another way
46[ $(java -version 2>&1 | sed 's/java version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q') -ge 17 ] && echo "version is at least 1.7, OK" || { echo "version is less than 1.7, NOT OK, exiting"; exit 1; }
47
48# checks if file exists, exits if not
49# @param $1 file full path
50function file_exist {
51 [ -f "$1" ] && echo "$1 FOUND, OK" || { echo "$1 NOT FOUND, exiting"; exit 1; }
52}
53
54# checks if directory exists, exits if not
55# @param $1 directory full path
56function dir_exist {
57 [ -d "$1" ] && echo "$1 DIRECTORY FOUND, OK" || { echo "$1 DIRECTORY NOT FOUND, exiting"; exit 1; }
58}
59
60# check TITAN dependencies
61[ ! -z "${TTCN3_DIR}" ] && echo "\$TTCN3_DIR is set to ${TTCN3_DIR}, OK" \
62|| { echo "\$TTCN3_DIR is not set, NOT OK, exiting"; exit 1; }
63dir_exist ${TTCN3_DIR}
64file_exist ${TTCN3_DIR}/lib/libmctrjninative.so
65[[ "${LD_LIBRARY_PATH}" == *"${TTCN3_DIR}/lib"* ]] && echo "\$TTCN3_DIR/lib is added to \$LD_LIBRARY_PATH=${LD_LIBRARY_PATH}, OK" \
66|| { echo "\$TTCN3_DIR is NOT added to \$LD_LIBRARY_PATH=${LD_LIBRARY_PATH}, NOT OK, exiting"; exit 1; }
67file_exist ${TTCN3_DIR}/demo/MyExample
68# Check if HelloWorld demo binary is compiled in parallel mode: output of MyExample -v contains "(parallel mode)"
69[ `${TTCN3_DIR}/demo/MyExample -v 2>&1 | grep "(parallel mode)" | wc -l` != 0 ] && echo "${TTCN3_DIR}/demo/MyExample is compiled in parallel mode, OK" \
70|| { echo "${TTCN3_DIR}/demo/MyExample is compiled in single mode, NOT in parallel mode, NOT OK, exiting"; exit 1; }
71
72# check JAR dependencies
73file_exist ${JUNIT_FULL}
74file_exist ${HAMCREST_FULL}
75
76# run test (and build its dependencies if needed)
77ant \
48a86384 78-Djunit.full=${JUNIT_FULL} \
79-Dhamcrest.full=${HAMCREST_FULL} \
3abe9331 80TITAN_Executor_API_test
48a86384 81
This page took 0.028523 seconds and 5 git commands to generate.