release test fixes

pull/558/head
Eric Blankenhorn 2026-07-02 12:36:57 -05:00
parent 0144433f0f
commit 7262e3b5bb
7 changed files with 60 additions and 7 deletions

View File

@ -53,12 +53,38 @@ TESTS += $(check_PROGRAMS)
check_SCRIPTS+= $(dist_noinst_SCRIPTS)
TESTS += $(check_SCRIPTS)
# Some test data is distributed under $(srcdir) but referenced by the test
# scripts (and by mosquitto.conf) via paths relative to the build directory:
# the broker test data (mosquitto.conf and its certificates) and the firmware
# example payload (examples/publish.dat). In an out-of-tree build -- notably
# "make distcheck" -- $(srcdir) != $(builddir), so stage a copy into the build
# tree before the tests run. In-tree builds are a no-op.
AM_TESTS_ENVIRONMENT = \
if test "$(abs_srcdir)" != "$(abs_builddir)"; then \
$(MKDIR_P) scripts/broker_test examples; \
cp -f $(srcdir)/scripts/broker_test/mosquitto.conf \
$(srcdir)/scripts/broker_test/ca-cert.pem \
$(srcdir)/scripts/broker_test/server-cert.pem \
$(srcdir)/scripts/broker_test/server-key.pem \
scripts/broker_test/; \
cp -f $(srcdir)/examples/publish.dat examples/; \
fi;
test: check
DISTCLEANFILES+= wolfmqtt-config
clean-local:
-rm -rf tests/fuzz/corpus
@if test "$(abs_srcdir)" != "$(abs_builddir)"; then \
rm -f scripts/broker_test/mosquitto.conf \
scripts/broker_test/ca-cert.pem \
scripts/broker_test/server-cert.pem \
scripts/broker_test/server-key.pem \
examples/publish.dat; \
rmdir scripts/broker_test 2>/dev/null || true; \
rmdir scripts 2>/dev/null || true; \
fi
maintainer-clean-local:
-rm Makefile.in

View File

@ -150,7 +150,20 @@ static int fw_message_build(MQTTCtx *mqttCtx, const char* fwFile,
ecc_key eccKey;
WC_RNG rng;
wc_InitRng(&rng);
/* Initialize the RNG and ECC key up front so the cleanup path at exit can
* always free them safely, even when an early error (such as a firmware
* file load failure) jumps to exit before the key is generated. */
rc = wc_InitRng(&rng);
if (rc != 0) {
PRINTF("Init RNG Failed! %d", rc);
return rc;
}
rc = wc_ecc_init(&eccKey);
if (rc != 0) {
PRINTF("Init ECC Key Failed! %d", rc);
wc_FreeRng(&rng);
return rc;
}
#endif
/* Verify file can be loaded */
@ -165,7 +178,6 @@ static int fw_message_build(MQTTCtx *mqttCtx, const char* fwFile,
#ifdef ENABLE_FIRMWARE_SIG
/* Generate Key */
/* Note: Real implementation would use previously exchanged/signed key */
wc_ecc_init(&eccKey);
rc = wc_ecc_make_key(&rng, 32, &eccKey);
if (rc != 0) {
PRINTF("Make ECC Key Failed! %d", rc);

View File

@ -34,7 +34,10 @@ then
generate_port
broker_args="-p $port"
fi
mosquitto $broker_args &
# Close the descriptors make passes to recipe commands (notably the
# "make -j" jobserver pipe) so a broker that outlives the test cannot stall
# a parallel make that is waiting on them.
mosquitto $broker_args 3>&- 4>&- 5>&- 6>&- 7>&- 8>&- 9>&- &
broker_pid=$!
echo "Broker PID is $broker_pid"

View File

@ -80,7 +80,10 @@ then
generate_port
broker_args="-p $port"
fi
mosquitto $broker_args &
# Close the descriptors make passes to recipe commands (notably the
# "make -j" jobserver pipe) so a broker that outlives the test cannot stall
# a parallel make that is waiting on them.
mosquitto $broker_args 3>&- 4>&- 5>&- 6>&- 7>&- 8>&- 9>&- &
broker_pid=$!
echo "Broker PID is $broker_pid"

View File

@ -34,7 +34,10 @@ then
generate_port
broker_args="-p $port"
fi
mosquitto $broker_args &
# Close the descriptors make passes to recipe commands (notably the
# "make -j" jobserver pipe) so a broker that outlives the test cannot stall
# a parallel make that is waiting on them.
mosquitto $broker_args 3>&- 4>&- 5>&- 6>&- 7>&- 8>&- 9>&- &
broker_pid=$!
echo "Broker PID is $broker_pid"
sleep 0.1

View File

@ -34,7 +34,10 @@ then
generate_port
broker_args="-p $port"
fi
mosquitto $broker_args &
# Close the descriptors make passes to recipe commands (notably the
# "make -j" jobserver pipe) so a broker that outlives the test cannot stall
# a parallel make that is waiting on them.
mosquitto $broker_args 3>&- 4>&- 5>&- 6>&- 7>&- 8>&- 9>&- &
broker_pid=$!
echo "Broker PID is $broker_pid"

View File

@ -41,7 +41,10 @@ else
generate_port
broker_args="-p $port"
fi
mosquitto $broker_args &
# Close the descriptors make passes to recipe commands (notably the "make -j"
# jobserver pipe) so a broker that outlives the test cannot stall a parallel
# make that is waiting on them.
mosquitto $broker_args 3>&- 4>&- 5>&- 6>&- 7>&- 8>&- 9>&- &
broker_pid=$!
echo "Broker PID is $broker_pid"
sleep 0.1