Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
4e70fd5d
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
4e70fd5d
编写于
9月 27, 2022
作者:
F
FondMemoryVVV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Modified Toolchain Codecheck
Signed-off-by:
N
FondMemoryVVV
<
mashuai53@huawei.com
>
上级
1d7ddd44
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
72 addition
and
72 deletion
+72
-72
commonlibrary/toolchain/libc-test/include/getfiles.cpp
commonlibrary/toolchain/libc-test/include/getfiles.cpp
+8
-9
commonlibrary/toolchain/libc-test/include/gettestfiles.cpp
commonlibrary/toolchain/libc-test/include/gettestfiles.cpp
+1
-2
commonlibrary/toolchain/libc-test/include/runtest.h
commonlibrary/toolchain/libc-test/include/runtest.h
+3
-4
commonlibrary/toolchain/libc-test/include/setrlim.cpp
commonlibrary/toolchain/libc-test/include/setrlim.cpp
+5
-6
commonlibrary/toolchain/libc-test/src/toolchaintest.cpp
commonlibrary/toolchain/libc-test/src/toolchaintest.cpp
+28
-29
commonlibrary/toolchain/libc-test/tar_files.py
commonlibrary/toolchain/libc-test/tar_files.py
+27
-22
未找到文件。
commonlibrary/toolchain/libc-test/include/getfiles.cpp
浏览文件 @
4e70fd5d
/*
/* Copyright (C) 2022 Huawei Device Co., Ltd.
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -23,19 +22,19 @@
...
@@ -23,19 +22,19 @@
namespace
OHOS
{
namespace
OHOS
{
using
namespace
std
;
using
namespace
std
;
static
vector
<
std
::
string
>
filenames
;
static
vector
<
std
::
string
>
g_
filenames
;
std
::
vector
<
std
::
string
>
r
untest
::
GetFileNames
(
std
::
string
path
)
std
::
vector
<
std
::
string
>
R
untest
::
GetFileNames
(
std
::
string
path
)
{
{
vector
<
string
>
tempName
;
vector
<
string
>
tempName
;
GetTestNames
(
path
,
tempName
);
GetTestNames
(
path
,
tempName
);
for
(
size_t
i
=
0
;
i
<
tempName
.
size
();
i
++
)
{
for
(
size_t
i
=
0
;
i
<
tempName
.
size
();
i
++
)
{
if
((
tempName
[
i
].
find
(
"stat"
,
path
.
length
()
-
1
)
!=
-
1
)
||
if
((
tempName
[
i
].
find
(
"stat"
,
path
.
length
()
-
1
)
!=
-
1
)
||
(
tempName
[
i
].
find
(
"sem_close-unmap"
,
path
.
length
()
-
1
)
!=
-
1
)
||
(
tempName
[
i
].
find
(
"sem_close-unmap"
,
path
.
length
()
-
1
)
!=
-
1
)
||
(
tempName
[
i
].
find
(
"runtest"
,
path
.
length
()
-
1
)
!=
-
1
))
{
(
tempName
[
i
].
find
(
"runtest"
,
path
.
length
()
-
1
)
!=
-
1
))
{
continue
;
continue
;
}
}
filenames
.
push_back
(
tempName
[
i
]);
g_
filenames
.
push_back
(
tempName
[
i
]);
}
}
return
filenames
;
return
g_
filenames
;
}
}
}
// namespace OHOS
}
// namespace OHOS
\ No newline at end of file
commonlibrary/toolchain/libc-test/include/gettestfiles.cpp
浏览文件 @
4e70fd5d
/*
/* Copyright (C) 2022 Huawei Device Co., Ltd.
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
...
commonlibrary/toolchain/libc-test/include/runtest.h
浏览文件 @
4e70fd5d
/*
/* Copyright (C) 2022 Huawei Device Co., Ltd.
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -19,9 +18,9 @@
...
@@ -19,9 +18,9 @@
#include <string>
#include <string>
#include <vector>
#include <vector>
namespace
OHOS
{
namespace
OHOS
{
class
r
untest
{
class
R
untest
{
public:
public:
static
int
t_s
etrlim
(
int
r
,
long
lim
);
static
int
TS
etrlim
(
int
r
,
long
lim
);
static
std
::
vector
<
std
::
string
>
GetFileNames
(
std
::
string
path
);
static
std
::
vector
<
std
::
string
>
GetFileNames
(
std
::
string
path
);
};
};
}
// namespace OHOS
}
// namespace OHOS
...
...
commonlibrary/toolchain/libc-test/include/setrlim.cpp
浏览文件 @
4e70fd5d
/*
/* Copyright (C) 2021 Huawei Device Co., Ltd.
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -19,11 +18,11 @@
...
@@ -19,11 +18,11 @@
#include "runtest.h"
#include "runtest.h"
namespace
OHOS
{
namespace
OHOS
{
int
runtest
::
t_s
etrlim
(
int
r
,
long
lim
)
int
Runtest
::
TS
etrlim
(
int
r
,
long
lim
)
{
{
struct
rlimit
rl
;
struct
rlimit
rl
;
//Gets the current stack size
//
Gets the current stack size
if
(
getrlimit
(
r
,
&
rl
))
{
if
(
getrlimit
(
r
,
&
rl
)
!=
0
)
{
printf
(
"getrlimit %d: %s
\n
"
,
r
,
strerror
(
errno
));
printf
(
"getrlimit %d: %s
\n
"
,
r
,
strerror
(
errno
));
return
-
1
;
return
-
1
;
}
}
...
@@ -35,7 +34,7 @@ int runtest::t_setrlim(int r, long lim)
...
@@ -35,7 +34,7 @@ int runtest::t_setrlim(int r, long lim)
}
}
rl
.
rlim_max
=
lim
;
rl
.
rlim_max
=
lim
;
rl
.
rlim_cur
=
lim
;
rl
.
rlim_cur
=
lim
;
if
(
setrlimit
(
r
,
&
rl
))
{
if
(
setrlimit
(
r
,
&
rl
)
!=
0
)
{
printf
(
"setrlimit(%d, %ld): %s
\n
"
,
r
,
lim
,
strerror
(
errno
));
printf
(
"setrlimit(%d, %ld): %s
\n
"
,
r
,
lim
,
strerror
(
errno
));
return
-
1
;
return
-
1
;
}
}
...
...
commonlibrary/toolchain/libc-test/src/toolchaintest.cpp
浏览文件 @
4e70fd5d
/*
/* Copyright (C) 2022 Huawei Device Co., Ltd.
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -34,26 +33,26 @@ using namespace std;
...
@@ -34,26 +33,26 @@ using namespace std;
using
namespace
testing
::
ext
;
using
namespace
testing
::
ext
;
using
namespace
testing
;
using
namespace
testing
;
namespace
OHOS
{
namespace
OHOS
{
class
t
oolchaintest
:
public
::
testing
::
TestWithParam
<
string
>
{};
class
T
oolchaintest
:
public
::
testing
::
TestWithParam
<
string
>
{};
static
string
filepath
=
"/data/local/tmp/libc-test"
;
static
string
g_
filepath
=
"/data/local/tmp/libc-test"
;
static
vector
<
std
::
string
>
temp
=
runtest
::
GetFileNames
(
filepath
);
static
vector
<
std
::
string
>
temp
=
Runtest
::
GetFileNames
(
g_
filepath
);
volatile
int
t_s
tatus
=
0
;
volatile
int
g_tS
tatus
=
0
;
static
void
h
andler
(
int
sig
)
static
void
H
andler
(
int
sig
)
{
{
}
}
static
int
s
tart
(
const
char
*
argvs
)
static
int
S
tart
(
const
char
*
argvs
)
{
{
int
pid
,
space
_size
=
100
*
1024
;
int
pid
,
space
Size
=
100
*
1024
;
//Create a child process
//
Create a child process
//Set the process stack space
//
Set the process stack space
pid
=
fork
();
pid
=
fork
();
if
(
pid
==
0
)
{
if
(
pid
==
0
)
{
runtest
::
t_setrlim
(
RLIMIT_STACK
,
space_s
ize
);
Runtest
::
TSetrlim
(
RLIMIT_STACK
,
spaceS
ize
);
//Overloading the subprocess space
//
Overloading the subprocess space
int
exe
=
execl
(
argvs
,
"strptime"
,
nullptr
);
int
exe
=
execl
(
argvs
,
"strptime"
,
nullptr
);
printf
(
"exe:%d %s exec failed: %s
\n
"
,
exe
,
argvs
,
strerror
(
errno
));
printf
(
"exe:%d %s exec failed: %s
\n
"
,
exe
,
argvs
,
strerror
(
errno
));
exit
(
1
);
exit
(
1
);
...
@@ -61,33 +60,33 @@ static int start(const char *argvs)
...
@@ -61,33 +60,33 @@ static int start(const char *argvs)
return
pid
;
return
pid
;
}
}
static
int
r
unTests
(
const
char
*
argvs
)
static
int
R
unTests
(
const
char
*
argvs
)
{
{
int
timeoutsec
=
5
,
timeout
=
0
;
int
timeoutsec
=
5
,
timeout
=
0
;
int
status
,
pid
;
int
status
,
pid
;
sigset_t
set
;
sigset_t
set
;
void
(
*
retfunc
)(
int
);
void
(
*
retfunc
)(
int
);
//signal set
//
signal set
sigemptyset
(
&
set
);
sigemptyset
(
&
set
);
sigaddset
(
&
set
,
SIGCHLD
);
sigaddset
(
&
set
,
SIGCHLD
);
sigprocmask
(
SIG_BLOCK
,
&
set
,
nullptr
);
sigprocmask
(
SIG_BLOCK
,
&
set
,
nullptr
);
retfunc
=
signal
(
SIGCHLD
,
h
andler
);
retfunc
=
signal
(
SIGCHLD
,
H
andler
);
if
(
retfunc
==
SIG_ERR
)
{
if
(
retfunc
==
SIG_ERR
)
{
printf
(
"signal triggering failed:%s
\n
"
,
strerror
(
errno
));
printf
(
"signal triggering failed:%s
\n
"
,
strerror
(
errno
));
}
}
pid
=
s
tart
(
argvs
);
pid
=
S
tart
(
argvs
);
//The function system call failed
//
The function system call failed
if
(
pid
==
-
1
)
{
if
(
pid
==
-
1
)
{
printf
(
"%s fork failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"%s fork failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
return
-
1
;
return
-
1
;
}
}
struct
timespec
tp
;
struct
timespec
tp
;
//Maximum blocking time
//
Maximum blocking time
tp
.
tv_sec
=
timeoutsec
;
tp
.
tv_sec
=
timeoutsec
;
tp
.
tv_nsec
=
0
;
tp
.
tv_nsec
=
0
;
if
(
sigtimedwait
(
&
set
,
nullptr
,
&
tp
)
==
-
1
)
{
if
(
sigtimedwait
(
&
set
,
nullptr
,
&
tp
)
==
-
1
)
{
//Call it again
//
Call it again
if
(
errno
==
EAGAIN
)
{
if
(
errno
==
EAGAIN
)
{
timeout
=
1
;
timeout
=
1
;
}
else
{
}
else
{
...
@@ -97,16 +96,16 @@ static int runTests(const char *argvs)
...
@@ -97,16 +96,16 @@ static int runTests(const char *argvs)
printf
(
"%s kill failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"%s kill failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
}
}
}
}
//Waiting for the process to stop
//
Waiting for the process to stop
if
(
waitpid
(
pid
,
&
status
,
0
)
!=
pid
)
{
if
(
waitpid
(
pid
,
&
status
,
0
)
!=
pid
)
{
printf
(
"%s waitpid failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"%s waitpid failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
return
-
1
;
return
-
1
;
}
}
//Process state
//
Process state
if
(
WIFEXITED
(
status
))
{
//The right exit
if
(
WIFEXITED
(
status
))
{
//
The right exit
if
(
WEXITSTATUS
(
status
)
==
0
)
{
//operate successfully
if
(
WEXITSTATUS
(
status
)
==
0
)
{
//
operate successfully
return
t_s
tatus
;
return
g_tS
tatus
;
}
}
printf
(
"FAIL %s [status %d]
\n
"
,
argvs
,
WEXITSTATUS
(
status
));
printf
(
"FAIL %s [status %d]
\n
"
,
argvs
,
WEXITSTATUS
(
status
));
}
else
if
(
timeout
)
{
}
else
if
(
timeout
)
{
...
@@ -121,15 +120,15 @@ static int runTests(const char *argvs)
...
@@ -121,15 +120,15 @@ static int runTests(const char *argvs)
/**
/**
* @tc.name :
t
oolchaintest.LibcTest
* @tc.name :
T
oolchaintest.LibcTest
* @tc.desc : start test
* @tc.desc : start test
* @tc.level : Level 3
* @tc.level : Level 3
*/
*/
HWTEST_P
(
t
oolchaintest
,
LibcTest
,
Function
|
MediumTest
|
Level3
)
HWTEST_P
(
T
oolchaintest
,
LibcTest
,
Function
|
MediumTest
|
Level3
)
{
{
int
ret
;
int
ret
;
string
testName
=
GetParam
();
string
testName
=
GetParam
();
ret
=
r
unTests
(
testName
.
c_str
());
ret
=
R
unTests
(
testName
.
c_str
());
if
(
ret
==
0
)
{
if
(
ret
==
0
)
{
EXPECT_EQ
(
0
,
ret
)
<<
"test "
<<
testName
<<
" succeed"
<<
endl
;
EXPECT_EQ
(
0
,
ret
)
<<
"test "
<<
testName
<<
" succeed"
<<
endl
;
}
else
{
}
else
{
...
@@ -137,5 +136,5 @@ HWTEST_P(toolchaintest, LibcTest, Function | MediumTest | Level3)
...
@@ -137,5 +136,5 @@ HWTEST_P(toolchaintest, LibcTest, Function | MediumTest | Level3)
EXPECT_EQ
(
-
1
,
ret
)
<<
"test "
<<
testName
<<
" failed"
<<
endl
;
EXPECT_EQ
(
-
1
,
ret
)
<<
"test "
<<
testName
<<
" failed"
<<
endl
;
}
}
}
}
INSTANTIATE_TEST_SUITE_P
(
libcTest
,
t
oolchaintest
,
testing
::
ValuesIn
(
temp
.
begin
(),
temp
.
end
()));
INSTANTIATE_TEST_SUITE_P
(
libcTest
,
T
oolchaintest
,
testing
::
ValuesIn
(
temp
.
begin
(),
temp
.
end
()));
}
// namespace OHOS
}
// namespace OHOS
\ No newline at end of file
commonlibrary/toolchain/libc-test/tar_files.py
浏览文件 @
4e70fd5d
...
@@ -20,33 +20,38 @@ import argparse
...
@@ -20,33 +20,38 @@ import argparse
import
tarfile
import
tarfile
import
shutil
import
shutil
copyFileCounts
=
0
copy_file_counts
=
0
def
copyFiles
(
sourceDir
,
targetDir
):
global
copyFileCounts
def
copy_files
(
sourcedir
,
targetDir
):
for
f
in
os
.
listdir
(
sourceDir
):
global
copy_file_counts
sourceF
=
os
.
path
.
join
(
sourceDir
,
f
)
for
f
in
os
.
listdir
(
sourcedir
):
targetF
=
os
.
path
.
join
(
targetDir
,
f
)
source_f
=
os
.
path
.
join
(
sourcedir
,
f
)
if
not
os
.
path
.
isfile
(
sourceF
):
target_f
=
os
.
path
.
join
(
targetDir
,
f
)
if
os
.
path
.
isdir
(
sourceF
):
if
not
os
.
path
.
isfile
(
source_f
):
copyFiles
(
sourceF
,
targetF
)
if
os
.
path
.
isdir
(
source_f
):
elif
os
.
path
.
isfile
(
sourceF
):
copy_files
(
source_f
,
target_f
)
elif
os
.
path
.
isfile
(
source_f
):
if
os
.
path
.
exists
(
targetDir
):
if
os
.
path
.
exists
(
targetDir
):
copyFileCounts
+=
1
copy_file_counts
+=
1
open
(
targetF
,
"wb"
).
write
(
open
(
sourceF
,
"rb"
).
read
())
with
open
(
target_f
,
"wb"
)
as
fp
:
fp
.
write
(
open
(
source_f
,
"rb"
).
read
())
elif
not
os
.
path
.
exists
(
targetDir
):
elif
not
os
.
path
.
exists
(
targetDir
):
os
.
makedirs
(
targetDir
)
os
.
makedirs
(
targetDir
)
copyFileCounts
+=
1
copy_file_counts
+=
1
open
(
targetF
,
"wb"
).
write
(
open
(
sourceF
,
"rb"
).
read
())
with
open
(
target_f
,
"wb"
)
as
fp
:
fp
.
write
(
open
(
source_f
,
"rb"
).
read
())
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"
)
for
root
,
dir
,
files
in
os
.
walk
(
source_dir
):
for
root
,
dirs
,
files
in
os
.
walk
(
source_dir
):
for
file
in
files
:
for
file
in
files
:
pathfile
=
os
.
path
.
join
(
root
,
file
)
pathfile
=
os
.
path
.
join
(
root
,
file
)
tar
.
add
(
pathfile
)
tar
.
add
(
pathfile
)
tar
.
close
()
tar
.
close
()
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
(
description
=
'manual to this script'
)
parser
=
argparse
.
ArgumentParser
(
description
=
'manual to this script'
)
parser
.
add_argument
(
"--input_path"
,
type
=
str
,
default
=
"0"
)
parser
.
add_argument
(
"--input_path"
,
type
=
str
,
default
=
"0"
)
...
@@ -57,7 +62,7 @@ if __name__ == "__main__":
...
@@ -57,7 +62,7 @@ if __name__ == "__main__":
print
(
args
.
output_path
)
print
(
args
.
output_path
)
print
(
args
.
temp_path
)
print
(
args
.
temp_path
)
copy
F
iles
(
args
.
input_path
,
args
.
temp_path
)
copy
_f
iles
(
args
.
input_path
,
args
.
temp_path
)
make_targz_one_by_one
(
args
.
output_path
,
args
.
temp_path
)
make_targz_one_by_one
(
args
.
output_path
,
args
.
temp_path
)
shutil
.
rmtree
(
args
.
temp_path
)
#delete middle files
shutil
.
rmtree
(
args
.
temp_path
)
# delete middle files
\ No newline at end of file
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录