Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
e9e4016d
T
Third Party Musl
项目概览
OpenHarmony
/
Third Party Musl
接近 2 年 前同步成功
通知
37
Star
125
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Musl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
e9e4016d
编写于
11月 29, 2022
作者:
D
dhy308
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add fault tolerant for getcwd()
Issue: I63QQ9 Test: libc-test pass Signed-off-by:
N
dhy308
<
tony.gan@huawei.com
>
上级
12c45ec0
变更
44
隐藏空白更改
内联
并排
Showing
44 changed file
with
376 addition
and
0 deletion
+376
-0
libc-test/src/functionalext/supplement/dirent/readdir_r.c
libc-test/src/functionalext/supplement/dirent/readdir_r.c
+4
-0
libc-test/src/functionalext/supplement/dirent/rewinddir.c
libc-test/src/functionalext/supplement/dirent/rewinddir.c
+5
-0
libc-test/src/functionalext/supplement/dirent/scandir.c
libc-test/src/functionalext/supplement/dirent/scandir.c
+15
-0
libc-test/src/functionalext/supplement/ipc/ftok.c
libc-test/src/functionalext/supplement/ipc/ftok.c
+4
-0
libc-test/src/functionalext/supplement/ipc/semtimedop.c
libc-test/src/functionalext/supplement/ipc/semtimedop.c
+4
-0
libc-test/src/functionalext/supplement/linux/copy_file_range.c
...test/src/functionalext/supplement/linux/copy_file_range.c
+16
-0
libc-test/src/functionalext/supplement/linux/removexattr.c
libc-test/src/functionalext/supplement/linux/removexattr.c
+4
-0
libc-test/src/functionalext/supplement/linux/sendfile.c
libc-test/src/functionalext/supplement/linux/sendfile.c
+8
-0
libc-test/src/functionalext/supplement/linux/setxattr.c
libc-test/src/functionalext/supplement/linux/setxattr.c
+4
-0
libc-test/src/functionalext/supplement/linux/splice.c
libc-test/src/functionalext/supplement/linux/splice.c
+8
-0
libc-test/src/functionalext/supplement/linux/swapoff.c
libc-test/src/functionalext/supplement/linux/swapoff.c
+4
-0
libc-test/src/functionalext/supplement/linux/swapon.c
libc-test/src/functionalext/supplement/linux/swapon.c
+4
-0
libc-test/src/functionalext/supplement/linux/sync_file_range.c
...test/src/functionalext/supplement/linux/sync_file_range.c
+12
-0
libc-test/src/functionalext/supplement/linux/syncfs.c
libc-test/src/functionalext/supplement/linux/syncfs.c
+4
-0
libc-test/src/functionalext/supplement/linux/tee.c
libc-test/src/functionalext/supplement/linux/tee.c
+4
-0
libc-test/src/functionalext/supplement/mman/mincore.c
libc-test/src/functionalext/supplement/mman/mincore.c
+4
-0
libc-test/src/functionalext/supplement/stat/fchmodat.c
libc-test/src/functionalext/supplement/stat/fchmodat.c
+8
-0
libc-test/src/functionalext/supplement/stat/fstatat.c
libc-test/src/functionalext/supplement/stat/fstatat.c
+4
-0
libc-test/src/functionalext/supplement/stat/lstat.c
libc-test/src/functionalext/supplement/stat/lstat.c
+16
-0
libc-test/src/functionalext/supplement/stat/mknod.c
libc-test/src/functionalext/supplement/stat/mknod.c
+4
-0
libc-test/src/functionalext/supplement/stat/utimensat.c
libc-test/src/functionalext/supplement/stat/utimensat.c
+8
-0
libc-test/src/functionalext/supplement/stdio/__fwritable.c
libc-test/src/functionalext/supplement/stdio/__fwritable.c
+8
-0
libc-test/src/functionalext/supplement/stdio/__fwriting.c
libc-test/src/functionalext/supplement/stdio/__fwriting.c
+12
-0
libc-test/src/functionalext/supplement/stdio/fputc.c
libc-test/src/functionalext/supplement/stdio/fputc.c
+8
-0
libc-test/src/functionalext/supplement/stdio/freopen.c
libc-test/src/functionalext/supplement/stdio/freopen.c
+4
-0
libc-test/src/functionalext/supplement/stdio/getline.c
libc-test/src/functionalext/supplement/stdio/getline.c
+12
-0
libc-test/src/functionalext/supplement/stdio/setbuf.c
libc-test/src/functionalext/supplement/stdio/setbuf.c
+8
-0
libc-test/src/functionalext/supplement/stdio/setbuffer.c
libc-test/src/functionalext/supplement/stdio/setbuffer.c
+8
-0
libc-test/src/functionalext/supplement/stdio/setlinebuf.c
libc-test/src/functionalext/supplement/stdio/setlinebuf.c
+4
-0
libc-test/src/functionalext/supplement/stdio/setvbuf.c
libc-test/src/functionalext/supplement/stdio/setvbuf.c
+8
-0
libc-test/src/functionalext/supplement/stdio/ungetwc.c
libc-test/src/functionalext/supplement/stdio/ungetwc.c
+4
-0
libc-test/src/functionalext/supplement/stdio/vfscanf.c
libc-test/src/functionalext/supplement/stdio/vfscanf.c
+12
-0
libc-test/src/functionalext/supplement/unistd/acct.c
libc-test/src/functionalext/supplement/unistd/acct.c
+4
-0
libc-test/src/functionalext/supplement/unistd/exit.c
libc-test/src/functionalext/supplement/unistd/exit.c
+8
-0
libc-test/src/functionalext/supplement/unistd/faccessat.c
libc-test/src/functionalext/supplement/unistd/faccessat.c
+44
-0
libc-test/src/functionalext/supplement/unistd/fchownat.c
libc-test/src/functionalext/supplement/unistd/fchownat.c
+8
-0
libc-test/src/functionalext/supplement/unistd/getpid.c
libc-test/src/functionalext/supplement/unistd/getpid.c
+4
-0
libc-test/src/functionalext/supplement/unistd/lchown.c
libc-test/src/functionalext/supplement/unistd/lchown.c
+4
-0
libc-test/src/functionalext/supplement/unistd/readlinkat.c
libc-test/src/functionalext/supplement/unistd/readlinkat.c
+20
-0
libc-test/src/functionalext/supplement/unistd/readv.c
libc-test/src/functionalext/supplement/unistd/readv.c
+4
-0
libc-test/src/functionalext/supplement/unistd/truncate.c
libc-test/src/functionalext/supplement/unistd/truncate.c
+12
-0
libc-test/src/functionalext/supplement/unistd/unlink.c
libc-test/src/functionalext/supplement/unistd/unlink.c
+8
-0
libc-test/src/functionalext/supplement/unistd/unlinkat.c
libc-test/src/functionalext/supplement/unistd/unlinkat.c
+8
-0
libc-test/src/functionalext/supplement/unistd/write.c
libc-test/src/functionalext/supplement/unistd/write.c
+20
-0
未找到文件。
libc-test/src/functionalext/supplement/dirent/readdir_r.c
浏览文件 @
e9e4016d
...
...
@@ -33,6 +33,10 @@ void readdir_r_0100(void)
{
char
name
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
name
,
sizeof
(
name
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
DIR
*
dir
=
opendir
(
name
);
if
(
dir
==
NULL
)
{
t_error
(
"%s failed: opendir. name = %s
\n
"
,
__func__
,
name
);
...
...
libc-test/src/functionalext/supplement/dirent/rewinddir.c
浏览文件 @
e9e4016d
...
...
@@ -34,6 +34,11 @@ void rewinddir_0100(void)
{
char
name
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
name
,
sizeof
(
name
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
DIR
*
dir
=
opendir
(
name
);
if
(
dir
==
NULL
)
{
t_error
(
"%s failed: opendir. name = %s
\n
"
,
__func__
,
name
);
...
...
libc-test/src/functionalext/supplement/dirent/scandir.c
浏览文件 @
e9e4016d
...
...
@@ -33,6 +33,11 @@ void scandir_0100(void)
struct
dirent
**
namelist
;
char
name
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
name
,
sizeof
(
name
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
int
n
=
scandir
(
name
,
&
namelist
,
NULL
,
alphasort
);
if
(
n
<
0
)
{
t_error
(
"%s failed: scandir. n = %d
\n
"
,
__func__
,
n
);
...
...
@@ -55,6 +60,11 @@ void scandir_0200(void)
struct
dirent
**
namelist
;
char
name
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
name
,
sizeof
(
name
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
int
n
=
scandir
(
name
,
&
namelist
,
NULL
,
versionsort
);
if
(
n
<
0
)
{
t_error
(
"%s failed: scandir. n = %d
\n
"
,
__func__
,
n
);
...
...
@@ -77,6 +87,11 @@ void scandir_0300(void)
struct
dirent
**
namelist
;
char
name
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
name
,
sizeof
(
name
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
int
n
=
scandir
(
name
,
&
namelist
,
filter
,
versionsort
);
if
(
n
<
0
)
{
t_error
(
"%s failed: scandir. n = %d
\n
"
,
__func__
,
n
);
...
...
libc-test/src/functionalext/supplement/ipc/ftok.c
浏览文件 @
e9e4016d
...
...
@@ -25,6 +25,10 @@ void ftok_0100(void)
{
char
dir_path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
dir_path
,
sizeof
(
dir_path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
dir_path
,
"/ftok"
);
key_t
result
=
ftok
(
dir_path
,
1
);
EXPECT_NE
(
"ftok_0100"
,
result
,
-
1
);
...
...
libc-test/src/functionalext/supplement/ipc/semtimedop.c
浏览文件 @
e9e4016d
...
...
@@ -31,6 +31,10 @@ void semtimedop_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
int
fd
=
open
(
path
,
O_RDWR
|
O_CREAT
);
...
...
libc-test/src/functionalext/supplement/linux/copy_file_range.c
浏览文件 @
e9e4016d
...
...
@@ -34,7 +34,15 @@ void copy_file_range_0100(void)
char
path_in
[
128
]
=
{
0
};
char
path_out
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path_in
,
sizeof
(
path_in
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd path_in failed
\n
"
,
__func__
);
return
;
}
cwd
=
getcwd
(
path_out
,
sizeof
(
path_out
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd path_out failed
\n
"
,
__func__
);
return
;
}
strcat
(
path_in
,
"/file_in.txt"
);
strcat
(
path_out
,
"/file_out.txt"
);
...
...
@@ -115,7 +123,15 @@ void copy_file_range_0300(void)
char
path_in
[
128
]
=
{
0
};
char
path_out
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path_in
,
sizeof
(
path_in
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd path_in failed
\n
"
,
__func__
);
return
;
}
cwd
=
getcwd
(
path_out
,
sizeof
(
path_out
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd path_out failed
\n
"
,
__func__
);
return
;
}
strcat
(
path_in
,
"/file_in.txt"
);
strcat
(
path_out
,
"/file_out.txt"
);
...
...
libc-test/src/functionalext/supplement/linux/removexattr.c
浏览文件 @
e9e4016d
...
...
@@ -33,6 +33,10 @@ void removexattr_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
int
fd
=
open
(
path
,
O_RDWR
|
O_CREAT
);
...
...
libc-test/src/functionalext/supplement/linux/sendfile.c
浏览文件 @
e9e4016d
...
...
@@ -31,7 +31,15 @@ void sendfile_0100(void)
char
fromfile
[
128
]
=
{
0
};
char
tofile
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
fromfile
,
sizeof
(
fromfile
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd fromfile failed
\n
"
,
__func__
);
return
;
}
cwd
=
getcwd
(
tofile
,
sizeof
(
tofile
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd tofile failed
\n
"
,
__func__
);
return
;
}
strcat
(
fromfile
,
"/fromfile.txt"
);
strcat
(
tofile
,
"/tofile.txt"
);
...
...
libc-test/src/functionalext/supplement/linux/setxattr.c
浏览文件 @
e9e4016d
...
...
@@ -33,6 +33,10 @@ void setxattr_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
int
fd
=
open
(
path
,
O_RDWR
|
O_CREAT
);
...
...
libc-test/src/functionalext/supplement/linux/splice.c
浏览文件 @
e9e4016d
...
...
@@ -33,7 +33,15 @@ void splice_0100(void)
char
fromfile
[
128
]
=
{
0
};
char
tofile
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
fromfile
,
sizeof
(
fromfile
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd fromfile failed
\n
"
,
__func__
);
return
;
}
cwd
=
getcwd
(
tofile
,
sizeof
(
tofile
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd tofile failed
\n
"
,
__func__
);
return
;
}
strcat
(
fromfile
,
"/fromfile.txt"
);
strcat
(
tofile
,
"/tofile.txt"
);
...
...
libc-test/src/functionalext/supplement/linux/swapoff.c
浏览文件 @
e9e4016d
...
...
@@ -29,6 +29,10 @@ void swapoff_0100(void)
{
char
dir_path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
dir_path
,
sizeof
(
dir_path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
errno
=
0
;
char
cmd
[
256
]
=
{
0
};
...
...
libc-test/src/functionalext/supplement/linux/swapon.c
浏览文件 @
e9e4016d
...
...
@@ -29,6 +29,10 @@ void swapon_0100(void)
{
char
dir_path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
dir_path
,
sizeof
(
dir_path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
errno
=
0
;
char
cmd
[
256
]
=
{
0
};
...
...
libc-test/src/functionalext/supplement/linux/sync_file_range.c
浏览文件 @
e9e4016d
...
...
@@ -29,6 +29,10 @@ void sync_file_range_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/sync_file_range.txt"
);
errno
=
0
;
...
...
@@ -76,6 +80,10 @@ void sync_file_range_0300(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/sync_file_range.txt"
);
errno
=
0
;
...
...
@@ -107,6 +115,10 @@ void sync_file_range_0400(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/sync_file_range.txt"
);
errno
=
0
;
...
...
libc-test/src/functionalext/supplement/linux/syncfs.c
浏览文件 @
e9e4016d
...
...
@@ -29,6 +29,10 @@ void syncfs_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/syncfs.txt"
);
errno
=
0
;
...
...
libc-test/src/functionalext/supplement/linux/tee.c
浏览文件 @
e9e4016d
...
...
@@ -76,6 +76,10 @@ void tee_0200(void)
char
*
text
=
"Hello"
;
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
int
result
;
...
...
libc-test/src/functionalext/supplement/mman/mincore.c
浏览文件 @
e9e4016d
...
...
@@ -32,6 +32,10 @@ void mincore_0100(void)
struct
stat
st
;
char
pathname
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
pathname
,
sizeof
(
pathname
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
pathname
,
"/mincore"
);
int
ret
=
stat
(
pathname
,
&
st
);
...
...
libc-test/src/functionalext/supplement/stat/fchmodat.c
浏览文件 @
e9e4016d
...
...
@@ -30,6 +30,10 @@ void fchmodat_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/test.txt"
);
int
fd
;
...
...
@@ -56,6 +60,10 @@ void fchmodat_0200(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/test.txt"
);
int
fd
;
...
...
libc-test/src/functionalext/supplement/stat/fstatat.c
浏览文件 @
e9e4016d
...
...
@@ -86,6 +86,10 @@ void fstatat_0300(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/fstatattest.txt"
);
struct
stat
st
;
...
...
libc-test/src/functionalext/supplement/stat/lstat.c
浏览文件 @
e9e4016d
...
...
@@ -32,6 +32,10 @@ void lstat_0100(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/stattest.txt"
);
const
char
str
[]
=
"this is a sample!"
;
...
...
@@ -55,6 +59,10 @@ void lstat_time64_0100(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/stattest.txt"
);
const
char
str
[]
=
"this is a sample!"
;
...
...
@@ -91,7 +99,15 @@ void lstat_0300(void)
char
ptr
[
128
]
=
{
0
};
char
ptrlink
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd file failed
\n
"
,
__func__
);
return
;
}
cwd
=
getcwd
(
ptrlink
,
sizeof
(
ptrlink
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd link failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/tests.txt"
);
strcat
(
ptrlink
,
"/tests.txt.soft"
);
struct
stat
buf
[
3
];
...
...
libc-test/src/functionalext/supplement/stat/mknod.c
浏览文件 @
e9e4016d
...
...
@@ -27,6 +27,10 @@ void mknod_0100(void)
{
char
pathname
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
pathname
,
sizeof
(
pathname
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
pathname
,
"/mknod"
);
int
ret
=
mknod
(
pathname
,
TEST_MODE
,
0
);
...
...
libc-test/src/functionalext/supplement/stat/utimensat.c
浏览文件 @
e9e4016d
...
...
@@ -33,6 +33,10 @@ void utimensat_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
int
fd
=
open
(
path
,
O_RDWR
|
O_CREAT
);
...
...
@@ -85,6 +89,10 @@ void utimensat_time64_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
int
fd
=
open
(
path
,
O_RDWR
|
O_CREAT
);
...
...
libc-test/src/functionalext/supplement/stdio/__fwritable.c
浏览文件 @
e9e4016d
...
...
@@ -27,6 +27,10 @@ void __fwritable_0100(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/Freadtest.txt"
);
FILE
*
fptr
=
fopen
(
ptr
,
"w+"
);
...
...
@@ -47,6 +51,10 @@ void __fwritable_0200(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/Freadtest.txt"
);
FILE
*
fptr
=
fopen
(
ptr
,
"r"
);
...
...
libc-test/src/functionalext/supplement/stdio/__fwriting.c
浏览文件 @
e9e4016d
...
...
@@ -31,6 +31,10 @@ void __fwriting_0100(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/Freadtest.txt"
);
FILE
*
fptr
=
fopen
(
ptr
,
"w"
);
...
...
@@ -49,6 +53,10 @@ void __fwriting_0200(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/Freadtest.txt"
);
const
char
*
wrstring
=
"helloworld"
;
...
...
@@ -69,6 +77,10 @@ void __fwriting_0300(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/Freadtest.txt"
);
char
abc
[
100
]
=
{
0
};
...
...
libc-test/src/functionalext/supplement/stdio/fputc.c
浏览文件 @
e9e4016d
...
...
@@ -24,6 +24,10 @@ void fputc_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/fputc.txt"
);
FILE
*
fptr
=
fopen
(
path
,
"w"
);
...
...
@@ -41,6 +45,10 @@ void fputc_0200(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/fputc.txt"
);
FILE
*
fptr
=
fopen
(
path
,
"r"
);
...
...
libc-test/src/functionalext/supplement/stdio/freopen.c
浏览文件 @
e9e4016d
...
...
@@ -25,6 +25,10 @@ void freopen_0100(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/freopen.txt"
);
FILE
*
fp
;
...
...
libc-test/src/functionalext/supplement/stdio/getline.c
浏览文件 @
e9e4016d
...
...
@@ -28,6 +28,10 @@ void getline_0100(void)
size_t
len
=
0
;
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/test.txt"
);
FILE
*
fp
=
fopen
(
path
,
"w+"
);
...
...
@@ -53,6 +57,10 @@ void getline_0200(void)
size_t
len
=
0
;
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
FILE
*
fp
=
fopen
(
path
,
"w+"
);
EXPECT_PTRNE
(
"getline_0100"
,
fp
,
NULL
);
...
...
@@ -74,6 +82,10 @@ void getline_0300(void)
char
*
line
=
NULL
;
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
FILE
*
fp
=
fopen
(
path
,
"w+"
);
EXPECT_PTRNE
(
"getline_0100"
,
fp
,
NULL
);
...
...
libc-test/src/functionalext/supplement/stdio/setbuf.c
浏览文件 @
e9e4016d
...
...
@@ -31,6 +31,10 @@ void setbuf_0100(void)
char
buf
[
BUFSIZ
]
=
{
0
};
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
FILE
*
f
=
fopen
(
path
,
"w+"
);
errno
=
0
;
...
...
@@ -60,6 +64,10 @@ void setbuf_0200(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
FILE
*
f
=
fopen
(
path
,
"w+"
);
...
...
libc-test/src/functionalext/supplement/stdio/setbuffer.c
浏览文件 @
e9e4016d
...
...
@@ -29,6 +29,10 @@ void setbuffer_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
FILE
*
fp
=
fopen
(
path
,
"w+"
);
char
buf
[
BUFSIZ
]
=
{
0
};
...
...
@@ -64,6 +68,10 @@ void setbuffer_0200(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
FILE
*
f
=
fopen
(
path
,
"w+"
);
...
...
libc-test/src/functionalext/supplement/stdio/setlinebuf.c
浏览文件 @
e9e4016d
...
...
@@ -29,6 +29,10 @@ void setlinebuf_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
FILE
*
f
=
fopen
(
path
,
"w+"
);
char
buffer
[
BUFSIZ
];
...
...
libc-test/src/functionalext/supplement/stdio/setvbuf.c
浏览文件 @
e9e4016d
...
...
@@ -25,6 +25,10 @@ void setvbuf_0100(void)
char
buff
[
1024
]
=
{
0
};
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
FILE
*
fptr
=
fopen
(
path
,
"w+"
);
EXPECT_PTRNE
(
"setvbuf_0100"
,
fptr
,
NULL
);
...
...
@@ -46,6 +50,10 @@ void setvbuf_0200(void)
char
buff
[
1024
]
=
{
0
};
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
FILE
*
fptr
=
fopen
(
path
,
"w+"
);
EXPECT_PTRNE
(
"setvbuf_0100"
,
fptr
,
NULL
);
...
...
libc-test/src/functionalext/supplement/stdio/ungetwc.c
浏览文件 @
e9e4016d
...
...
@@ -34,6 +34,10 @@ void ungetwc_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
FILE
*
file
=
fopen
(
path
,
"a+"
);
if
(
!
file
)
{
...
...
libc-test/src/functionalext/supplement/stdio/vfscanf.c
浏览文件 @
e9e4016d
...
...
@@ -39,6 +39,10 @@ void vfscanf_0100(void)
char
buffer
[
BUFSIZ
];
char
file
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
file
,
sizeof
(
file
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
file
,
"/vfscanf.txt"
);
fp
=
fopen
(
file
,
"w+"
);
if
(
fp
==
NULL
)
{
...
...
@@ -77,6 +81,10 @@ void vfscanf_0200(void)
char
buffer
[
BUFSIZ
];
char
file
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
file
,
sizeof
(
file
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
file
,
"/vfscanf.txt"
);
fp
=
fopen
(
file
,
"w+"
);
if
(
fp
==
NULL
)
{
...
...
@@ -115,6 +123,10 @@ void vfscanf_0300(void)
int
val2
=
0
;
char
file
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
file
,
sizeof
(
file
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
file
,
"/vfscanf.txt"
);
fp
=
fopen
(
file
,
"w+"
);
if
(
fp
==
NULL
)
{
...
...
libc-test/src/functionalext/supplement/unistd/acct.c
浏览文件 @
e9e4016d
...
...
@@ -37,6 +37,10 @@ void acct_0200(void)
{
char
filePath
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
filePath
,
sizeof
(
filePath
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
filePath
,
"/accttest.txt"
);
int
result
=
acct
(
filePath
);
...
...
libc-test/src/functionalext/supplement/unistd/exit.c
浏览文件 @
e9e4016d
...
...
@@ -26,6 +26,10 @@ void exit_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
char
cmd
[
256
]
=
{
0
};
snprintf
(
cmd
,
sizeof
(
cmd
),
"cd %s; ./exittest01"
,
path
);
system
(
cmd
);
...
...
@@ -60,6 +64,10 @@ void exit_0200(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
char
cmd
[
256
]
=
{
0
};
snprintf
(
cmd
,
sizeof
(
cmd
),
"cd %s; ./exittest02"
,
path
);
system
(
cmd
);
...
...
libc-test/src/functionalext/supplement/unistd/faccessat.c
浏览文件 @
e9e4016d
...
...
@@ -31,6 +31,10 @@ void faccessat_0100(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/faccessattest.txt"
);
int
fd
=
open
(
ptr
,
O_RDWR
|
O_CREAT
);
EXPECT_TRUE
(
"faccessat_0100"
,
fd
>=
0
);
...
...
@@ -49,6 +53,10 @@ void faccessat_0200(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/faccessattest.txt"
);
int
fd
=
-
1
;
int
isExist
=
faccessat
(
fd
,
ptr
,
F_OK
,
0
);
...
...
@@ -66,6 +74,10 @@ void faccessat_0300(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/faccessattest.txt"
);
int
fd
=
open
(
ptr
,
O_RDWR
|
O_CREAT
,
00040
);
EXPECT_TRUE
(
"faccessat_0300"
,
fd
>=
0
);
...
...
@@ -84,6 +96,10 @@ void faccessat_0400(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/faccessattest.txt"
);
int
fd
=
open
(
ptr
,
O_RDWR
|
O_CREAT
,
00020
);
EXPECT_TRUE
(
"faccessat_0400"
,
fd
>=
0
);
...
...
@@ -102,6 +118,10 @@ void faccessat_0500(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/faccessattest.txt"
);
int
fd
=
open
(
ptr
,
O_RDWR
|
O_CREAT
,
00010
);
char
cmd
[
256
]
=
{
0
};
...
...
@@ -123,6 +143,10 @@ void faccessat_0600(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/faccessattest.txt"
);
int
fd
=
open
(
ptr
,
O_RDWR
|
O_CREAT
);
EXPECT_TRUE
(
"faccessat_0600"
,
fd
>=
0
);
...
...
@@ -141,6 +165,10 @@ void faccessat_0700(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/faccessattest.txt"
);
int
fd
=
open
(
ptr
,
O_RDWR
|
O_CREAT
,
00070
);
EXPECT_TRUE
(
"faccessat_0700"
,
fd
>=
0
);
...
...
@@ -159,6 +187,10 @@ void faccessat_0800(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/faccessattest.txt"
);
int
fd
=
open
(
ptr
,
O_RDWR
|
O_CREAT
);
EXPECT_TRUE
(
"faccessat_0800"
,
fd
>=
0
);
...
...
@@ -177,6 +209,10 @@ void faccessat_0900(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/faccessattest.txt"
);
int
fd
=
open
(
ptr
,
O_RDWR
|
O_CREAT
,
00070
);
EXPECT_TRUE
(
"faccessat_0900"
,
fd
>=
0
);
...
...
@@ -197,6 +233,10 @@ void faccessat_1000(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/faccessattest.txt"
);
int
fd
=
open
(
ptr
,
O_RDWR
|
O_CREAT
,
00070
);
EXPECT_TRUE
(
"faccessat_1000"
,
fd
>=
0
);
...
...
@@ -216,6 +256,10 @@ void faccessat_1100(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/faccessattest.txt"
);
int
fd
=
open
(
ptr
,
O_RDWR
|
O_CREAT
);
EXPECT_TRUE
(
"faccessat_1100"
,
fd
>=
0
);
...
...
libc-test/src/functionalext/supplement/unistd/fchownat.c
浏览文件 @
e9e4016d
...
...
@@ -27,6 +27,10 @@ void fchownat_0100(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/fchownattest.txt"
);
int
fd
=
open
(
ptr
,
O_RDWR
|
O_CREAT
);
EXPECT_TRUE
(
"fchownat_0100"
,
fd
>=
0
);
...
...
@@ -50,6 +54,10 @@ void fchownat_0200(void)
{
char
ptr
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
ptr
,
sizeof
(
ptr
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
ptr
,
"/fchownattest.txt"
);
int
fd
=
open
(
ptr
,
O_RDWR
|
O_CREAT
);
EXPECT_TRUE
(
"fchownat_0200"
,
fd
>=
0
);
...
...
libc-test/src/functionalext/supplement/unistd/getpid.c
浏览文件 @
e9e4016d
...
...
@@ -28,6 +28,10 @@ void getpid_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/ps.txt"
);
char
cmd
[
256
]
=
{
0
};
snprintf
(
cmd
,
sizeof
(
cmd
),
"ps -eo command,pid | grep -E
\"
PID|getpid
\"
> %s"
,
path
);
...
...
libc-test/src/functionalext/supplement/unistd/lchown.c
浏览文件 @
e9e4016d
...
...
@@ -27,6 +27,10 @@ void lchown_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/lchown"
);
int
ret
=
lchown
(
path
,
TEST_ID_VALUE
,
TEST_ID_VALUE
);
EXPECT_EQ
(
"lchown_0100"
,
ret
,
CMPFLAG
);
...
...
libc-test/src/functionalext/supplement/unistd/readlinkat.c
浏览文件 @
e9e4016d
...
...
@@ -54,6 +54,10 @@ void readlinkat_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd file failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
int
result
=
create_file
(
path
);
if
(
result
!=
0
)
{
...
...
@@ -63,6 +67,10 @@ void readlinkat_0100(void)
char
linkpath
[
128
]
=
{
0
};
cwd
=
getcwd
(
linkpath
,
sizeof
(
linkpath
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd link failed
\n
"
,
__func__
);
return
;
}
strcat
(
linkpath
,
"/linkfile.txt"
);
remove
(
linkpath
);
...
...
@@ -101,6 +109,10 @@ void readlinkat_0200(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd file failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
int
result
=
create_file
(
path
);
if
(
result
!=
0
)
{
...
...
@@ -110,6 +122,10 @@ void readlinkat_0200(void)
char
dirname
[
128
]
=
{
0
};
cwd
=
getcwd
(
dirname
,
sizeof
(
dirname
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd dir failed
\n
"
,
__func__
);
return
;
}
DIR
*
dir
=
opendir
(
dirname
);
if
(
dir
==
NULL
)
{
t_error
(
"%s failed: dirname = %s
\n
"
,
__func__
,
dirname
);
...
...
@@ -123,6 +139,10 @@ void readlinkat_0200(void)
char
linkpath
[
128
]
=
{
0
};
cwd
=
getcwd
(
linkpath
,
sizeof
(
linkpath
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd link failed
\n
"
,
__func__
);
return
;
}
strcat
(
linkpath
,
"/linkfile.txt"
);
remove
(
linkpath
);
...
...
libc-test/src/functionalext/supplement/unistd/readv.c
浏览文件 @
e9e4016d
...
...
@@ -30,6 +30,10 @@ void readv_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
int
fd
=
open
(
path
,
O_RDWR
|
O_CREAT
);
...
...
libc-test/src/functionalext/supplement/unistd/truncate.c
浏览文件 @
e9e4016d
...
...
@@ -35,6 +35,10 @@ void truncate_0100(void)
{
char
path_n
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path_n
,
sizeof
(
path_n
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path_n
,
"/files.txt"
);
FILE
*
f
=
fopen
(
path_n
,
"a"
);
if
(
f
==
NULL
)
{
...
...
@@ -60,6 +64,10 @@ void truncate_0200(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
FILE
*
f
=
fopen
(
path
,
"a"
);
if
(
f
==
NULL
)
{
...
...
@@ -105,6 +113,10 @@ void truncate_0300(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
int
result
=
truncate
(
path
,
nlen
);
if
(
result
==
0
)
{
...
...
libc-test/src/functionalext/supplement/unistd/unlink.c
浏览文件 @
e9e4016d
...
...
@@ -28,6 +28,10 @@ void unlink_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/test_unlink.txt"
);
int
fd
=
open
(
path
,
O_CREAT
);
int
error_code
=
-
1
;
...
...
@@ -51,6 +55,10 @@ void unlink_0200(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/unexist_test_unlink.txt"
);
int
result
=
unlink
(
path
);
int
error_code
=
-
1
;
...
...
libc-test/src/functionalext/supplement/unistd/unlinkat.c
浏览文件 @
e9e4016d
...
...
@@ -27,6 +27,10 @@ void unlinkat_0100(void)
{
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
int
fd
=
open
(
path
,
O_CREAT
,
0664
);
...
...
@@ -49,6 +53,10 @@ void unlinkat_0200(void)
errno
=
0
;
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/file.txt"
);
int
result
=
unlinkat
(
AT_FDCWD
,
path
,
AT_REMOVEDIR
);
if
(
result
==
0
)
{
...
...
libc-test/src/functionalext/supplement/unistd/write.c
浏览文件 @
e9e4016d
...
...
@@ -29,6 +29,10 @@ void write_0100(void)
const
char
*
msg
=
"This is a c test code for write function"
;
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/test_write.txt"
);
int
len
=
strlen
(
msg
);
char
buf
[
1024
]
=
{
0
};
...
...
@@ -65,6 +69,10 @@ void write_0200(void)
const
char
*
msg
=
"This is a c test code for write function"
;
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/test_write.txt"
);
int
len
=
0
;
int
fd
=
open
(
path
,
O_RDWR
|
O_RSYNC
|
O_CREAT
,
0664
);
...
...
@@ -90,6 +98,10 @@ void write_0300(void)
const
char
*
msg
=
"This is a c test code for write function"
;
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/test_write.txt"
);
int
len
=
strlen
(
msg
)
+
1
;
int
fd
=
open
(
path
,
O_RDWR
|
O_RSYNC
|
O_CREAT
,
0664
);
...
...
@@ -115,6 +127,10 @@ void write_0400(void)
const
char
*
msg
=
"This is a c test code for write function"
;
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/test_write.txt"
);
int
len
=
strlen
(
msg
);
int
fd
=
open
(
path
,
O_RDWR
);
...
...
@@ -136,6 +152,10 @@ void write_0500(void)
const
char
*
msg
=
NULL
;
char
path
[
128
]
=
{
0
};
char
*
cwd
=
getcwd
(
path
,
sizeof
(
path
));
if
(
!
cwd
)
{
t_error
(
"%s getcwd failed
\n
"
,
__func__
);
return
;
}
strcat
(
path
,
"/test_write.txt"
);
int
len
=
1
;
int
fd
=
open
(
path
,
O_RDWR
|
O_RSYNC
|
O_CREAT
,
0664
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录