Add listener readiness check in runtest.sh
This commit is contained in:
parent
4beafbe674
commit
3cdcadcb6d
2 changed files with 10 additions and 1 deletions
|
@ -303,6 +303,8 @@ def main():
|
|||
hopper_thread = threading.Thread(target=channel_hopper, args=(args.monitor_iface,))
|
||||
hopper_thread.daemon = True
|
||||
hopper_thread.start()
|
||||
|
||||
print("LISTENING_STARTED", flush=True)
|
||||
|
||||
while running:
|
||||
sniff(iface=args.monitor_iface, prn=handle_packet, store=False, timeout=5)
|
||||
|
|
|
@ -168,12 +168,19 @@ for ((COUNTER = 1; COUNTER <= NUM_TESTS; COUNTER++)); do
|
|||
LISTENER_SAMPLE_FILE="${TEST_FILE%.csv}-listener-$COUNTER-$i.csv"
|
||||
|
||||
log "Launching listener for sample $COUNTER/$i..."
|
||||
|
||||
READY_FILE="/tmp/listener_ready_$COUNTER_$i"
|
||||
|
||||
sudo "${SCRIPT_DIRECTORY}/listener.py" \
|
||||
--main-iface "$INTERFACE" \
|
||||
--monitor-iface "$LISTEN_INTERFACE" \
|
||||
--outfile "$LISTENER_SAMPLE_FILE" \
|
||||
"${LISTENER_ARGS[@]}" &
|
||||
"${LISTENER_ARGS[@]}" > >(tee "$READY_FILE") &
|
||||
LISTENER_PID=$!
|
||||
|
||||
# Wait for the READY_FILE to contain "LISTENING_STARTED"
|
||||
timeout 5 bash -c "until grep -q LISTENING_STARTED $READY_FILE; do sleep 0.2; done"
|
||||
|
||||
fi
|
||||
log " Sample $i of $NUM_SAMPLES"
|
||||
START_TIME=$(date -Iseconds)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue