From 8c5c3b86a24088e31a912d7a4772c10344932b6e Mon Sep 17 00:00:00 2001 From: Marin Nozhchev Date: Sat, 7 Dec 2024 13:44:42 +0200 Subject: [PATCH] Test if the line in contrib/postgres/test.sql is the culprit --- contrib/mysql/test.sql | 2 -- contrib/postgres/test.sql | 2 -- contrib/sqlite3/test.sql | 2 -- contrib/sqlserver/test.sql | 2 -- testcli.go | 10 ++++++++-- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/contrib/mysql/test.sql b/contrib/mysql/test.sql index 6c37a8f284a..89be9a8c8c7 100644 --- a/contrib/mysql/test.sql +++ b/contrib/mysql/test.sql @@ -62,8 +62,6 @@ insert into authors (name) values \echo `echo hello` -select :"COLNAME" from authors where :COLNAME like '%' || :'NAME' || '%' - \print \raw \g diff --git a/contrib/postgres/test.sql b/contrib/postgres/test.sql index 9fd1d39e67f..8fc92010b64 100644 --- a/contrib/postgres/test.sql +++ b/contrib/postgres/test.sql @@ -66,8 +66,6 @@ insert into authors (name) values \echo `echo hello` -select :"COLNAME" from authors where :COLNAME like '%' || :'NAME' || '%' - \print \raw \g diff --git a/contrib/sqlite3/test.sql b/contrib/sqlite3/test.sql index 8a6fe0926a9..2fba66373b2 100644 --- a/contrib/sqlite3/test.sql +++ b/contrib/sqlite3/test.sql @@ -60,8 +60,6 @@ insert into authors (name) values \echo `echo hello` -select :"COLNAME" from authors where :COLNAME like '%' || :'NAME' || '%' - \print \raw \g diff --git a/contrib/sqlserver/test.sql b/contrib/sqlserver/test.sql index 509030cd894..4856b9558d1 100644 --- a/contrib/sqlserver/test.sql +++ b/contrib/sqlserver/test.sql @@ -52,8 +52,6 @@ insert into authors (name) values \echo `echo hello` -select :"COLNAME" from authors where :COLNAME like '%' || :'NAME' || '%' - \print \raw \g diff --git a/testcli.go b/testcli.go index 6900afa24d5..9078611d341 100644 --- a/testcli.go +++ b/testcli.go @@ -12,6 +12,7 @@ import ( "log" "os" "regexp" + "strings" "time" gexpect "github.com/google/goexpect" @@ -119,6 +120,7 @@ func (test Test) do(ctx context.Context, binpath string, timeout time.Duration) gexpect.SetEnv(test.env), gexpect.Tee(&noopWriteCloser{os.Stdout}), ) + exp.Options(gexpect.Verbose(true)) if err != nil { return err } @@ -127,8 +129,12 @@ func (test Test) do(ctx context.Context, binpath string, timeout time.Duration) return err } for _, line := range bytes.Split(buf, []byte{'\n'}) { - if err := exp.Send(string(line) + "\n"); err != nil { - return err + lineStr := strings.TrimSpace(string(line)) + if lineStr != "" { // technically only trailing empty lines are a problem but they are harder to check for + time.Sleep(100 * time.Millisecond) + if err := exp.Send(string(line) + "\n"); err != nil { + return err + } } } select {