diff --git a/aw/cxx/distributed/distributed_agent.cpp b/aw/cxx/distributed/distributed_agent.cpp index fc1d7afe21c09ff51ae7afb02d33e3fbd5a42c71..9310b45487990200794ae00a969309c8357c769b 100644 --- a/aw/cxx/distributed/distributed_agent.cpp +++ b/aw/cxx/distributed/distributed_agent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -78,7 +78,7 @@ int DistributedAgent::InitAgentServer() } int num = 1; - if (setsockopt(serverSockFd, SOL_SOCKET, SO_REUSEADDR, &num, sizeof(num)) != 0) { + if (setsockopt(serverSockFd, SOL_SOCKET, SO_REUSEADDR, &num, sizeof(num))) { close(serverSockFd); serverSockFd = -1; return serverSockFd; @@ -155,7 +155,7 @@ int DistributedAgent::DoCmdServer(int serverSockFd) // every cmd length less than MAX_BUFF_LEN bytes; int recvCmdLen = recv(clientSockFd_, buff, DST_COMMAND_HEAD_LEN, 0); if (static_cast(recvCmdLen) < DST_COMMAND_HEAD_LEN) { - if (recvCmdLen == 0) { + if (!recvCmdLen) { HiLog::Info(DistributedAgent::LABEL, "agent connect socket closed, IP:%s .\n", inet_ntoa(clientAddr.sin_addr)); mbStop_ = true; diff --git a/aw/cxx/distributed/distributed_major.cpp b/aw/cxx/distributed/distributed_major.cpp index 771aec9759cb0a7fc78c4ce0bc6e13a9db60907a..98d2d67901e4e3014c28d2e56577b933690aefd0 100644 --- a/aw/cxx/distributed/distributed_major.cpp +++ b/aw/cxx/distributed/distributed_major.cpp @@ -130,7 +130,7 @@ int DistributeTestEnvironment::ConnectAgent(size_t devNo) addr.sin_port = htons(serverPort_); int connectCount = 0; for (connectCount = 0; connectCount < CONNECT_TIME; connectCount++) { // try connect to agent 3 times. - if (connect(clientSockFd, reinterpret(&addr), sizeof(addr)) == 0) { + if (!connect(clientSockFd, reinterpret(&addr), sizeof(addr))) { break; } std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME)); // delay 10ms @@ -223,7 +223,7 @@ bool DistributeTestEnvironment::SendToAgent(size_t devNo, int cmdType, void *pst HiLog::Error(LABEL, "get error message. type is :%d", pCmdTest->cmdTestType); } } else { - if (rlen == 0) { + if (!rlen) { // peer socket is closed. HiLog::Error(LABEL, "device socket close."); break; diff --git a/aw/cxx/distributed/utils/csv_transform_xml.h b/aw/cxx/distributed/utils/csv_transform_xml.h index 2802b020067b65cf7dc4dd68679e313d34d46dcb..89b20883b7ba7a3e400d79cb757ed91142eb1992 100644 --- a/aw/cxx/distributed/utils/csv_transform_xml.h +++ b/aw/cxx/distributed/utils/csv_transform_xml.h @@ -67,7 +67,7 @@ public: int testCaseSum = vecLines_.size() / 3; // one item case_result from csv includes 3 strings int failCaseSum = 0; for (std::string s : vecLines_) { - if (s.compare("FAILED") == 0) { + if (!s.compare("FAILED")) { failCaseSum++; } } @@ -78,7 +78,7 @@ public: << "\" failures=\""<< failCaseSum << "\" disabled=\"0\" errors=\"0\" time=\"192.553\">" << std::endl; unsigned long i = 0; while (i < vecLines_.size()) { - if (vecLines_.at(i + 2).compare("FAILED") == 0) { // the result of every case intervals 2 string + if (!(vecLines_.at(i + 2).compare("FAILED"))) { // the result of every case intervals 2 string xmlOut << " " << std::endl; xmlOut << " "<< std::endl; diff --git a/aw/cxx/hwext/perf.cpp b/aw/cxx/hwext/perf.cpp index e1414a510c4761c0d3abe5c2efc07218011bcbc9..5e59bf45102ca263919497cf15074b03887e8207 100644 --- a/aw/cxx/hwext/perf.cpp +++ b/aw/cxx/hwext/perf.cpp @@ -103,7 +103,7 @@ bool BaseLineManager::ReadXmlFile(string baselinePath) xmlNodePtr ptrRootNode = xmlDocGetRootElement(ptrXmlDoc); if (ptrRootNode == nullptr || ptrRootNode->name == nullptr || - xmlStrcmp(ptrRootNode->name, reinterpret_cast(XML_TAG_ROOT)) != 0) { + xmlStrcmp(ptrRootNode->name, reinterpret_cast(XML_TAG_ROOT))) { xmlFreeDoc(ptrXmlDoc); return false; } @@ -138,7 +138,7 @@ bool BaseLineManager::IsNoBaseline() return m_bNoBaseline; } -double BaseLineManager::StrToDouble(const string& str) +double BaseLineManager::StrtoDouble(const string& str) { istringstream iss(str); double num; @@ -157,7 +157,7 @@ bool BaseLineManager::GetExtraValueDouble(const string testcaseName, const strin map properties = *iter; if (properties.count(XML_TAG_CASENAME) == 1 && properties[XML_TAG_CASENAME] == testcaseName) { if (properties.count(extra) == 1) { - value = StrToDouble(properties[extra]); + value = StrtoDouble(properties[extra]); } break; } diff --git a/aw/cxx/hwext/perf.h b/aw/cxx/hwext/perf.h index 9cc894ce54c2846ab2780aa5dc329df173b0257e..2ce761100996d0ad63f1cf8010af4bd40d3552b9 100644 --- a/aw/cxx/hwext/perf.h +++ b/aw/cxx/hwext/perf.h @@ -63,7 +63,7 @@ public: private: bool ReadXmlFile(std::string path); - double StrToDouble(const std::string &str); + double StrtoDouble(const std::string &str); private: BaselineConfig m_bastCfg; diff --git a/examples/calculator/src/calculator.cpp b/examples/calculator/src/calculator.cpp index 63cd5de36daf2282c64443e4d18375f742e24f58..dd942ace19e31e40b64e799df9662b8b3d2f2af2 100644 --- a/examples/calculator/src/calculator.cpp +++ b/examples/calculator/src/calculator.cpp @@ -32,7 +32,7 @@ int Sub(int e1, int e2) int Mul(int e1, int e2) { int result = e1 * e2; - if (e1 == 0) { + if (!e1) { return 0; } if ((result / e1) != e2) { @@ -43,7 +43,7 @@ int Mul(int e1, int e2) int Div(int e1, int e2) { - if (e2 == 0) { + if (!e2) { return -1; } diff --git a/examples/calculator/test/fuzztest/common/parse_fuzzer/corpus/init b/examples/calculator/test/fuzztest/common/parse_fuzzer/corpus/init index 6b7212c8a6a9ee6e433ea43d0c2c2e96568ad4c4..4dc63c8f403b1fa695180b46d78e22021ec1cd04 100644 --- a/examples/calculator/test/fuzztest/common/parse_fuzzer/corpus/init +++ b/examples/calculator/test/fuzztest/common/parse_fuzzer/corpus/init @@ -1 +1,12 @@ -FUZZ \ No newline at end of file +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. \ No newline at end of file diff --git a/examples/detector/src/detector.cpp b/examples/detector/src/detector.cpp index 368603fdb99e7c40bcbd12fd75012312f273b03b..7392964c54ae83a1d0f98ef795266e3ed93b432f 100644 --- a/examples/detector/src/detector.cpp +++ b/examples/detector/src/detector.cpp @@ -32,7 +32,7 @@ bool IsPrime(int n) return false; } - if (n % DetectorTest::HALF == 0) { + if (!(n % DetectorTest::HALF)) { return n == DetectorTest::HALF; } @@ -40,7 +40,7 @@ bool IsPrime(int n) if (i > (n / i)) { break; } - if (n % i == 0) { + if (!(n % i)) { return false; } } @@ -51,5 +51,5 @@ bool IsPrime(int n) bool FileExist(const char* fileName) { struct stat myStat; - return (stat(fileName, &myStat) == 0); + return (!stat(fileName, &myStat)); } diff --git a/examples/distributedb/test/distributedtest/common/distribute_demo.cpp b/examples/distributedb/test/distributedtest/common/distribute_demo.cpp index c0f0e51c2ba6a3123913339ee9de1ecc8f886479..eec2dff17fc0f82baab930c4c5b1aca8784fa43d 100644 --- a/examples/distributedb/test/distributedtest/common/distribute_demo.cpp +++ b/examples/distributedb/test/distributedtest/common/distribute_demo.cpp @@ -151,7 +151,7 @@ HWTEST_F(DistributeDemo, getkvstore_001, TestSize.Level0) { Options options; options.createIfMissing = true; options.encrypt = false; - options.persistant = true; + options.persistent = true; std::string appId = "com.ohos.nb.service.user1_test"; std::string storeId = "student_1"; manager = AppDistributedKvDataManager::GetInstance(appId, "/data/test"); diff --git a/examples/distributedb/test/distributedtest/common/distribute_demo_agent.cpp b/examples/distributedb/test/distributedtest/common/distribute_demo_agent.cpp index 478c6f82d15b43760523f4a9ff9c614a87a4a868..50886b9ed0dadecff347e1f7a6553568a4bfcef0 100644 --- a/examples/distributedb/test/distributedtest/common/distribute_demo_agent.cpp +++ b/examples/distributedb/test/distributedtest/common/distribute_demo_agent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -83,7 +83,7 @@ bool DistributeDemoAgent::SetUp() Options options; options.createIfMissing = true; options.encrypt = false; - options.persistant = true; + options.persistent = true; std::string storeId = g_storeId; Status status = g_manager->GetKvStore(options, storeId, [&](std::unique_ptr kvStore) { g_kvStorePtr = std::move(kvStore); @@ -115,7 +115,7 @@ int DistributeDemoAgent::OnProcessMsg(const std::string &strMsg, int len, nret = returnBufLen; } else { HiLog::Info(LABEL, "receive message=%s.", strMsg.c_str()); - if (strncmp(strMsg.c_str(), "recall", MSG_CALL_LEN) == 0) { + if (!strncmp(strMsg.c_str(), "recall", MSG_CALL_LEN)) { returnStr = "I get recall message."; int ptrlen = returnStr.size(); if (ptrlen > returnBufLen) { diff --git a/examples/lite/c_demo/include/calc_multi.h b/examples/lite/c_demo/include/calc_multi.h index 919b046524a5e5a7299850420c269b8f272d3181..439809c5e35738c520f1b6c37f93c3571c307f3d 100644 --- a/examples/lite/c_demo/include/calc_multi.h +++ b/examples/lite/c_demo/include/calc_multi.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Huawei Device Co., Ltd. + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/examples/lite/c_demo/source/BUILD.gn b/examples/lite/c_demo/source/BUILD.gn index c32c1b2c586561b5a7aef09f9a32818d412c6804..1d3e8a815e0061e52df85903cf7916097df02857 100755 --- a/examples/lite/c_demo/source/BUILD.gn +++ b/examples/lite/c_demo/source/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/libs/benchmark/README_zh.md b/libs/benchmark/README_zh.md index 0d859d6aabeb1f87dff17e9129709af069595e01..8265e1c53f7dfd31c76a3a2b0890670d0b159d7e 100644 --- a/libs/benchmark/README_zh.md +++ b/libs/benchmark/README_zh.md @@ -6,7 +6,7 @@ ``` /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 XXXX Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -158,7 +158,7 @@ BENCHMARK_MAIN(); ``` /* - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2021 XXXX Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -242,10 +242,11 @@ BENCHMARK_MAIN(); benchmark还支持其他多种参数,具体介绍和使用参考[benchmark](https://gitee.com/openharmony/third_party_benchmark/blob/master/README.md) -## 用例编译 + +## 用例编译 ``` -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2021 XXXX Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -283,7 +284,7 @@ group("unittest") { 1. 添加文件头注释信息 ``` - # Copyright (c) 2021 Huawei Device Co., Ltd. + # Copyright (c) 2021 XXXX Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/libs/benchmark/template/benchmark_detail.html b/libs/benchmark/template/benchmark_detail.html index 1e39923bc0ce3ed562f4b9c623e102c3ab75f752..0a289a1e90e8acfdf8bace2f88b9e48298be54eb 100644 --- a/libs/benchmark/template/benchmark_detail.html +++ b/libs/benchmark/template/benchmark_detail.html @@ -1,3 +1,17 @@ + diff --git a/libs/benchmark/template/benchmark_summary.html b/libs/benchmark/template/benchmark_summary.html index 2d5224eb36721250994592d2fd5332ecae86beab..7a40913e52b502795fbd48df4b582087f3eb5930 100644 --- a/libs/benchmark/template/benchmark_summary.html +++ b/libs/benchmark/template/benchmark_summary.html @@ -1,3 +1,17 @@ + diff --git a/libs/fuzzlib/README_zh.md b/libs/fuzzlib/README_zh.md index b4ca91190def65375448ae65365150375ef0b851..3d52e2ceb5dcaf7c7edda7f10507bbcecc748529 100644 --- a/libs/fuzzlib/README_zh.md +++ b/libs/fuzzlib/README_zh.md @@ -138,7 +138,7 @@ Fuzzing测试框架使用了LLVM编译器框架中的[libFuzzer](https://llvm.or 2. BUILD.gn编写 - 基于[ohos_fuzztest] # 配置Fuzz模板,例如: + 基于[ohos_fuzztest]配置Fuzz模板,例如: ``` ohos_fuzztest("CalculatorFuzzTest") { #定义测试套名称CalculatorFuzzTest @@ -155,7 +155,7 @@ Fuzzing测试框架使用了LLVM编译器框架中的[libFuzzer](https://llvm.or } ``` - [group] # 引用测试套,例如: + [group]引用测试套,例如: ``` group("fuzztest") { diff --git a/libs/fuzzlib/fuzzer_helper.py b/libs/fuzzlib/fuzzer_helper.py index 7bfb2f48ec7591ec25a833f8cd2381ddc825d9a9..b8c6217419047f2c6d31f1a22b6e03b4c5b3d2f9 100644 --- a/libs/fuzzlib/fuzzer_helper.py +++ b/libs/fuzzlib/fuzzer_helper.py @@ -112,8 +112,8 @@ def generate(args): template_args = { 'project_name': args.project_name, - 'author': "@fixme", - 'email': "@fixme" + 'author': "", + 'email': "" } project_dir_path = os.path.join(args.project_path, args.project_name) diff --git a/libs/fuzzlib/tools/__init__.py b/libs/fuzzlib/tools/__init__.py index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..74e555a47a3152df7771378bb33a0b937433ce68 100644 --- a/libs/fuzzlib/tools/__init__.py +++ b/libs/fuzzlib/tools/__init__.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- +# +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# \ No newline at end of file diff --git a/src/core/build/build_manager.py b/src/core/build/build_manager.py index f2d437f53910f7a129938e58bae0b92bf0d01667..0f95c6da19ba3ca517ba42a67f408f3b487c1caa 100755 --- a/src/core/build/build_manager.py +++ b/src/core/build/build_manager.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/build/build_testcases.py b/src/core/build/build_testcases.py index 2189a1bf1444c0b2810ddba7697c09682563f749..3d07569932c1c85614805a3f9f8db3b951345960 100755 --- a/src/core/build/build_testcases.py +++ b/src/core/build/build_testcases.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -44,8 +44,8 @@ class BuildTestcases(object): user_manager = UserConfigManager() self.is_build_example = user_manager.get_user_config_flag( "build", "example") - self.build_paramter_dic = user_manager.get_user_config( - "build", "paramter") + self.build_parameter_dic = user_manager.get_user_config( + "build", "parameter") @classmethod def _copy_folder(cls, source_dir, target_dir): diff --git a/src/core/build/select_targets.py b/src/core/build/select_targets.py index 756a02224da20c3bdaadd9c2280dcb27f9cfdbaf..912a6d942592669afeac12d70effceb40813f339 100755 --- a/src/core/build/select_targets.py +++ b/src/core/build/select_targets.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/command/run.py b/src/core/command/run.py index 8b5cb5d311a9f09ae037d0ac65961acc8a663022..d89d6577e882c39367246e97ec0e78bd5f4ee0b4 100755 --- a/src/core/command/run.py +++ b/src/core/command/run.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/config/resource_manager.py b/src/core/config/resource_manager.py index e6780c2a4adf3b9ebaa6829e7b1661229b0c86f8..538b813dce5cf23e7c04717af23899d6f0d276ee 100755 --- a/src/core/config/resource_manager.py +++ b/src/core/config/resource_manager.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/driver/drivers.py b/src/core/driver/drivers.py index 224fb818b9344b15f204b307ee19b4e69e4a26b8..5a160f470c13e791f799c8dae314888e315602b4 100755 --- a/src/core/driver/drivers.py +++ b/src/core/driver/drivers.py @@ -2,7 +2,7 @@ # coding=utf-8 # -# Copyright (c) 2020 Huawei Device Co., Ltd. +# Copyright (c) 2020-2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/src/core/utils.py b/src/core/utils.py index 379afb9f30d91d0a782d175c28fd251eb2e50d80..45d10b2ee3e7c809ddc73843525959631deb5ae0 100755 --- a/src/core/utils.py +++ b/src/core/utils.py @@ -155,7 +155,7 @@ def parse_product_info(product_form): def is_32_bit_test(): manager = UserConfigManager() - para_dic = manager.get_user_config("build", "paramter") + para_dic = manager.get_user_config("build", "parameter") target_cpu = para_dic.get("target_cpu", "") if target_cpu == "arm": return True