1+ #! /bin/bash
2+ 
3+ #  Copyright 2015 Samsung Electronics Co., Ltd.
4+ # 
5+ #  Licensed under the Apache License, Version 2.0 (the "License");
6+ #  you may not use this file except in compliance with the License.
7+ #  You may obtain a copy of the License at
8+ # 
9+ #      http://www.apache.org/licenses/LICENSE-2.0
10+ # 
11+ #  Unless required by applicable law or agreed to in writing, software
12+ #  distributed under the License is distributed on an "AS IS" BASIS
13+ #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+ #  See the License for the specific language governing permissions and
15+ #  limitations under the License.
16+ 
17+ TARGET=" $1 "   # debug.linux release.linux
18+ TARGET_IP=" $2 "   #  ip address of target board
19+ TARGET_USER=" $3 "   #  login
20+ TARGET_PASS=" $4 "   #  password
21+ 
22+ if  [ $#  -lt  4 ]
23+ then 
24+   echo  " This script runs ./jerry/* and ./jerry-test-suite/* tests on the remote board." 
25+   echo  " " 
26+   echo  " Usage:" 
27+   echo  "   1st parameter: target to be tested: {debug.linux, release.linux}" 
28+   echo  "   2nd parameter: ip address of target board: {110.110.110.110}" 
29+   echo  "   3rd parameter: ssh login to target board: {login}" 
30+   echo  "   4th parameter: ssh password to target board: {password}" 
31+   echo  " " 
32+   echo  " Example:" 
33+   echo  "   ./tools/runners/run-tests-remote.sh debug.linux 110.110.110.110 login password" 
34+   exit  1
35+ fi 
36+ 
37+ BASE_DIR=$( dirname " $( readlink -f " $0 " ) "   ) 
38+ 
39+ OUT_DIR=" ${BASE_DIR} "  /../.././build/bin
40+ LOGS_PATH_FULL=" ${OUT_DIR} "  /" ${TARGET} "  /check
41+ 
42+ export  SSHPASS=" ${TARGET_PASS} " 
43+ 
44+ rm -rf " ${LOGS_PATH_FULL} " 
45+ 
46+ mkdir -p " ${LOGS_PATH_FULL} " 
47+ 
48+ REMOTE_TMP_DIR=$( sshpass -e ssh " ${TARGET_USER} "  @" ${TARGET_IP} "   ' mktemp -d' ) 
49+ REMOTE_TMP_TAR=$( sshpass -e ssh " ${TARGET_USER} "  @" ${TARGET_IP} "   ' mktemp' ) 
50+ LOCAL_TMP_TAR=$( mktemp) 
51+ 
52+ tar -zcf " ${LOCAL_TMP_TAR} "   \
53+   " ${BASE_DIR} "  /../.././build/bin/" ${TARGET} "   \
54+   " ${BASE_DIR} "  /../.././tests/benchmarks \
55+   " ${BASE_DIR} "  /../.././tests/jerry \
56+   " ${BASE_DIR} "  /../.././tests/jerry-test-suite \
57+   " ${BASE_DIR} "  /../.././tools/runners \
58+   " ${BASE_DIR} "  /../.././tools/precommit-full-testing.sh >  /dev/null 2>&1 
59+ 
60+ sshpass -e scp " ${LOCAL_TMP_TAR} "   " ${TARGET_USER} "  @" ${TARGET_IP} "  :" ${REMOTE_TMP_TAR} " 
61+ 
62+ sshpass -e ssh " ${TARGET_USER} "  @" ${TARGET_IP} "   \
63+   " tar -zxf \" ${REMOTE_TMP_TAR} \"  -C \" ${REMOTE_TMP_DIR} \" ; rm \" ${REMOTE_TMP_TAR} \" ;\ 
64+   cd \" ${REMOTE_TMP_DIR} \" ; \  
65+   ./tools/precommit-full-testing.sh ./build/bin \" $TARGET \"  > ./build/bin/\" ${TARGET} \" /check/run.log 2>&1; \  
66+   echo \$ ? > ./build/bin/\" ${TARGET} \" /check/IS_TEST_OK"  
67+ 
68+ sshpass -e scp -r " ${TARGET_USER} "  @" ${TARGET_IP} "  :" ${REMOTE_TMP_DIR} "  /build/bin/" ${TARGET} "  /check/*  " ${LOGS_PATH_FULL} " 
69+ sshpass -e ssh " ${TARGET_USER} "  @" ${TARGET_IP} "   " rm -rf \" ${REMOTE_TMP_DIR} \" " 
70+ 
71+ STATUS=$( cat " ${LOGS_PATH_FULL} "  /IS_TEST_OK) 
72+ 
73+ if  [ " ${STATUS} "   ==  0 ] ;  then 
74+   echo  " ${TARGET}  testing passed." 
75+   exit  0
76+ else 
77+   echo  " ${TARGET}  testing failed." 
78+   echo  " See logs in ${LOGS_PATH_FULL}  directory for details." 
79+   exit  1
80+ fi 
0 commit comments