Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
e97d1a44
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e97d1a44
编写于
7月 29, 2022
作者:
F
FondMemoryVVV
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改toolchain目录tar_files.py文件
Signed-off-by:
N
FondMemoryVVV
<
mashuai53@huawei.com
>
上级
d5c96ba3
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
7 addition
and
926 deletion
+7
-926
.history/toolchain/libc-test/src/toolchaintest_20220722151310.cpp
.../toolchain/libc-test/src/toolchaintest_20220722151310.cpp
+0
-131
.history/toolchain/libc-test/src/toolchaintest_20220725110950.cpp
.../toolchain/libc-test/src/toolchaintest_20220725110950.cpp
+0
-131
.history/toolchain/libc-test/src/toolchaintest_20220725111203.cpp
.../toolchain/libc-test/src/toolchaintest_20220725111203.cpp
+0
-131
.history/toolchain/libc-test/src/toolchaintest_20220725111643.cpp
.../toolchain/libc-test/src/toolchaintest_20220725111643.cpp
+0
-131
.history/toolchain/libc-test/src/toolchaintest_20220725112418.cpp
.../toolchain/libc-test/src/toolchaintest_20220725112418.cpp
+0
-131
.history/toolchain/libc-test/src/toolchaintest_20220725112546.cpp
.../toolchain/libc-test/src/toolchaintest_20220725112546.cpp
+0
-131
.history/toolchain/libc-test/src/toolchaintest_20220725112551.cpp
.../toolchain/libc-test/src/toolchaintest_20220725112551.cpp
+0
-131
toolchain/BUILD.gn
toolchain/BUILD.gn
+0
-0
toolchain/libc-test/BUILD.gn
toolchain/libc-test/BUILD.gn
+0
-0
toolchain/libc-test/Test.json
toolchain/libc-test/Test.json
+0
-0
toolchain/libc-test/include/getfiles.cpp
toolchain/libc-test/include/getfiles.cpp
+0
-0
toolchain/libc-test/include/runtest.h
toolchain/libc-test/include/runtest.h
+0
-0
toolchain/libc-test/include/setrlim.cpp
toolchain/libc-test/include/setrlim.cpp
+0
-0
toolchain/libc-test/src/toolchaintest.cpp
toolchain/libc-test/src/toolchaintest.cpp
+0
-0
toolchain/libc-test/tar_files.py
toolchain/libc-test/tar_files.py
+7
-9
未找到文件。
.history/toolchain/libc-test/src/toolchaintest_20220722151310.cpp
已删除
100644 → 0
浏览文件 @
d5c96ba3
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cerrno>
#include <ctime>
#include <cstdio>
#include <vector>
#include <csignal>
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "gtest/gtest.h"
#include "runtest.h"
using
namespace
std
;
using
namespace
testing
::
ext
;
class
ToolChainTest
:
public
testing
::
Test
{};
volatile
int
t_status
=
0
;
static
void
handler
(
int
s
)
{
}
static
int
start
(
char
*
wrap
,
const
char
*
argvs
)
{
int
pid
,
space_size
=
100
*
1024
;
pid
=
fork
();
if
(
pid
==
0
)
{
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
);
}
return
pid
;
}
static
int
runtests
(
const
char
*
argvs
)
{
char
wrap
[]
=
""
;
int
timeoutsec
=
5
,
timeout
=
0
;
int
status
,
pid
;
sigset_t
set
;
void
(
*
retfunc
)(
int
);
sigemptyset
(
&
set
);
sigaddset
(
&
set
,
SIGCHLD
);
sigprocmask
(
SIG_BLOCK
,
&
set
,
nullptr
);
retfunc
=
signal
(
SIGCHLD
,
handler
);
if
(
retfunc
==
SIG_ERR
)
{
printf
(
"signal triggering failed:%s
\n
"
,
strerror
(
errno
));
}
pid
=
start
(
wrap
,
argvs
);
if
(
pid
==
-
1
)
{
printf
(
"%s fork failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
return
-
1
;
}
struct
timespec
tp
;
tp
.
tv_sec
=
timeoutsec
;
tp
.
tv_nsec
=
0
;
if
(
sigtimedwait
(
&
set
,
nullptr
,
&
tp
)
==
-
1
)
{
if
(
errno
==
EAGAIN
)
{
timeout
=
1
;
}
else
{
printf
(
"%s sigtimedwait failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
}
if
(
kill
(
pid
,
SIGKILL
)
==
-
1
)
{
printf
(
"%s kill failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
}
}
if
(
waitpid
(
pid
,
&
status
,
0
)
!=
pid
)
{
printf
(
"%s waitpid failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
return
-
1
;
}
if
(
WIFEXITED
(
status
))
{
if
(
WEXITSTATUS
(
status
)
==
0
)
{
return
t_status
;
}
printf
(
"FAIL %s [status %d]
\n
"
,
argvs
,
WEXITSTATUS
(
status
));
}
else
if
(
timeout
)
{
printf
(
"FAIL %s [timed out]
\n
"
,
argvs
);
}
else
if
(
WIFSIGNALED
(
status
))
{
printf
(
"FAIL %s [signal %s]
\n
"
,
argvs
,
strsignal
(
WTERMSIG
(
status
)));
}
else
{
printf
(
"FAIL %s [unknown]
\n
"
,
argvs
);
}
return
1
;
}
/**
* @tc.name : ToolChainTest.LibcTest
* @tc.desc : start test
* @tc.level : Level 2
*/
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
;
}
}
.history/toolchain/libc-test/src/toolchaintest_20220725110950.cpp
已删除
100644 → 0
浏览文件 @
d5c96ba3
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cerrno>
#include <ctime>
#include <cstdio>
#include <vector>
#include <csignal>
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "gtest/gtest.h"
#include "runtest.h"
using
namespace
std
;
using
namespace
testing
::
ext
;
class
toolchaintest
:
public
testing
::
Test
{};
volatile
int
t_status
=
0
;
static
void
handler
(
int
s
)
{
}
static
int
start
(
char
*
wrap
,
const
char
*
argvs
)
{
int
pid
,
space_size
=
100
*
1024
;
pid
=
fork
();
if
(
pid
==
0
)
{
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
);
}
return
pid
;
}
static
int
runtests
(
const
char
*
argvs
)
{
char
wrap
[]
=
""
;
int
timeoutsec
=
5
,
timeout
=
0
;
int
status
,
pid
;
sigset_t
set
;
void
(
*
retfunc
)(
int
);
sigemptyset
(
&
set
);
sigaddset
(
&
set
,
SIGCHLD
);
sigprocmask
(
SIG_BLOCK
,
&
set
,
nullptr
);
retfunc
=
signal
(
SIGCHLD
,
handler
);
if
(
retfunc
==
SIG_ERR
)
{
printf
(
"signal triggering failed:%s
\n
"
,
strerror
(
errno
));
}
pid
=
start
(
wrap
,
argvs
);
if
(
pid
==
-
1
)
{
printf
(
"%s fork failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
return
-
1
;
}
struct
timespec
tp
;
tp
.
tv_sec
=
timeoutsec
;
tp
.
tv_nsec
=
0
;
if
(
sigtimedwait
(
&
set
,
nullptr
,
&
tp
)
==
-
1
)
{
if
(
errno
==
EAGAIN
)
{
timeout
=
1
;
}
else
{
printf
(
"%s sigtimedwait failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
}
if
(
kill
(
pid
,
SIGKILL
)
==
-
1
)
{
printf
(
"%s kill failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
}
}
if
(
waitpid
(
pid
,
&
status
,
0
)
!=
pid
)
{
printf
(
"%s waitpid failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
return
-
1
;
}
if
(
WIFEXITED
(
status
))
{
if
(
WEXITSTATUS
(
status
)
==
0
)
{
return
t_status
;
}
printf
(
"FAIL %s [status %d]
\n
"
,
argvs
,
WEXITSTATUS
(
status
));
}
else
if
(
timeout
)
{
printf
(
"FAIL %s [timed out]
\n
"
,
argvs
);
}
else
if
(
WIFSIGNALED
(
status
))
{
printf
(
"FAIL %s [signal %s]
\n
"
,
argvs
,
strsignal
(
WTERMSIG
(
status
)));
}
else
{
printf
(
"FAIL %s [unknown]
\n
"
,
argvs
);
}
return
1
;
}
/**
* @tc.name : toolchaintest.LibcTest
* @tc.desc : start test
* @tc.level : Level 2
*/
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
;
}
}
.history/toolchain/libc-test/src/toolchaintest_20220725111203.cpp
已删除
100644 → 0
浏览文件 @
d5c96ba3
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cerrno>
#include <ctime>
#include <cstdio>
#include <vector>
#include <csignal>
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "gtest/gtest.h"
#include "runtest.h"
using
namespace
std
;
using
namespace
testing
::
ext
;
class
toolchaintest
:
public
testing
::
Test
{};
volatile
int
t_status
=
0
;
static
void
handler
(
int
s
)
{
}
static
int
start
(
char
*
wrap
,
const
char
*
argvs
)
{
int
pid
,
space_size
=
100
*
1024
;
pid
=
fork
();
if
(
pid
==
0
)
{
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
);
}
return
pid
;
}
static
int
runtests
(
const
char
*
argvs
)
{
char
wrap
[]
=
""
;
int
timeoutsec
=
5
,
timeout
=
0
;
int
status
,
pid
;
sigset_t
set
;
void
(
*
retfunc
)(
int
);
sigemptyset
(
&
set
);
sigaddset
(
&
set
,
SIGCHLD
);
sigprocmask
(
SIG_BLOCK
,
&
set
,
nullptr
);
retfunc
=
signal
(
SIGCHLD
,
handler
);
if
(
retfunc
==
SIG_ERR
)
{
printf
(
"signal triggering failed:%s
\n
"
,
strerror
(
errno
));
}
pid
=
start
(
wrap
,
argvs
);
if
(
pid
==
-
1
)
{
printf
(
"%s fork failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
return
-
1
;
}
struct
timespec
tp
;
tp
.
tv_sec
=
timeoutsec
;
tp
.
tv_nsec
=
0
;
if
(
sigtimedwait
(
&
set
,
nullptr
,
&
tp
)
==
-
1
)
{
if
(
errno
==
EAGAIN
)
{
timeout
=
1
;
}
else
{
printf
(
"%s sigtimedwait failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
}
if
(
kill
(
pid
,
SIGKILL
)
==
-
1
)
{
printf
(
"%s kill failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
}
}
if
(
waitpid
(
pid
,
&
status
,
0
)
!=
pid
)
{
printf
(
"%s waitpid failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
return
-
1
;
}
if
(
WIFEXITED
(
status
))
{
if
(
WEXITSTATUS
(
status
)
==
0
)
{
return
t_status
;
}
printf
(
"FAIL %s [status %d]
\n
"
,
argvs
,
WEXITSTATUS
(
status
));
}
else
if
(
timeout
)
{
printf
(
"FAIL %s [timed out]
\n
"
,
argvs
);
}
else
if
(
WIFSIGNALED
(
status
))
{
printf
(
"FAIL %s [signal %s]
\n
"
,
argvs
,
strsignal
(
WTERMSIG
(
status
)));
}
else
{
printf
(
"FAIL %s [unknown]
\n
"
,
argvs
);
}
return
1
;
}
/**
* @tc.name : toolchaintest.LibcTest
* @tc.desc : start test
* @tc.level : Level 2
*/
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
;
}
}
.history/toolchain/libc-test/src/toolchaintest_20220725111643.cpp
已删除
100644 → 0
浏览文件 @
d5c96ba3
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cerrno>
#include <ctime>
#include <cstdio>
#include <vector>
#include <csignal>
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "gtest/gtest.h"
#include "runtest.h"
using
namespace
std
;
using
namespace
testing
::
ext
;
class
toolchaintest
:
public
testing
::
Test
{};
volatile
int
t_status
=
0
;
static
void
handler
(
int
s
)
{
}
static
int
start
(
char
*
wrap
,
const
char
*
argvs
)
{
int
pid
,
space_size
=
100
*
1024
;
pid
=
fork
();
if
(
pid
==
0
)
{
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
);
}
return
pid
;
}
static
int
runtests
(
const
char
*
argvs
)
{
char
wrap
[]
=
""
;
int
timeoutsec
=
5
,
timeout
=
0
;
int
status
,
pid
;
sigset_t
set
;
void
(
*
retfunc
)(
int
);
sigemptyset
(
&
set
);
sigaddset
(
&
set
,
SIGCHLD
);
sigprocmask
(
SIG_BLOCK
,
&
set
,
nullptr
);
retfunc
=
signal
(
SIGCHLD
,
handler
);
if
(
retfunc
==
(
int
)
SIG_ERR
)
{
printf
(
"signal triggering failed:%s
\n
"
,
strerror
(
errno
));
}
pid
=
start
(
wrap
,
argvs
);
if
(
pid
==
-
1
)
{
printf
(
"%s fork failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
return
-
1
;
}
struct
timespec
tp
;
tp
.
tv_sec
=
timeoutsec
;
tp
.
tv_nsec
=
0
;
if
(
sigtimedwait
(
&
set
,
nullptr
,
&
tp
)
==
-
1
)
{
if
(
errno
==
EAGAIN
)
{
timeout
=
1
;
}
else
{
printf
(
"%s sigtimedwait failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
}
if
(
kill
(
pid
,
SIGKILL
)
==
-
1
)
{
printf
(
"%s kill failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
}
}
if
(
waitpid
(
pid
,
&
status
,
0
)
!=
pid
)
{
printf
(
"%s waitpid failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
return
-
1
;
}
if
(
WIFEXITED
(
status
))
{
if
(
WEXITSTATUS
(
status
)
==
0
)
{
return
t_status
;
}
printf
(
"FAIL %s [status %d]
\n
"
,
argvs
,
WEXITSTATUS
(
status
));
}
else
if
(
timeout
)
{
printf
(
"FAIL %s [timed out]
\n
"
,
argvs
);
}
else
if
(
WIFSIGNALED
(
status
))
{
printf
(
"FAIL %s [signal %s]
\n
"
,
argvs
,
strsignal
(
WTERMSIG
(
status
)));
}
else
{
printf
(
"FAIL %s [unknown]
\n
"
,
argvs
);
}
return
1
;
}
/**
* @tc.name : toolchaintest.LibcTest
* @tc.desc : start test
* @tc.level : Level 2
*/
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
;
}
}
.history/toolchain/libc-test/src/toolchaintest_20220725112418.cpp
已删除
100644 → 0
浏览文件 @
d5c96ba3
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cerrno>
#include <ctime>
#include <cstdio>
#include <vector>
#include <csignal>
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "gtest/gtest.h"
#include "runtest.h"
using
namespace
std
;
using
namespace
testing
::
ext
;
class
toolchaintest
:
public
testing
::
Test
{};
volatile
int
t_status
=
0
;
static
void
handler
(
int
s
)
{
}
static
int
start
(
char
*
wrap
,
const
char
*
argvs
)
{
int
pid
,
space_size
=
100
*
1024
;
pid
=
fork
();
if
(
pid
==
0
)
{
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
);
}
return
pid
;
}
static
int
runtests
(
const
char
*
argvs
)
{
char
wrap
[]
=
""
;
int
timeoutsec
=
5
,
timeout
=
0
;
int
status
,
pid
;
sigset_t
set
;
void
(
*
retfunc
)(
int
);
sigemptyset
(
&
set
);
sigaddset
(
&
set
,
SIGCHLD
);
sigprocmask
(
SIG_BLOCK
,
&
set
,
nullptr
);
retfunc
=
signal
(
SIGCHLD
,
handler
);
if
(
retfunc
==
int
(
SIG_ERR
))
{
printf
(
"signal triggering failed:%s
\n
"
,
strerror
(
errno
));
}
pid
=
start
(
wrap
,
argvs
);
if
(
pid
==
-
1
)
{
printf
(
"%s fork failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
return
-
1
;
}
struct
timespec
tp
;
tp
.
tv_sec
=
timeoutsec
;
tp
.
tv_nsec
=
0
;
if
(
sigtimedwait
(
&
set
,
nullptr
,
&
tp
)
==
-
1
)
{
if
(
errno
==
EAGAIN
)
{
timeout
=
1
;
}
else
{
printf
(
"%s sigtimedwait failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
}
if
(
kill
(
pid
,
SIGKILL
)
==
-
1
)
{
printf
(
"%s kill failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
}
}
if
(
waitpid
(
pid
,
&
status
,
0
)
!=
pid
)
{
printf
(
"%s waitpid failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
return
-
1
;
}
if
(
WIFEXITED
(
status
))
{
if
(
WEXITSTATUS
(
status
)
==
0
)
{
return
t_status
;
}
printf
(
"FAIL %s [status %d]
\n
"
,
argvs
,
WEXITSTATUS
(
status
));
}
else
if
(
timeout
)
{
printf
(
"FAIL %s [timed out]
\n
"
,
argvs
);
}
else
if
(
WIFSIGNALED
(
status
))
{
printf
(
"FAIL %s [signal %s]
\n
"
,
argvs
,
strsignal
(
WTERMSIG
(
status
)));
}
else
{
printf
(
"FAIL %s [unknown]
\n
"
,
argvs
);
}
return
1
;
}
/**
* @tc.name : toolchaintest.LibcTest
* @tc.desc : start test
* @tc.level : Level 2
*/
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
;
}
}
.history/toolchain/libc-test/src/toolchaintest_20220725112546.cpp
已删除
100644 → 0
浏览文件 @
d5c96ba3
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cerrno>
#include <ctime>
#include <cstdio>
#include <vector>
#include <csignal>
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "gtest/gtest.h"
#include "runtest.h"
using
namespace
std
;
using
namespace
testing
::
ext
;
class
toolchaintest
:
public
testing
::
Test
{};
volatile
int
t_status
=
0
;
static
void
handler
(
int
s
)
{
}
static
int
start
(
char
*
wrap
,
const
char
*
argvs
)
{
int
pid
,
space_size
=
100
*
1024
;
pid
=
fork
();
if
(
pid
==
0
)
{
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
);
}
return
pid
;
}
static
int
runtests
(
const
char
*
argvs
)
{
char
wrap
[]
=
""
;
int
timeoutsec
=
5
,
timeout
=
0
;
int
status
,
pid
;
sigset_t
set
;
void
(
*
retfunc
)(
int
);
sigemptyset
(
&
set
);
sigaddset
(
&
set
,
SIGCHLD
);
sigprocmask
(
SIG_BLOCK
,
&
set
,
nullptr
);
retfunc
=
signal
(
SIGCHLD
,
handler
);
if
(
retfunc
==
int
(
SIG_ERR
))
{
printf
(
"signal triggering failed:%s
\n
"
,
strerror
(
errno
));
}
pid
=
start
(
wrap
,
argvs
);
if
(
pid
==
-
1
)
{
printf
(
"%s fork failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
return
-
1
;
}
struct
timespec
tp
;
tp
.
tv_sec
=
timeoutsec
;
tp
.
tv_nsec
=
0
;
if
(
sigtimedwait
(
&
set
,
nullptr
,
&
tp
)
==
-
1
)
{
if
(
errno
==
EAGAIN
)
{
timeout
=
1
;
}
else
{
printf
(
"%s sigtimedwait failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
}
if
(
kill
(
pid
,
SIGKILL
)
==
-
1
)
{
printf
(
"%s kill failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
}
}
if
(
waitpid
(
pid
,
&
status
,
0
)
!=
pid
)
{
printf
(
"%s waitpid failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
return
-
1
;
}
if
(
WIFEXITED
(
status
))
{
if
(
WEXITSTATUS
(
status
)
==
0
)
{
return
t_status
;
}
printf
(
"FAIL %s [status %d]
\n
"
,
argvs
,
WEXITSTATUS
(
status
));
}
else
if
(
timeout
)
{
printf
(
"FAIL %s [timed out]
\n
"
,
argvs
);
}
else
if
(
WIFSIGNALED
(
status
))
{
printf
(
"FAIL %s [signal %s]
\n
"
,
argvs
,
strsignal
(
WTERMSIG
(
status
)));
}
else
{
printf
(
"FAIL %s [unknown]
\n
"
,
argvs
);
}
return
1
;
}
/**
* @tc.name : toolchaintest.LibcTest
* @tc.desc : start test
* @tc.level : Level 2
*/
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
;
}
}
.history/toolchain/libc-test/src/toolchaintest_20220725112551.cpp
已删除
100644 → 0
浏览文件 @
d5c96ba3
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cerrno>
#include <ctime>
#include <cstdio>
#include <vector>
#include <csignal>
#include <unistd.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "gtest/gtest.h"
#include "runtest.h"
using
namespace
std
;
using
namespace
testing
::
ext
;
class
toolchaintest
:
public
testing
::
Test
{};
volatile
int
t_status
=
0
;
static
void
handler
(
int
s
)
{
}
static
int
start
(
char
*
wrap
,
const
char
*
argvs
)
{
int
pid
,
space_size
=
100
*
1024
;
pid
=
fork
();
if
(
pid
==
0
)
{
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
);
}
return
pid
;
}
static
int
runtests
(
const
char
*
argvs
)
{
char
wrap
[]
=
""
;
int
timeoutsec
=
5
,
timeout
=
0
;
int
status
,
pid
;
sigset_t
set
;
void
(
*
retfunc
)(
int
);
sigemptyset
(
&
set
);
sigaddset
(
&
set
,
SIGCHLD
);
sigprocmask
(
SIG_BLOCK
,
&
set
,
nullptr
);
retfunc
=
signal
(
SIGCHLD
,
handler
);
if
(
retfunc
==
int
(
SIG_ERR
))
{
printf
(
"signal triggering failed:%s
\n
"
,
strerror
(
errno
));
}
pid
=
start
(
wrap
,
argvs
);
if
(
pid
==
-
1
)
{
printf
(
"%s fork failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
return
-
1
;
}
struct
timespec
tp
;
tp
.
tv_sec
=
timeoutsec
;
tp
.
tv_nsec
=
0
;
if
(
sigtimedwait
(
&
set
,
nullptr
,
&
tp
)
==
-
1
)
{
if
(
errno
==
EAGAIN
)
{
timeout
=
1
;
}
else
{
printf
(
"%s sigtimedwait failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
}
if
(
kill
(
pid
,
SIGKILL
)
==
-
1
)
{
printf
(
"%s kill failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
}
}
if
(
waitpid
(
pid
,
&
status
,
0
)
!=
pid
)
{
printf
(
"%s waitpid failed: %s
\n
"
,
argvs
,
strerror
(
errno
));
printf
(
"FAIL %s [internal]
\n
"
,
argvs
);
return
-
1
;
}
if
(
WIFEXITED
(
status
))
{
if
(
WEXITSTATUS
(
status
)
==
0
)
{
return
t_status
;
}
printf
(
"FAIL %s [status %d]
\n
"
,
argvs
,
WEXITSTATUS
(
status
));
}
else
if
(
timeout
)
{
printf
(
"FAIL %s [timed out]
\n
"
,
argvs
);
}
else
if
(
WIFSIGNALED
(
status
))
{
printf
(
"FAIL %s [signal %s]
\n
"
,
argvs
,
strsignal
(
WTERMSIG
(
status
)));
}
else
{
printf
(
"FAIL %s [unknown]
\n
"
,
argvs
);
}
return
1
;
}
/**
* @tc.name : toolchaintest.LibcTest
* @tc.desc : start test
* @tc.level : Level 2
*/
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
;
}
}
commonlibrary/ets_utils/
toolchain/BUILD.gn
→
toolchain/BUILD.gn
浏览文件 @
e97d1a44
文件已移动
commonlibrary/ets_utils/
toolchain/libc-test/BUILD.gn
→
toolchain/libc-test/BUILD.gn
浏览文件 @
e97d1a44
文件已移动
commonlibrary/ets_utils/
toolchain/libc-test/Test.json
→
toolchain/libc-test/Test.json
浏览文件 @
e97d1a44
文件已移动
commonlibrary/ets_utils/
toolchain/libc-test/include/getfiles.cpp
→
toolchain/libc-test/include/getfiles.cpp
浏览文件 @
e97d1a44
文件已移动
commonlibrary/ets_utils/
toolchain/libc-test/include/runtest.h
→
toolchain/libc-test/include/runtest.h
浏览文件 @
e97d1a44
文件已移动
commonlibrary/ets_utils/
toolchain/libc-test/include/setrlim.cpp
→
toolchain/libc-test/include/setrlim.cpp
浏览文件 @
e97d1a44
文件已移动
commonlibrary/ets_utils/
toolchain/libc-test/src/toolchaintest.cpp
→
toolchain/libc-test/src/toolchaintest.cpp
浏览文件 @
e97d1a44
文件已移动
commonlibrary/ets_utils/
toolchain/libc-test/tar_files.py
→
toolchain/libc-test/tar_files.py
浏览文件 @
e97d1a44
...
...
@@ -24,19 +24,17 @@ import shutil
copyFileCounts
=
0
def
copyFiles
(
sourceDir
,
targetDir
):
global
copyFileCounts
def
copy_files
(
sourceDir
,
targetDir
):
for
f
in
os
.
listdir
(
sourceDir
):
source
F
=
os
.
path
.
join
(
sourceDir
,
f
)
target
F
=
os
.
path
.
join
(
targetDir
,
f
)
if
os
.
path
.
isfile
(
source
F
):
source
_files
=
os
.
path
.
join
(
sourceDir
,
f
)
target
_files
=
os
.
path
.
join
(
targetDir
,
f
)
if
os
.
path
.
isfile
(
source
_files
):
if
not
os
.
path
.
exists
(
targetDir
):
os
.
makedirs
(
targetDir
)
copyFileCounts
+=
1
if
not
os
.
path
.
exists
(
targetF
)
or
(
os
.
path
.
exists
(
targetF
)
and
(
os
.
path
.
getsize
(
targetF
)
!=
os
.
path
.
getsize
(
sourceF
))):
open
(
targetF
,
"wb"
).
write
(
open
(
sourceF
,
"rb"
).
read
())
if
os
.
path
.
isdir
(
sourceF
):
copyFiles
(
sourceF
,
targetF
)
open
(
target_files
,
"wb"
).
write
(
open
(
source_files
,
"rb"
).
read
())
if
os
.
path
.
isdir
(
source_files
):
copy_files
(
source_files
,
target_files
)
def
make_targz_one_by_one
(
output_filename
,
source_dir
):
tar
=
tarfile
.
open
(
output_filename
,
"w"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录