util: Warn line breaking the gem5-dist script

Once the switch node in a dist-gem5 simulation gets started it listens
the first available port starting from the initially supplied one.

To bind full system nodes to the switch, the switch logfile
is parsed for the exact port number.

This is fragile and it broke when the following line:

info: tcp_iface listening on port

changed to

build/ARM/dev/net/tcp_iface.cc:97: info: tcp_iface listening on port

This patch is fixing the problem with a more robust regex matching

Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Change-Id: I2721b3c04653ac1e09878e80d8b1ea34ec1a0f73
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/62512
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Richard Cooper <richard.cooper@arm.com>
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Giacomo Travaglini
2022-08-03 17:47:42 +01:00
parent 0dc2a87666
commit 566cdd81a8

View File

@@ -1,7 +1,7 @@
#! /bin/bash #! /bin/bash
# #
# Copyright (c) 2015 ARM Limited # Copyright (c) 2015, 2022 Arm Limited
# All rights reserved # All rights reserved
# #
# The license below extends only to copyright in the software and shall # The license below extends only to copyright in the software and shall
@@ -319,12 +319,18 @@ SW_PID=$!
# block here till switch process starts # block here till switch process starts
connected $RUN_DIR/log.switch "tcp_iface listening on port" "switch" $SW_PID connected $RUN_DIR/log.switch "tcp_iface listening on port" "switch" $SW_PID
LINE=$(grep -r "tcp_iface listening on port" $RUN_DIR/log.switch)
IFS=' ' read -ra ADDR <<< "$LINE"
# actual port that switch is listening on may be different # actual port that switch is listening on may be different
# from what we specified if the port was busy # from what we specified if the port was busy
SW_PORT=${ADDR[5]} PORT_REGEX="tcp_iface listening on port ([0-9]+)"
SW_FILE=$(cat $RUN_DIR/log.switch)
if [[ $SW_FILE =~ $PORT_REGEX ]]; then
SW_PORT="${BASH_REMATCH[1]}"
else
echo "Unable to find port info from $RUN_DIR/log.switch"
abort_func
fi
# Now launch all the gem5 processes with ssh. # Now launch all the gem5 processes with ssh.
echo "START $(date)" echo "START $(date)"