diff --git a/arkui/BUILD.gn b/arkui/BUILD.gn index 6c1f44d66ba493e9e6441769fad39a7e0e86ba4b..89b9f93f3123d52f54995e0b7a3bf7010cc19593 100644 --- a/arkui/BUILD.gn +++ b/arkui/BUILD.gn @@ -33,7 +33,6 @@ group("arkui") { "ace_napi_test:ActsAceNapiEtsTest", "ace_standard:ActsAceStandardTest", "ace_standard_video:ActsAceStandardVideoTest", - "libuv:ActsLibuvTestSuite", "libuv:libuvTest", ] } diff --git a/arkui/libuv/BUILD.gn b/arkui/libuv/BUILD.gn index 05c237975bd3d76657a62a3be6742bf9a035f17d..ad4046c3b40e7dc0459740744e09bdde1cb1827e 100644 --- a/arkui/libuv/BUILD.gn +++ b/arkui/libuv/BUILD.gn @@ -61,7 +61,6 @@ ohos_static_library("libuvTestStatic") { "//third_party/libuv/test/test-get-passwd.c", "//third_party/libuv/test/test-getaddrinfo.c", "//third_party/libuv/test/test-gethostname.c", - "//third_party/libuv/test/test-getnameinfo.c", "//third_party/libuv/test/test-getsockname.c", "//third_party/libuv/test/test-getters-setters.c", "//third_party/libuv/test/test-gettimeofday.c", @@ -209,8 +208,8 @@ ohos_executable("libuvruntest") { deps = [ ":libuvTestStatic" ] } -ohos_moduletest_suite("ActsLibuvTestSuite") { - sources = [ "src/ActsLibuvTestSuite.cpp" ] +ohos_moduletest_suite("ActsLibuvTest") { + sources = [ "src/ActsLibuvTest.cpp" ] include_dirs = [ "//test/xts/acts/arkui/libuv/src", @@ -228,7 +227,7 @@ action("cpLibuv") { script = "cplibuv.sh" outputs = [ "${target_out_dir}/cplibuv.log" ] deps = [ - ":ActsLibuvTestSuite", + ":ActsLibuvTest", ":libuvruntest", ] } @@ -237,7 +236,7 @@ group("libuvTest") { testonly = true if (is_standard_system) { deps = [ - ":ActsLibuvTestSuite", + ":ActsLibuvTest", ":cpLibuv", ":libuvruntest", ] diff --git a/arkui/libuv/README_zh.md b/arkui/libuv/README_zh.md index a76c350cd50ce4ac73f7f877cd19e1b533161142..0764b6740cc6311053b8a78e47041aefab5cf6cd 100644 --- a/arkui/libuv/README_zh.md +++ b/arkui/libuv/README_zh.md @@ -14,8 +14,8 @@ Libuv测试套件使用Libuv三方库内原有的unittest,通过acts测试套 ├── cplibuv.sh ├── genlocal.py ├── src -│ ├── ActsLibuvTestSuite.cpp -│ └── ActsLibuvTestSuite.h +│ ├── ActsLibuvTest.cpp +│ └── ActsLibuvTest.h └── Test.json ``` @@ -35,12 +35,12 @@ Libuv测试套件使用Libuv三方库内原有的unittest,通过acts测试套 ./build.sh --product-name rk3568 --gn-args build_xts=true --build-target "acts" --gn-args is_standard_system=true ``` - + * 测试运行:进入suites/acts目录,执行python -m xdevice,然后在命令框里输入一下命令 ```bash - run -l ActsLibuvTestSuite + run -l ActsLibuvTest ``` - \ No newline at end of file + diff --git a/arkui/libuv/Test.json b/arkui/libuv/Test.json index 4f23ce05d02cfc8353584170cf2bb55680e1ed2f..228c6a34bdc55bbccb2a80d2ae96c246e01ca7fa 100644 --- a/arkui/libuv/Test.json +++ b/arkui/libuv/Test.json @@ -1,7 +1,7 @@ { - "description": "Config for ActsLibuvTestSuite test cases", + "description": "Config for ActsLibuvTest test cases", "driver": { - "module-name": "ActsLibuvTestSuite", + "module-name": "ActsLibuvTest", "native-test-timeout": "120000", "native-test-device-path": "/data/local/tmp", "runtime-hint": "100s", @@ -10,13 +10,17 @@ "kits": [ { "pre-push" : [ + "mkdir -p /data/local/tmp/test/fixtures" ], "post-push" : [ "chmod -R 777 /data/local/tmp/*" ], "push": [ - "ActsLibuvTestSuite->/data/local/tmp/ActsLibuvTestSuite", - "libuvdata/libuvruntest->/data/local/tmp/libuvruntest " + "ActsLibuvTest->/data/local/tmp/ActsLibuvTest", + "libuvdata/libuvruntest->/data/local/tmp/libuvruntest", + "libuvdata/test/fixtures/empty_file->/data/local/tmp/test/fixtures/empty_file", + "libuvdata/test/fixtures/load_error.node->/data/local/tmp/test/fixtures/load_error.node", + "libuvdata/test/fixtures/lorem_ipsum.txt->/data/local/tmp/test/fixtures/lorem_ipsum.txt" ], "type": "PushKit" }, diff --git a/arkui/libuv/cplibuv.sh b/arkui/libuv/cplibuv.sh index a549b12edfe2ec7f75d80c4f1c0c64f0639074ea..88130f01f4ba28b0ee489740f20e5ab83a8a100f 100755 --- a/arkui/libuv/cplibuv.sh +++ b/arkui/libuv/cplibuv.sh @@ -15,6 +15,7 @@ set -e -mkdir -p "suites/acts/testcases/libuvdata" +mkdir -p "suites/acts/testcases/libuvdata/test" cp -rf "../../test/xts/acts/arkui/libuv/genlocal.py" "suites/acts/testcases/libuvdata" cp -rf "common/common/libuvruntest" "suites/acts/testcases/libuvdata" +cp -rf "../../third_party/libuv/test/fixtures" "suites/acts/testcases/libuvdata/test" diff --git a/arkui/libuv/genlocal.py b/arkui/libuv/genlocal.py index b31525f10e4d457e91fd4c34e8edbc537d0d1396..a1f4f94f7ea1fedf547db835bb8f7225772ae71b 100644 --- a/arkui/libuv/genlocal.py +++ b/arkui/libuv/genlocal.py @@ -142,7 +142,7 @@ def writemulbuildgn(): #替换index.ets里的名称 indexetsname = hapdirpath + G_INDEXETSPATH os.system(r"sed -i 's/{}/{}/g' {}".format(G_SUITENAMEPATTERN, suiteitemcap, indexetsname)) - + #替换Test.json里的名称 testjsonname = hapdirpath + G_TESTJSONPATH os.system(r"sed -i 's/{}/{}/g' {}".format(G_SUITENAMEPATTERN, suiteitemcap, testjsonname)) @@ -177,7 +177,7 @@ def removedir(rootdir): os.rmdir(rootdir) -def printhelp(): +def printhelp(): print("Need testsuite and codepattern:\n") print("For example\n") print("python3 .\GenerateTestCase.py apilack\n") @@ -201,7 +201,7 @@ def new_report(bakdir, str): if __name__ == '__main__': latestpath = new_report("reports", "") tmpfile = "tmptestsuite.xml" - putfile = "/result/ActsLibuvTestSuite.xml" + putfile = "/result/ActsLibuvTest.xml" tasklogfile = "/log/task_log.log" putdir = latestpath+putfile tasklogpath = latestpath+tasklogfile @@ -255,4 +255,4 @@ if __name__ == '__main__': xmlfile.write("\n") xmlfile.close() #将tmp文件替换xts框架的result - os.system(r"cp {} {}".format(tmpfile, putdir)) \ No newline at end of file + os.system(r"cp {} {}".format(tmpfile, putdir)) diff --git a/arkui/libuv/src/ActsLibuvTestSuite.cpp b/arkui/libuv/src/ActsLibuvTest.cpp similarity index 74% rename from arkui/libuv/src/ActsLibuvTestSuite.cpp rename to arkui/libuv/src/ActsLibuvTest.cpp index 00f688ba794c4e6275032b0cdb082e84fcdef4b1..eda5eaa8381349d8d3d922e6ba662463315e5f2d 100644 --- a/arkui/libuv/src/ActsLibuvTestSuite.cpp +++ b/arkui/libuv/src/ActsLibuvTest.cpp @@ -15,7 +15,7 @@ #include #include -#include "ActsLibuvTestSuite.h" +#include "ActsLibuvTest.h" extern "C"{ #include "runner.h" } @@ -25,27 +25,27 @@ namespace OHOS { using namespace testing::ext; // Preset action of the test suite, which is executed before the first test case - void ActsLibuvTestSuite::SetUpTestCase(void) + void ActsLibuvTest::SetUpTestCase(void) { } // Test suite cleanup action, which is executed after the last test case - void ActsLibuvTestSuite::TearDownTestCase(void) + void ActsLibuvTest::TearDownTestCase(void) { } // Preset action of the test case - void ActsLibuvTestSuite::SetUp() + void ActsLibuvTest::SetUp() { } // Cleanup action of the test case - void ActsLibuvTestSuite::TearDown() + void ActsLibuvTest::TearDown() { } - HWTEST_F(ActsLibuvTestSuite, TestLibuvTestCase001, Function | MediumTest | Level2) + HWTEST_F(ActsLibuvTest, TestLibuvTestCase001, Function | MediumTest | Level2) { - printf("------start ActsLibuvTestSuite------\n"); + printf("------start ActsLibuvTest------\n"); system("/data/local/tmp/libuvruntest"); EXPECT_TRUE(true); - printf("------end ActsLibuvTestSuite------\n"); + printf("------end ActsLibuvTest------\n"); } } diff --git a/arkui/libuv/src/ActsLibuvTestSuite.h b/arkui/libuv/src/ActsLibuvTest.h similarity index 93% rename from arkui/libuv/src/ActsLibuvTestSuite.h rename to arkui/libuv/src/ActsLibuvTest.h index 036c9aa5a428d27e1929f8fcc5fe3a8e1c68e0a8..0f9cd32cf6bc730ccb01fd3f9a60be84146c35e8 100644 --- a/arkui/libuv/src/ActsLibuvTestSuite.h +++ b/arkui/libuv/src/ActsLibuvTest.h @@ -18,7 +18,7 @@ #include namespace OHOS { - class ActsLibuvTestSuite : public testing::Test { + class ActsLibuvTest : public testing::Test { public: protected: // Preset action of the test suite, which is executed before the first test case