From b1cdc7ff3cb3099aaeefb5fb659889d5b5cc08a7 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 14 Jul 2022 11:42:55 +0800 Subject: [PATCH] test: valgrind case --- tests/script/tsim/insert/basic0.sim | 163 +++++++++++--------------- tests/script/tsim/insert/basic1.sim | 41 ++----- tests/script/tsim/valgrind/basic1.sim | 70 ++++++----- 3 files changed, 116 insertions(+), 158 deletions(-) diff --git a/tests/script/tsim/insert/basic0.sim b/tests/script/tsim/insert/basic0.sim index 722bc0f907..6de904eca1 100644 --- a/tests/script/tsim/insert/basic0.sim +++ b/tests/script/tsim/insert/basic0.sim @@ -32,7 +32,6 @@ if $rows != 3 then return -1 endi - print =============== insert data, mode1: one row one table in sql print =============== insert data, mode1: mulit rows one table in sql #print =============== insert data, mode1: one rows mulit table in sql @@ -41,9 +40,6 @@ 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 ct1 values(now+4s, -14, -2.4, -3.4) ct2 values(now+4s, -14, -2.4, -3.4) -#sql insert into ct1 values(now+5s, -15, -2.5, -3.5)(now+6s, -16, -2.6, -3.6) ct2 values(now+5s, -15, -2.5, -3.5)(now+6s, -16, -2.6, -3.6) - sql insert into ct3 values('2021-01-01 00:00:00.000', 10, 2.0, 3.0) #=================================================================== @@ -67,16 +63,6 @@ endi if $data03 != 3.000000000 then return -1 endi -#if $data41 != -14 then -# return -1 -#endi -#if $data42 != -2.40000 then -# return -1 -#endi -#if $data43 != -3.400000000 then -# return -1 -#endi - print =============== select count(*) from child table sql select count(*) from ct1 @@ -107,10 +93,10 @@ if $data03 != 4 then endi #print =============== select first(*)/first(column) from child table -#sql select first(*) from ct1 -#print ====> select first(*) from ct1 -#print rows: $rows -#print $data00 $data01 $data02 $data03 +sql select first(*) from ct1 +print ====> select first(*) from ct1 +print rows: $rows +print $data00 $data01 $data02 $data03 sql select first(ts), first(c1), first(c2), first(c3) from ct1 print ====> select first(ts), first(c1), first(c2), first(c3) from ct1 @@ -217,23 +203,23 @@ if $data32 != -3.300000000 then return -1 endi #=================================================================== -#=================================================================== #print =============== query data from stb -#sql select * from stb -#if $rows != 4 then -# return -1 -#endi +sql select * from stb +print $rows +if $rows != 9 then + return -1 +endi #print =============== select count(*) from supter table -#sql select count(*) from stb -#print $data00 $data01 $data02 -#if $rows != 1 then -# return -1 -#endi -#if $data00 != 9 then -# return -1 -#endi +sql select count(*) from stb +print $data00 $data01 $data02 +if $rows != 1 then + return -1 +endi +if $data00 != 9 then + return -1 +endi print =============== select count(column) from supter table sql select ts, c1, c2, c3 from stb @@ -264,28 +250,23 @@ if $data03 != 3.000000000 then endi #print =============== select count(column) from supter table -#sql select count(ts), count(c1), count(c2), count(c3) from stb -#print rows: $rows -#print $data00 $data01 $data02 $data03 -#print $data10 $data11 $data12 $data13 -#print $data20 $data21 $data22 $data23 -#print $data30 $data31 $data32 $data33 -#if $data00 != 9 then -# return -1 -#endi -#if $data01 != 8 then -# return -1 -#endi -#if $data02 != 8 then -# return -1 -#endi -#if $data03 != 8 then -# return -1 -#endi +sql select count(ts), count(c1), count(c2), count(c3) from stb +print rows: $rows +print $data00 $data01 $data02 $data03 +if $data00 != 9 then + return -1 +endi +if $data01 != 9 then + return -1 +endi +if $data02 != 9 then + return -1 +endi +if $data03 != 9 then + return -1 +endi #=================================================================== -#=================================================================== - print =============== stop and restart taosd, then again do query above system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s start @@ -326,16 +307,6 @@ endi if $data03 != 3.000000000 then return -1 endi -#if $data41 != -14 then -# return -1 -#endi -#if $data42 != -2.40000 then -# return -1 -#endi -#if $data43 != -3.400000000 then -# return -1 -#endi - print =============== select count(*) from child table sql select count(*) from ct1 @@ -366,10 +337,10 @@ if $data03 != 4 then endi #print =============== select first(*)/first(column) from child table -#sql select first(*) from ct1 -#print ====> select first(*) from ct1 -#print rows: $rows -#print $data00 $data01 $data02 $data03 +sql select first(*) from ct1 +print ====> select first(*) from ct1 +print rows: $rows +print $data00 $data01 $data02 $data03 sql select first(ts), first(c1), first(c2), first(c3) from ct1 print ====> select first(ts), first(c1), first(c2), first(c3) from ct1 @@ -474,24 +445,23 @@ endi if $data32 != -3.300000000 then return -1 endi -#=================================================================== -#=================================================================== -#print =============== query data from stb -#sql select * from stb -#if $rows != 4 then -# return -1 -#endi +#=================================================================== +print =============== query data from stb +sql select * from stb +if $rows != 9 then + return -1 +endi -#print =============== select count(*) from supter table -#sql select count(*) from stb -#print $data00 $data01 $data02 -#if $rows != 1 then -# return -1 -#endi -#if $data00 != 9 then -# return -1 -#endi +print =============== select count(*) from supter table +sql select count(*) from stb +print $data00 $data01 $data02 +if $rows != 1 then + return -1 +endi +if $data00 != 9 then + return -1 +endi print =============== select count(column) from supter table sql select ts, c1, c2, c3 from stb @@ -521,20 +491,19 @@ if $data03 != 3.000000000 then endi #print =============== select count(column) from supter table -#sql select count(ts), count(c1), count(c2), count(c3) from stb -#print $data00 $data01 $data02 $data03 -#if $data00 != 8 then -# return -1 -#endi -#if $data01 != 8 then -# return -1 -#endi -#if $data02 != 8 then -# return -1 -#endi -#if $data03 != 8 then -# return -1 -#endi +sql select count(ts), count(c1), count(c2), count(c3) from stb +print $data00 $data01 $data02 $data03 +if $data00 != 9 then + return -1 +endi +if $data01 != 9 then + return -1 +endi +if $data02 != 9 then + return -1 +endi +if $data03 != 9 then + return -1 +endi - -system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode1 -s stop -x SIGINT \ No newline at end of file diff --git a/tests/script/tsim/insert/basic1.sim b/tests/script/tsim/insert/basic1.sim index d98407b380..6d31dcdffb 100644 --- a/tests/script/tsim/insert/basic1.sim +++ b/tests/script/tsim/insert/basic1.sim @@ -1,9 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/exec.sh -n dnode1 -s start -sleep 50 sql connect - print =============== create database sql create database d1 sql show databases @@ -17,7 +15,6 @@ sql use d1 print =============== create super table, include all type sql create table if not exists stb (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(16), c9 nchar(16), c10 timestamp, c11 tinyint unsigned, c12 smallint unsigned, c13 int unsigned, c14 bigint unsigned) tags (t1 bool, t2 tinyint, t3 smallint, t4 int, t5 bigint, t6 float, t7 double, t8 binary(16), t9 nchar(16), t10 timestamp, t11 tinyint unsigned, t12 smallint unsigned, t13 int unsigned, t14 bigint unsigned) - sql create stable if not exists stb_1 (ts timestamp, i int) tags (j int) sql create table stb_2 (ts timestamp, i int) tags (j int) sql create stable stb_3 (ts timestamp, i int) tags (j int) @@ -36,11 +33,6 @@ if $rows != 2 then return -1 endi - -print =============== insert data, mode1: one row one table in sql -print =============== insert data, mode1: mulit rows one table in sql -print =============== insert data, mode1: one rows mulit table in sql -print =============== insert data, mode1: mulit rows mulit table in sql sql insert into c1 values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) sql insert into c1 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+2s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) @@ -69,32 +61,15 @@ if $data03 != -2 then endi print =============== query data from st, but not support select * from super table, waiting fix -#sql select * from st -#if $rows != 4 then -# return -1 -#endi +sql select * from stb +if $rows != 4 then + return -1 +endi print =============== stop and restart taosd system sh/exec.sh -n dnode1 -s stop -x SIGINT system sh/exec.sh -n dnode1 -s start -$loop_cnt = 0 -check_dnode_ready: - $loop_cnt = $loop_cnt + 1 - sleep 200 - if $loop_cnt == 10 then - print ====> dnode not ready! - return -1 - endi -sql show dnodes -print ===> $rows $data00 $data01 $data02 $data03 $data04 $data05 -if $data00 != 1 then - return -1 -endi -if $data04 != ready then - goto check_dnode_ready -endi - print =============== query data sql select * from c1 print rows: $rows @@ -119,9 +94,9 @@ if $data03 != -2 then endi print =============== query data from st, but not support select * from super table, waiting fix -#sql select * from st -#if $rows != 4 then -# return -1 -#endi +sql select * from stb +if $rows != 4 then + return -1 +endi system sh/exec.sh -n dnode1 -s stop -x SIGINT diff --git a/tests/script/tsim/valgrind/basic1.sim b/tests/script/tsim/valgrind/basic1.sim index f0430195c9..784b83d96b 100644 --- a/tests/script/tsim/valgrind/basic1.sim +++ b/tests/script/tsim/valgrind/basic1.sim @@ -1,7 +1,7 @@ system sh/stop_dnodes.sh system sh/deploy.sh -n dnode1 -i 1 system sh/cfg.sh -n dnode1 -c debugflag -v 131 -system sh/exec.sh -n dnode1 -s start -v +system sh/exec.sh -n dnode1 -s start sql connect print =============== step1: create drop show dnodes @@ -23,51 +23,65 @@ if $data(1)[4] != ready then endi print =============== step2: create db -sql create database d1 vgroups 1 buffer 3 +sql create database d1 vgroups 3 buffer 3 sql show databases sql use d1 sql show vgroups -print =============== step3: create show stable -sql create table if not exists stb (ts timestamp, c1 int, c2 float, c3 double) tags (t1 int unsigned) +print =============== step3: create show stable, include all type +sql create table if not exists stb (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 float, c7 double, c8 binary(16), c9 nchar(16), c10 timestamp, c11 tinyint unsigned, c12 smallint unsigned, c13 int unsigned, c14 bigint unsigned) tags (t1 bool, t2 tinyint, t3 smallint, t4 int, t5 bigint, t6 float, t7 double, t8 binary(16), t9 nchar(16), t10 timestamp, t11 tinyint unsigned, t12 smallint unsigned, t13 int unsigned, t14 bigint unsigned) +sql create stable if not exists stb_1 (ts timestamp, c1 int) tags (j int) +sql create table stb_2 (ts timestamp, c1 int) tags (t1 int) +sql create stable stb_3 (ts timestamp, c1 int) tags (t1 int) sql show stables -if $rows != 1 then +if $rows != 4 then return -1 endi -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) +print =============== step4: ccreate child table +sql create table c1 using stb tags(true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) +sql create table c2 using stb tags(false, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 2', 'child tbl 2', '2022-02-25 18:00:00.000', 10, 20, 30, 40) sql show tables -if $rows != 3 then +if $rows != 2 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) +sql insert into c1 values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) +sql insert into c1 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+2s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) +sql insert into c2 values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) +sql insert into c2 values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) (now+2s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) -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 =============== step6: alter insert +sql insert into c3 using stb tags(true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) values(now-1s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) +sql insert into c3 using stb tags(true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) values(now+0s, true, -1, -2, -3, -4, -6.0, -7.0, 'child tbl 1', 'child tbl 1', '2022-02-25 18:00:00.000', 10, 20, 30, 40) -print =============== step7: count -sql select count(*) from ct1; +print =============== restart +system sh/exec.sh -n dnode1 -s stop -x SIGINT +system sh/exec.sh -n dnode1 -s start -v + +print =============== stepa: query data +sql select * from c1 +#sql select * from stb +#sql select * from stb_1 +#sql select ts, c1, c2, c3 from c1 +#sql select ts, c1, c2, c3 from stb +#sql select ts, c1 from stb_2 +#sql select ts, c1, t1 from c1 +#sql select ts, c1, t1 from stb +#sql select ts, c1, t1 from stb_2 + +print =============== stepb: count +#sql select count(*) from c1; #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 c1 #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 +print =============== stepc: func +#sql select first(ts), first(c1), first(c2), first(c3) from c1 +#sql select min(c2), min(c3), min(c4) from c1 +#sql select max(c2), max(c3), max(c4) from c1 +#sql select sum(c2), sum(c3), sum(c4) from c1 _OVER: system sh/exec.sh -n dnode1 -s stop -x SIGINT