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

add toolchain

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