修改scan status重的测试用例,覆盖更多分支。

This commit is contained in:
zhengchao
2021-07-15 17:03:09 +08:00
parent 15562f1c57
commit 99e8ffb510
3 changed files with 13 additions and 7 deletions

View File

@@ -95,7 +95,7 @@ struct Maat_hierarchy_clause
struct Maat_hierarchy struct Maat_hierarchy
{ {
pthread_rwlock_t rwlock; pthread_rwlock_t rwlock;
time_t version; time_t version; //After full update, clause id may indicate a different clause. Comparing hier->version and mid->hier_ver can prevent false positive match.
struct bool_matcher* bm; struct bool_matcher* bm;
struct Maat_hierarchy_compile* hash_compile_by_id; //key: compile_id, value: struct Maat_hierarchy_compile*. struct Maat_hierarchy_compile* hash_compile_by_id; //key: compile_id, value: struct Maat_hierarchy_compile*.

View File

@@ -160,7 +160,6 @@ struct Maat_region_inner
int expr_id_cnt; int expr_id_cnt;
int expr_id_lb; //low boundary int expr_id_lb; //low boundary
int expr_id_ub; //up boundary int expr_id_ub; //up boundary
enum MAAT_TABLE_TYPE table_type;
}; };

View File

@@ -4049,15 +4049,18 @@ TEST_F(MaatCmdTest, SameScanStatusWhenClauseUpdate_TSG6419)
//region11->group11--clause1-->compile1 //region11->group11--clause1-->compile1
// / // /
//region21->group21--clause2--/ //region21->group21--clause2---/
// / // /
//region22->group22---/ //region22->group22--clause3-/
Maat_command_raw_set_compile(feather, MAAT_OP_DEL, &compile1, compile_table_name, NULL, 2, 0, 0);
Maat_command_raw_set_compile(feather, MAAT_OP_ADD, &compile1, compile_table_name, NULL, 3, 0, 0);
memset(&group22, 0, sizeof(group22)); memset(&group22, 0, sizeof(group22));
group22.group_id=Maat_command_get_new_group_id(feather); group22.group_id=Maat_command_get_new_group_id(feather);
group22.table_name=g2c_tn; group22.table_name=g2c_tn;
group22.compile_id=compile1.config_id; group22.compile_id=compile1.config_id;
group22.clause_index=2; group22.clause_index=3;
Maat_command_raw_set_group2compile(feather, MAAT_OP_ADD, &group22); Maat_command_raw_set_group2compile(feather, MAAT_OP_ADD, &group22);
region22.region_id=Maat_command_get_new_region_id(feather); region22.region_id=Maat_command_get_new_region_id(feather);
@@ -4069,6 +4072,10 @@ TEST_F(MaatCmdTest, SameScanStatusWhenClauseUpdate_TSG6419)
sleep(1); sleep(1);
table_id=Maat_table_register(feather, app_id_table_name); table_id=Maat_table_register(feather, app_id_table_name);
ret=Maat_scan_intval(feather, table_id, 31, result, 4, &mid, 0);
EXPECT_EQ(ret, -2);
ret=Maat_scan_intval(feather, table_id, scan_app_id, result, 4, &mid, 0); ret=Maat_scan_intval(feather, table_id, scan_app_id, result, 4, &mid, 0);
EXPECT_EQ(ret, 1); EXPECT_EQ(ret, 1);
EXPECT_EQ(result[0].config_id, compile1.config_id); EXPECT_EQ(result[0].config_id, compile1.config_id);