decouple the dependency of trace_analyzer_test unit test (#6941)
Summary: Since gflags use the global variable to store the flags passed in. In the unit test, if we git one flag per unit test, the result is that all the flags are combined together in the following tests. Therefore, it has the dependency. In this PR, we pass the full arguments each time to ensure that the old arguments will be overwritten by the new one such that the dependency is removed. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6941 Test Plan: make asan_check. run each unit test in trace_analyzer_test independently and in arbitrary orders. Reviewed By: pdillinger Differential Revision: D21909176 Pulled By: zhichao-cao fbshipit-source-id: dca550a0a4a205c30faa620e258a020a3b5b4e13
This commit is contained in:
parent
3020df9df5
commit
fb08330f74
@ -188,7 +188,10 @@ TEST_F(TraceAnalyzerTest, Get) {
|
||||
std::string trace_path = test_path_ + "/trace";
|
||||
std::string output_path = test_path_ + "/get";
|
||||
std::string file_path;
|
||||
std::vector<std::string> paras = {"-analyze_get"};
|
||||
std::vector<std::string> paras = {
|
||||
"-analyze_get=true", "-analyze_put=false",
|
||||
"-analyze_delete=false", "-analyze_single_delete=false",
|
||||
"-analyze_range_delete=false", "-analyze_iterator=false"};
|
||||
paras.push_back("-output_dir=" + output_path);
|
||||
paras.push_back("-trace_path=" + trace_path);
|
||||
paras.push_back("-key_space_dir=" + test_path_);
|
||||
@ -254,7 +257,10 @@ TEST_F(TraceAnalyzerTest, Put) {
|
||||
std::string trace_path = test_path_ + "/trace";
|
||||
std::string output_path = test_path_ + "/put";
|
||||
std::string file_path;
|
||||
std::vector<std::string> paras = {"-analyze_put"};
|
||||
std::vector<std::string> paras = {
|
||||
"-analyze_get=false", "-analyze_put=true",
|
||||
"-analyze_delete=false", "-analyze_single_delete=false",
|
||||
"-analyze_range_delete=false", "-analyze_iterator=false"};
|
||||
paras.push_back("-output_dir=" + output_path);
|
||||
paras.push_back("-trace_path=" + trace_path);
|
||||
paras.push_back("-key_space_dir=" + test_path_);
|
||||
@ -298,7 +304,7 @@ TEST_F(TraceAnalyzerTest, Put) {
|
||||
CheckFileContent(k_whole_prefix, file_path, true);
|
||||
|
||||
// Check the overall qps
|
||||
std::vector<std::string> all_qps = {"1 1 0 0 0 0 0 0 2"};
|
||||
std::vector<std::string> all_qps = {"0 1 0 0 0 0 0 0 1"};
|
||||
file_path = output_path + "/test-qps_stats.txt";
|
||||
CheckFileContent(all_qps, file_path, true);
|
||||
|
||||
@ -325,7 +331,10 @@ TEST_F(TraceAnalyzerTest, Delete) {
|
||||
std::string trace_path = test_path_ + "/trace";
|
||||
std::string output_path = test_path_ + "/delete";
|
||||
std::string file_path;
|
||||
std::vector<std::string> paras = {"-analyze_delete"};
|
||||
std::vector<std::string> paras = {
|
||||
"-analyze_get=false", "-analyze_put=false",
|
||||
"-analyze_delete=true", "-analyze_single_delete=false",
|
||||
"-analyze_range_delete=false", "-analyze_iterator=false"};
|
||||
paras.push_back("-output_dir=" + output_path);
|
||||
paras.push_back("-trace_path=" + trace_path);
|
||||
paras.push_back("-key_space_dir=" + test_path_);
|
||||
@ -370,7 +379,7 @@ TEST_F(TraceAnalyzerTest, Delete) {
|
||||
CheckFileContent(k_whole_prefix, file_path, true);
|
||||
|
||||
// Check the overall qps
|
||||
std::vector<std::string> all_qps = {"1 1 1 0 0 0 0 0 3"};
|
||||
std::vector<std::string> all_qps = {"0 0 1 0 0 0 0 0 1"};
|
||||
file_path = output_path + "/test-qps_stats.txt";
|
||||
CheckFileContent(all_qps, file_path, true);
|
||||
|
||||
@ -391,7 +400,11 @@ TEST_F(TraceAnalyzerTest, Merge) {
|
||||
std::string trace_path = test_path_ + "/trace";
|
||||
std::string output_path = test_path_ + "/merge";
|
||||
std::string file_path;
|
||||
std::vector<std::string> paras = {"-analyze_merge"};
|
||||
std::vector<std::string> paras = {
|
||||
"-analyze_get=false", "-analyze_put=false",
|
||||
"-analyze_delete=false", "-analyze_merge=true",
|
||||
"-analyze_single_delete=false", "-analyze_range_delete=false",
|
||||
"-analyze_iterator=false"};
|
||||
paras.push_back("-output_dir=" + output_path);
|
||||
paras.push_back("-trace_path=" + trace_path);
|
||||
paras.push_back("-key_space_dir=" + test_path_);
|
||||
@ -435,7 +448,7 @@ TEST_F(TraceAnalyzerTest, Merge) {
|
||||
CheckFileContent(k_whole_prefix, file_path, true);
|
||||
|
||||
// Check the overall qps
|
||||
std::vector<std::string> all_qps = {"1 1 1 0 0 1 0 0 4"};
|
||||
std::vector<std::string> all_qps = {"0 0 0 0 0 1 0 0 1"};
|
||||
file_path = output_path + "/test-qps_stats.txt";
|
||||
CheckFileContent(all_qps, file_path, true);
|
||||
|
||||
@ -463,7 +476,11 @@ TEST_F(TraceAnalyzerTest, SingleDelete) {
|
||||
std::string trace_path = test_path_ + "/trace";
|
||||
std::string output_path = test_path_ + "/single_delete";
|
||||
std::string file_path;
|
||||
std::vector<std::string> paras = {"-analyze_single_delete"};
|
||||
std::vector<std::string> paras = {
|
||||
"-analyze_get=false", "-analyze_put=false",
|
||||
"-analyze_delete=false", "-analyze_merge=false",
|
||||
"-analyze_single_delete=true", "-analyze_range_delete=false",
|
||||
"-analyze_iterator=false"};
|
||||
paras.push_back("-output_dir=" + output_path);
|
||||
paras.push_back("-trace_path=" + trace_path);
|
||||
paras.push_back("-key_space_dir=" + test_path_);
|
||||
@ -508,7 +525,7 @@ TEST_F(TraceAnalyzerTest, SingleDelete) {
|
||||
CheckFileContent(k_whole_prefix, file_path, true);
|
||||
|
||||
// Check the overall qps
|
||||
std::vector<std::string> all_qps = {"1 1 1 1 0 1 0 0 5"};
|
||||
std::vector<std::string> all_qps = {"0 0 0 1 0 0 0 0 1"};
|
||||
file_path = output_path + "/test-qps_stats.txt";
|
||||
CheckFileContent(all_qps, file_path, true);
|
||||
|
||||
@ -530,7 +547,11 @@ TEST_F(TraceAnalyzerTest, DeleteRange) {
|
||||
std::string trace_path = test_path_ + "/trace";
|
||||
std::string output_path = test_path_ + "/range_delete";
|
||||
std::string file_path;
|
||||
std::vector<std::string> paras = {"-analyze_range_delete"};
|
||||
std::vector<std::string> paras = {
|
||||
"-analyze_get=false", "-analyze_put=false",
|
||||
"-analyze_delete=false", "-analyze_merge=false",
|
||||
"-analyze_single_delete=false", "-analyze_range_delete=true",
|
||||
"-analyze_iterator=false"};
|
||||
paras.push_back("-output_dir=" + output_path);
|
||||
paras.push_back("-trace_path=" + trace_path);
|
||||
paras.push_back("-key_space_dir=" + test_path_);
|
||||
@ -576,7 +597,7 @@ TEST_F(TraceAnalyzerTest, DeleteRange) {
|
||||
CheckFileContent(k_whole_prefix, file_path, true);
|
||||
|
||||
// Check the overall qps
|
||||
std::vector<std::string> all_qps = {"1 1 1 1 2 1 0 0 7"};
|
||||
std::vector<std::string> all_qps = {"0 0 0 0 2 0 0 0 2"};
|
||||
file_path = output_path + "/test-qps_stats.txt";
|
||||
CheckFileContent(all_qps, file_path, true);
|
||||
|
||||
@ -599,7 +620,11 @@ TEST_F(TraceAnalyzerTest, Iterator) {
|
||||
std::string trace_path = test_path_ + "/trace";
|
||||
std::string output_path = test_path_ + "/iterator";
|
||||
std::string file_path;
|
||||
std::vector<std::string> paras = {"-analyze_iterator"};
|
||||
std::vector<std::string> paras = {
|
||||
"-analyze_get=false", "-analyze_put=false",
|
||||
"-analyze_delete=false", "-analyze_merge=false",
|
||||
"-analyze_single_delete=false", "-analyze_range_delete=false",
|
||||
"-analyze_iterator=true"};
|
||||
paras.push_back("-output_dir=" + output_path);
|
||||
paras.push_back("-trace_path=" + trace_path);
|
||||
paras.push_back("-key_space_dir=" + test_path_);
|
||||
@ -645,7 +670,7 @@ TEST_F(TraceAnalyzerTest, Iterator) {
|
||||
CheckFileContent(k_whole_prefix, file_path, true);
|
||||
|
||||
// Check the overall qps
|
||||
std::vector<std::string> all_qps = {"1 1 1 1 2 1 1 1 9"};
|
||||
std::vector<std::string> all_qps = {"0 0 0 0 0 0 1 1 2"};
|
||||
file_path = output_path + "/test-qps_stats.txt";
|
||||
CheckFileContent(all_qps, file_path, true);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user