Skip to content

Commit e349e32

Browse files
committed
doc(supervisor/posix): add initial
Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com>
1 parent 1e9ad28 commit e349e32

2 files changed

Lines changed: 89 additions & 13 deletions

File tree

docs/samples/supervisor.md

Lines changed: 82 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ It also preloads the following images:
1414
- `webserver-complex.wasm`
1515
- `webserver.wasm`
1616

17-
Currently it only supports Zephyr.
17+
In Zephyr, there is no daemon, and Ocre is run directly from the command line. In Linux there is the `ocred` daemon, which listens in a socket and `ocre` (client) will connect to it.
18+
19+
In Linux, a library called OcreClient is used to interact with the daemon. It offers almost the same functionality as the OcreCore library.
1820

1921
## Building and running on Zephyr
2022

@@ -72,34 +74,92 @@ If it is not possible to flash the storage_partition with west, as a workaround,
7274
it is possible to use the [Supervisor] with `ocre pull` to populate the images
7375
directory, and then flash just this demo with the command above.
7476

77+
## Building and running on Linux
78+
79+
Make sure you are using the [Devcontainer](../Devcontainers.md) or have the necessary
80+
tools for Linux described in the [Get Started with Linux](../GetStartedLinux.md) guide.
81+
82+
In Linux, the the supervisor is split in two parts:
83+
84+
- `ocred`, the ocre daemon which uses a control socket that listens in a socket.
85+
- `ocre-cli`, the ocre command line which interacts with the daemon to manage the containers.
86+
87+
From the root of the repository, or from anywhere else, create build directory:
88+
89+
```sh
90+
mkdir build
91+
cd build
92+
```
93+
94+
Configure the Ocre Library build:
95+
96+
```sh
97+
cmake ..
98+
```
99+
100+
Make sure `..` points to the root of the ocre-runtime source tree.
101+
102+
Build ocre and the samples:
103+
104+
```sh
105+
make
106+
```
107+
108+
Run the daemon:
109+
110+
```sh
111+
./src/samples/supervisor/posix/server/ocred
112+
```
113+
114+
Note that this command should be run from the build directory
115+
(i.e. the directory that contains files in the relative path `./src/ocre/var/lib/ocre/images/`).
116+
117+
This will create the ocre socket by default in `/tmp/ocre.sock`.
118+
119+
On another terminal, run the client:
120+
121+
```sh
122+
./src/samples/supervisor/posix/ocre_cli ps
123+
```
124+
125+
Other commands, described in the next section work just fine.
126+
127+
Notice that the container logs are not redirected to the client. Check the ocre daemon logs for more information.
128+
75129
## Using ocre-cli (shell)
76130

77131
Quick usage of ocre client is described below. Detailed usage information can be found on the [Ocre CLI](../OcreCli.md) documentation.
78132

79133
Get help:
80134

