mirror of
https://github.com/glebarez/go-sqlite.git
synced 2025-10-05 15:56:52 +08:00
add detecting the silent error happening on darwin/crash5.test
This commit is contained in:
19
tcl_test.go
19
tcl_test.go
@@ -5,6 +5,7 @@
|
|||||||
package sqlite // import "modernc.org/sqlite"
|
package sqlite // import "modernc.org/sqlite"
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bytes"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
@@ -115,9 +116,23 @@ func TestTclTest(t *testing.T) {
|
|||||||
}
|
}
|
||||||
os.Setenv("PATH", fmt.Sprintf("%s%c%s", dir, os.PathListSeparator, os.Getenv("PATH")))
|
os.Setenv("PATH", fmt.Sprintf("%s%c%s", dir, os.PathListSeparator, os.Getenv("PATH")))
|
||||||
cmd = exec.Command(bin, args...)
|
cmd = exec.Command(bin, args...)
|
||||||
cmd.Stdout = os.Stdout
|
var w echoWriter
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stdout = &w
|
||||||
|
cmd.Stderr = &w
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if b := w.w.Bytes(); bytes.Contains(b, []byte("while executing")) {
|
||||||
|
t.Fatal("silent/unreported error detected in output")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type echoWriter struct {
|
||||||
|
w bytes.Buffer
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *echoWriter) Write(b []byte) (int, error) {
|
||||||
|
os.Stdout.Write(b)
|
||||||
|
return w.w.Write(b)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user