From cb1b6794293121492b5f60c9d45aec4a524c850a Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Sat, 16 Jul 2022 20:13:44 +0800 Subject: [PATCH] test: valgrind case --- tests/script/jenkins/basic.txt | 27 +++---- tests/script/tsim/compute/last_row.sim | 2 - tests/script/tsim/stable/alter_insert1.sim | 3 - tests/script/tsim/stable/alter_insert2.sim | 2 - tests/script/tsim/stable/dnode3.sim | 2 - tests/script/tsim/tag/add.sim | 28 ++++---- tests/script/tsim/tag/change.sim | 37 +++++----- tests/script/tsim/valgrind/checkError4.sim | 1 - tests/script/tsim/valgrind/checkError5.sim | 82 ++++++++++++++++++++++ 9 files changed, 128 insertions(+), 56 deletions(-) create mode 100644 tests/script/tsim/valgrind/checkError5.sim diff --git a/tests/script/jenkins/basic.txt b/tests/script/jenkins/basic.txt index 3e2d7a38f0..7347446556 100644 --- a/tests/script/jenkins/basic.txt +++ b/tests/script/jenkins/basic.txt @@ -266,26 +266,27 @@ ./test.sh -f tsim/tmq/snapshot1.sim # --- stable +./test.sh -f tsim/stable/alter_comment.sim +./test.sh -f tsim/stable/alter_count.sim +./test.sh -f tsim/stable/alter_import.sim +./test.sh -f tsim/stable/alter_insert1.sim +./test.sh -f tsim/stable/alter_insert2.sim +./test.sh -f tsim/stable/alter_metrics.sim +./test.sh -f tsim/stable/column_add.sim +./test.sh -f tsim/stable/column_drop.sim +./test.sh -f tsim/stable/column_modify.sim ./test.sh -f tsim/stable/disk.sim ./test.sh -f tsim/stable/dnode3.sim ./test.sh -f tsim/stable/metrics.sim ./test.sh -f tsim/stable/refcount.sim ./test.sh -f tsim/stable/show.sim -./test.sh -f tsim/stable/values.sim -./test.sh -f tsim/stable/vnode3.sim -./test.sh -f tsim/stable/column_add.sim -./test.sh -f tsim/stable/column_drop.sim -./test.sh -f tsim/stable/column_modify.sim ./test.sh -f tsim/stable/tag_add.sim ./test.sh -f tsim/stable/tag_drop.sim +./test.sh -f tsim/stable/tag_filter.sim ./test.sh -f tsim/stable/tag_modify.sim ./test.sh -f tsim/stable/tag_rename.sim -./test.sh -f tsim/stable/alter_comment.sim -./test.sh -f tsim/stable/alter_count.sim -./test.sh -f tsim/stable/alter_insert1.sim -./test.sh -f tsim/stable/alter_insert2.sim -./test.sh -f tsim/stable/alter_import.sim -./test.sh -f tsim/stable/tag_filter.sim +./test.sh -f tsim/stable/values.sim +./test.sh -f tsim/stable/vnode3.sim # --- for multi process mode ./test.sh -f tsim/user/basic.sim -m @@ -367,7 +368,7 @@ ./test.sh -f tsim/compute/diff2.sim ./test.sh -f tsim/compute/first.sim ./test.sh -f tsim/compute/interval.sim -# jira ./test.sh -f tsim/compute/last_row.sim +./test.sh -f tsim/compute/last_row.sim ./test.sh -f tsim/compute/last.sim ./test.sh -f tsim/compute/leastsquare.sim ./test.sh -f tsim/compute/max.sim @@ -416,7 +417,7 @@ ./test.sh -f tsim/tag/4.sim ./test.sh -f tsim/tag/5.sim # jira ./test.sh -f tsim/tag/6.sim -# jira ./test.sh -f tsim/tag/add.sim +./test.sh -f tsim/tag/add.sim ./test.sh -f tsim/tag/bigint.sim ./test.sh -f tsim/tag/binary_binary.sim ./test.sh -f tsim/tag/binary.sim diff --git a/tests/script/tsim/compute/last_row.sim b/tests/script/tsim/compute/last_row.sim index 590fada86a..70fb6626cd 100644 --- a/tests/script/tsim/compute/last_row.sim +++ b/tests/script/tsim/compute/last_row.sim @@ -65,8 +65,6 @@ if $data00 != 19 then return -1 endi - - print =============== step7 sql select last_row(tbcol) from $mt print ===> $data00 diff --git a/tests/script/tsim/stable/alter_insert1.sim b/tests/script/tsim/stable/alter_insert1.sim index 82781f2fe5..bcea0b48c4 100644 --- a/tests/script/tsim/stable/alter_insert1.sim +++ b/tests/script/tsim/stable/alter_insert1.sim @@ -934,11 +934,8 @@ if $data79 != null then endi print ======== step9 - system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 3000 sql select * from tb order by ts asc if $rows != 8 then diff --git a/tests/script/tsim/stable/alter_insert2.sim b/tests/script/tsim/stable/alter_insert2.sim index a30175f398..faae24d32a 100644 --- a/tests/script/tsim/stable/alter_insert2.sim +++ b/tests/script/tsim/stable/alter_insert2.sim @@ -604,9 +604,7 @@ sql_error alter table tb drop column a print ======== step9 system sh/exec.sh -n dnode1 -s stop -x SIGINT -sleep 3000 system sh/exec.sh -n dnode1 -s start -sleep 3000 sql select * from tb order by ts desc if $rows != 7 then diff --git a/tests/script/tsim/stable/dnode3.sim b/tests/script/tsim/stable/dnode3.sim index 03e8df26b7..4a2d148738 100644 --- a/tests/script/tsim/stable/dnode3.sim +++ b/tests/script/tsim/stable/dnode3.sim @@ -69,8 +69,6 @@ if $rows != 2 then return -1 endi -sleep 100 - print =============== step2 $i = 1 $tb = $tbPrefix . $i diff --git a/tests/script/tsim/tag/add.sim b/tests/script/tsim/tag/add.sim index 423224b1d6..a22d337eff 100644 --- a/tests/script/tsim/tag/add.sim +++ b/tests/script/tsim/tag/add.sim @@ -250,8 +250,8 @@ sql alter table $mt add tag tgcol6 binary(10) sql reset query cache sql alter table $tb set tag tgcol4=false -sql alter table $tb set tag tgcol5=5 -sql alter table $tb set tag tgcol6=6 +sql alter table $tb set tag tgcol5='5' +sql alter table $tb set tag tgcol6='6' sql reset query cache sql select * from $mt where tgcol5 = '5' @@ -390,8 +390,8 @@ sql alter table $mt add tag tgcol5 binary(17) sql alter table $mt add tag tgcol6 bool sql reset query cache sql alter table $tb set tag tgcol4=4 -sql alter table $tb set tag tgcol5=5 -sql alter table $tb set tag tgcol6=1 +sql alter table $tb set tag tgcol5='5' +sql alter table $tb set tag tgcol6='1' sql reset query cache sql select * from $mt where tgcol5 = '5' @@ -409,7 +409,7 @@ endi if $data03 != 5 then return -1 endi -if $data04 != 1 then +if $data04 != 0 then return -1 endi @@ -425,7 +425,7 @@ $i = 9 $mt = $mtPrefix . $i $tb = $tbPrefix . $i sql create table $mt (ts timestamp, tbcol int) TAGS(tgcol1 double, tgcol2 binary(10), tgcol3 binary(10)) -sql create table $tb using $mt tags( 1, 2, '3' ) +sql create table $tb using $mt tags( 1, '2', '3' ) sql insert into $tb values(now, 1) sql select * from $mt where tgcol2 = '2' if $rows != 1 then @@ -520,7 +520,7 @@ sql alter table $mt add tag tgcol4 binary(10) sql alter table $mt add tag tgcol5 bool sql reset query cache -sql alter table $tb set tag tgcol4=4 +sql alter table $tb set tag tgcol4='4' sql alter table $tb set tag tgcol5=false sql reset query cache @@ -598,9 +598,9 @@ sql alter table $mt add tag tgcol7 bigint sql alter table $mt add tag tgcol8 smallint sql reset query cache -sql alter table $tb set tag tgcol4=4 +sql alter table $tb set tag tgcol4='4' sql alter table $tb set tag tgcol5=5 -sql alter table $tb set tag tgcol6=6 +sql alter table $tb set tag tgcol6='6' sql alter table $tb set tag tgcol7=7 sql alter table $tb set tag tgcol8=8 sql reset query cache @@ -687,11 +687,11 @@ sql alter table $mt add tag tgcol5 bigint sql reset query cache sql alter table $tb set tag tgcol1=false -sql alter table $tb set tag tgcol2=5 +sql alter table $tb set tag tgcol2='5' sql alter table $tb set tag tgcol3=4 -sql alter table $tb set tag tgcol4=3 +sql alter table $tb set tag tgcol4='3' sql alter table $tb set tag tgcol5=2 -sql alter table $tb set tag tgcol6=1 +sql alter table $tb set tag tgcol6='1' sql reset query cache sql select * from $mt where tgcol4 = '3' @@ -783,8 +783,8 @@ sql alter table $mt add tag tgcol4 int sql alter table $mt add tag tgcol6 bigint sql reset query cache -sql alter table $tb set tag tgcol1=7 -sql alter table $tb set tag tgcol2=8 +sql alter table $tb set tag tgcol1='7' +sql alter table $tb set tag tgcol2='8' sql alter table $tb set tag tgcol3=9 sql alter table $tb set tag tgcol4=10 sql alter table $tb set tag tgcol5=11 diff --git a/tests/script/tsim/tag/change.sim b/tests/script/tsim/tag/change.sim index f58e387217..236ad8ea67 100644 --- a/tests/script/tsim/tag/change.sim +++ b/tests/script/tsim/tag/change.sim @@ -40,19 +40,19 @@ if $data03 != 2 then return -1 endi -sql alter table $mt change tag tagcx tgcol3 -x step21 +sql alter table $mt rename tag tagcx tgcol3 -x step21 return -1 step21: -sql alter table $mt change tag tgcol1 tgcol2 -x step22 +sql alter table $mt rename tag tgcol1 tgcol2 -x step22 return -1 step22: -#sql alter table $mt change tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20 +#sql alter table $mt rename tag tgcol1 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -x step20 # return -1 #step20: -sql alter table $mt change tag tgcol1 tgcol3 -sql alter table $mt change tag tgcol2 tgcol4 -sql alter table $mt change tag tgcol4 tgcol3 -x step23 +sql alter table $mt rename tag tgcol1 tgcol3 +sql alter table $mt rename tag tgcol2 tgcol4 +sql alter table $mt rename tag tgcol4 tgcol3 -x step23 return -1 step23: @@ -77,8 +77,8 @@ if $data03 != 2 then return -1 endi -sql alter table $mt change tag tgcol1 tgcol3 -sql alter table $mt change tag tgcol2 tgcol4 +sql alter table $mt rename tag tgcol1 tgcol3 +sql alter table $mt rename tag tgcol2 tgcol4 print =============== step4 $i = 4 @@ -101,8 +101,8 @@ if $data03 != 2.00000 then return -1 endi -sql alter table $mt change tag tgcol1 tgcol3 -sql alter table $mt change tag tgcol2 tgcol4 +sql alter table $mt rename tag tgcol1 tgcol3 +sql alter table $mt rename tag tgcol2 tgcol4 print =============== step5 $i = 5 @@ -125,8 +125,8 @@ if $data03 != 2 then return -1 endi -sql alter table $mt change tag tgcol1 tgcol3 -sql alter table $mt change tag tgcol2 tgcol4 +sql alter table $mt rename tag tgcol1 tgcol3 +sql alter table $mt rename tag tgcol2 tgcol4 print =============== step6 $i = 6 @@ -163,15 +163,14 @@ endi sql alter table $mt drop tag tgcol3 sql reset query cache -sql alter table $mt change tag tgcol4 tgcol3 -sql alter table $mt change tag tgcol1 tgcol7 -sql alter table $mt change tag tgcol2 tgcol8 +sql alter table $mt rename tag tgcol4 tgcol3 +sql alter table $mt rename tag tgcol1 tgcol7 +sql alter table $mt rename tag tgcol2 tgcol8 sql reset query cache -sql alter table $mt change tag tgcol3 tgcol9 -sql alter table $mt change tag tgcol5 tgcol10 -sql alter table $mt change tag tgcol6 tgcol11 +sql alter table $mt rename tag tgcol3 tgcol9 +sql alter table $mt rename tag tgcol5 tgcol10 +sql alter table $mt rename tag tgcol6 tgcol11 -sleep 3000 sql reset query cache print =============== step2 diff --git a/tests/script/tsim/valgrind/checkError4.sim b/tests/script/tsim/valgrind/checkError4.sim index be1dc003ad..745ff40517 100644 --- a/tests/script/tsim/valgrind/checkError4.sim +++ b/tests/script/tsim/valgrind/checkError4.sim @@ -57,7 +57,6 @@ sql drop table d1.stb2 sql drop database d1 sql drop database d2 -goto _OVER print =============== step7: repeat sql create database d1 vgroups 2 buffer 3 sql create database d2 vgroups 2 buffer 3 diff --git a/tests/script/tsim/valgrind/checkError5.sim b/tests/script/tsim/valgrind/checkError5.sim new file mode 100644 index 0000000000..61964d1c42 --- /dev/null +++ b/tests/script/tsim/valgrind/checkError5.sim @@ -0,0 +1,82 @@ +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 +sql connect + +print =============== step1: create drop show dnodes +$x = 0 +step1: + $x = $x + 1 + sleep 1000 + if $x == 10 then + print ---> dnode not ready! + return -1 + endi +sql show dnodes +print ---> $data00 $data01 $data02 $data03 $data04 $data05 +if $rows != 1 then + return -1 +endi +if $data(1)[4] != ready then + goto step1 +endi + +print =============== step2: create db +sql create database db +sql use db +sql create table db.stb (ts timestamp, c1 int, c2 binary(4)) tags(t1 int, t2 float, t3 binary(16)) comment "abd" + +print =============== step3: alter stb +sql_error alter table db.stb add column ts int +sql alter table db.stb add column c3 int +sql alter table db.stb add column c4 bigint +sql alter table db.stb add column c5 binary(12) +sql alter table db.stb drop column c1 +sql alter table db.stb drop column c4 +sql alter table db.stb MODIFY column c2 binary(32) +sql alter table db.stb add tag t4 bigint +sql alter table db.stb add tag c1 int +sql alter table db.stb add tag t5 binary(12) +sql alter table db.stb drop tag c1 +sql alter table db.stb drop tag t5 +sql alter table db.stb MODIFY tag t3 binary(32) +sql alter table db.stb rename tag t1 tx + +sql alter table db.stb comment 'abcde' ; +goto _OVER + +print =============== step4: alter tb +sql create table tb (ts timestamp, a int) +sql insert into tb values(now-28d, -28) +sql select count(a) from tb +sql alter table tb add column b smallint +sql insert into tb values(now-25d, -25, 0) +sql select count(b) from tb +sql alter table tb add column c tinyint +sql insert into tb values(now-22d, -22, 3, 0) +sql select count(c) from tb +sql alter table tb add column d int +sql insert into tb values(now-19d, -19, 6, 0, 0) +sql select count(d) from tb +sql alter table tb add column e bigint +sql alter table tb add column f float +sql alter table tb add column g double +sql alter table tb add column h binary(10) +sql select count(a), count(b), count(c), count(d), count(e), count(f), count(g), count(h) from tb +sql select * from tb order by ts desc + +_OVER: +system sh/exec.sh -n dnode1 -s stop -x SIGINT +print =============== check +$null= + +system_content sh/checkValgrind.sh -n dnode1 +print cmd return result ----> [ $system_content ] +if $system_content > 0 then + return -1 +endi + +if $system_content == $null then + return -1 +endi