Nits: fix DNS resolution message. Add Makefile comment for testing targets

This commit is contained in:
cpq 2023-02-02 10:33:00 +00:00
parent 50da233258
commit 961cc13948
3 changed files with 17 additions and 7 deletions

View File

@ -23,14 +23,22 @@ flash: firmware.bin
# Requires env variable VCON_API_KEY set
DEVICE_URL ?= https://dash.vcon.io/api/v3/devices/2
test: EXTRA_CFLAGS += -DUART_DEBUG=UART1
test: update
curl --fail -su :$(VCON_API_KEY) $(DEVICE_URL)/tx?t=5 | tee /tmp/output.txt
grep 'Ethernet: up' /tmp/output.txt
grep 'MQTT connected' /tmp/output.txt
# Upload firmware to a remote test device
update: firmware.bin
curl --fail -su :$(VCON_API_KEY) $(DEVICE_URL)/ota --data-binary @$<
# Read serial port on a remote test device for 5 seconds, store in a
# temporary file, and check the output for expected patterns
test: EXTRA_CFLAGS += -DUART_DEBUG=UART1
test: update
curl --fail -su :$(VCON_API_KEY) $(DEVICE_URL)/tx?t=5 | tee /tmp/output.txt
grep 'Ethernet: up' /tmp/output.txt # Check for network init
grep 'MQTT connected' /tmp/output.txt # Check for MQTT connection success
# Read serial port on a remote test device for 5 seconds
tx:
curl -su :$(VCON_API_KEY) $(DEVICE_URL)/tx?t=5
clean:
@rm -rf firmware.* *.su

View File

@ -273,7 +273,8 @@ static void dns_cb(struct mg_connection *c, int ev, void *ev_data,
if (dm.resolved) {
dm.addr.port = d->c->rem.port; // Save port
d->c->rem = dm.addr; // Copy resolved address
MG_DEBUG(("%lu %s is %M", d->c->id, dm.name, mg_print_ip, &c->rem));
MG_DEBUG(
("%lu %s is %M", d->c->id, dm.name, mg_print_ip, &d->c->rem));
mg_connect_resolved(d->c);
#if MG_ENABLE_IPV6
} else if (dm.addr.is_ip6 == false && dm.name[0] != '\0' &&

View File

@ -161,7 +161,8 @@ static void dns_cb(struct mg_connection *c, int ev, void *ev_data,
if (dm.resolved) {
dm.addr.port = d->c->rem.port; // Save port
d->c->rem = dm.addr; // Copy resolved address
MG_DEBUG(("%lu %s is %M", d->c->id, dm.name, mg_print_ip, &c->rem));
MG_DEBUG(
("%lu %s is %M", d->c->id, dm.name, mg_print_ip, &d->c->rem));
mg_connect_resolved(d->c);
#if MG_ENABLE_IPV6
} else if (dm.addr.is_ip6 == false && dm.name[0] != '\0' &&