Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions gen_lcov.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ rm UTResport.tar

mkdir -p build
cd build
cmake -DENABLE_COVERAGE=ON ..
gmake all
cmake -DENABLE_COVERAGE=ON -DBUILD_UNITTEST=ON ..
gmake all -j 4

# init
cd ..
Expand All @@ -18,10 +18,14 @@ lcov -d build -b . --no-external --initial -c -o sevenyou_init.info

# run
cd build/bin
./auth_tool_test
./object_request_test
./object_op_test
./bucket_op_test
./all-test
#./async-op-test
#./bucket-op-test
#./live-channel-test
#./object-op-test
#./object-request-test
#./object-response-test
#./util-test

# second
cd ../..
Expand Down
2 changes: 2 additions & 0 deletions include/response/bucket_resp.h
Original file line number Diff line number Diff line change
Expand Up @@ -613,12 +613,14 @@ class GetBucketRefererResp : public BaseResp {
std::string GetRefererType() const { return m_referer_type; }
std::vector<std::string> GetDomainList() const { return m_domain_list; }
std::string GetEmptyReferConf() const { return m_empty_refer_conf; }
std::string GetVerifySignatureUrl() const {return m_verify_signature_url; }

private:
std::string m_status;
std::string m_referer_type;
std::vector<std::string> m_domain_list;
std::string m_empty_refer_conf;
std::string m_verify_signature_url;
};

} // namespace qcloud_cos
Expand Down
6 changes: 4 additions & 2 deletions src/op/base_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,16 @@ std::string BaseOp::GetRealUrl(const std::string& host, const std::string& path,
dest_path = "/" + dest_path;
}

if (m_config->GetSetIntranetOnce() &&
if (m_config &&
m_config->GetSetIntranetOnce() &&
m_config->IsUseIntranet() &&
!m_config->GetIntranetAddr().empty()) {
dest_host = m_config->GetIntranetAddr();
} else if (CosSysConfig::IsUseIntranet() &&
!CosSysConfig::GetIntranetAddr().empty()) {
dest_host = CosSysConfig::GetIntranetAddr();
} else if (!m_config->GetDestDomain().empty()) {
} else if (m_config &&
(!m_config->GetDestDomain().empty())) {
dest_host = m_config->GetDestDomain();
} else if (!CosSysConfig::GetDestDomain().empty()) {
dest_host = CosSysConfig::GetDestDomain();
Expand Down
4 changes: 3 additions & 1 deletion src/response/bucket_resp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1294,10 +1294,12 @@ bool GetBucketRefererResp::ParseFromXmlString(const std::string& body) {
m_referer_type = refer_node->value();
} else if ("EmptyReferConfiguration" == node_name) {
m_empty_refer_conf = refer_node->value();
} else if ("VerifySignatureURL" == node_name) {
m_verify_signature_url = refer_node->value();
} else {
SDK_LOG_WARN("Unknown field in RefererConfiguration, field_name=%s",
node_name.c_str());
return false;
//return false;
}
}
return true;
Expand Down
7 changes: 4 additions & 3 deletions unittest/src/async_op_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ enum OpType { ASYNC_OP = 1, MULTI_ASYNC_OP };

#define CHECK_DEL_RESP(resp) ASSERT_EQ(resp.GetContentLength(), 0);

#if 1

TEST_F(AsyncOpTest, AsyncOpWithoutCallback) {
std::vector<int> base_file_size_v = {
Expand Down Expand Up @@ -517,6 +516,7 @@ TEST_F(AsyncOpTest, AsyncOpWithWithDoneCallback) {
}
}

#if 0
TEST_F(AsyncOpTest, AsyncOpWithConcurrent) {
const int concurrent_size = 5; // 并发文件个数为5
std::vector<int> base_file_size_v = {
Expand Down Expand Up @@ -720,7 +720,7 @@ TEST_F(AsyncOpTest, AsyncOpWithConcurrent) {
}
}
}

#endif

TEST_F(AsyncOpTest, AsyncPutWithException) {
// cancel op
Expand Down Expand Up @@ -978,8 +978,8 @@ TEST_F(AsyncOpTest, AsyncGetWithException) {
TestUtils::RemoveFile(local_file_download);
}
}
#endif

#if 0
TEST_F(AsyncOpTest, AsyncConcurrentWithException) {
const int concurrent_size = 5; // 并发数为5
std::vector<int> op_type_v = {ASYNC_OP, MULTI_ASYNC_OP};
Expand Down Expand Up @@ -1084,5 +1084,6 @@ TEST_F(AsyncOpTest, AsyncConcurrentWithException) {
TestUtils::RemoveFile(local_file_download);
}
}
#endif

} // namespace qcloud_cos
2 changes: 1 addition & 1 deletion unittest/src/bucket_op_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ TEST_F(BucketOpTest, HeadBucketTest) {
HeadBucketResp resp;
CosResult result = m_client->HeadBucket(req, &resp);
EXPECT_TRUE(!result.IsSucc());
EXPECT_EQ(result.GetHttpStatus(), 400);
EXPECT_EQ(result.GetHttpStatus(), 404);
}
}

Expand Down