Skip to content

Commit

Permalink
riscv64: Improve command forwarding
Browse files Browse the repository at this point in the history
Previous implementation uses `netcat` to test existence of
pre-configured target port, but that port is occupied in advance of
`sshd` inside VM is ready.

Replace `netcat` with `ssh` with `ConnectTimeout` set to directly verify
the connectivity of `sshd`.

Signed-off-by: Ruoqing He <[email protected]>
  • Loading branch information
TimePrinciple committed Sep 30, 2024
1 parent 3fef366 commit b1cf97e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions riscv64/start_in_qemu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ $QEMU_DIR/bin/qemu-system-riscv64 \

HOST=riscv-qemu

while ! nc -z localhost 2222; do
echo "Dialing qemu-system-riscv64..."
sleep 1
echo "Testing SSH connectivity to $HOST..."
while ! ssh -o ConnectTimeout=3 $HOST exit; do
echo "$HOST is not ready..."
done

# Issue command
COMMAND=$@
echo "$HOST is ready, forwarding command: $COMMAND"
ssh $HOST "export PATH=\"\$PATH:/root/.cargo/bin\" && cd workdir && $COMMAND"

0 comments on commit b1cf97e

Please sign in to comment.