81-
```
135+
````
136+
82137
ocre
138+
83139
```
84140
85141
List local images:
86142
87143
```
144+
88145
ocre image ls
146+
89147
```
90148
91149
It should display the local images:
92150
93151
```
94-
SHA-256 SIZE NAME
95-
d9d2984172d74b157cbcd27ff53ce5b5e07c1b8f9aa06facd16a59f66ddd0afb 22772 blinky.wasm
96-
fdeffaf2240bd6b3541fccbb5974c72f03cbf4bdd0970ea7e0a5647f08b7b50a 58601 filesystem-full.wasm
97-
a8042be335fd733ecf4c48b76e6c00a43b274ad9b0d9a6d3c662c5f0c36d4a40 41545 filesystem.wasm
98-
4a42158ff5b0a4d0a65d9cf8a3d2bb411d846434a236ca84b483e05b2f1dff99 5026 hello-world.wasm
99-
c7b29c38bd91f67e69771fbe83db4ae84d515a6038a77ee6823ae377c55eac3c 23111 publisher.wasm
100-
5f94ea4678c4c1ab42a3302e190ffe61c58b8db4fcf4919e1c5a576a1b8dcd3b 22944 subscriber.wasm
101-
496ab513d6b1b586f846834fd8d17e0360c053bc614f2c2418ef84a87fbcd384 98082 webserver-complex.wasm
102-
0a8cd55cb93c995d71500381c11bab1f2536c66282b8cab324b42c35817fba57 81647 webserver.wasm
152+
153+
SHA-256 SIZE NAME
154+
d9d2984172d74b157cbcd27ff53ce5b5e07c1b8f9aa06facd16a59f66ddd0afb 22772 blinky.wasm
155+
fdeffaf2240bd6b3541fccbb5974c72f03cbf4bdd0970ea7e0a5647f08b7b50a 58601 filesystem-full.wasm
156+
a8042be335fd733ecf4c48b76e6c00a43b274ad9b0d9a6d3c662c5f0c36d4a40 41545 filesystem.wasm
157+
4a42158ff5b0a4d0a65d9cf8a3d2bb411d846434a236ca84b483e05b2f1dff99 5026 hello-world.wasm
158+
c7b29c38bd91f67e69771fbe83db4ae84d515a6038a77ee6823ae377c55eac3c 23111 publisher.wasm
159+
5f94ea4678c4c1ab42a3302e190ffe61c58b8db4fcf4919e1c5a576a1b8dcd3b 22944 subscriber.wasm
160+
496ab513d6b1b586f846834fd8d17e0360c053bc614f2c2418ef84a87fbcd384 98082 webserver-complex.wasm
161+
0a8cd55cb93c995d71500381c11bab1f2536c66282b8cab324b42c35817fba57 81647 webserver.wasm
162+
103163
```
104164
105165
If there are no images, before you proceed, you can use `ocre pull` to populate the images.
@@ -108,32 +168,42 @@ Check the Ocre SDK and [Ocre CLI](../OcreCli.md) documentation for details.
108168
Start a container with the the `hello-world.wasm` image:
109169
110170
```
171+
111172
ocre run hello-world.wasm
173+
112174
```
113175
114176
Start a background container named `my_blinky` with the `blinky.wasm` image:
115177
116178
```
179+
117180
ocre run -n my_blinky -d -k ocre:api blinky.wasm
181+
118182
```
119183
120184
Show container statuses:
121185
122186
```
187+
123188
ocre ps
189+
124190
```
125191
126192
Kill the `my_blinky` container:
127193
128194
```
195+
129196
ocre kill my_blinky
197+
130198
```
131199
132200
Remove the `my_blinky` container:
133201
134202
```
203+
135204
ocre rm my_blinky
136-
```
205+
206+
````
137207

138208
Please, refer to [Ocre CLI](../OcreCli.md) documentation and help messages for details
139209

docs/tests/SystemTests.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ cd tests/system/posix/build
2525

2626
Configure and build the cmake project. Note that `..` points to `tests/system/posix`:
2727

28+
Alternatively, the IPC system tests can be build in the directory `tests/system/posix-ipc`. Note that only `test_context` and `test_container` are available in IPC mode.
29+
2830
```sh
2931
cmake ..
3032
make
@@ -68,6 +70,7 @@ Please, refer to their source code for more details.
6870
## Zephyr
6971

7072
### Build and run
73+
7174
To build the Zephyr system tests for the `native_sim_64` board:
7275

7376
```sh
@@ -82,16 +85,19 @@ Replace `context` with `container`, `lib`, or `ocre` to build different tests:
8285
- `tests/system/zephyr/container` - Tests the specific functionality of a container
8386

8487
To run the test:
88+
8589
```sh
8690
west build -t run
8791
```
8892

8993
The last lines of the output will be something like:
94+
9095
```
9196
-----------------------
92-
25 Tests 0 Failures 0 Ignored
97+
25 Tests 0 Failures 0 Ignored
9398
OK
9499
```
95100

96101
### Details
102+
97103
Each test must be run individually. Run the build command for one test at a time, then execute `west build -t run` to run that specific test.

0 commit comments

Comments
 (0)