Fix unit tests

This commit is contained in:
hsaturn
2023-01-14 14:26:30 +01:00
parent a0435b2cfb
commit 3b2460572b
3 changed files with 13 additions and 10 deletions

View File

@@ -1,27 +1,28 @@
tests:
set -e; \
@set -e; \
for i in *-tests/Makefile; do \
$(MAKE) -C $$(dirname $$i) -j clean; \
echo '==== Making:' $$(dirname $$i); \
$(MAKE) -C $$(dirname $$i) -j; \
done
debugtest:
set -e; \
@set -e; \
$(MAKE) clean; \
$(MAKE) -C debug-mode -j; \
debug-mode/debug-tests.out
runtests: debugtest
$(MAKE) clean
$(MAKE) tests
set -e; \
@$(MAKE) clean
@$(MAKE) tests
@set -e; \
for i in *-tests/Makefile; do \
echo '==== Running:' $$(dirname $$i); \
$$(dirname $$i)/$$(dirname $$i).out; \
done
clean:
set -e; \
@set -e; \
for i in *-tests/Makefile; do \
echo '==== Cleaning:' $$(dirname $$i); \
$(MAKE) -C $$(dirname $$i) clean; \

View File

@@ -19,7 +19,8 @@ class TestReceiver : public MqttClassBinder<TestReceiver>
void onPublish(const MqttClient* /* source */, const Topic& topic, const char* payload, size_t /* length */)
{
Serial << "--> routed message received by " << name_ << ':' << topic.c_str() << " = " << payload << endl;
(void) topic;
// Serial << "--> routed message received by " << name_ << ':' << topic.c_str() << " = " << payload << endl;
messages[name_]++;
}
@@ -35,7 +36,8 @@ std::map<std::string, int> TestReceiver::messages;
static int unrouted = 0;
void onUnrouted(const MqttClient*, const Topic& topic, const char*, size_t)
{
Serial << "--> unrouted: " << topic.c_str() << endl;
(void) topic;
// Serial << "--> unrouted: " << topic.c_str() << endl;
unrouted++;
}

View File

@@ -42,7 +42,7 @@ test(local_client_should_unregister_when_destroyed)
test(local_client_do_not_disconnect_after_publishing)
{
set_millis(0);
EpoxyTest::set_millis(0);
MqttBroker broker(1883);
MqttClient client(&broker, "client");
MqttClient sender(&broker, "sender");
@@ -56,7 +56,7 @@ test(local_client_do_not_disconnect_after_publishing)
sender.publish("test", "value");
broker.loop();
add_seconds(60);
EpoxyTest::add_seconds(60);
client.loop();
sender.loop();
broker.loop();