Skip to content
This repository was archived by the owner on Dec 26, 2022. It is now read-only.

Commit fe2b9c6

Browse files
authored
Merge pull request #692 from splasky/x86_test
test(endpoint): Provide automated test script
2 parents 2f3dd3a + 9dd9a31 commit fe2b9c6

File tree

7 files changed

+83
-29
lines changed

7 files changed

+83
-29
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,5 @@ resolv.conf
101101
output_base/
102102
_build_endpoint/
103103
endpoint.*.update
104+
.repo
105+
legato/

docs/endpoint.md

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -106,37 +106,9 @@ $ sudo apt-get install -y \
106106
zlib1g-dev
107107
```
108108

109-
Create a workspace
110-
111-
```shell
112-
$ mkdir -p workspace
113-
$ cd workspace
114-
```
115-
116-
Clone a specific version of `legato`. The `19.07.0` is the preferred stable version.
117-
118-
```shell
119-
$ repo init -u git://github.com/legatoproject/manifest -m legato/releases/19.07.0.xml # specific legato 19.07.0 version
120-
$ repo sync
121-
```
122-
123-
Build legato as native target
124-
125-
```shell
126-
$ cd legato
127-
$ make localhost
128-
```
129-
130-
Checkout the shell to legato shell
109+
Use GNU Make to build endpoint application at the root directory of tangle-accelerator.
131110

132111
```shell
133-
$ source framework/tools/scripts/configlegatoenv
134-
```
135-
136-
Finally, use GNU Make to build endpoint application at the root directory of tangle-accelerator.
137-
138-
```shell
139-
$ cd tangle-accelerator
140112
$ make legato # build endpoint as native target
141113
```
142114

endpoint/build-legato.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
3+
set -uo pipefail
4+
5+
COMMON_FILE="tests/endpoint/common.sh"
6+
7+
if [ ! -f "$COMMON_FILE" ]
8+
then
9+
echo "$COMMON_FILE is not exists."
10+
echo "Always execute this script in top-level directory."
11+
exit 1
12+
fi
13+
source $COMMON_FILE
14+
15+
download_legato_repo
16+
build_legato_repo

endpoint/platform/simulator/build.mk

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,10 @@
44
# terms of the MIT license. A copy of the license can be found in the file
55
# "LICENSE" at the root of this distribution.
66

7+
export LEGATO_ROOT := $(PWD)/legato
8+
export PATH := $(LEGATO_ROOT)/bin:$(LEGATO_ROOT)build/localhost/framework/bin:$(PATH)
9+
export LEGATO_TARGET := localhost
10+
711
platform-build-command = \
12+
sh -c "endpoint/build-legato.sh"; \
813
cd endpoint && mkapp -v -t localhost -C -DENABLE_ENDPOINT_TEST $(LEGATO_FLAGS) endpoint.adef;

tests/endpoint/common.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
LEGATO_VERSION="20.04.0"
2+
3+
function download_legato_repo(){
4+
echo "Downloading Legato AF"
5+
repo init -u git://github.com/legatoproject/manifest -m legato/releases/${LEGATO_VERSION}.xml
6+
repo sync
7+
}
8+
9+
function build_legato_repo(){
10+
if [ ! -d "legato" ]; then
11+
echo "Please download the Legato AF first"
12+
exit 1
13+
fi
14+
15+
if [ ! -f "legato/Makefile" ]; then
16+
echo "The Makefile inside legato project is missing"
17+
echo "Please remove the legato directory and download Legato AF again."
18+
exit 1
19+
fi
20+
21+
echo "Building Legato AF"
22+
make -C legato localhost
23+
}
24+
25+
function setup_leaf(){
26+
if ! which "leaf"
27+
then
28+
echo "Please install Legato leaf first"
29+
exit 1
30+
fi
31+
leaf --non-interactive setup legato-latest -p "$1"
32+
}

tests/endpoint/test-WP77.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
set -uo pipefail
4+
5+
COMMON_FILE="tests/endpoint/common.sh"
6+
7+
if [ ! -f "$COMMON_FILE" ]
8+
then
9+
echo "$COMMON_FILE is not exists."
10+
exit 1
11+
fi
12+
source $COMMON_FILE
13+
14+
# setup WP77 leaf shell
15+
setup_leaf "swi-wp77_3.4.0"
16+
17+
make TESTS=true TARGET=wp77xx EP_TA_HOST=node.deviceproof.org EP_TA_PORT=5566 legato && \
18+
tar zcf endpoint.tgz endpoint/_build_endpoint/wp77xx/app/endpoint/staging/read-only/

tests/endpoint/test-endpoint.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
set -uo pipefail
4+
5+
# Create endpoint app
6+
make EP_TA_HOST=node.deviceproof.org EP_TA_PORT=5566 legato
7+
8+
# Run endpoint app test here
9+
endpoint/_build_endpoint/localhost/app/endpoint/staging/read-only/bin/endpoint

0 commit comments

Comments
 (0)