Hi Dominique, 

That would be an other way, but what I'm looking for is using the Command Line 
Shell ".testcase" and ".check" method. 

Create an example test file: 
echo ".testcase 100 
SELECT (1,2,3)<(1,2,4), (1,2,3)<(1,NULL,4), (1,2,3)<(2,NULL,1); 
.check 1||1 

.testcase 110 
SELECT (1,2,3)<(1,2,4), (1,2,3)<(1,NULL,4), (1,2,3)<(2,NULL,1); 
.check 1|5|1" > test-script.sql 

Execute the test: 
sqlite3 < test-script.sql 

Bail will not work for that. 

Kind regards, 

Lodewijk 


Van: "Dominique Devienne" <ddevie...@gmail.com> 
Aan: "sqlite-users" <sqlite-users@mailinglists.sqlite.org> 
Verzonden: Maandag 16 oktober 2017 13:49:18 
Onderwerp: Re: [sqlite] Using .testcase and .check in continuous integration 
test 

On Mon, Oct 16, 2017 at 12:32 PM, Lodewijk Duymaer van Twist < 
lodew...@adesys.nl> wrote: 

> I would like use .testcase and .check in our GitLab Continuous Integration 
> test. 
> 
> GitLab pipelines will check process return code for success or fail. 
> 
> Consider a simple test: 
> lodewijk@DebianDev:~$ sqlite3 database.db3 < test.sql 
> testcase-100 ok 
> testcase-110 ok 
> lodewijk@DebianDev:~$ echo $? 
> 0 
> 
> Now if I would have a failure the return value of the sqlite3 process will 
> also be 0: 
> lodewijk@DebianDev:~$ sqlite3 octalarm.db3 < test/test-languages.sql 
> testcase-100 FAILED 
> Expected: [66] 
> Got: [67 
> ] 
> lodewijk@DebianDev:~$ echo $? 
> 0 
> 
> Is there a nice elegant way of making my CI stop on a failure? 
> 

C:\Users\ddevienne>sqlite3 -bail bad.db "create table foo(id)" && echo OK 
OK 

C:\Users\ddevienne>sqlite3 -bail bad.db "create table bar" && echo OK 
Error: near "bar": syntax error 

C:\Users\ddevienne> 
_______________________________________________ 
sqlite-users mailing list 
sqlite-users@mailinglists.sqlite.org 
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users 
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to