提交 e598dbfe 编写于 作者: D dhy308

fix review problems

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