[riot-notifications] [RIOT-OS/RIOT] dist/tools/ethos: deduplicate setup_network.sh, start_network.sh (#11840)

Francisco notifications at github.com
Wed Jul 17 11:06:43 CEST 2019


fjmolinas requested changes on this pull request.

I tested `start_network.sh` by running the test in #11818 using wireless nodes. The BR was an `iotlab-m3`.

I also tested `gnrc_networking` on a `samr21-xpro` with the same BR and I was able to ping the `samr21-xpro` from my local host.

If you agree with my changes than squash directly.

>  cleanup() {
-    echo "Cleaning up..."
-    remove_tap
-    ip a d fd00:dead:beef::1/128 dev lo
-    kill ${UHCPD_PID}
+    [ -n "${SETUP_NETWORK_PID}" ] && kill -TERM ${SETUP_NETWORK_PID}

This fails to kill all the decedent processes, I would suggest this change:

```
diff --git a/dist/tools/ethos/start_network.sh b/dist/tools/ethos/start_network.sh
index 4f832a258..a457735e0 100755
--- a/dist/tools/ethos/start_network.sh
+++ b/dist/tools/ethos/start_network.sh
@@ -3,13 +3,13 @@
 ETHOS_DIR="$(dirname $(readlink -f $0))"
 
 cleanup() {
-    [ -n "${SETUP_NETWORK_PID}" ] && kill -TERM ${SETUP_NETWORK_PID}
     trap "" INT QUIT TERM EXIT
+    [ -n "${SETUP_NETWORK_GPID}" ] && kill -TERM -$SETUP_NETWORK_GPID
 }
 
 setup_network() {
     ${ETHOS_DIR}/setup_network.sh $1 $2 &
-    SETUP_NETWORK_PID=$!
+    SETUP_NETWORK_GPID=$(ps -o pgid= $! | grep -o '[0-9]*')
 }
 
 PORT=$1
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/11840#pullrequestreview-262863805
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190717/0d94b6be/attachment.html>


More information about the notifications mailing list