提交 e598dbfe 编写于 作者: D dhy308

fix review problems

Signed-off-by: Ndhy308 <tony.gan@huawei.com>
上级 36c724e1
......@@ -18,6 +18,7 @@
#include <string.h>
#include <sys/wait.h>
#include "fortify_test.h"
#include "functionalext.h"
#include "test.h"
#define FILE_MODE_ALL (0777)
......@@ -120,7 +121,7 @@ static void open_0030(void)
static void open_0040(void)
{
int fd = open("/proc/version", O_RDWR);
TEST(fd != -1);
EXPECT_NE(open_0040, fd, -1);
close(fd);
return;
......@@ -216,7 +217,7 @@ static void openat_0030(void)
static void openat_0040(void)
{
int fd = openat(AT_FDCWD, "/proc/version", O_RDWR);
TEST(fd != -1);
EXPECT_NE(openat_0040, fd, -1);
close(fd);
return;
......@@ -313,7 +314,7 @@ static void open64_0030(void)
static void open64_0040(void)
{
int fd = open64("/proc/version", O_RDWR);
TEST(fd != -1);
EXPECT_NE(open64_0040, fd, -1);
close(fd);
return;
......@@ -409,7 +410,7 @@ static void openat64_0030(void)
static void openat64_0040(void)
{
int fd = openat64(AT_FDCWD, "/proc/version", O_RDWR);
TEST(fd != -1);
EXPECT_NE(openat64_0040, fd, -1);
close(fd);
return;
......
......@@ -19,6 +19,7 @@
#include <string.h>
#include <sys/wait.h>
#include "fortify_test.h"
#include "functionalext.h"
#include "test.h"
#define PPOLL_TIMESPEC_NSEC (100)
......@@ -82,7 +83,7 @@ static void poll_0030(void)
{
nfds_t fd_count = atoi("1");
struct pollfd buf[2] = {{0, POLLIN, 0}, {1, POLLIN, 0}};
TEST(poll(buf, fd_count, 1) == 1);
EXPECT_EQ(poll_0030, poll(buf, fd_count, 1), 1);
return;
}
......@@ -151,7 +152,7 @@ static void ppoll_0030(void)
nfds_t fd_count = atoi("1");
struct pollfd buf[2] = {{0, POLLIN, 0}, {1, POLLIN, 0}};
struct timespec ts = { .tv_nsec = PPOLL_TIMESPEC_NSEC };
TEST(ppoll(buf, fd_count, &ts, NULL) == 1);
EXPECT_EQ(ppoll_0030, ppoll(buf, fd_count, &ts, NULL), 1);
return;
}
......
......@@ -20,6 +20,7 @@
#include <string.h>
#include <sys/wait.h>
#include "fortify_test.h"
#include "functionalext.h"
#include "test.h"
#include "../../../../porting/linux/user/include/fortify/fortify.h"
......@@ -909,7 +910,7 @@ static void test_strlen_0020()
exit(0);
default:
waitpid(pid, &status, WUNTRACED);
TEST(WIFEXITED(status) == 0);
EXPECT_EQ(test_strlen_0020, WIFEXITED(status), 0);
kill(pid, SIGCONT);
break;
}
......
......@@ -16,6 +16,7 @@
#include <errno.h>
#include <shadow.h>
#include <string.h>
#include "functionalext.h"
#include "test.h"
/**
......@@ -34,15 +35,9 @@ void getspnam_r_0100(void)
const char *spwd_name = "root";
int result = getspnam_r(spwd_name, &spwd_storage, buf, sizeof(buf), &spwd);
if (result != 0) {
t_error("%s getgrnam_r failed\n", __func__);
}
if (!spwd) {
t_error("%s failed, spwd is NULL\n", __func__);
}
if (strcmp(spwd_name, spwd->sp_namp)) {
t_error("%s spwd->sp_namp is %s\n", __func__, spwd->sp_namp);
}
EXPECT_EQ(getspnam_r_0100, result, 0);
EXPECT_PTRNE(getspnam_r_0100, spwd, NULL);
EXPECT_EQ(getspnam_r_0100, strcmp(spwd_name, spwd->sp_namp), 0);
}
int main(int argc, char *argv[])
......
......@@ -310,7 +310,7 @@ static void pthread_mutex_timedlock_monotonic_np_0030(void)
{
pthread_mutex_t *mtx = (pthread_mutex_t *)NULL;
struct timespec ts = {0};
TEST(pthread_mutex_timedlock_monotonic_np(mtx, &ts) == EINVAL);
EXPECT_EQ(pthread_mutex_timedlock_monotonic_np(mtx, &ts), EINVAL);
}
/********************************************* Test case dividing line ***********************************************/
......
......@@ -277,7 +277,7 @@ static void pthread_rwlock_timedrdlock_monotonic_np_0020(void)
static void pthread_rwlock_timedrdlock_monotonic_np_0030(void)
{
struct timespec ts = {0};
TEST(pthread_rwlock_timedrdlock_monotonic_np((pthread_rwlock_t *)NULL, &ts) == EINVAL);
EXPECT_EQ(pthread_rwlock_timedrdlock_monotonic_np((pthread_rwlock_t *)NULL, &ts), EINVAL);
}
int main(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册