You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2023/02/23 22:19:38 UTC

[plc4x] branch fix/cdutz/reenable-golang-driver-testsuites updated (386cade444 -> db91a6abb6)

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a change to branch fix/cdutz/reenable-golang-driver-testsuites
in repository https://gitbox.apache.org/repos/asf/plc4x.git


    from 386cade444 fix(plc4go): Fixed one place where Sebastian's HexDiff wasn't used yet.
     new 1fc5bfc311 chore(driver/eip): Changed the testsuite runner to output the data, even if there's too little.
     new db91a6abb6 chore(driver/eip): Made the EIP connection request run.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 plc4go/internal/eip/Connection.go             | 4 ++--
 plc4go/internal/eip/MessageCodec.go           | 5 +++--
 plc4go/spi/testutils/DriverTestRunner.go      | 5 ++++-
 plc4go/tests/drivers/tests/eip_driver_test.go | 2 ++
 4 files changed, 11 insertions(+), 5 deletions(-)


[plc4x] 01/02: chore(driver/eip): Changed the testsuite runner to output the data, even if there's too little.

Posted by cd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch fix/cdutz/reenable-golang-driver-testsuites
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit 1fc5bfc3117c5c97c68d4e7aab4f3d7a898bd76c
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Thu Feb 23 23:19:12 2023 +0100

    chore(driver/eip): Changed the testsuite runner to output the data, even if there's too little.
---
 plc4go/spi/testutils/DriverTestRunner.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/plc4go/spi/testutils/DriverTestRunner.go b/plc4go/spi/testutils/DriverTestRunner.go
index ea2c286b3b..077bbfff29 100644
--- a/plc4go/spi/testutils/DriverTestRunner.go
+++ b/plc4go/spi/testutils/DriverTestRunner.go
@@ -302,7 +302,10 @@ func (m DriverTestsuite) ExecuteStep(connection plc4go.PlcConnection, testcase *
 		log.Trace().Uint32("expectedRawOutputLength", expectedRawOutputLength).Msg("Reading bytes")
 		for testTransportInstance.GetNumDrainableBytes() < expectedRawOutputLength {
 			if time.Now().Sub(now) > 2*time.Second {
-				return errors.Errorf("error getting bytes from transport. Not enough data available: actual(%d)<expected(%d)", testTransportInstance.GetNumDrainableBytes(), expectedRawOutputLength)
+				drainableBytes := testTransportInstance.GetNumDrainableBytes()
+				actualRawOutput, _ := testTransportInstance.DrainWriteBuffer(drainableBytes)
+				return errors.Errorf("error getting bytes from transport. Not enough data available: actual(%d)<expected(%d), \nactual:   0x%X\nexpected: 0x%X\nHexdumps:\n%s",
+					drainableBytes, expectedRawOutputLength, actualRawOutput, expectedRawOutput, utils.DiffHex(actualRawOutput, expectedRawOutput))
 			}
 			time.Sleep(10 * time.Millisecond)
 		}


[plc4x] 02/02: chore(driver/eip): Made the EIP connection request run.

Posted by cd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch fix/cdutz/reenable-golang-driver-testsuites
in repository https://gitbox.apache.org/repos/asf/plc4x.git

commit db91a6abb62dd55a49630818a0d8e54b4d515712
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Thu Feb 23 23:19:27 2023 +0100

    chore(driver/eip): Made the EIP connection request run.
---
 plc4go/internal/eip/Connection.go             | 4 ++--
 plc4go/internal/eip/MessageCodec.go           | 5 +++--
 plc4go/tests/drivers/tests/eip_driver_test.go | 2 ++
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/plc4go/internal/eip/Connection.go b/plc4go/internal/eip/Connection.go
index 9f9cbea906..82aa6f9915 100644
--- a/plc4go/internal/eip/Connection.go
+++ b/plc4go/internal/eip/Connection.go
@@ -187,10 +187,10 @@ func (m *Connection) setupConnection(ctx context.Context, ch chan plc4go.PlcConn
 		////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 		// Connect Register Session
 
-		log.Debug().Msg("Sending ListServices Request")
+		log.Debug().Msg("Sending EipConnectionRequest")
 		connectionResponseChan := make(chan readWriteModel.EipConnectionResponse)
 		connectionResponseErrorChan := make(chan error)
-		if err := m.messageCodec.SendRequest(ctx, readWriteModel.NewListServicesRequest(EmptySessionHandle, uint32(readWriteModel.CIPStatus_Success), []byte(DefaultSenderContext), uint32(0)), func(message spi.Message) bool {
+		if err := m.messageCodec.SendRequest(ctx, readWriteModel.NewEipConnectionRequest(EmptySessionHandle, uint32(readWriteModel.CIPStatus_Success), []byte(DefaultSenderContext), uint32(0)), func(message spi.Message) bool {
 			eipPacket := message.(readWriteModel.EipPacket)
 			return eipPacket != nil
 		}, func(message spi.Message) error {
diff --git a/plc4go/internal/eip/MessageCodec.go b/plc4go/internal/eip/MessageCodec.go
index 37aa4650b1..9606863525 100644
--- a/plc4go/internal/eip/MessageCodec.go
+++ b/plc4go/internal/eip/MessageCodec.go
@@ -51,13 +51,14 @@ func (m *MessageCodec) Send(message spi.Message) error {
 	// Cast the message to the correct type of struct
 	eipPacket := message.(model.EipPacket)
 	// Serialize the request
-	theBytes, err := eipPacket.Serialize()
+	wb := utils.NewWriteBufferByteBased(utils.WithByteOrderForByteBasedBuffer(binary.LittleEndian))
+	err := eipPacket.SerializeWithWriteBuffer(context.Background(), wb)
 	if err != nil {
 		return errors.Wrap(err, "error serializing request")
 	}
 
 	// Send it to the PLC
-	err = m.GetTransportInstance().Write(theBytes)
+	err = m.GetTransportInstance().Write(wb.GetBytes())
 	if err != nil {
 		return errors.Wrap(err, "error sending request")
 	}
diff --git a/plc4go/tests/drivers/tests/eip_driver_test.go b/plc4go/tests/drivers/tests/eip_driver_test.go
index a60f902f0f..f3a05a4edc 100644
--- a/plc4go/tests/drivers/tests/eip_driver_test.go
+++ b/plc4go/tests/drivers/tests/eip_driver_test.go
@@ -26,8 +26,10 @@ import (
 	"github.com/apache/plc4x/plc4go/protocols/eip/readwrite"
 	"github.com/apache/plc4x/plc4go/spi/testutils"
 	_ "github.com/apache/plc4x/plc4go/tests/initializetest"
+	"github.com/rs/zerolog"
 )
 
 func TestEIPDriver(t *testing.T) {
+	zerolog.SetGlobalLevel(zerolog.DebugLevel)
 	testutils.RunDriverTestsuite(t, eip.NewDriver(), "assets/testing/protocols/eip/DriverTestsuite.xml", readwrite.EipXmlParserHelper{})
 }