提交 15e0464c 编写于 作者: F FondMemoryVVV

Modify the format

Signed-off-by: NFondMemoryVVV <mashuai53@huawei.com>
上级 9b4503c4
...@@ -15,11 +15,9 @@ import("//test/xts/tools/build/suite.gni") ...@@ -15,11 +15,9 @@ import("//test/xts/tools/build/suite.gni")
group("toolchain") { group("toolchain") {
testonly = true testonly = true
deps = [ deps = [ "//third_party/musl:libctest" ]
"//third_party/musl:libctest",
]
if (is_standard_system) { if (is_standard_system) {
deps = [ deps += [
#":tar_testcases", #":tar_testcases",
":tar_dllib", ":tar_dllib",
] ]
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
#include "runtest.h" #include "runtest.h"
using namespace std; using namespace std;
vector<string> filenames;
vector<string> filenames;
vector<std::string> GetFileNames(std::string path) vector<std::string> GetFileNames(std::string path)
{ {
vector<string> tempName; vector<string> tempName;
......
...@@ -20,8 +20,7 @@ ...@@ -20,8 +20,7 @@
#include "runtest.h" #include "runtest.h"
static void GetTestNames(std::string path, std::vector<std::string>& tempName)
void GetTestNames(std::string path, std::vector<std::string>& tempName)
{ {
DIR *pDir; DIR *pDir;
struct dirent* ptr; struct dirent* ptr;
...@@ -43,9 +42,3 @@ void GetTestNames(std::string path, std::vector<std::string>& tempName) ...@@ -43,9 +42,3 @@ void GetTestNames(std::string path, std::vector<std::string>& tempName)
} }
closedir(pDir); closedir(pDir);
} }
\ No newline at end of file
...@@ -41,4 +41,3 @@ int t_setrlim(int r, long lim) ...@@ -41,4 +41,3 @@ int t_setrlim(int r, long lim)
} }
return 0; return 0;
} }
...@@ -27,12 +27,15 @@ ...@@ -27,12 +27,15 @@
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h> #include <sys/resource.h>
#include "gtest/gtest.h"
#include "runtest.h" #include "runtest.h"
#include "gtest/gtest.h"
using namespace std; using namespace std;
using namespace testing::ext; using namespace testing::ext;
class ToolChainTest : public ::testing::TestWithParam<string> {}; using namespace testing;
class toolchaintest : public ::testing::TestWithParam<string> {};
static string filepath = "/data/local/tmp/libc-test/src"; static string filepath = "/data/local/tmp/libc-test/src";
static vector<std::string> temp = GetFileNames(filepath); static vector<std::string> temp = GetFileNames(filepath);
...@@ -68,7 +71,7 @@ static int runTests(const char *argvs) ...@@ -68,7 +71,7 @@ static int runTests(const char *argvs)
sigaddset(&set, SIGCHLD); sigaddset(&set, SIGCHLD);
sigprocmask(SIG_BLOCK, &set, nullptr); sigprocmask(SIG_BLOCK, &set, nullptr);
retfunc = signal(SIGCHLD, handler); retfunc = signal(SIGCHLD, handler);
if (retfunc == int(SIG_ERR)) { if (retfunc == SIG_ERR) {
printf("signal triggering failed:%s\n", strerror(errno)); printf("signal triggering failed:%s\n", strerror(errno));
} }
pid = start(wrap, argvs); pid = start(wrap, argvs);
...@@ -111,11 +114,11 @@ static int runTests(const char *argvs) ...@@ -111,11 +114,11 @@ 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) HWTEST_P(toolchaintest, LibcTest, Function | MediumTest | Level3)
{ {
int ret; int ret;
string testName = GetParam(); string testName = GetParam();
...@@ -127,4 +130,4 @@ static HWTEST_F(ToolChainTest, LibcTest, Function | MediumTest | Level3) ...@@ -127,4 +130,4 @@ static HWTEST_F(ToolChainTest, LibcTest, Function | MediumTest | Level3)
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())); INSTANTIATE_TEST_CASE_P(libcTest, toolchaintest, testing::ValuesIn(temp.begin(), temp.end()));
\ No newline at end of file
...@@ -24,17 +24,19 @@ import shutil ...@@ -24,17 +24,19 @@ import shutil
copyFileCounts = 0 copyFileCounts = 0
def copy_files(source_d, target_d): def copyFiles(sourceDir, targetDir):
for f in os.listdir(source_d): global copyFileCounts
source_files = os.path.join(source_d, f) for f in os.listdir(sourceDir):
target_files = os.path.join(target_d, f) sourceF = os.path.join(sourceDir, f)
if os.path.isfile(source_files): targetF = os.path.join(targetDir, f)
if not os.path.exists(target_d): if os.path.isfile(sourceF):
os.makedirs(target_d) if not os.path.exists(targetDir):
os.makedirs(targetDir)
copyFileCounts += 1 copyFileCounts += 1
open(target_files, "wb").write(open(source_files, "rb").read()) if not os.path.exists(targetF) or (os.path.exists(targetF) and (os.path.getsize(targetF) != os.path.getsize(sourceF))):
if os.path.isdir(source_files): open(targetF, "wb").write(open(sourceF, "rb").read())
copy_files(source_files, target_files) if os.path.isdir(sourceF):
copyFiles(sourceF, targetF)
def make_targz_one_by_one(output_filename, source_dir): def make_targz_one_by_one(output_filename, source_dir):
tar = tarfile.open(output_filename,"w") tar = tarfile.open(output_filename,"w")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册