diff --git a/toolchain/libc-test/include/getfiles.cpp b/toolchain/libc-test/include/getfiles.cpp index 3a520e3acb7e6163a411d3b0228b66db854f8211..70d62f513b420433459604824ca356fed34159b8 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 ddf282da053b686f8213d769523f23d4559c565e..46c9f6144e29eb0cc9d3be143c86d7e980bf6032 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 fbd57e05df2f9f72a454e6313862de4eacee0ff1..d729ff4d23f91dee80501da4ef461c8978cde4d5 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 0a9ac13810cc2801c4b5e752257acf84ddcdf03c..9ff4c9d917b96af9f0ac54c4f32c02f4ee60e8bc 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);