Skip to content

Instantly share code, notes, and snippets.

@jungle-boogie
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jungle-boogie/305c25100a62308e80fb to your computer and use it in GitHub Desktop.
Save jungle-boogie/305c25100a62308e80fb to your computer and use it in GitHub Desktop.
make
tclsh tools/assemble.tcl sqawk-dev.tcl > sqawk.tcl
tclsh tests.tcl
==== test1 Handle broken pipe, read from stdin FAILED
==== Contents of test case:
with-temp-files filename ch {
puts $ch "line 1\nline 2\nline 3"
close $ch
set result [sqawk-tcl {select a0 from a} < $filename | head -n 1]
}
return $result
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't load file "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so": Cannot open "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so"
while executing
"load /usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so sqlite3"
("package ifneeded sqlite3 3.8.12" script)
invoked from within
"package require sqlite3"
(file "sqawk.tcl" line 8)
while executing
"exec [info nameofexecutable] sqawk.tcl {*}$args"
(procedure "sqawk-tcl" line 2)
invoked from within
"sqawk-tcl {select a0 from a} < $filename | head -n 1"
("uplevel" body line 4)
invoked from within
"uplevel 1 $script"
(procedure "with-temp-files" line 16)
invoked from within
"with-temp-files filename ch {
puts $ch "line 1\nline 2\nline 3"
close $ch
set result [sqawk-tcl {select a0 from a}..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
---- errorCode: CHILDSTATUS 6271 1
==== test1 FAILED
==== test3 JOIN on two files from examples/hp/ FAILED
==== Contents of test case:
with-temp-files filename {
sqawk-tcl {
select a1, b1, a2 from a inner join b on a2 = b2
where b1 < 10000 order by b1
} examples/hp/MD5SUMS examples/hp/du-bytes > $filename
set result [exec diff examples/hp/results.correct $filename]
}
return $result
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't load file "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so": Cannot open "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so"
while executing
"load /usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so sqlite3"
("package ifneeded sqlite3 3.8.12" script)
invoked from within
"package require sqlite3"
(file "sqawk.tcl" line 8)
while executing
"exec [info nameofexecutable] sqawk.tcl {*}$args"
(procedure "sqawk-tcl" line 2)
invoked from within
"sqawk-tcl {
select a1, b1, a2 from a inner join b on a2 = b2
where b1 < 10000 order by b1
} examples/hp/MD..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
(procedure "with-temp-files" line 16)
invoked from within
"with-temp-files filename {
sqawk-tcl {
select a1, b1, a2 from a inner join b on a2 = b2
where b1 < 10000 o..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
---- errorCode: CHILDSTATUS 6275 1
==== test3 FAILED
==== test4 JOIN on files from examples/three-files/, FS setting FAILED
==== Contents of test case:
with-temp-files filename {
set dir examples/three-files/
sqawk-tcl -FS , {
select a1, a2, b2, c2 from a inner join b on a1 = b1
inner join c on a1 = c1
} $dir/1 FS=_ FS=, $dir/2 $dir/3 > $filename
unset dir
set result [exec diff examples/three-files/results.correct $filename]
}
return $result
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't load file "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so": Cannot open "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so"
while executing
"load /usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so sqlite3"
("package ifneeded sqlite3 3.8.12" script)
invoked from within
"package require sqlite3"
(file "sqawk.tcl" line 8)
while executing
"exec [info nameofexecutable] sqawk.tcl {*}$args"
(procedure "sqawk-tcl" line 2)
invoked from within
"sqawk-tcl -FS , {
select a1, a2, b2, c2 from a inner join b on a1 = b1
inner join c on a1 = c1
} $dir/1 FS..."
("uplevel" body line 3)
invoked from within
"uplevel 1 $script"
(procedure "with-temp-files" line 16)
invoked from within
"with-temp-files filename {
set dir examples/three-files/
sqawk-tcl -FS , {
select a1, a2, b2, c2 from a inner ..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
---- errorCode: CHILDSTATUS 6276 1
==== test4 FAILED
==== test5 Custom table names FAILED
==== Contents of test case:
with-temp-files filename1 ch1 {
with-temp-files filename2 ch2 {
puts $ch1 "foo 1\nfoo 2\nfoo 3"
puts $ch2 "bar 4\nbar 5\nbar 6"
close $ch1
close $ch2
set result [sqawk-tcl {
select foo2 from foo; select b2 from b
} table=foo $filename1 $filename2]
}
}
return $result
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't load file "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so": Cannot open "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so"
while executing
"load /usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so sqlite3"
("package ifneeded sqlite3 3.8.12" script)
invoked from within
"package require sqlite3"
(file "sqawk.tcl" line 8)
while executing
"exec [info nameofexecutable] sqawk.tcl {*}$args"
(procedure "sqawk-tcl" line 2)
invoked from within
"sqawk-tcl {
select foo2 from foo; select b2 from b
} table=foo $filename1 $filename2"
("uplevel" body line 6)
invoked from within
"uplevel 1 $script"
(procedure "with-temp-files" line 16)
invoked from within
"with-temp-files filename2 ch2 {
puts $ch1 "foo 1\nfoo 2\nfoo 3"
puts $ch2 "bar 4\nbar 5\nbar 6"
close ..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
(procedure "with-temp-files" line 16)
invoked from within
"with-temp-files filename1 ch1 {
with-temp-files filename2 ch2 {
puts $ch1 "foo 1\nfoo 2\nfoo 3"
puts $ch2 ..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
---- errorCode: CHILDSTATUS 6279 1
==== test5 FAILED
==== test6 Custom table names and prefixes FAILED
==== Contents of test case:
with-temp-files filename1 ch1 filename2 ch2 {
puts $ch1 "foo 1\nfoo 2\nfoo 3"
puts $ch2 "bar 4\nbar 5\nbar 6"
close $ch1
close $ch2
set result [sqawk-tcl {
select foo.x2 from foo; select baz2 from bar
} table=foo prefix=x $filename1 table=bar prefix=baz $filename2]
}
return $result
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't load file "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so": Cannot open "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so"
while executing
"load /usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so sqlite3"
("package ifneeded sqlite3 3.8.12" script)
invoked from within
"package require sqlite3"
(file "sqawk.tcl" line 8)
while executing
"exec [info nameofexecutable] sqawk.tcl {*}$args"
(procedure "sqawk-tcl" line 2)
invoked from within
"sqawk-tcl {
select foo.x2 from foo; select baz2 from bar
} table=foo prefix=x $filename1 table=bar prefix=baz $filename2"
("uplevel" body line 6)
invoked from within
"uplevel 1 $script"
(procedure "with-temp-files" line 16)
invoked from within
"with-temp-files filename1 ch1 filename2 ch2 {
puts $ch1 "foo 1\nfoo 2\nfoo 3"
puts $ch2 "bar 4\nbar 5\nbar 6"
clos..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
---- errorCode: CHILDSTATUS 6280 1
==== test6 FAILED
==== test7 Header row FAILED
==== Contents of test case:
with-temp-files filename ch {
puts $ch "name\tposition\toffice\tphone"
puts $ch "Smith\tCEO\t10\t555-1234"
puts $ch "James\tHead of marketing\t11\t555-1235"
puts $ch "McDonald\tDeveloper\t12\t555-1236\tGood at tables"
close $ch
set result [sqawk-tcl {
select name, office from staff
where position = "CEO"
or staff.phone = "555-1234"
or staff.a5 = "Good at tables"
} FS=\t table=staff prefix=a header=1 $filename]
}
return $result
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't load file "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so": Cannot open "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so"
while executing
"load /usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so sqlite3"
("package ifneeded sqlite3 3.8.12" script)
invoked from within
"package require sqlite3"
(file "sqawk.tcl" line 8)
while executing
"exec [info nameofexecutable] sqawk.tcl {*}$args"
(procedure "sqawk-tcl" line 2)
invoked from within
"sqawk-tcl {
select name, office from staff
where position = "CEO"
or staff.phone = "555-1234"
..."
("uplevel" body line 7)
invoked from within
"uplevel 1 $script"
(procedure "with-temp-files" line 16)
invoked from within
"with-temp-files filename ch {
puts $ch "name\tposition\toffice\tphone"
puts $ch "Smith\tCEO\t10\t555-1234"
puts $c..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
---- errorCode: CHILDSTATUS 6283 1
==== test7 FAILED
==== test8 ::sqawk::parsers::awk::splitmerge FAILED
==== Contents of test case:
source sqawk.tcl
set result {}
set lambda {
{from to {sep AB}} {
set startingList [list start u v w x y z tail]
set result {}
lappend result [lrange $startingList 0 $from-1]
lappend result [join [lrange $startingList $from $to] $sep]
lappend result [lrange $startingList $to+1 end]
return [string trim [join $result { }] { }]
}
}
for {set i 0} {$i < 20} {incr i} {
for {set j 0} {$j <= $i} {incr j} {
set literalSplit [::sqawk::parsers::awk::splitmerge startABuABvABwABxAByABzABtail {AB} [list $j $i]]
set regexpSplit [::sqawk::parsers::awk::splitmerge startABuABvABwABxAByABzABtail {(AB?)+} [list $j $i]]
set correct [apply $lambda $j $i]
set match [expr {
($literalSplit eq $correct) && ($regexpSplit eq $correct)
}]
lappend result $match
}
}
return [lsort -unique $result]
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't load file "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so": Cannot open "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so"
while executing
"load /usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so sqlite3"
("package ifneeded sqlite3 3.8.12" script)
invoked from within
"package require sqlite3"
(file "sqawk.tcl" line 8)
invoked from within
"source sqawk.tcl"
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
---- errorCode: NONE
==== test8 FAILED
==== test9 merge option FAILED
==== Contents of test case:
with-temp-files filename ch {
set result {}
puts $ch "foo 1 foo 2 foo 3"
puts $ch "bar 4 bar 5 bar 6"
close $ch
lappend result [sqawk-tcl -OFS - {
select a1, a2, a3 from a
} {merge=0-1,2-3,4-5} $filename]
lappend result [sqawk-tcl -OFS - {
select a1, a2, a3 from a
} {merge=0 1 2 3 4 5} $filename]
}
return [lindex [lsort -unique $result] 0]
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't load file "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so": Cannot open "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so"
while executing
"load /usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so sqlite3"
("package ifneeded sqlite3 3.8.12" script)
invoked from within
"package require sqlite3"
(file "sqawk.tcl" line 8)
while executing
"exec [info nameofexecutable] sqawk.tcl {*}$args"
(procedure "sqawk-tcl" line 2)
invoked from within
"sqawk-tcl -OFS - {
select a1, a2, a3 from a
} {merge=0-1,2-3,4-5} $filename"
("uplevel" body line 6)
invoked from within
"uplevel 1 $script"
(procedure "with-temp-files" line 16)
invoked from within
"with-temp-files filename ch {
set result {}
puts $ch "foo 1 foo 2 foo 3"
puts $ch "bar 4 bar 5 bar 6"..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
---- errorCode: CHILDSTATUS 6286 1
==== test9 FAILED
==== test10 CSV input FAILED
==== Contents of test case:
with-temp-files filename1 ch1 filename2 ch2 {
set result {}
puts $ch1 "1,2,\"Hello, World!\"\nΑλαμπουρνέζικα,3,4\n5,6,7"
close $ch1
puts $ch2 "1;2;\"Hello, World!\"\nΑλαμπουρνέζικα;3;4\n5;6;7"
close $ch2
lappend result [sqawk-tcl -OFS - {
select a1, a2, a3 from a
} format=csv $filename1]
lappend result [sqawk-tcl -OFS - {
select a1, a2, a3 from a
} format=csvalt {csvsep=;} $filename2]
}
return [lindex [lsort -unique $result] 0]
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't load file "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so": Cannot open "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so"
while executing
"load /usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so sqlite3"
("package ifneeded sqlite3 3.8.12" script)
invoked from within
"package require sqlite3"
(file "sqawk.tcl" line 8)
while executing
"exec [info nameofexecutable] sqawk.tcl {*}$args"
(procedure "sqawk-tcl" line 2)
invoked from within
"sqawk-tcl -OFS - {
select a1, a2, a3 from a
} format=csv $filename1"
("uplevel" body line 7)
invoked from within
"uplevel 1 $script"
(procedure "with-temp-files" line 16)
invoked from within
"with-temp-files filename1 ch1 filename2 ch2 {
set result {}
puts $ch1 "1,2,\"Hello, World!\"\nΑλαμπουρνέζικα,3,4..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
---- errorCode: CHILDSTATUS 6289 1
==== test10 FAILED
==== test11 Default output format FAILED
==== Contents of test case:
with-temp-files filename ch {
puts $ch "line 1\nline 2\nline 3"
close $ch
set result [sqawk-tcl -output awk {select a0 from a} $filename]
}
return $result
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't load file "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so": Cannot open "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so"
while executing
"load /usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so sqlite3"
("package ifneeded sqlite3 3.8.12" script)
invoked from within
"package require sqlite3"
(file "sqawk.tcl" line 8)
while executing
"exec [info nameofexecutable] sqawk.tcl {*}$args"
(procedure "sqawk-tcl" line 2)
invoked from within
"sqawk-tcl -output awk {select a0 from a} $filename"
("uplevel" body line 4)
invoked from within
"uplevel 1 $script"
(procedure "with-temp-files" line 16)
invoked from within
"with-temp-files filename ch {
puts $ch "line 1\nline 2\nline 3"
close $ch
set result [sqawk-tcl -output awk {selec..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
---- errorCode: CHILDSTATUS 6290 1
==== test11 FAILED
==== test12 Verbatim reproduction of input in a0 FAILED
==== Contents of test case:
with-temp-files filename ch {
puts $ch "test:\n\ttclsh tests.tcl\n\"\{"
close $ch
set result [sqawk-tcl {select a0 from a} $filename]
}
return $result
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't load file "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so": Cannot open "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so"
while executing
"load /usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so sqlite3"
("package ifneeded sqlite3 3.8.12" script)
invoked from within
"package require sqlite3"
(file "sqawk.tcl" line 8)
while executing
"exec [info nameofexecutable] sqawk.tcl {*}$args"
(procedure "sqawk-tcl" line 2)
invoked from within
"sqawk-tcl {select a0 from a} $filename"
("uplevel" body line 4)
invoked from within
"uplevel 1 $script"
(procedure "with-temp-files" line 16)
invoked from within
"with-temp-files filename ch {
puts $ch "test:\n\ttclsh tests.tcl\n\"\{"
close $ch
set result [sqawk-tcl {select a0..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
---- errorCode: CHILDSTATUS 6291 1
==== test12 FAILED
==== test13 Empty lines FAILED
==== Contents of test case:
with-temp-files filename ch {
puts $ch "\n\n\n"
close $ch
set result {}
lappend result [sqawk-tcl {select a1 from a} $filename]
lappend result [sqawk-tcl {select a1 from a} format=csv $filename]
}
return $result
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't load file "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so": Cannot open "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so"
while executing
"load /usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so sqlite3"
("package ifneeded sqlite3 3.8.12" script)
invoked from within
"package require sqlite3"
(file "sqawk.tcl" line 8)
while executing
"exec [info nameofexecutable] sqawk.tcl {*}$args"
(procedure "sqawk-tcl" line 2)
invoked from within
"sqawk-tcl {select a1 from a} $filename"
("uplevel" body line 5)
invoked from within
"uplevel 1 $script"
(procedure "with-temp-files" line 16)
invoked from within
"with-temp-files filename ch {
puts $ch "\n\n\n"
close $ch
set result {}
lappend result [sqawk-tcl {sel..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
---- errorCode: CHILDSTATUS 6292 1
==== test13 FAILED
==== test14 CSV output FAILED
==== Contents of test case:
with-temp-files filename ch {
puts $ch "a,b\n1,2"
close $ch
set result {}
lappend result [sqawk-tcl -output awk {select a1 from a} $filename]
lappend result [sqawk-tcl -output csv {select a1 from a} $filename]
}
return $result
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't load file "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so": Cannot open "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so"
while executing
"load /usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so sqlite3"
("package ifneeded sqlite3 3.8.12" script)
invoked from within
"package require sqlite3"
(file "sqawk.tcl" line 8)
while executing
"exec [info nameofexecutable] sqawk.tcl {*}$args"
(procedure "sqawk-tcl" line 2)
invoked from within
"sqawk-tcl -output awk {select a1 from a} $filename"
("uplevel" body line 5)
invoked from within
"uplevel 1 $script"
(procedure "with-temp-files" line 16)
invoked from within
"with-temp-files filename ch {
puts $ch "a,b\n1,2"
close $ch
set result {}
lappend result [sqawk-tcl -o..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
---- errorCode: CHILDSTATUS 6293 1
==== test14 FAILED
==== test14 Tcl output FAILED
==== Contents of test case:
with-temp-files filename ch {
puts $ch "1\t2\tHello, World!\t "
close $ch
set result [sqawk-tcl -FS \t -output tcl {select a1,a2,a3,a4 from a} $filename]
}
return $result
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: couldn't load file "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so": Cannot open "/usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so"
while executing
"load /usr/local/lib/tcl8.6/sqlite3/libtclsqlite3.so sqlite3"
("package ifneeded sqlite3 3.8.12" script)
invoked from within
"package require sqlite3"
(file "sqawk.tcl" line 8)
while executing
"exec [info nameofexecutable] sqawk.tcl {*}$args"
(procedure "sqawk-tcl" line 2)
invoked from within
"sqawk-tcl -FS \t -output tcl {select a1,a2,a3,a4 from a} $filename"
("uplevel" body line 4)
invoked from within
"uplevel 1 $script"
(procedure "with-temp-files" line 16)
invoked from within
"with-temp-files filename ch {
puts $ch "1\t2\tHello, World!\t "
close $ch
set result [sqawk-tcl -FS \t -output tc..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $script"
---- errorCode: CHILDSTATUS 6294 1
==== test14 FAILED
*** Error code 1
Stop.
make: stopped in /usr/home/jungle/bin/sqawk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment