1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #13178 from miri64/dist/fix/iotlab-improvements

dist/testbed-support: several improvements
This commit is contained in:
Martine Lenders 2020-03-03 18:39:26 +01:00 committed by GitHub
commit 47eeafc553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 19 deletions

View File

@ -10,9 +10,15 @@ IOTLAB_EXP_NAME ?= RIOT_EXP
IOTLAB_DEBUG_PORT ?= 3333
IOTLAB_DEBUG_NODE ?= $(shell iotlab-experiment get -i $(IOTLAB_EXP_ID) --resources | \
grep -m 1 "network_address" | sed 's/.*-\([0-9]*\)\..*/\1/')
IOTLAB_AUTHORITY = "$(IOTLAB_USER)@$(IOTLAB_SITE).iot-lab.info"
ifeq (,$(filter iotlab-exp,$(MAKECMDGOALS)))
# derive experiment site from IOTLAB_EXP_ID, if not given and not used with
# `iotlab_exp`
IOTLAB_SITE ?= $(shell iotlab-experiment --format=str --jmespath "keys(items[0])[0]" \
get -ri -i $(IOTLAB_EXP_ID))
endif
ifneq (,$(findstring m3,$(IOTLAB_TYPE)))
BINARY := $(ELFFILE)
else
@ -49,18 +55,19 @@ iotlab-exp: $(IOTLAB_AUTH) all
$(Q)iotlab-experiment wait -i $(NEW_ID)
ifdef IOTLAB_LOGGING
$(Q)ssh -t $(IOTLAB_AUTHORITY) "tmux new -d -s riot-$(NEW_ID)\
$(Q)ssh -t $(IOTLAB_AUTHORITY) \
"$(if $(IOTLAB_TMUX),tmux new -d -s riot-$(NEW_ID),) \
'script -fac "'"'"serial_aggregator -i $(NEW_ID)"'"'"\
RIOT_LOG-$(IOTLAB_EXP_NAME)-$(NEW_ID)'"
endif
iotlab-flash: $(IOTLAB_AUTH) iotlab-check-exp all
iotlab-flash: $(IOTLAB_AUTH) all
$(Q)iotlab-node --update $(BINARY) -i $(IOTLAB_EXP_ID) $(NODES_PARAM_BASE) $(EXCLUDE_PARAM)
iotlab-reset: $(IOTLAB_AUTH) iotlab-check-exp
iotlab-reset: $(IOTLAB_AUTH)
$(Q)iotlab-node --reset -i $(IOTLAB_EXP_ID) $(NODES_PARAM_BASE) $(EXCLUDE_PARAM)
iotlab-debug-server: $(IOTLAB_AUTH) iotlab-check-exp
iotlab-debug-server: $(IOTLAB_AUTH)
$(eval DEBUG_TYPE := $(shell echo $(IOTLAB_TYPE) | cut -d: -f1))
$(eval DEBUG_NODE := $(shell echo $(IOTLAB_DEBUG_NODE) | sed 's/$(DEBUG_TYPE)-\([0-9]*\)/\1/'))
@ -68,18 +75,19 @@ iotlab-debug-server: $(IOTLAB_AUTH) iotlab-check-exp
@echo "Debug on node $(IOTLAB_DEBUG_NODE)"
$(Q)ssh -N -L $(IOTLAB_DEBUG_PORT):$(IOTLAB_DEBUG_NODE):3333 $(IOTLAB_AUTHORITY)
iotlab-stop: $(IOTLAB_AUTH) iotlab-check-exp
iotlab-stop: $(IOTLAB_AUTH)
$(Q)iotlab-experiment stop -i $(IOTLAB_EXP_ID)
iotlab-term: iotlab-check-exp
$(Q)ssh -t $(IOTLAB_AUTHORITY) "iotlab-experiment get -r > /dev/null || \
# wait for flash if it is provided e.g. with `make iotlab-flash iotlab-term`
IOTLABTERMFLASHDEPS ?= $(filter iotlab-flash iotlab-exp,$(MAKECMDGOALS))
iotlab-term: $(IOTLABTERMFLASHDEPS)
$(Q)ssh -t $(IOTLAB_AUTHORITY) "iotlab-experiment get -r -i $(IOTLAB_EXP_ID) > /dev/null || \
iotlab-auth -u $(IOTLAB_USER)"
$(Q)ssh -t $(IOTLAB_AUTHORITY) \
"tmux attach -t riot-$(IOTLAB_EXP_ID) || tmux new -s riot-$(IOTLAB_EXP_ID) \
'$(if $(IOTLAB_LOGGING), \
"$(if $(IOTLAB_TMUX),tmux attach -t riot-$(IOTLAB_EXP_ID) || tmux new -s riot-$(IOTLAB_EXP_ID) ',) \
$(if $(IOTLAB_LOGGING), \
script -fac "'"'"serial_aggregator -i $(IOTLAB_EXP_ID) $(NODES_PARAM_BASE)"'"'" \
RIOT_LOG-$(IOTLAB_EXP_NAME)-$(IOTLAB_EXP_ID), \
serial_aggregator -i $(IOTLAB_EXP_ID) $(NODES_PARAM_BASE))'"
iotlab-check-exp: IOTLAB_SITE ?= $(shell iotlab-experiment get -ri -i $(IOTLAB_EXP_ID) | sed -n 4p | cut -d\" -f2)
serial_aggregator -i $(IOTLAB_EXP_ID) $(NODES_PARAM_BASE))$(if $(IOTLAB_TMUX),',)"

View File

@ -36,6 +36,7 @@ brackets):
* IOTLAB_PROFILE
* IOTLAB_EXCLUDE_NODES
* IOTLAB_LOGGING
* IOTLAB_TMUX
### Format of a Resource ID
Both variables `IOTLAB_PHY_NODES` and `IOTLAB_EXCLUDE_NODES` use the resource id
@ -73,20 +74,19 @@ into a file called "RIOT_LOG-<EXPNAME>-<EXPID>".
This target updates the application on all registered nodes of the given
experiment to the current version of the application.
Certain nodes can be excluded by listing them in the `IOTLAB_EXCLUDE_NODES` variable
using the resource id string format as described above. If you do not use the default site,
then you must specify the site with `IOTLAB_SITE`.
using the resource id string format as described above.
#### iotlab-reset
This target resets all registered nodes of the given experiment.
Certain nodes can be excluded by listing them in the `IOTLAB_EXCLUDE_NODES` variable
using the resource id string format as described above. If you do not use the default site,
then you must specify the site with `IOTLAB_SITE`.
using the resource id string format as described above.
#### iotlab-term
Uses ssh to login the user on the IoT-LAB server of the specified site and
start the `serial_aggregator` to communication with all registered nodes.
If `IOTLAB_LOGGING` is set to `1`, then closing the connection with `CTRL+C/D` will also quit
the logging process. Detach from the server-side tmux process with `CTRL+A-D`
(or as defined in your server-side `.tmux.conf` file)
the logging process. If you enabled TMUX with `IOTLAB_TMUX`, detach from the
server-side tmux process with `CTRL+A-D` (or as defined in your server-side
`.tmux.conf` file)