提交 8e7f0c6c 编写于 作者: F FondMemoryVVV

add toolchain

Signed-off-by: NFondMemoryVVV <mashuai53@huawei.com>
上级 4f6a6918
...@@ -47,6 +47,7 @@ _all_test_packages = [ ...@@ -47,6 +47,7 @@ _all_test_packages = [
"${ACTS_ROOT}/barrierfree:barrierfree", "${ACTS_ROOT}/barrierfree:barrierfree",
"${ACTS_ROOT}/customization:customization", "${ACTS_ROOT}/customization:customization",
"${ACTS_ROOT}/distributedschedule:distributedschedule", "${ACTS_ROOT}/distributedschedule:distributedschedule",
"${ACTS_ROOT}/toolchain:toolchain",
] ]
_all_test_packages_ivi = [ _all_test_packages_ivi = [
......
...@@ -15,6 +15,9 @@ import("//test/xts/tools/build/suite.gni") ...@@ -15,6 +15,9 @@ import("//test/xts/tools/build/suite.gni")
group("toolchain") { group("toolchain") {
testonly = true testonly = true
deps = [
"//third_party/musl:libctest",
]
if (is_standard_system) { if (is_standard_system) {
deps = [ deps = [
#":tar_testcases", #":tar_testcases",
......
...@@ -17,28 +17,24 @@ ...@@ -17,28 +17,24 @@
#include <vector> #include <vector>
#include <cstring> #include <cstring>
#include <dirent.h> #include <dirent.h>
#include "gettestfiles.cpp"
#include "runtest.h" #include "runtest.h"
void GetFileNames(std::string path, std::vector<std::string>& filenames) using namespace std;
vector<string> filenames;
vector<std::string> GetFileNames(std::string path)
{ {
DIR *pDir; vector<string> tempName;
struct dirent* ptr; GetTestNames(path, tempName);
std::string p; for (size_t i = 0; i < tempName.size(); i++) {
if (!(pDir = opendir(path.c_str()))) { if ((tempName[i].find("stat", path.length()-1) != -1) ||
std::cout << "Folder doesn't Exist!" << std::endl; (tempName[i].find("sem_close-unmap", path.length()-1) != -1) ||
return; (tempName[i].find("runtest", path.length()-1) != -1)) {
} continue;
while ((ptr = readdir(pDir)) != nullptr) {
if (ptr->d_type == DT_DIR) {
if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
GetFileNames(path + "/" + ptr->d_name, filenames);
}
} else {
if (strcmp(ptr->d_name, ".") != 0 && strcmp(ptr->d_name, "..") != 0) {
filenames.push_back(path + "/" + ptr->d_name);
}
} }
filenames.push_back(tempName[i]);
} }
closedir(pDir); return filenames;
} }
\ No newline at end of file
...@@ -20,6 +20,6 @@ ...@@ -20,6 +20,6 @@
#include <vector> #include <vector>
int t_setrlim(int r, long lim); int t_setrlim(int r, long lim);
void GetFileNames(std::string path, std::vector<std::string>& filenames); std::vector<std::string> GetFileNames(std::string path);
#endif // TOOLCHAIN_LIBC_TEST_INCLUDE_RUNTEST_H_ #endif // TOOLCHAIN_LIBC_TEST_INCLUDE_RUNTEST_H_
...@@ -32,8 +32,10 @@ ...@@ -32,8 +32,10 @@
using namespace std; using namespace std;
using namespace testing::ext; using namespace testing::ext;
class toolchaintest : public testing::Test {}; class ToolChainTest : public ::testing::TestWithParam<string> {};
static string filepath = "/data/local/tmp/libc-test/src";
static vector<std::string> temp = GetFileNames(filepath);
volatile int t_status = 0; volatile int t_status = 0;
static void handler(int s) static void handler(int s)
...@@ -54,7 +56,7 @@ static int start(char *wrap, const char *argvs) ...@@ -54,7 +56,7 @@ static int start(char *wrap, const char *argvs)
return pid; return pid;
} }
static int runtests(const char *argvs) static int runTests(const char *argvs)
{ {
char wrap[] = ""; char wrap[] = "";
int timeoutsec = 5, timeout = 0; int timeoutsec = 5, timeout = 0;
...@@ -109,23 +111,20 @@ static int runtests(const char *argvs) ...@@ -109,23 +111,20 @@ static int runtests(const char *argvs)
} }
/** /**
* @tc.name : toolchaintest.LibcTest * @tc.name : ToolChainTest.LibcTest
* @tc.desc : start test * @tc.desc : start test
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
static HWTEST_F(toolchaintest, LibcTest, Function | MediumTest | Level3) static HWTEST_F(ToolChainTest, LibcTest, Function | MediumTest | Level3)
{ {
int ret; int ret;
vector<string> temp; string testName = GetParam();
string filepath = "/data/local/tmp/libc-test/src"; ret = runTests(testName.c_str());
GetFileNames(filepath, temp); if (ret == 0) {
for (size_t i = 0; i < temp.size(); i++) { EXPECT_EQ(0, ret) << "test " << testName << " succeed" << endl;
if ((temp[i].find("stat", filepath.length()-1) != -1) || } else {
(temp[i].find("sem_close-unmap", filepath.length()-1) != -1) || EXPECT_EQ(1, ret) << "test " << testName << " failed" << endl;
(temp[i].find("runtest", filepath.length()-1) != -1)) { EXPECT_EQ(-1, ret) << "test " << testName << " failed" << endl;
continue;
}
ret = runtests(temp[i].c_str());
EXPECT_EQ(0, ret) << "test " << temp[i] << " failed" << endl;
} }
} }
INSTANTIATE_TEST_CASE_P(libcTest, ToolChainTest, testing:: ValuesIn(temp.begin(), temp.end()));
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册