Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
paho.mqtt.c
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
eclipse
paho.mqtt.c
Commits
7dc676e5
Commit
7dc676e5
authored
Jun 28, 2018
by
Ian Craggs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add another batch of MQTT V5 tests #470 #471 #487
parent
d57c84b5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
544 additions
and
6 deletions
+544
-6
MQTTAsync.c
src/MQTTAsync.c
+2
-0
MQTTAsync.h
src/MQTTAsync.h
+2
-0
MQTTProperties.c
src/MQTTProperties.c
+1
-2
CMakeLists.txt
test/CMakeLists.txt
+18
-0
test10.c
test/test10.c
+518
-1
test11.c
test/test11.c
+3
-3
No files found.
src/MQTTAsync.c
View file @
7dc676e5
...
@@ -1219,6 +1219,7 @@ static void MQTTAsync_writeComplete(int socket, int rc)
...
@@ -1219,6 +1219,7 @@ static void MQTTAsync_writeComplete(int socket, int rc)
data
.
token
=
command
->
token
;
data
.
token
=
command
->
token
;
data
.
code
=
rc
;
data
.
code
=
rc
;
data
.
message
=
NULL
;
data
.
message
=
NULL
;
data
.
packet_type
=
PUBLISH
;
Log
(
TRACE_MIN
,
-
1
,
"Calling publish failure for client %s"
,
m
->
c
->
clientID
);
Log
(
TRACE_MIN
,
-
1
,
"Calling publish failure for client %s"
,
m
->
c
->
clientID
);
(
*
(
command
->
onFailure5
))(
command
->
context
,
&
data
);
(
*
(
command
->
onFailure5
))(
command
->
context
,
&
data
);
}
}
...
@@ -3599,6 +3600,7 @@ static MQTTPacket* MQTTAsync_cycle(int* sock, unsigned long timeout, int* rc)
...
@@ -3599,6 +3600,7 @@ static MQTTPacket* MQTTAsync_cycle(int* sock, unsigned long timeout, int* rc)
data
.
token
=
command
->
command
.
token
;
data
.
token
=
command
->
command
.
token
;
data
.
reasonCode
=
ack
.
rc
;
data
.
reasonCode
=
ack
.
rc
;
data
.
properties
=
ack
.
properties
;
data
.
properties
=
ack
.
properties
;
data
.
packet_type
=
pack
->
header
.
bits
.
type
;
Log
(
TRACE_MIN
,
-
1
,
"Calling publish failure for client %s"
,
m
->
c
->
clientID
);
Log
(
TRACE_MIN
,
-
1
,
"Calling publish failure for client %s"
,
m
->
c
->
clientID
);
(
*
(
command
->
command
.
onFailure5
))(
command
->
command
.
context
,
&
data
);
(
*
(
command
->
command
.
onFailure5
))(
command
->
command
.
context
,
&
data
);
}
}
...
...
src/MQTTAsync.h
View file @
7dc676e5
...
@@ -455,6 +455,8 @@ typedef struct
...
@@ -455,6 +455,8 @@ typedef struct
int
code
;
int
code
;
/** Optional further text explaining the error. Can be NULL. */
/** Optional further text explaining the error. Can be NULL. */
const
char
*
message
;
const
char
*
message
;
/** Packet type on which the failure occurred - used for publish QoS 1/2 exchanges*/
int
packet_type
;
}
MQTTAsync_failureData5
;
}
MQTTAsync_failureData5
;
#define MQTTAsync_failureData5_initializer {{'M', 'Q', 'F', 'D'}, 0, 0, SUCCESS, MQTTProperties_initializer, 0, NULL}
#define MQTTAsync_failureData5_initializer {{'M', 'Q', 'F', 'D'}, 0, 0, SUCCESS, MQTTProperties_initializer, 0, NULL}
...
...
src/MQTTProperties.c
View file @
7dc676e5
...
@@ -98,8 +98,7 @@ int MQTTProperties_add(MQTTProperties* props, const MQTTProperty* prop)
...
@@ -98,8 +98,7 @@ int MQTTProperties_add(MQTTProperties* props, const MQTTProperty* prop)
if
((
type
=
MQTTProperty_getType
(
prop
->
identifier
))
<
0
)
if
((
type
=
MQTTProperty_getType
(
prop
->
identifier
))
<
0
)
{
{
printf
(
"id %d
\n
"
,
prop
->
identifier
);
/*StackTrace_printStack(stdout);*/
StackTrace_printStack
(
stdout
);
rc
=
MQTT_INVALID_PROPERTY_ID
;
rc
=
MQTT_INVALID_PROPERTY_ID
;
goto
exit
;
goto
exit
;
}
}
...
...
test/CMakeLists.txt
View file @
7dc676e5
...
@@ -604,6 +604,21 @@ ADD_TEST(
...
@@ -604,6 +604,21 @@ ADD_TEST(
COMMAND
"test10"
"--test_no"
"6"
"--connection"
${
MQTT_TEST_BROKER
}
"--proxy_connection"
${
MQTT_TEST_PROXY
}
COMMAND
"test10"
"--test_no"
"6"
"--connection"
${
MQTT_TEST_BROKER
}
"--proxy_connection"
${
MQTT_TEST_PROXY
}
)
)
ADD_TEST
(
NAME test10-7-request_response
COMMAND
"test10"
"--test_no"
"7"
"--connection"
${
MQTT_TEST_BROKER
}
"--proxy_connection"
${
MQTT_TEST_PROXY
}
)
ADD_TEST
(
NAME test10-8-subscribe_options
COMMAND
"test10"
"--test_no"
"8"
"--connection"
${
MQTT_TEST_BROKER
}
"--proxy_connection"
${
MQTT_TEST_PROXY
}
)
ADD_TEST
(
NAME test10-9-shared_subscriptions
COMMAND
"test10"
"--test_no"
"9"
"--connection"
${
MQTT_TEST_BROKER
}
"--proxy_connection"
${
MQTT_TEST_PROXY
}
)
SET_TESTS_PROPERTIES
(
SET_TESTS_PROPERTIES
(
test10-1-client_topic_aliases
test10-1-client_topic_aliases
test10-2-server_topic_aliases
test10-2-server_topic_aliases
...
@@ -611,6 +626,9 @@ SET_TESTS_PROPERTIES(
...
@@ -611,6 +626,9 @@ SET_TESTS_PROPERTIES(
test10-4-flow_control
test10-4-flow_control
test10-5-error_handling
test10-5-error_handling
test10-6-qos_1_2_errors
test10-6-qos_1_2_errors
test10-7-request_response
test10-8-subscribe_options
test10-9-shared_subscriptions
PROPERTIES TIMEOUT 540
PROPERTIES TIMEOUT 540
)
)
...
...
test/test10.c
View file @
7dc676e5
This diff is collapsed.
Click to expand it.
test/test11.c
View file @
7dc676e5
...
@@ -1257,7 +1257,7 @@ void test_qos_1_2_errors_onPublishFailure3(void* context, MQTTAsync_failureData5
...
@@ -1257,7 +1257,7 @@ void test_qos_1_2_errors_onPublishFailure3(void* context, MQTTAsync_failureData5
int
rc
;
int
rc
;
MyLog
(
LOGA_INFO
,
"Callback: publish failure, reason code
\"
%s
\"
msgid: %d packet type: "
,
MyLog
(
LOGA_INFO
,
"Callback: publish failure, reason code
\"
%s
\"
msgid: %d packet type: "
,
MQTTReasonCodeString
(
response
->
reasonCode
),
response
->
token
);
MQTTReasonCodeString
(
response
->
reasonCode
),
response
->
token
,
response
->
packet_type
);
logProperties
(
&
response
->
properties
);
logProperties
(
&
response
->
properties
);
...
@@ -1274,7 +1274,7 @@ void test_qos_1_2_errors_onPublishFailure2(void* context, MQTTAsync_failureData5
...
@@ -1274,7 +1274,7 @@ void test_qos_1_2_errors_onPublishFailure2(void* context, MQTTAsync_failureData5
int
rc
;
int
rc
;
MyLog
(
LOGA_INFO
,
"Callback: publish failure, reason code
\"
%s
\"
msgid: %d packet type: "
,
MyLog
(
LOGA_INFO
,
"Callback: publish failure, reason code
\"
%s
\"
msgid: %d packet type: "
,
MQTTReasonCodeString
(
response
->
reasonCode
),
response
->
token
);
MQTTReasonCodeString
(
response
->
reasonCode
),
response
->
token
,
response
->
packet_type
);
logProperties
(
&
response
->
properties
);
logProperties
(
&
response
->
properties
);
...
@@ -1312,7 +1312,7 @@ void test_qos_1_2_errors_onPublishFailure(void* context, MQTTAsync_failureData5*
...
@@ -1312,7 +1312,7 @@ void test_qos_1_2_errors_onPublishFailure(void* context, MQTTAsync_failureData5*
int
rc
;
int
rc
;
MyLog
(
LOGA_INFO
,
"Callback: publish failure, reason code
\"
%s
\"
msgid: %d packet type: "
,
MyLog
(
LOGA_INFO
,
"Callback: publish failure, reason code
\"
%s
\"
msgid: %d packet type: "
,
MQTTReasonCodeString
(
response
->
reasonCode
),
response
->
token
);
MQTTReasonCodeString
(
response
->
reasonCode
),
response
->
token
,
response
->
packet_type
);
logProperties
(
&
response
->
properties
);
logProperties
(
&
response
->
properties
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment