add mynewt test script for jenkins.
parent
891effdc58
commit
0e65b89bd3
|
@ -0,0 +1 @@
|
||||||
|
tmp/
|
|
@ -92,3 +92,22 @@ wolfssl read
|
||||||
wolfssl clear
|
wolfssl clear
|
||||||
net close
|
net close
|
||||||
```
|
```
|
||||||
|
|
||||||
|
# jenkins script
|
||||||
|
## setup for jenkins node
|
||||||
|
|
||||||
|
install below softwares
|
||||||
|
|
||||||
|
- git
|
||||||
|
- expect
|
||||||
|
- bash
|
||||||
|
- screen
|
||||||
|
- [newt](https://mynewt.apache.org/latest/get_started/native_install/index.html)(v1.4.1 over)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
execute `jenkins.sh` script on jenkins.
|
||||||
|
|
||||||
|
```
|
||||||
|
./mynewt/jenkins.sh
|
||||||
|
```
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
#!/bin/bash -ex
|
||||||
|
|
||||||
|
BASEDIR=`dirname $0`
|
||||||
|
BASEDIR=`cd $BASEDIR && pwd -P`
|
||||||
|
|
||||||
|
# kill previous process
|
||||||
|
set +e
|
||||||
|
killall -9 wolfsslclienttlsmn.elf
|
||||||
|
set -e
|
||||||
|
|
||||||
|
pushd ${BASEDIR} > /dev/null
|
||||||
|
|
||||||
|
/bin/rm -rf tmp
|
||||||
|
/bin/mkdir tmp
|
||||||
|
pushd tmp > /dev/null
|
||||||
|
|
||||||
|
# create mynewt project
|
||||||
|
newt new myproj
|
||||||
|
NEWTPROJ=`pwd`/myproj
|
||||||
|
pushd ${NEWTPROJ} > /dev/null
|
||||||
|
newt upgrade
|
||||||
|
popd > /dev/null
|
||||||
|
|
||||||
|
# deploy wolfssl source files to mynewt project
|
||||||
|
git clone https://github.com/wolfSSL/wolfssl.git
|
||||||
|
WOLFSSL=`pwd`/wolfssl
|
||||||
|
${WOLFSSL}/IDE/mynewt/setup.sh ${NEWTPROJ}
|
||||||
|
|
||||||
|
# deploy wolfssl example source files to mynewt project
|
||||||
|
${BASEDIR}/setup.sh ${NEWTPROJ}
|
||||||
|
|
||||||
|
# build sample program
|
||||||
|
pushd ${NEWTPROJ} > /dev/null
|
||||||
|
newt target create wolfsslclienttlsmn_sim
|
||||||
|
newt target set wolfsslclienttlsmn_sim app=apps/wolfsslclienttlsmn
|
||||||
|
newt target set wolfsslclienttlsmn_sim bsp=@apache-mynewt-core/hw/bsp/native
|
||||||
|
newt target set wolfsslclienttlsmn_sim build_profile=debug
|
||||||
|
newt build wolfsslclienttlsmn_sim
|
||||||
|
|
||||||
|
/bin/rm -f wolfsslclienttlsmn.log
|
||||||
|
(./bin/targets/wolfsslclienttlsmn_sim/app/apps/wolfsslclienttlsmn/wolfsslclienttlsmn.elf &) > wolfsslclienttlsmn.log
|
||||||
|
sleep 1
|
||||||
|
TTY_NAME=`cat wolfsslclienttlsmn.log | cut -d ' ' -f 3`
|
||||||
|
|
||||||
|
expect ${BASEDIR}/test_client-tls.expect $TTY_NAME
|
||||||
|
|
||||||
|
killall -9 wolfsslclienttlsmn.elf
|
||||||
|
|
||||||
|
popd > /dev/null
|
||||||
|
|
||||||
|
popd > /dev/null # tmp
|
||||||
|
|
||||||
|
# cleanup tmp directory on jenkins
|
||||||
|
if [ ! -z "$JENKINS_URL" ]; then
|
||||||
|
/bin/rm -rf tmp
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd > /dev/null # ${BASEDIR}
|
|
@ -0,0 +1,62 @@
|
||||||
|
#!/usr/bin/env expect
|
||||||
|
|
||||||
|
set timeout 10
|
||||||
|
|
||||||
|
set tty [lindex $argv 0]
|
||||||
|
spawn screen $tty
|
||||||
|
|
||||||
|
send "\n"
|
||||||
|
expect {
|
||||||
|
timeout {exit 2}
|
||||||
|
-re ".* compat>"
|
||||||
|
}
|
||||||
|
|
||||||
|
send "net tcp\n"
|
||||||
|
expect {
|
||||||
|
timeout {exit 3}
|
||||||
|
-re ".* mn_socket\\(TCP\\) = 0.*\n.* compat>"
|
||||||
|
}
|
||||||
|
|
||||||
|
send "net connect\n"
|
||||||
|
expect {
|
||||||
|
timeout {exit 4}
|
||||||
|
-re ".* net_test_writable 0 - 0.*"
|
||||||
|
}
|
||||||
|
|
||||||
|
send "wolfssl init\n"
|
||||||
|
expect {
|
||||||
|
timeout {exit 5}
|
||||||
|
-re ".* compat>"
|
||||||
|
}
|
||||||
|
|
||||||
|
send "wolfssl connect\n"
|
||||||
|
expect {
|
||||||
|
timeout {exit 6}
|
||||||
|
-re ".* wolfSSL_connect\\(\\) = 1.*\n.* compat>"
|
||||||
|
}
|
||||||
|
|
||||||
|
send "wolfssl write\n"
|
||||||
|
expect {
|
||||||
|
timeout {exit 7}
|
||||||
|
-re ".* wolfSSL_write\\(\\) = .*\n.* compat>"
|
||||||
|
}
|
||||||
|
|
||||||
|
send "wolfssl read\n"
|
||||||
|
expect {
|
||||||
|
timeout {exit 8}
|
||||||
|
-re ".* compat>"
|
||||||
|
}
|
||||||
|
|
||||||
|
send "wolfssl clear\n"
|
||||||
|
expect {
|
||||||
|
timeout {exit 9}
|
||||||
|
-re ".* compat>"
|
||||||
|
}
|
||||||
|
|
||||||
|
send "net close\n"
|
||||||
|
expect {
|
||||||
|
timeout {exit 10}
|
||||||
|
-re ".* mn_close\\(\\) = 0.*\n.* compat>"
|
||||||
|
}
|
||||||
|
|
||||||
|
exit 0
|
|
@ -1,22 +0,0 @@
|
||||||
#!/bin/sh -e
|
|
||||||
|
|
||||||
if [ $# -ne 1 ]; then
|
|
||||||
echo "$0 program_path"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
PROGRAM=$1
|
|
||||||
|
|
||||||
TIMEOUT=10
|
|
||||||
|
|
||||||
expect -c "
|
|
||||||
set timeout ${TIMEOUT}
|
|
||||||
spawn \"${PROGRAM}\"
|
|
||||||
expect -re {uart0 at (.*)} {
|
|
||||||
send $expect_out(1,string)
|
|
||||||
send $expect_out(0,string)
|
|
||||||
send $expect_out(2,string)
|
|
||||||
}
|
|
||||||
expect \"$\"
|
|
||||||
exit 0
|
|
||||||
"
|
|
||||||
exit 0
|
|
Loading…
Reference in New Issue