From 8be8f0792f85859247c3c75212ed7eaa70292c25 Mon Sep 17 00:00:00 2001 From: FondMemoryVVV Date: Fri, 26 Aug 2022 15:07:50 +0800 Subject: [PATCH] Modify the format Signed-off-by: FondMemoryVVV --- toolchain/libc-test/include/getfiles.cpp | 7 ++++--- toolchain/libc-test/include/runtest.h | 11 ++++++++--- toolchain/libc-test/include/setrlim.cpp | 7 ++++--- toolchain/libc-test/src/toolchaintest.cpp | 8 +++++--- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/toolchain/libc-test/include/getfiles.cpp b/toolchain/libc-test/include/getfiles.cpp index 3a520e3ac..70d62f513 100644 --- a/toolchain/libc-test/include/getfiles.cpp +++ b/toolchain/libc-test/include/getfiles.cpp @@ -20,11 +20,11 @@ #include "gettestfiles.cpp" #include "runtest.h" - +namespace OHOS{ using namespace std; static vector filenames; -vector GetFileNames(std::string path) +std::vector runtest::GetFileNames(std::string path) { vector tempName; GetTestNames(path, tempName); @@ -37,4 +37,5 @@ vector GetFileNames(std::string path) filenames.push_back(tempName[i]); } return filenames; -} \ No newline at end of file +} +} //namespace OHOS \ No newline at end of file diff --git a/toolchain/libc-test/include/runtest.h b/toolchain/libc-test/include/runtest.h index ddf282da0..46c9f6144 100644 --- a/toolchain/libc-test/include/runtest.h +++ b/toolchain/libc-test/include/runtest.h @@ -18,8 +18,13 @@ #include #include #include +namespace OHOS { -int t_setrlim(int r, long lim); -std::vector GetFileNames(std::string path); - +class runtest +{ +public: + static int t_setrlim(int r, long lim); + static std::vector GetFileNames(std::string path); +}; +} //namespace OHOS #endif // TOOLCHAIN_LIBC_TEST_INCLUDE_RUNTEST_H_ diff --git a/toolchain/libc-test/include/setrlim.cpp b/toolchain/libc-test/include/setrlim.cpp index fbd57e05d..d729ff4d2 100644 --- a/toolchain/libc-test/include/setrlim.cpp +++ b/toolchain/libc-test/include/setrlim.cpp @@ -18,8 +18,8 @@ #include #include "runtest.h" - -int t_setrlim(int r, long lim) +namespace OHOS{ +int runtest::t_setrlim(int r, long lim) { struct rlimit rl; @@ -40,4 +40,5 @@ int t_setrlim(int r, long lim) return -1; } return 0; -} \ No newline at end of file +} +} //namespace OHOS \ No newline at end of file diff --git a/toolchain/libc-test/src/toolchaintest.cpp b/toolchain/libc-test/src/toolchaintest.cpp index 0a9ac1381..9ff4c9d91 100644 --- a/toolchain/libc-test/src/toolchaintest.cpp +++ b/toolchain/libc-test/src/toolchaintest.cpp @@ -37,7 +37,7 @@ namespace OHOS { class toolchaintest : public ::testing::TestWithParam {}; static string filepath = "/data/local/tmp/libc-test/src"; -static vector temp = GetFileNames(filepath); +static vector temp = runtest::GetFileNames(filepath); volatile int t_status = 0; static void handler(int s) @@ -50,7 +50,7 @@ static int start(char *wrap, const char *argvs) pid = fork(); if (pid == 0) { - t_setrlim(RLIMIT_STACK, space_size); + runtest::t_setrlim(RLIMIT_STACK, space_size); int exe = execl(argvs, "strptime", nullptr); printf("exe:%d %s exec failed: %s\n", exe, argvs, strerror(errno)); exit(1); @@ -64,11 +64,13 @@ static int runTests(const char *argvs) int timeoutsec = 5, timeout = 0; int status, pid; sigset_t set; + void (*retfunc)(int); sigemptyset(&set); sigaddset(&set, SIGCHLD); sigprocmask(SIG_BLOCK, &set, nullptr); - if (signal(SIGCHLD, handler) == SIG_ERR) { + retfunc = signal(SIGCHLD, handler); + if (retfunc == SIG_ERR) { printf("signal triggering failed:%s\n", strerror(errno)); } pid = start(wrap, argvs); -- GitLab