You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by sr...@apache.org on 2022/11/16 11:35:45 UTC

[plc4x] branch develop updated: test(plc4go/spi): added proper stack trace printing to ManualTestSuite (connection fail)

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

sruehl pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/plc4x.git


The following commit(s) were added to refs/heads/develop by this push:
     new e90ae711e8 test(plc4go/spi): added proper stack trace printing to ManualTestSuite (connection fail)
e90ae711e8 is described below

commit e90ae711e83e49d7afe96028da1d94a46ad62e7d
Author: Sebastian Rühl <sr...@apache.org>
AuthorDate: Wed Nov 16 12:35:37 2022 +0100

    test(plc4go/spi): added proper stack trace printing to ManualTestSuite (connection fail)
---
 plc4go/spi/testutils/ManualTestRunner.go | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/plc4go/spi/testutils/ManualTestRunner.go b/plc4go/spi/testutils/ManualTestRunner.go
index 9237c5122d..4573c96801 100644
--- a/plc4go/spi/testutils/ManualTestRunner.go
+++ b/plc4go/spi/testutils/ManualTestRunner.go
@@ -21,6 +21,7 @@ package testutils
 
 import (
 	"fmt"
+	"github.com/pkg/errors"
 	"math/rand"
 	"reflect"
 	"strings"
@@ -76,6 +77,14 @@ func WithUnwrappedValue(unwrap bool) WithTestCaseOption {
 func (m *ManualTestSuite) Run() plc4go.PlcConnection {
 	connectionResult := <-m.DriverManager.GetConnection(m.ConnectionString)
 	if err := connectionResult.GetErr(); err != nil {
+		tracer, ok := errors.Cause(err).(interface{ StackTrace() errors.StackTrace })
+		if ok {
+			stackTrace := tracer.StackTrace()
+			for _, f := range stackTrace {
+				fmt.Printf("%+s:%d\n", f, f)
+			}
+			fmt.Println()
+		}
 		m.t.Error(err)
 		m.t.FailNow()
 	}