Skip to content

Commit 271e011

Browse files
Fix bridge and portforward tests issues (#13)
* Test .sh files need to have execution rights * Pattern for checking DHCP address in logs is adjusted * Applied WA for frequent incorrect IP address from DHCP
1 parent 84d7148 commit 271e011

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

qnx_qemu/configs/network_setup_dhcp.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,13 @@ MAX_RETRIES=10 # 10 retries * 3 seconds = 30 seconds tot
4141

4242
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
4343
# Get current IP address for vtnet0
44-
IP_ADDR=$(ifconfig vtnet0 | grep 'inet ' | awk '{print $2}')
44+
45+
# It can happen that dhcpcd at the beggining assigns an APIPA address (169.254.x.x)
46+
# Wait for the correct IP assignment
47+
IP_ADDR_TO_CHECK=$(ifconfig vtnet0 | grep 'inet ' | awk '{print $2}')
48+
if ! echo "$IP_ADDR_TO_CHECK" | grep -q "^169\.254"; then
49+
IP_ADDR=$IP_ADDR_TO_CHECK
50+
fi
4551

4652
if [ -n "$IP_ADDR" ] && [ "$IP_ADDR" != "0.0.0.0" ]; then
4753
echo "---> DHCP successful! Acquired IP"

qnx_qemu/test/test_qnx_qemu_bridge.sh

100644100755
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,9 +279,9 @@ detect_qnx_ip() {
279279
done
280280

281281
# Try to extract IP from DHCP status in logs
282-
local ip_pattern="IP: [0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+"
282+
local ip_pattern="IP address set to: [0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+"
283283
if grep -q "$ip_pattern" "$OUTPUT_LOG" 2>/dev/null; then
284-
detected_ip=$(grep "$ip_pattern" "$OUTPUT_LOG" | tail -1 | sed 's/.*IP: \([0-9.]*\).*/\1/')
284+
detected_ip=$(grep "$ip_pattern" "$OUTPUT_LOG" | tail -1 | sed 's/.*IP address set to: \([0-9.]*\).*/\1/')
285285
if [ -n "$detected_ip" ] && [ "$detected_ip" != "0.0.0.0" ]; then
286286
echo "✓ Detected QNX IP address from logs: $detected_ip"
287287
QNX_IP="$detected_ip"

qnx_qemu/test/test_qnx_qemu_portforward.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)