|
@@ -161,11 +161,11 @@ SCENARIO("Integration test of Transport layer", "[integration, transport]")
|
|
"\x7b\x49\xfa\x72", 34u);
|
|
"\x7b\x49\xfa\x72", 34u);
|
|
THEN("The shellmatta responds to the command")
|
|
THEN("The shellmatta responds to the command")
|
|
{
|
|
{
|
|
- char *dummyData = (char*)"\x01\x01\x00\x2f\x00\x00\x01\x01"
|
|
|
|
|
|
+ char *dummyData = (char*)"\x01\x01\x00\x2f\x00\x01\x01\x01"
|
|
"doSomething argument - length: 20"
|
|
"doSomething argument - length: 20"
|
|
"\r\n"
|
|
"\r\n"
|
|
"shellmatta->"
|
|
"shellmatta->"
|
|
- "\xc8\xae\xc0\x56";
|
|
|
|
|
|
+ "\x4c\x9f\xd9\xa7";
|
|
|
|
|
|
CHECK(write_length == 59u);
|
|
CHECK(write_length == 59u);
|
|
REQUIRE(memcmp(write_data, dummyData, 59) == 0);
|
|
REQUIRE(memcmp(write_data, dummyData, 59) == 0);
|
|
@@ -184,21 +184,21 @@ SCENARIO("Integration test of Transport layer", "[integration, transport]")
|
|
"\xad\x33\x31\xcc", 26u);
|
|
"\xad\x33\x31\xcc", 26u);
|
|
THEN("The shellmatta responds multiple telegrams")
|
|
THEN("The shellmatta responds multiple telegrams")
|
|
{
|
|
{
|
|
- char *dummyData = (char*)"\x01\x01\x00\xff\x00\x00\x01\x01"
|
|
|
|
|
|
+ char *dummyData = (char*)"\x01\x01\x00\xff\x00\x01\x01\x01"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very"
|
|
"This is my very very very"
|
|
- "\x0f\x90\xc0\xfd"
|
|
|
|
- "\x01\x01\x00\x7f\x00\x00\x01\x02"
|
|
|
|
|
|
+ "\x00\x9c\x41\xe1"
|
|
|
|
+ "\x01\x01\x00\x7f\x00\x01\x01\x02"
|
|
" very large payload\r\n"
|
|
" very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"\r\n"
|
|
"\r\n"
|
|
"shellmatta->"
|
|
"shellmatta->"
|
|
- "\x00\xc9\x5d\x37";
|
|
|
|
|
|
+ "\x39\x75\x0d\x6b";
|
|
|
|
|
|
CHECK(write_length == 406u);
|
|
CHECK(write_length == 406u);
|
|
REQUIRE(memcmp(write_data, dummyData, 406u) == 0);
|
|
REQUIRE(memcmp(write_data, dummyData, 406u) == 0);
|
|
@@ -217,21 +217,21 @@ SCENARIO("Integration test of Transport layer", "[integration, transport]")
|
|
"\xad\x33\x31\xcc", 26u);
|
|
"\xad\x33\x31\xcc", 26u);
|
|
THEN("The shellmatta responds multiple telegrams")
|
|
THEN("The shellmatta responds multiple telegrams")
|
|
{
|
|
{
|
|
- char *dummyData = (char*)"\x01\x01\x00\xff\x00\x00\x01\x01"
|
|
|
|
|
|
+ char *dummyData = (char*)"\x01\x01\x00\xff\x00\x01\x01\x01"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very"
|
|
"This is my very very very"
|
|
- "\x0f\x90\xc0\xfd"
|
|
|
|
- "\x01\x01\x00\x7f\x00\x00\x01\x02"
|
|
|
|
|
|
+ "\x00\x9c\x41\xe1"
|
|
|
|
+ "\x01\x01\x00\x7f\x00\x01\x01\x02"
|
|
" very large payload\r\n"
|
|
" very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"This is my very very very very large payload\r\n"
|
|
"\r\n"
|
|
"\r\n"
|
|
"shellmatta->"
|
|
"shellmatta->"
|
|
- "\x00\xc9\x5d\x37";
|
|
|
|
|
|
+ "\x39\x75\x0d\x6b";
|
|
|
|
|
|
CHECK(write_length == 406u);
|
|
CHECK(write_length == 406u);
|
|
REQUIRE(memcmp(write_data, dummyData, 406u) == 0);
|
|
REQUIRE(memcmp(write_data, dummyData, 406u) == 0);
|
|
@@ -248,11 +248,11 @@ SCENARIO("Integration test of Transport layer", "[integration, transport]")
|
|
shellmatta_processData(handle, (char*)"doSomething argument\r\n", 22u);
|
|
shellmatta_processData(handle, (char*)"doSomething argument\r\n", 22u);
|
|
THEN("The shellmatta responds to the command")
|
|
THEN("The shellmatta responds to the command")
|
|
{
|
|
{
|
|
- char *dummyData = (char*)"\x01\x01\x00\x2f\x00\x00\x01\x01"
|
|
|
|
|
|
+ char *dummyData = (char*)"\x01\x01\x00\x2f\x00\x01\x01\x01"
|
|
"doSomething argument - length: 20"
|
|
"doSomething argument - length: 20"
|
|
"\r\n"
|
|
"\r\n"
|
|
"shellmatta->"
|
|
"shellmatta->"
|
|
- "\xc8\xae\xc0\x56"
|
|
|
|
|
|
+ "\x4c\x9f\xd9\xa7"
|
|
"doSomething argument - length: 20\r\n"
|
|
"doSomething argument - length: 20\r\n"
|
|
"shellmatta->";
|
|
"shellmatta->";
|
|
|
|
|
|
@@ -265,7 +265,7 @@ SCENARIO("Integration test of Transport layer", "[integration, transport]")
|
|
{
|
|
{
|
|
/* check with valid payload - disable echo to reduce cluttering */
|
|
/* check with valid payload - disable echo to reduce cluttering */
|
|
shellmatta_configure(handle, SHELLMATTA_MODE_INSERT, false, '\r');
|
|
shellmatta_configure(handle, SHELLMATTA_MODE_INSERT, false, '\r');
|
|
- shellmatta_transport_configure(handle, false, true, NULL);
|
|
|
|
|
|
+ shellmatta_transport_configure(handle, false, true, NULL, NULL);
|
|
shellmatta_processData(handle, (char*)"\x01\x01\x00\x16\x00\x00\x00\x00"
|
|
shellmatta_processData(handle, (char*)"\x01\x01\x00\x16\x00\x00\x00\x00"
|
|
"doSomething argument\r\n"
|
|
"doSomething argument\r\n"
|
|
"\x7b\x49\xfa\x72", 34u);
|
|
"\x7b\x49\xfa\x72", 34u);
|
|
@@ -280,11 +280,11 @@ SCENARIO("Integration test of Transport layer", "[integration, transport]")
|
|
THEN("The shellmatta returns the data")
|
|
THEN("The shellmatta returns the data")
|
|
{
|
|
{
|
|
|
|
|
|
- char *dummyData = (char*)"\x01\x01\x00\x2f\x00\x00\x01\x01"
|
|
|
|
|
|
+ char *dummyData = (char*)"\x01\x01\x00\x2f\x00\x01\x01\x01"
|
|
"doSomething argument - length: 20"
|
|
"doSomething argument - length: 20"
|
|
"\r\n"
|
|
"\r\n"
|
|
"shellmatta->"
|
|
"shellmatta->"
|
|
- "\xc8\xae\xc0\x56";
|
|
|
|
|
|
+ "\x4c\x9f\xd9\xa7";
|
|
|
|
|
|
CHECK(write_length == 59u);
|
|
CHECK(write_length == 59u);
|
|
REQUIRE(memcmp(write_data, dummyData, 59) == 0);
|
|
REQUIRE(memcmp(write_data, dummyData, 59) == 0);
|
|
@@ -300,8 +300,8 @@ SCENARIO("Integration test of Transport layer", "[integration, transport]")
|
|
"\xc4\xa3\x07\xe6", 12u);
|
|
"\xc4\xa3\x07\xe6", 12u);
|
|
THEN("The valid Sequence counter is returned")
|
|
THEN("The valid Sequence counter is returned")
|
|
{
|
|
{
|
|
- char *dummyData = (char*)"\x01\x01\x81\x00\x00\x00\x01\x01"
|
|
|
|
- "\xb4\x0f\x12\xe9";
|
|
|
|
|
|
+ char *dummyData = (char*)"\x01\x01\x81\x00\x00\x01\x01\x01"
|
|
|
|
+ "\xb5\xcd\x78\xde";
|
|
|
|
|
|
CHECK(write_length == 12);
|
|
CHECK(write_length == 12);
|
|
REQUIRE(memcmp(write_data, dummyData, 12) == 0);
|
|
REQUIRE(memcmp(write_data, dummyData, 12) == 0);
|
|
@@ -316,8 +316,8 @@ SCENARIO("Integration test of Transport layer", "[integration, transport]")
|
|
"\xc4\xa3\x07\xe6", 12u);
|
|
"\xc4\xa3\x07\xe6", 12u);
|
|
THEN("The next Sequence counter is returned")
|
|
THEN("The next Sequence counter is returned")
|
|
{
|
|
{
|
|
- char *dummyData = (char*)"\x01\x01\x81\x00\x00\x00\x02\x02"
|
|
|
|
- "\x06\x2b\x10\x90";
|
|
|
|
|
|
+ char *dummyData = (char*)"\x01\x01\x81\x00\x00\x01\x02\x02"
|
|
|
|
+ "\x07\xe9\x7a\xa7";
|
|
|
|
|
|
CHECK(write_length == 12);
|
|
CHECK(write_length == 12);
|
|
REQUIRE(memcmp(write_data, dummyData, 12) == 0);
|
|
REQUIRE(memcmp(write_data, dummyData, 12) == 0);
|
|
@@ -353,7 +353,7 @@ SCENARIO("Integration test of Transport layer with mandatory transport layer", "
|
|
write_length = 0u;
|
|
write_length = 0u;
|
|
|
|
|
|
WHEN("The tansport layer is set to mandatory") {
|
|
WHEN("The tansport layer is set to mandatory") {
|
|
- ret = shellmatta_transport_configure(handle, true, false, NULL);
|
|
|
|
|
|
+ ret = shellmatta_transport_configure(handle, true, false, NULL, NULL);
|
|
CHECK(ret == SHELLMATTA_OK);
|
|
CHECK(ret == SHELLMATTA_OK);
|
|
|
|
|
|
AND_WHEN("manual mode is used after transport layer mode")
|
|
AND_WHEN("manual mode is used after transport layer mode")
|
|
@@ -366,11 +366,11 @@ SCENARIO("Integration test of Transport layer with mandatory transport layer", "
|
|
shellmatta_processData(handle, (char*)"doSomething argument\r\n", 22u);
|
|
shellmatta_processData(handle, (char*)"doSomething argument\r\n", 22u);
|
|
THEN("The shellmatta responds only to the first command - and waits for a new telegram to start")
|
|
THEN("The shellmatta responds only to the first command - and waits for a new telegram to start")
|
|
{
|
|
{
|
|
- char *dummyData = (char*)"\x01\x01\x00\x2f\x00\x00\x01\x01"
|
|
|
|
|
|
+ char *dummyData = (char*)"\x01\x01\x00\x2f\x00\x01\x01\x01"
|
|
"doSomething argument - length: 20"
|
|
"doSomething argument - length: 20"
|
|
"\r\n"
|
|
"\r\n"
|
|
"shellmatta->"
|
|
"shellmatta->"
|
|
- "\xc8\xae\xc0\x56";
|
|
|
|
|
|
+ "\x4c\x9f\xd9\xa7";
|
|
|
|
|
|
CHECK(write_length == 59);
|
|
CHECK(write_length == 59);
|
|
CHECK(memcmp(write_data, dummyData, write_length) == 0);
|
|
CHECK(memcmp(write_data, dummyData, write_length) == 0);
|
|
@@ -407,7 +407,7 @@ SCENARIO("Integration test of Transport layer - reset transport layer", "[integr
|
|
write_length = 0u;
|
|
write_length = 0u;
|
|
|
|
|
|
WHEN("The tansport layer is set to mandatory") {
|
|
WHEN("The tansport layer is set to mandatory") {
|
|
- ret = shellmatta_transport_configure(handle, true, false, NULL);
|
|
|
|
|
|
+ ret = shellmatta_transport_configure(handle, true, false, NULL, NULL);
|
|
CHECK(ret == SHELLMATTA_OK);
|
|
CHECK(ret == SHELLMATTA_OK);
|
|
|
|
|
|
AND_WHEN("A partial telegram is passed")
|
|
AND_WHEN("A partial telegram is passed")
|
|
@@ -438,3 +438,69 @@ SCENARIO("Integration test of Transport layer - reset transport layer", "[integr
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+SCENARIO("Integration test of Transport layer - addressing", "[integration, transport]")
|
|
|
|
+{
|
|
|
|
+ GIVEN("Shellmatta up and running with one command - transport layer with UUID")
|
|
|
|
+ {
|
|
|
|
+ shellmatta_instance_t inst;
|
|
|
|
+ shellmatta_handle_t handle;
|
|
|
|
+ shellmatta_retCode_t ret;
|
|
|
|
+ char buffer[1024];
|
|
|
|
+ char historyBuffer[1024];
|
|
|
|
+
|
|
|
|
+ shellmatta_doInit( &inst,
|
|
|
|
+ &handle,
|
|
|
|
+ buffer,
|
|
|
|
+ sizeof(buffer),
|
|
|
|
+ historyBuffer,
|
|
|
|
+ sizeof(historyBuffer),
|
|
|
|
+ "shellmatta->",
|
|
|
|
+ NULL,
|
|
|
|
+ writeFct);
|
|
|
|
+ shellmatta_addCmd(handle, &doSomethingCmd);
|
|
|
|
+
|
|
|
|
+ ret = shellmatta_transport_configure(handle, true, false, (uint8_t *)"123456789012345", NULL);
|
|
|
|
+ CHECK(ret == SHELLMATTA_OK);
|
|
|
|
+
|
|
|
|
+ write_callCnt = 0u;
|
|
|
|
+ memset(write_data, 0, sizeof(write_data));
|
|
|
|
+ write_length = 0u;
|
|
|
|
+
|
|
|
|
+ WHEN("The shellmatta is searched using an invalid range") {
|
|
|
|
+ ret = shellmatta_transport_configure(handle, true, false, NULL, NULL);
|
|
|
|
+
|
|
|
|
+ /* check with valid payload - disable echo to reduce cluttering */
|
|
|
|
+ shellmatta_configure(handle, SHELLMATTA_MODE_INSERT, false, '\r');
|
|
|
|
+ shellmatta_processData(handle, (char*)"\x01\x01\x03\x20\x00\x00\x00\x00"
|
|
|
|
+ "234567890123456\0"
|
|
|
|
+ "345678901234567\0"
|
|
|
|
+ "\x93\x0c\xc3\x04", 44u);
|
|
|
|
+
|
|
|
|
+ THEN("The shellmatta does not respond")
|
|
|
|
+ {
|
|
|
|
+ CHECK(write_length == 0);
|
|
|
|
+ CHECK(inst.transportLayer.sequenceH2S == 1);
|
|
|
|
+ REQUIRE(inst.transportLayer.state == SHELLMATTA_TRANSPORT_STATE_WAIT);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ WHEN("The shellmatta is searched using a valid range") {
|
|
|
|
+ ret = shellmatta_transport_configure(handle, true, false, NULL, NULL);
|
|
|
|
+
|
|
|
|
+ /* check with valid payload - disable echo to reduce cluttering */
|
|
|
|
+ shellmatta_configure(handle, SHELLMATTA_MODE_INSERT, false, '\r');
|
|
|
|
+ shellmatta_processData(handle, (char*)"\x01\x01\x03\x20\x00\x00\x00\x00"
|
|
|
|
+ "123456789012344\0"
|
|
|
|
+ "345678901234567\0"
|
|
|
|
+ "\x9b\x69\x59\x5f", 44u);
|
|
|
|
+
|
|
|
|
+ THEN("The shellmatta does not respond")
|
|
|
|
+ {
|
|
|
|
+ CHECK(write_length == 28);
|
|
|
|
+ CHECK(inst.transportLayer.sequenceH2S == 1);
|
|
|
|
+ REQUIRE(inst.transportLayer.state == SHELLMATTA_TRANSPORT_STATE_WAIT);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|