Skip to content

Commit be1616d

Browse files
committed
Fix tests on big-endian
Values written to qos_returned were of type enum aws_mqtt_qos but were interpreted as values of type uint8_t when read which at least on big-endian resulted in incorrect results. Fixes ace204e suback return code
1 parent f9aefbc commit be1616d

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

tests/v3/connection_state_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ static int s_test_mqtt_connect_subscribe_fail_from_broker_fn(struct aws_allocato
808808
/* Check the subscribe returned QoS is failure */
809809
size_t length = aws_array_list_length(&state_test_data->qos_returned);
810810
ASSERT_UINT_EQUALS(1, length);
811-
uint8_t qos = 0;
811+
enum aws_mqtt_qos qos = 0;
812812
ASSERT_SUCCESS(aws_array_list_get_at(&state_test_data->qos_returned, &qos, 0));
813813
ASSERT_UINT_EQUALS(AWS_MQTT_QOS_FAILURE, qos);
814814

@@ -878,7 +878,7 @@ static int s_test_mqtt_subscribe_multi_fn(struct aws_allocator *allocator, void
878878
/* Check the subscribe returned QoS is expected */
879879
size_t length = aws_array_list_length(&state_test_data->qos_returned);
880880
ASSERT_UINT_EQUALS(2, length);
881-
uint8_t qos = 0;
881+
enum aws_mqtt_qos qos = 0;
882882
ASSERT_SUCCESS(aws_array_list_get_at(&state_test_data->qos_returned, &qos, 0));
883883
ASSERT_UINT_EQUALS(AWS_MQTT_QOS_EXACTLY_ONCE, qos);
884884
ASSERT_SUCCESS(aws_array_list_get_at(&state_test_data->qos_returned, &qos, 1));

tests/v3/mqtt311_testing_utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ int aws_test311_setup_mqtt_server_fn(struct aws_allocator *allocator, void *ctx)
324324
&state_test_data->published_messages, allocator, 4, sizeof(struct received_publish_packet)));
325325
ASSERT_SUCCESS(aws_array_list_init_dynamic(
326326
&state_test_data->any_published_messages, allocator, 4, sizeof(struct received_publish_packet)));
327-
ASSERT_SUCCESS(aws_array_list_init_dynamic(&state_test_data->qos_returned, allocator, 2, sizeof(uint8_t)));
327+
ASSERT_SUCCESS(aws_array_list_init_dynamic(&state_test_data->qos_returned, allocator, 2, sizeof(enum aws_mqtt_qos)));
328328

329329
ASSERT_SUCCESS(aws_mqtt_client_connection_set_connection_termination_handler(
330330
state_test_data->mqtt_connection, aws_test311_on_connection_termination_fn, state_test_data));

tests/v3/mqtt311_testing_utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ struct mqtt_connection_state_test {
7575
size_t publishes_received;
7676
size_t expected_publishes;
7777
/* The returned QoS from mock server */
78-
struct aws_array_list qos_returned; /* list of uint_8 */
78+
struct aws_array_list qos_returned; /* list of enum aws_mqtt_qos */
7979
size_t ops_completed;
8080
size_t expected_ops_completed;
8181
size_t connection_close_calls; /* All of the times on_connection_closed has been called */

tests/v3/operation_statistics_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct mqtt_connection_state_test {
6464
size_t publishes_received;
6565
size_t expected_publishes;
6666
/* The returned QoS from mock server */
67-
struct aws_array_list qos_returned; /* list of uint_8 */
67+
struct aws_array_list qos_returned; /* list of enum aws_mqtt_qos */
6868
size_t ops_completed;
6969
size_t expected_ops_completed;
7070
};
@@ -253,7 +253,7 @@ static int s_operation_statistics_setup_mqtt_server_fn(struct aws_allocator *all
253253
&state_test_data->published_messages, allocator, 4, sizeof(struct received_publish_packet)));
254254
ASSERT_SUCCESS(aws_array_list_init_dynamic(
255255
&state_test_data->any_published_messages, allocator, 4, sizeof(struct received_publish_packet)));
256-
ASSERT_SUCCESS(aws_array_list_init_dynamic(&state_test_data->qos_returned, allocator, 2, sizeof(uint8_t)));
256+
ASSERT_SUCCESS(aws_array_list_init_dynamic(&state_test_data->qos_returned, allocator, 2, sizeof(enum aws_mqtt_qos)));
257257
return AWS_OP_SUCCESS;
258258
}
259259

0 commit comments

Comments
 (0)