test/crash5.test and get_pwd
(1) By Dan Peterson (danp128) on 2021-01-06 23:16:13 [source]
Hi there,
As part of helping test gitlab.com/cznic/sqlite, a C to Go translation of sqlite, I came across trouble with test/crash5.test that I wanted to double check.
Inside the crashsql tclbody value, get_pwd
is used a couple times. crashsql
writes this tclbody value, including uses of get_pwd
, to a file and then uses exec
to run it. However, it's not clear how the context the tclbody value executes in knows about get_pwd
.
This showed up as errors like this while running crash5.test, on both darwin and linux:
crash5-1.85.1.../home/danp/sq/sqlite-bld/testfixture: invalid command name "get_pwd"
while executing
"get_pwd"
(file "crash.tcl" line 10)
invoked from within
"source $argv0"
invoked from within
"if {[llength $argv]>=1} {
set argv0 [lindex $argv 0]
set argv [lrange $argv 1 end]
source $argv0
} else {
set line {}
while {![eof stdin]} {
if {$line..."
Ok
But only when crashsql
's use of exec
is tweaked to also send stderr to the parent's stdout, eg:
--- a/test/tester.tcl
+++ b/test/tester.tcl
@@ -1719,7 +1719,7 @@ proc crashsql {args} {
}
close $f
set r [catch {
- exec [info nameofexec] crash.tcl >@stdout
+ exec [info nameofexec] crash.tcl >@stdout 2>@stdout
} msg]
# Windows/ActiveState TCL returns a slightly different
If I change uses of get_pwd
to pwd
the test makes it further but errors in a different way:
crash5-2.68.1.../home/danp/sq/sqlite-bld/testfixture: UNIQUE constraint failed: t1.a
while executing
"db eval {
DELETE FROM t1; -- This will put page 4 on the free list.
INSERT INTO t1 VALUES('111111111', '2222222222', '3333333..."
(file "crash.tcl" line 32)
invoked from within
"source $argv0"
invoked from within
"if {[llength $argv]>=1} {
set argv0 [lindex $argv 0]
set argv [lrange $argv 1 end]
source $argv0
} else {
set line {}
while {![eof stdin]} {
if {$line..."
Ok
But it's not clear if that's the expected behavior for the test and I'm wondering if there are further issues.
So, my questions:
- Is it possible crash5.test is using crashsql's tclbody and get_pwd in a way that won't work?
- If so, and that were to be solved, does it seem like the test might have other issues that need fixing?
Thanks, and thank you very much for sqlite. -Dan
(2) By Dan Kennedy (dan) on 2021-01-07 18:51:24 in reply to 1 [link] [source]
Thanks for looking into this. Should now be fixed here:
https://sqlite.org/src/info/0c8e2ede5c325aa7
Dan