From af4e0626b62f42eb377d043c88e4aaa5945ae5f2 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Wed, 13 Jul 2022 11:25:33 +0800 Subject: [PATCH] test: valgrind case --- tests/script/tsim/valgrind/basic1.sim | 47 +++++++++++++------- tests/script/tsim/valgrind/basic2.sim | 51 ++++++++++++++-------- tests/script/tsim/valgrind/checkError1.sim | 19 ++++---- tests/script/tsim/valgrind/checkError2.sim | 21 ++++----- tests/script/tsim/valgrind/checkError3.sim | 19 ++++---- 5 files changed, 89 insertions(+), 68 deletions(-) diff --git a/tests/script/tsim/valgrind/basic1.sim b/tests/script/tsim/valgrind/basic1.sim index e9dfc0eb4e..f0430195c9 100644 --- a/tests/script/tsim/valgrind/basic1.sim +++ b/tests/script/tsim/valgrind/basic1.sim @@ -35,36 +35,51 @@ if $rows != 1 then return -1 endi -print =============== step3: create show table +print =============== step4: create show table sql create table ct1 using stb tags(1000) +sql create table ct2 using stb tags(2000) +sql create table ct3 using stb tags(3000) sql show tables -if $rows != 1 then +if $rows != 3 then return -1 endi print =============== step5: insert data sql insert into ct1 values(now+0s, 10, 2.0, 3.0) sql insert into ct1 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) +sql insert into ct2 values(now+0s, 10, 2.0, 3.0) +sql insert into ct2 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) +sql insert into ct3 values('2021-01-01 00:00:00.000', 10, 2.0, 3.0) -print =============== step6: select data +print =============== step6: query data sql select * from ct1 -#sql select * from stb +sql select * from stb +sql select c1, c2, c3 from ct1 +sql select ts, c1, c2, c3 from stb + +print =============== step7: count +sql select count(*) from ct1; +#sql select count(*) from stb; +#sql select count(ts), count(c1), count(c2), count(c3) from ct1 +#sql select count(ts), count(c1), count(c2), count(c3) from stb + +print =============== step8: func +#sql select first(ts), first(c1), first(c2), first(c3) from ct1 +#sql select min(c1), min(c2), min(c3) from ct1 +#sql select max(c1), max(c2), max(c3) from ct1 +#sql select sum(c1), sum(c2), sum(c3) from ct1 _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT - print =============== check -print ----> start to check if there are ERRORS in vagrind log file for each dnode -system_content sh/checkValgrind.sh -n dnode1 - -print cmd return result ----> [ $system_content ] -if $system_content <= 0 then - return 0 -endi - $null= -if $system_content == $null then - return 0 + +system_content sh/checkValgrind.sh -n dnode1 +print cmd return result ----> [ $system_content ] +if $system_content > 1 then + return -1 endi -return -1 +if $system_content == $null then + return -1 +endi diff --git a/tests/script/tsim/valgrind/basic2.sim b/tests/script/tsim/valgrind/basic2.sim index 154617bc18..b55f4a22b2 100644 --- a/tests/script/tsim/valgrind/basic2.sim +++ b/tests/script/tsim/valgrind/basic2.sim @@ -35,36 +35,51 @@ if $rows != 1 then return -1 endi -print =============== step3: create show table +print =============== step4: create show table sql create table ct1 using stb tags(1000) -#sql show tables -#if $rows != 1 then -# return -1 -#endi +sql create table ct2 using stb tags(2000) +sql create table ct3 using stb tags(3000) +sql show tables +if $rows != 3 then + return -1 +endi print =============== step5: insert data sql insert into ct1 values(now+0s, 10, 2.0, 3.0) sql insert into ct1 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) +sql insert into ct2 values(now+0s, 10, 2.0, 3.0) +sql insert into ct2 values(now+1s, 11, 2.1, 3.1)(now+2s, -12, -2.2, -3.2)(now+3s, -13, -2.3, -3.3) +sql insert into ct3 values('2021-01-01 00:00:00.000', 10, 2.0, 3.0) -print =============== step6: select data +print =============== step6: query data sql select * from ct1 sql select * from stb +sql select c1, c2, c3 from ct1 +sql select ts, c1, c2, c3 from stb + +print =============== step7: count +sql select count(*) from ct1; +sql select count(*) from stb; +#sql select count(ts), count(c1), count(c2), count(c3) from ct1 +#sql select count(ts), count(c1), count(c2), count(c3) from stb + +print =============== step8: func +#sql select first(ts), first(c1), first(c2), first(c3) from ct1 +#sql select min(c1), min(c2), min(c3) from ct1 +#sql select max(c1), max(c2), max(c3) from ct1 +#sql select sum(c1), sum(c2), sum(c3) from ct1 _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT - print =============== check -print ----> start to check if there are ERRORS in vagrind log file for each dnode -system_content sh/checkValgrind.sh -n dnode1 - -print cmd return result ----> [ $system_content ] -if $system_content <= 0 then - return 0 -endi - $null= -if $system_content == $null then - return 0 + +system_content sh/checkValgrind.sh -n dnode1 +print cmd return result ----> [ $system_content ] +if $system_content > 1 then + return -1 endi -return -1 +if $system_content == $null then + return -1 +endi diff --git a/tests/script/tsim/valgrind/checkError1.sim b/tests/script/tsim/valgrind/checkError1.sim index 1a76d8ce5c..dae7615395 100644 --- a/tests/script/tsim/valgrind/checkError1.sim +++ b/tests/script/tsim/valgrind/checkError1.sim @@ -94,17 +94,14 @@ print =============== stop system sh/exec.sh -n dnode1 -s stop -x SIGINT print =============== check -print ----> start to check if there are ERRORS in vagrind log file for each dnode -system_content sh/checkValgrind.sh -n dnode1 - -print cmd return result ----> [ $system_content ] -if $system_content <= 0 then - return 0 -endi - $null= -if $system_content == $null then - return 0 + +system_content sh/checkValgrind.sh -n dnode1 +print cmd return result ----> [ $system_content ] +if $system_content > 1 then + return -1 endi -return -1 +if $system_content == $null then + return -1 +endi diff --git a/tests/script/tsim/valgrind/checkError2.sim b/tests/script/tsim/valgrind/checkError2.sim index fdac687224..3939b7c854 100644 --- a/tests/script/tsim/valgrind/checkError2.sim +++ b/tests/script/tsim/valgrind/checkError2.sim @@ -35,7 +35,7 @@ if $rows != 1 then return -1 endi -print =============== step3: create show table +print =============== step4: create show table sql create table ct1 using stb tags(1000) sql show tables if $rows != 1 then @@ -54,17 +54,14 @@ _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT print =============== check -print ----> start to check if there are ERRORS in vagrind log file for each dnode -system_content sh/checkValgrind.sh -n dnode1 - -print cmd return result ----> [ $system_content ] -if $system_content <= 0 then - return 0 -endi - $null= -if $system_content == $null then - return 0 + +system_content sh/checkValgrind.sh -n dnode1 +print cmd return result ----> [ $system_content ] +if $system_content > 1 then + return -1 endi -return -1 +if $system_content == $null then + return -1 +endi diff --git a/tests/script/tsim/valgrind/checkError3.sim b/tests/script/tsim/valgrind/checkError3.sim index 3713f372ae..fe4f4654b1 100644 --- a/tests/script/tsim/valgrind/checkError3.sim +++ b/tests/script/tsim/valgrind/checkError3.sim @@ -129,17 +129,14 @@ print =============== stop system sh/exec.sh -n dnode1 -s stop -x SIGINT print =============== check -print ----> start to check if there are ERRORS in vagrind log file for each dnode -system_content sh/checkValgrind.sh -n dnode1 - -print cmd return result ----> [ $system_content ] -if $system_content <= 0 then - return 0 -endi - $null= -if $system_content == $null then - return 0 + +system_content sh/checkValgrind.sh -n dnode1 +print cmd return result ----> [ $system_content ] +if $system_content > 1 then + return -1 endi -return -1 +if $system_content == $null then + return -1 +endi