Merging in 2.0.2.
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
chdir_empty(void)
|
||||
{
|
||||
int rv;
|
||||
@@ -49,20 +49,13 @@ chdir_empty(void)
|
||||
|
||||
report_begin("chdir to empty string");
|
||||
rv = chdir("");
|
||||
return report_check2(rv, errno, EINVAL, 0);
|
||||
report_check2(rv, errno, EINVAL, 0);
|
||||
}
|
||||
|
||||
void
|
||||
test_chdir(void)
|
||||
{
|
||||
int ntests = 0, result = 0, lost_points = 0;
|
||||
test_chdir_path(&ntests, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = chdir_empty();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
test_chdir_path();
|
||||
chdir_empty();
|
||||
}
|
||||
|
||||
|
@@ -36,9 +36,5 @@
|
||||
void
|
||||
test_close(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
test_close_fd(&ntests, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
test_close_fd();
|
||||
}
|
||||
|
@@ -45,29 +45,27 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
dup2_fd2(int fd, const char *desc)
|
||||
{
|
||||
int rv, failure;
|
||||
int rv;
|
||||
|
||||
report_begin("%s", desc);
|
||||
rv = dup2(STDIN_FILENO, fd);
|
||||
failure = report_check(rv, errno, EBADF);
|
||||
report_check(rv, errno, EBADF);
|
||||
|
||||
if (rv != -1) {
|
||||
close(fd); /* just in case */
|
||||
}
|
||||
return failure;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
dup2_self(void)
|
||||
{
|
||||
struct stat sb;
|
||||
int rv;
|
||||
int testfd;
|
||||
int failure;
|
||||
|
||||
/* use fd that isn't in use */
|
||||
testfd = CLOSED_FD;
|
||||
@@ -77,23 +75,22 @@ dup2_self(void)
|
||||
rv = dup2(STDIN_FILENO, testfd);
|
||||
if (rv == -1) {
|
||||
report_result(rv, errno);
|
||||
report_aborted(&failure);
|
||||
return failure;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
|
||||
report_begin("dup2 to same fd");
|
||||
rv = dup2(testfd, testfd);
|
||||
if (rv == testfd) {
|
||||
report_passed(&failure);
|
||||
report_passed();
|
||||
}
|
||||
else if (rv<0) {
|
||||
report_result(rv, errno);
|
||||
report_failure(&failure);
|
||||
report_failure();
|
||||
}
|
||||
else {
|
||||
report_warnx("returned %d instead", rv);
|
||||
report_failure(&failure);
|
||||
failure = FAILED;
|
||||
report_failure();
|
||||
}
|
||||
|
||||
report_begin("fstat fd after dup2 to itself");
|
||||
@@ -103,60 +100,43 @@ dup2_self(void)
|
||||
}
|
||||
report_result(rv, errno);
|
||||
if (rv==0) {
|
||||
report_passed(&failure);
|
||||
report_passed();
|
||||
}
|
||||
else if (errno != ENOSYS) {
|
||||
report_failure(&failure);
|
||||
report_failure();
|
||||
}
|
||||
else {
|
||||
report_skipped(&failure);
|
||||
report_skipped();
|
||||
/* no support for fstat; try lseek */
|
||||
report_begin("lseek fd after dup2 to itself");
|
||||
rv = lseek(testfd, 0, SEEK_CUR);
|
||||
report_result(rv, errno);
|
||||
if (rv==0 || (rv==-1 && errno==ESPIPE)) {
|
||||
report_passed(&failure);
|
||||
report_passed();
|
||||
}
|
||||
else {
|
||||
report_failure(&failure);
|
||||
report_failure();
|
||||
}
|
||||
}
|
||||
|
||||
close(testfd);
|
||||
return failure;
|
||||
}
|
||||
|
||||
void
|
||||
test_dup2(void)
|
||||
{
|
||||
int ntests = 0, failure, lost_points = 0;
|
||||
/* This does the first fd. */
|
||||
test_dup2_fd(&ntests, &lost_points);
|
||||
test_dup2_fd();
|
||||
|
||||
/* Any interesting cases added here should also go in common_fds.c */
|
||||
ntests++;
|
||||
failure = dup2_fd2(-1, "dup2 to -1");
|
||||
handle_result(failure, &lost_points);
|
||||
|
||||
ntests++;
|
||||
failure = dup2_fd2(-5, "dup2 to -5");
|
||||
handle_result(failure, &lost_points);
|
||||
|
||||
ntests++;
|
||||
failure = dup2_fd2(IMPOSSIBLE_FD, "dup2 to impossible fd");
|
||||
handle_result(failure, &lost_points);
|
||||
dup2_fd2(-1, "dup2 to -1");
|
||||
dup2_fd2(-5, "dup2 to -5");
|
||||
dup2_fd2(IMPOSSIBLE_FD, "dup2 to impossible fd");
|
||||
#ifdef OPEN_MAX
|
||||
ntests++;
|
||||
failure = dup2_fd2(OPEN_MAX, "dup2 to OPEN_MAX");
|
||||
handle_result(failure, &lost_points);
|
||||
dup2_fd2(OPEN_MAX, "dup2 to OPEN_MAX");
|
||||
#else
|
||||
warnx("Warning: OPEN_MAX not defined - test skipped");
|
||||
#endif
|
||||
|
||||
ntests++;
|
||||
failure = dup2_self();
|
||||
handle_result(failure, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
dup2_self();
|
||||
}
|
||||
|
@@ -32,7 +32,6 @@
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
@@ -43,7 +42,7 @@
|
||||
|
||||
static
|
||||
int
|
||||
exec_common_fork(int *result)
|
||||
exec_common_fork(void)
|
||||
{
|
||||
int pid, rv, status, err;
|
||||
|
||||
@@ -57,7 +56,7 @@ exec_common_fork(int *result)
|
||||
err = errno;
|
||||
report_begin("forking for test");
|
||||
report_result(pid, err);
|
||||
report_aborted(result);
|
||||
report_aborted();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -71,11 +70,10 @@ exec_common_fork(int *result)
|
||||
err = errno;
|
||||
report_begin("waiting for test subprocess");
|
||||
report_result(rv, err);
|
||||
report_failure(result);
|
||||
report_failure();
|
||||
return -1;
|
||||
}
|
||||
if (WIFEXITED(status) && WEXITSTATUS(status) == MAGIC_STATUS) {
|
||||
*result = SUCCESS;
|
||||
return 1;
|
||||
}
|
||||
/* Oops... */
|
||||
@@ -86,134 +84,98 @@ exec_common_fork(int *result)
|
||||
else {
|
||||
report_warnx("exit %d", WEXITSTATUS(status));
|
||||
}
|
||||
report_failure(result);
|
||||
report_failure();
|
||||
return -1;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
exec_badprog(const void *prog, const char *desc)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
char *args[2];
|
||||
args[0] = (char *)"foo";
|
||||
args[1] = NULL;
|
||||
|
||||
if (exec_common_fork(&result) != 0) {
|
||||
return result;
|
||||
if (exec_common_fork() != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
report_begin(desc);
|
||||
rv = execv(prog, args);
|
||||
result = report_check(rv, errno, EFAULT);
|
||||
int code = result ? result : MAGIC_STATUS;
|
||||
exit(code);
|
||||
report_check(rv, errno, EFAULT);
|
||||
exit(MAGIC_STATUS);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
exec_emptyprog(void)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
char *args[2];
|
||||
args[0] = (char *)"foo";
|
||||
args[1] = NULL;
|
||||
|
||||
if (exec_common_fork(&result) != 0) {
|
||||
return result;
|
||||
if (exec_common_fork() != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
report_begin("exec the empty string");
|
||||
rv = execv("", args);
|
||||
result = report_check2(rv, errno, EINVAL, EISDIR);
|
||||
int code = result ? result : MAGIC_STATUS;
|
||||
exit(code);
|
||||
report_check2(rv, errno, EINVAL, EISDIR);
|
||||
exit(MAGIC_STATUS);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
exec_badargs(void *args, const char *desc)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
if (exec_common_fork(&result) != 0) {
|
||||
return result;
|
||||
|
||||
if (exec_common_fork() != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
report_begin(desc);
|
||||
rv = execv("/bin/true", args);
|
||||
result = report_check(rv, errno, EFAULT);
|
||||
int code = result ? result : MAGIC_STATUS;
|
||||
exit(code);
|
||||
report_check(rv, errno, EFAULT);
|
||||
exit(MAGIC_STATUS);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
exec_onearg(void *ptr, const char *desc)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
|
||||
char *args[3];
|
||||
args[0] = (char *)"foo";
|
||||
args[1] = (char *)ptr;
|
||||
args[2] = NULL;
|
||||
|
||||
if (exec_common_fork(&result) != 0) {
|
||||
return result;
|
||||
if (exec_common_fork() != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
report_begin(desc);
|
||||
rv = execv("/bin/true", args);
|
||||
result = report_check(rv, errno, EFAULT);
|
||||
int code = result ? result : MAGIC_STATUS;
|
||||
exit(code);
|
||||
|
||||
report_check(rv, errno, EFAULT);
|
||||
exit(MAGIC_STATUS);
|
||||
}
|
||||
|
||||
void
|
||||
test_execv(void)
|
||||
{
|
||||
int ntests = 0, result = 0, lost_points = 0;
|
||||
ntests++;
|
||||
result = exec_badprog(NULL, "exec with NULL program");
|
||||
handle_result(result, &lost_points);
|
||||
exec_badprog(NULL, "exec with NULL program");
|
||||
exec_badprog(INVAL_PTR, "exec with invalid pointer program");
|
||||
exec_badprog(KERN_PTR, "exec with kernel pointer program");
|
||||
|
||||
ntests++;
|
||||
result = exec_badprog(INVAL_PTR, "exec with invalid pointer program");
|
||||
handle_result(result, &lost_points);
|
||||
exec_emptyprog();
|
||||
|
||||
ntests++;
|
||||
result = exec_badprog(KERN_PTR, "exec with kernel pointer program");
|
||||
handle_result(result, &lost_points);
|
||||
exec_badargs(NULL, "exec with NULL arglist");
|
||||
exec_badargs(INVAL_PTR, "exec with invalid pointer arglist");
|
||||
exec_badargs(KERN_PTR, "exec with kernel pointer arglist");
|
||||
|
||||
ntests++;
|
||||
result = exec_emptyprog();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = exec_badargs(NULL, "exec with NULL arglist");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = exec_badargs(INVAL_PTR, "exec with invalid pointer arglist");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = exec_badargs(KERN_PTR, "exec with kernel pointer arglist");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
|
||||
ntests++;
|
||||
result = exec_onearg(INVAL_PTR, "exec with invalid pointer arg");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = exec_onearg(KERN_PTR, "exec with kernel pointer arg");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
exec_onearg(INVAL_PTR, "exec with invalid pointer arg");
|
||||
exec_onearg(KERN_PTR, "exec with kernel pointer arg");
|
||||
}
|
||||
|
@@ -36,11 +36,6 @@
|
||||
void
|
||||
test_fsync(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
|
||||
test_fsync_fd(&ntests, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
test_fsync_fd();
|
||||
}
|
||||
|
||||
|
@@ -44,67 +44,52 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
ftruncate_fd_device(void)
|
||||
{
|
||||
int rv, fd;
|
||||
int result;
|
||||
|
||||
report_begin("ftruncate on device");
|
||||
|
||||
fd = open("null:", O_RDWR);
|
||||
if (fd<0) {
|
||||
report_warn("opening null: failed");
|
||||
report_aborted(&result);
|
||||
return result;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ftruncate(fd, 6);
|
||||
result = report_check(rv, errno, EINVAL);
|
||||
report_check(rv, errno, EINVAL);
|
||||
|
||||
close(fd);
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
ftruncate_size_neg(void)
|
||||
{
|
||||
int rv, fd;
|
||||
int result;
|
||||
|
||||
report_begin("ftruncate to negative size");
|
||||
|
||||
fd = open_testfile(NULL);
|
||||
if (fd<0) {
|
||||
report_aborted(&result);
|
||||
return result;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
|
||||
rv = ftruncate(fd, -60);
|
||||
result = report_check(rv, errno, EINVAL);
|
||||
report_check(rv, errno, EINVAL);
|
||||
|
||||
close(fd);
|
||||
remove(TESTFILE);
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
test_ftruncate(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
test_ftruncate_fd();
|
||||
|
||||
test_ftruncate_fd(&ntests, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = ftruncate_fd_device();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = ftruncate_size_neg();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
ftruncate_fd_device();
|
||||
ftruncate_size_neg();
|
||||
}
|
||||
|
@@ -36,9 +36,5 @@
|
||||
void
|
||||
test_getcwd(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
test_getcwd_buf(&ntests, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
test_getcwd_buf();
|
||||
}
|
||||
|
@@ -36,11 +36,6 @@
|
||||
void
|
||||
test_getdirentry(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
|
||||
test_getdirentry_fd(&ntests, &lost_points);
|
||||
test_getdirentry_buf(&ntests, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
test_getdirentry_fd();
|
||||
test_getdirentry_buf();
|
||||
}
|
||||
|
@@ -41,34 +41,30 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
one_ioctl_badbuf(int fd, int code, const char *codename,
|
||||
void *ptr, const char *ptrdesc)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
|
||||
report_begin("ioctl %s with %s", codename, ptrdesc);
|
||||
rv = ioctl(fd, code, ptr);
|
||||
result = report_check(rv, errno, EFAULT);
|
||||
return result;
|
||||
report_check(rv, errno, EFAULT);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
any_ioctl_badbuf(int fd, int code, const char *codename)
|
||||
{
|
||||
int result;
|
||||
result = one_ioctl_badbuf(fd, code, codename, NULL, "NULL pointer");
|
||||
result |= one_ioctl_badbuf(fd, code, codename, INVAL_PTR, "invalid pointer");
|
||||
result |= one_ioctl_badbuf(fd, code, codename, KERN_PTR, "kernel pointer");
|
||||
return result;
|
||||
one_ioctl_badbuf(fd, code, codename, NULL, "NULL pointer");
|
||||
one_ioctl_badbuf(fd, code, codename, INVAL_PTR, "invalid pointer");
|
||||
one_ioctl_badbuf(fd, code, codename, KERN_PTR, "kernel pointer");
|
||||
}
|
||||
|
||||
#define IOCTL(fd, sym) any_ioctl_badbuf(fd, sym, #sym)
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
ioctl_badbuf(void)
|
||||
{
|
||||
/*
|
||||
@@ -83,39 +79,25 @@ ioctl_badbuf(void)
|
||||
|
||||
/* suppress gcc warning */
|
||||
(void)any_ioctl_badbuf;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
ioctl_badcode(void)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
|
||||
report_begin("invalid ioctl");
|
||||
rv = ioctl(STDIN_FILENO, NONEXIST_IOCTL, NULL);
|
||||
result = report_check(rv, errno, EIOCTL);
|
||||
return result;
|
||||
report_check(rv, errno, EIOCTL);
|
||||
}
|
||||
|
||||
void
|
||||
test_ioctl(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
|
||||
test_ioctl_fd(&ntests, &lost_points);
|
||||
test_ioctl_fd();
|
||||
|
||||
/* Since we don't actually define any ioctls, this is not meaningful */
|
||||
ntests++;
|
||||
result = ioctl_badcode();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = ioctl_badbuf();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
ioctl_badcode();
|
||||
ioctl_badbuf();
|
||||
}
|
||||
|
@@ -37,70 +37,52 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
link_dir(void)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
|
||||
report_begin("hard link of .");
|
||||
rv = link(".", TESTDIR);
|
||||
result = report_check(rv, errno, EINVAL);
|
||||
report_check(rv, errno, EINVAL);
|
||||
if (rv==0) {
|
||||
/* this might help recover... maybe */
|
||||
remove(TESTDIR);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
link_empty1(void)
|
||||
{
|
||||
int rv;
|
||||
|
||||
report_begin("hard link of empty string");
|
||||
rv = link("", TESTDIR);
|
||||
return report_check(rv, errno, EINVAL);
|
||||
report_check(rv, errno, EINVAL);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
link_empty2(void)
|
||||
{
|
||||
int rv;
|
||||
int result = FAILED;
|
||||
|
||||
report_begin("hard link to empty string");
|
||||
if (create_testdir()<0) {
|
||||
/*report_aborted();*/ /* XXX in create_testdir */
|
||||
return result;
|
||||
return;
|
||||
}
|
||||
rv = link(TESTDIR, "");
|
||||
result = report_check(rv, errno, EINVAL);
|
||||
report_check(rv, errno, EINVAL);
|
||||
rmdir(TESTDIR);
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
test_link(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
|
||||
test_link_paths(&ntests, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = link_dir();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = link_empty1();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = link_empty2();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
test_link_paths();
|
||||
link_dir();
|
||||
link_empty1();
|
||||
link_empty2();
|
||||
}
|
||||
|
@@ -44,38 +44,34 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
lseek_fd_device(void)
|
||||
{
|
||||
int fd, rv;
|
||||
int result;
|
||||
|
||||
report_begin("lseek on device");
|
||||
|
||||
fd = open("null:", O_RDONLY);
|
||||
if (fd<0) {
|
||||
report_warn("opening null: failed");
|
||||
report_aborted(&result);
|
||||
return result;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
|
||||
rv = lseek(fd, 309, SEEK_SET);
|
||||
result = report_check(rv, errno, ESPIPE);
|
||||
report_check(rv, errno, ESPIPE);
|
||||
|
||||
close(fd);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
lseek_file_stdin(void)
|
||||
{
|
||||
int fd, fd2, rv, status;
|
||||
const char slogan[] = "There ain't no such thing as a free lunch";
|
||||
size_t len = strlen(slogan);
|
||||
pid_t pid;
|
||||
int result = 0;
|
||||
|
||||
report_begin("lseek stdin when open on file");
|
||||
|
||||
@@ -83,27 +79,27 @@ lseek_file_stdin(void)
|
||||
pid = fork();
|
||||
if (pid<0) {
|
||||
report_warn("fork failed");
|
||||
report_aborted(&result);
|
||||
return result;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
else if (pid!=0) {
|
||||
/* parent */
|
||||
rv = waitpid(pid, &status, 0);
|
||||
if (rv<0) {
|
||||
report_warn("waitpid failed");
|
||||
report_aborted(&result);
|
||||
report_aborted();
|
||||
}
|
||||
if (WIFSIGNALED(status)) {
|
||||
report_warnx("subprocess exited with signal %d",
|
||||
WTERMSIG(status));
|
||||
report_aborted(&result);
|
||||
report_aborted();
|
||||
}
|
||||
else if (WIFEXITED(status) && WEXITSTATUS(status) != 0) {
|
||||
report_warnx("subprocess exited with code %d",
|
||||
WEXITSTATUS(status));
|
||||
report_aborted(&result);
|
||||
report_aborted();
|
||||
}
|
||||
return result;
|
||||
return;
|
||||
}
|
||||
|
||||
/* child */
|
||||
@@ -150,159 +146,133 @@ lseek_file_stdin(void)
|
||||
}
|
||||
|
||||
/* blah */
|
||||
report_skipped(&result);
|
||||
report_skipped();
|
||||
|
||||
rv = lseek(STDIN_FILENO, 0, SEEK_SET);
|
||||
report_begin("try 1: SEEK_SET");
|
||||
result = report_check(rv, errno, 0);
|
||||
report_check(rv, errno, 0);
|
||||
|
||||
rv = lseek(STDIN_FILENO, 0, SEEK_END);
|
||||
report_begin("try 2: SEEK_END");
|
||||
result = report_check(rv, errno, 0);
|
||||
report_check(rv, errno, 0);
|
||||
|
||||
remove(TESTFILE);
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
lseek_loc_negative(void)
|
||||
{
|
||||
int fd, rv;
|
||||
int result;
|
||||
|
||||
report_begin("lseek to negative offset");
|
||||
|
||||
fd = open_testfile(NULL);
|
||||
if (fd<0) {
|
||||
report_aborted(&result);
|
||||
return result;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
|
||||
rv = lseek(fd, -309, SEEK_SET);
|
||||
result = report_check(rv, errno, EINVAL);
|
||||
report_check(rv, errno, EINVAL);
|
||||
|
||||
close(fd);
|
||||
remove(TESTFILE);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
lseek_whence_inval(void)
|
||||
{
|
||||
int fd, rv;
|
||||
int result;
|
||||
|
||||
report_begin("lseek with invalid whence code");
|
||||
|
||||
fd = open_testfile(NULL);
|
||||
if (fd<0) {
|
||||
report_aborted(&result);
|
||||
return result;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
|
||||
rv = lseek(fd, 0, 3594);
|
||||
result = report_check(rv, errno, EINVAL);
|
||||
report_check(rv, errno, EINVAL);
|
||||
|
||||
close(fd);
|
||||
remove(TESTFILE);
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
lseek_loc_pasteof(void)
|
||||
{
|
||||
const char *message = "blahblah";
|
||||
int fd;
|
||||
off_t pos;
|
||||
int result;
|
||||
|
||||
report_begin("seek past/to EOF");
|
||||
|
||||
fd = open_testfile(message);
|
||||
if (fd<0) {
|
||||
report_aborted(&result);
|
||||
return result;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
|
||||
pos = lseek(fd, 5340, SEEK_SET);
|
||||
if (pos == -1) {
|
||||
report_warn("lseek past EOF failed");
|
||||
report_failure(&result);
|
||||
report_failure();
|
||||
goto out;
|
||||
}
|
||||
if (pos != 5340) {
|
||||
report_warnx("lseek to 5340 got offset %lld", (long long) pos);
|
||||
report_failure(&result);
|
||||
report_failure();
|
||||
goto out;
|
||||
}
|
||||
|
||||
pos = lseek(fd, -50, SEEK_CUR);
|
||||
if (pos == -1) {
|
||||
report_warn("small seek beyond EOF failed");
|
||||
report_failure(&result);
|
||||
report_failure();
|
||||
goto out;
|
||||
}
|
||||
if (pos != 5290) {
|
||||
report_warnx("SEEK_CUR to 5290 got offset %lld",
|
||||
(long long) pos);
|
||||
report_failure(&result);
|
||||
report_failure();
|
||||
goto out;
|
||||
}
|
||||
|
||||
pos = lseek(fd, 0, SEEK_END);
|
||||
if (pos == -1) {
|
||||
report_warn("seek to EOF failed");
|
||||
report_failure(&result);
|
||||
report_failure();
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (pos != (off_t) strlen(message)) {
|
||||
report_warnx("seek to EOF got %lld (should be %zu)",
|
||||
(long long) pos, strlen(message));
|
||||
report_failure(&result);
|
||||
report_failure();
|
||||
goto out;
|
||||
}
|
||||
|
||||
report_passed(&result);
|
||||
report_passed();
|
||||
|
||||
out:
|
||||
close(fd);
|
||||
remove(TESTFILE);
|
||||
return result;
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
test_lseek(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
test_lseek_fd();
|
||||
|
||||
test_lseek_fd(&ntests, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = lseek_fd_device();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = lseek_file_stdin();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = lseek_loc_negative();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = lseek_loc_pasteof();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = lseek_whence_inval();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
lseek_fd_device();
|
||||
lseek_file_stdin();
|
||||
lseek_loc_negative();
|
||||
lseek_loc_pasteof();
|
||||
lseek_whence_inval();
|
||||
}
|
||||
|
@@ -44,58 +44,44 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
mkdir_dot(void)
|
||||
{
|
||||
int rv;
|
||||
|
||||
report_begin("mkdir .");
|
||||
rv = mkdir(".", 0775);
|
||||
return report_check(rv, errno, EEXIST);
|
||||
report_check(rv, errno, EEXIST);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
mkdir_dotdot(void)
|
||||
{
|
||||
int rv;
|
||||
|
||||
report_begin("mkdir ..");
|
||||
rv = mkdir("..", 0775);
|
||||
return report_check(rv, errno, EEXIST);
|
||||
report_check(rv, errno, EEXIST);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
mkdir_empty(void)
|
||||
{
|
||||
int rv;
|
||||
|
||||
report_begin("mkdir of empty string");
|
||||
rv = mkdir("", 0775);
|
||||
return report_check(rv, errno, EINVAL);
|
||||
report_check(rv, errno, EINVAL);
|
||||
}
|
||||
|
||||
void
|
||||
test_mkdir(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
test_mkdir_path();
|
||||
|
||||
test_mkdir_path(&ntests, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = mkdir_dot();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
mkdir_dot();
|
||||
mkdir_dotdot();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
mkdir_empty();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
}
|
||||
|
@@ -44,48 +44,35 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
open_badflags(void)
|
||||
{
|
||||
int fd;
|
||||
|
||||
report_begin("open null: with bad flags");
|
||||
fd = open("null:", 309842);
|
||||
return report_check(fd, errno, EINVAL);
|
||||
report_check(fd, errno, EINVAL);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
open_empty(void)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
|
||||
report_begin("open empty string");
|
||||
rv = open("", O_RDONLY);
|
||||
result = report_check2(rv, errno, 0, EINVAL);
|
||||
report_check2(rv, errno, 0, EINVAL);
|
||||
if (rv>=0) {
|
||||
close(rv);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
test_open(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
test_open_path();
|
||||
|
||||
test_open_path(&ntests, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = open_badflags();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = open_empty();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
open_badflags();
|
||||
open_empty();
|
||||
}
|
||||
|
@@ -44,23 +44,22 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
pipe_badptr(void *ptr, const char *desc)
|
||||
{
|
||||
int rv;
|
||||
|
||||
report_begin("%s", desc);
|
||||
rv = pipe(ptr);
|
||||
return report_check(rv, errno, EFAULT);
|
||||
report_check(rv, errno, EFAULT);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
pipe_unaligned(void)
|
||||
{
|
||||
int fds[3], rv;
|
||||
char *ptr;
|
||||
int result;
|
||||
|
||||
report_begin("pipe with unaligned pointer");
|
||||
|
||||
@@ -68,32 +67,15 @@ pipe_unaligned(void)
|
||||
ptr++;
|
||||
|
||||
rv = pipe((int *)ptr);
|
||||
report_survival(rv, errno, &result);
|
||||
return result;
|
||||
report_survival(rv, errno);
|
||||
}
|
||||
|
||||
void
|
||||
test_pipe(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
pipe_badptr(NULL, "pipe with NULL pointer");
|
||||
pipe_badptr(INVAL_PTR, "pipe with invalid pointer");
|
||||
pipe_badptr(KERN_PTR, "pipe with kernel pointer");
|
||||
|
||||
ntests++;
|
||||
result = pipe_badptr(NULL, "pipe with NULL pointer");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = pipe_badptr(INVAL_PTR, "pipe with invalid pointer");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = pipe_badptr(KERN_PTR, "pipe with kernel pointer");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = pipe_unaligned();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
pipe_unaligned();
|
||||
}
|
||||
|
@@ -36,13 +36,7 @@
|
||||
void
|
||||
test_read(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
|
||||
test_read_fd(&ntests, &lost_points);
|
||||
test_read_buf(&ntests, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
|
||||
test_read_fd();
|
||||
test_read_buf();
|
||||
}
|
||||
|
||||
|
@@ -37,28 +37,26 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
readlink_file(void)
|
||||
{
|
||||
char buf[128];
|
||||
int fd, rv;
|
||||
int result;
|
||||
|
||||
report_begin("readlink on file");
|
||||
fd = open_testfile("the question contains an invalid assumption");
|
||||
if (fd<0) {
|
||||
report_aborted(&result);
|
||||
return result;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
close(fd);
|
||||
rv = readlink(TESTFILE, buf, sizeof(buf));
|
||||
result = report_check(rv, errno, EINVAL);
|
||||
report_check(rv, errno, EINVAL);
|
||||
remove(TESTFILE);
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
readlink_dir(void)
|
||||
{
|
||||
char buf[128];
|
||||
@@ -66,11 +64,11 @@ readlink_dir(void)
|
||||
|
||||
report_begin("readlink on .");
|
||||
rv = readlink(".", buf, sizeof(buf));
|
||||
return report_check(rv, errno, EISDIR);
|
||||
report_check(rv, errno, EISDIR);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
readlink_empty(void)
|
||||
{
|
||||
char buf[128];
|
||||
@@ -78,31 +76,17 @@ readlink_empty(void)
|
||||
|
||||
report_begin("readlink on empty string");
|
||||
rv = readlink("", buf, sizeof(buf));
|
||||
return report_check2(rv, errno, EISDIR, EINVAL);
|
||||
report_check2(rv, errno, EISDIR, EINVAL);
|
||||
}
|
||||
|
||||
void
|
||||
test_readlink(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
test_readlink_path();
|
||||
test_readlink_buf();
|
||||
|
||||
test_readlink_path(&ntests, &lost_points);
|
||||
test_readlink_buf(&ntests, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = readlink_file();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = readlink_dir();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = readlink_empty();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
readlink_file();
|
||||
readlink_dir();
|
||||
readlink_empty();
|
||||
}
|
||||
|
||||
|
@@ -44,27 +44,19 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
reboot_badflags(void)
|
||||
{
|
||||
int rv;
|
||||
|
||||
tprintf("(This should not kill the system...)\n");
|
||||
printf("(This should not kill the system...)\n");
|
||||
report_begin("reboot with invalid flags");
|
||||
rv = reboot(15353);
|
||||
return report_check(rv, errno, EINVAL);
|
||||
report_check(rv, errno, EINVAL);
|
||||
}
|
||||
|
||||
void
|
||||
test_reboot(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
|
||||
ntests++;
|
||||
result = reboot_badflags();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
reboot_badflags();
|
||||
}
|
||||
|
@@ -44,83 +44,63 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
remove_dir(void)
|
||||
{
|
||||
int rv;
|
||||
int result = FAILED;
|
||||
|
||||
report_begin("remove() on a directory");
|
||||
|
||||
if (create_testdir() < 0) {
|
||||
/*report_aborted();*/ /* XXX in create_testdir */
|
||||
return result;
|
||||
return;
|
||||
}
|
||||
|
||||
rv = remove(TESTDIR);
|
||||
result = report_check(rv, errno, EISDIR);
|
||||
report_check(rv, errno, EISDIR);
|
||||
rmdir(TESTDIR);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
remove_dot(void)
|
||||
{
|
||||
int rv;
|
||||
|
||||
report_begin("remove() on .");
|
||||
rv = remove(".");
|
||||
return report_check2(rv, errno, EISDIR, EINVAL);
|
||||
report_check2(rv, errno, EISDIR, EINVAL);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
remove_dotdot(void)
|
||||
{
|
||||
int rv;
|
||||
|
||||
report_begin("remove() on ..");
|
||||
rv = remove("..");
|
||||
return report_check2(rv, errno, EISDIR, EINVAL);
|
||||
report_check2(rv, errno, EISDIR, EINVAL);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
remove_empty(void)
|
||||
{
|
||||
int rv;
|
||||
|
||||
report_begin("remove() on empty string");
|
||||
rv = remove("");
|
||||
return report_check2(rv, errno, EISDIR, EINVAL);
|
||||
report_check2(rv, errno, EISDIR, EINVAL);
|
||||
}
|
||||
|
||||
void
|
||||
test_remove(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
test_remove_path();
|
||||
|
||||
test_remove_path(&ntests, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = remove_dir();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = remove_dot();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = remove_dotdot();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = remove_empty();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
remove_dir();
|
||||
remove_dot();
|
||||
remove_dotdot();
|
||||
remove_empty();
|
||||
}
|
||||
|
@@ -37,100 +37,75 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
rename_dot(void)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
|
||||
report_begin("rename .");
|
||||
|
||||
rv = rename(".", TESTDIR);
|
||||
result = report_check(rv, errno, EINVAL);
|
||||
report_check(rv, errno, EINVAL);
|
||||
if (rv==0) {
|
||||
/* oops... put it back */
|
||||
rename(TESTDIR, ".");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
rename_dotdot(void)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
|
||||
report_begin("rename ..");
|
||||
rv = rename("..", TESTDIR);
|
||||
result = report_check(rv, errno, EINVAL);
|
||||
report_check(rv, errno, EINVAL);
|
||||
if (rv==0) {
|
||||
/* oops... put it back */
|
||||
rename(TESTDIR, "..");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
rename_empty1(void)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
|
||||
report_begin("rename empty string");
|
||||
rv = rename("", TESTDIR);
|
||||
result = report_check2(rv, errno, EISDIR, EINVAL);
|
||||
report_check2(rv, errno, EISDIR, EINVAL);
|
||||
if (rv==0) {
|
||||
/* don't try to remove it */
|
||||
rename(TESTDIR, TESTDIR "-foo");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
rename_empty2(void)
|
||||
{
|
||||
int rv;
|
||||
int result = FAILED;
|
||||
|
||||
report_begin("rename to empty string");
|
||||
if (create_testdir()<0) {
|
||||
/*report_aborted();*/ /* XXX in create_testdir */
|
||||
return result;
|
||||
return;
|
||||
}
|
||||
rv = rename(TESTDIR, "");
|
||||
result = report_check2(rv, errno, EISDIR, EINVAL);
|
||||
report_check2(rv, errno, EISDIR, EINVAL);
|
||||
rmdir(TESTDIR);
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
test_rename(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
test_rename_paths();
|
||||
|
||||
test_rename_paths(&ntests, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = rename_dot();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = rename_dotdot();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = rename_empty1();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = rename_empty2();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
rename_dot();
|
||||
rename_dotdot();
|
||||
rename_empty1();
|
||||
rename_empty2();
|
||||
}
|
||||
|
||||
|
@@ -44,83 +44,61 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
rmdir_file(void)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
|
||||
report_begin("rmdir a file");
|
||||
if (create_testfile()<0) {
|
||||
report_aborted(&result);
|
||||
return result;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
rv = rmdir(TESTFILE);
|
||||
result = report_check(rv, errno, ENOTDIR);
|
||||
report_check(rv, errno, ENOTDIR);
|
||||
remove(TESTFILE);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
rmdir_dot(void)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
|
||||
report_begin("rmdir .");
|
||||
rv = rmdir(".");
|
||||
result = report_check(rv, errno, EINVAL);
|
||||
return result;
|
||||
report_check(rv, errno, EINVAL);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
rmdir_dotdot(void)
|
||||
{
|
||||
int rv;
|
||||
|
||||
report_begin("rmdir ..");
|
||||
rv = rmdir("..");
|
||||
return report_check2(rv, errno, EINVAL, ENOTEMPTY);
|
||||
report_check2(rv, errno, EINVAL, ENOTEMPTY);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
rmdir_empty(void)
|
||||
{
|
||||
int rv;
|
||||
|
||||
report_begin("rmdir empty string");
|
||||
rv = rmdir("");
|
||||
return report_check(rv, errno, EINVAL);
|
||||
report_check(rv, errno, EINVAL);
|
||||
}
|
||||
|
||||
void
|
||||
test_rmdir(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
test_rmdir_path();
|
||||
|
||||
test_rmdir_path(&ntests, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = rmdir_file();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = rmdir_dot();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = rmdir_dotdot();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = rmdir_empty();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
rmdir_file();
|
||||
rmdir_dot();
|
||||
rmdir_dotdot();
|
||||
rmdir_empty();
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ try_sbrk(long val)
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
enforce_sbrk(long val, const char *desc, int err)
|
||||
{
|
||||
int result;
|
||||
@@ -67,79 +67,59 @@ enforce_sbrk(long val, const char *desc, int err)
|
||||
report_begin("sbrk %s", desc);
|
||||
|
||||
result = try_sbrk(val);
|
||||
return report_check(result, errno, err);
|
||||
report_check(result, errno, err);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
sbrk_bigpos(void)
|
||||
{
|
||||
return enforce_sbrk(1024*1024*1024 + (1024*1024*1024 - 4096*17), "huge positive", ENOMEM);
|
||||
enforce_sbrk(4096*1024*256, "huge positive", ENOMEM);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
sbrk_bigneg(void)
|
||||
{
|
||||
return enforce_sbrk(-4096*1024*256, "huge negative", EINVAL);
|
||||
enforce_sbrk(-4096*1024*256, "huge negative", EINVAL);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
sbrk_neg(void)
|
||||
{
|
||||
return enforce_sbrk(-8192, "too-large negative", EINVAL);
|
||||
enforce_sbrk(-8192, "too-large negative", EINVAL);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
sbrk_unalignedpos(void)
|
||||
{
|
||||
int result;
|
||||
|
||||
report_begin("sbrk unaligned positive");
|
||||
result = try_sbrk(17);
|
||||
return report_check2(result, errno, 0, EINVAL);
|
||||
report_check2(result, errno, 0, EINVAL);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
sbrk_unalignedneg(void)
|
||||
{
|
||||
int result;
|
||||
|
||||
report_begin("sbrk unaligned negative");
|
||||
result = try_sbrk(-17);
|
||||
return report_check2(result, errno, 0, EINVAL);
|
||||
report_check2(result, errno, 0, EINVAL);
|
||||
}
|
||||
|
||||
void
|
||||
test_sbrk(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
|
||||
ntests++;
|
||||
result = sbrk_neg();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = sbrk_bigpos();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = sbrk_bigneg();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = sbrk_unalignedpos();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = sbrk_unalignedneg();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
sbrk_neg();
|
||||
sbrk_bigpos();
|
||||
sbrk_bigneg();
|
||||
sbrk_unalignedpos();
|
||||
sbrk_unalignedneg();
|
||||
}
|
||||
|
||||
|
@@ -67,7 +67,7 @@ badbuf_stat(struct stat *sb)
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
common_badbuf(int (*statfunc)(struct stat *), void *ptr,
|
||||
const char *call, const char *ptrdesc)
|
||||
{
|
||||
@@ -75,24 +75,22 @@ common_badbuf(int (*statfunc)(struct stat *), void *ptr,
|
||||
|
||||
report_begin("%s with %s buf", call, ptrdesc);
|
||||
rv = statfunc(ptr);
|
||||
return report_check(rv, errno, EFAULT);
|
||||
report_check(rv, errno, EFAULT);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
any_badbuf(int (*statfunc)(struct stat *), const char *call)
|
||||
{
|
||||
int result;
|
||||
result = common_badbuf(statfunc, NULL, call, "NULL");
|
||||
result |= common_badbuf(statfunc, INVAL_PTR, call, "invalid pointer");
|
||||
result |= common_badbuf(statfunc, KERN_PTR, call, "kernel pointer");
|
||||
return result;
|
||||
common_badbuf(statfunc, NULL, call, "NULL");
|
||||
common_badbuf(statfunc, INVAL_PTR, call, "invalid pointer");
|
||||
common_badbuf(statfunc, KERN_PTR, call, "kernel pointer");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
any_empty(int (*statfunc)(const char *, struct stat *), const char *call)
|
||||
{
|
||||
struct stat sb;
|
||||
@@ -100,7 +98,7 @@ any_empty(int (*statfunc)(const char *, struct stat *), const char *call)
|
||||
|
||||
report_begin("%s on empty string", call);
|
||||
rv = statfunc("", &sb);
|
||||
return report_check2(rv, errno, 0, EINVAL);
|
||||
report_check2(rv, errno, 0, EINVAL);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -108,56 +106,23 @@ any_empty(int (*statfunc)(const char *, struct stat *), const char *call)
|
||||
void
|
||||
test_fstat(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
|
||||
test_fstat_fd(&ntests, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = any_badbuf(badbuf_fstat, "fstat");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
test_fstat_fd();
|
||||
any_badbuf(badbuf_fstat, "fstat");
|
||||
}
|
||||
|
||||
void
|
||||
test_lstat(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
|
||||
test_lstat_path(&ntests, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = any_empty(lstat, "lstat");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = any_badbuf(badbuf_lstat, "lstat");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
test_lstat_path();
|
||||
any_empty(lstat, "lstat");
|
||||
any_badbuf(badbuf_lstat, "lstat");
|
||||
}
|
||||
|
||||
void
|
||||
test_stat(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
|
||||
test_stat_path(&ntests, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = any_empty(stat, "stat");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = any_badbuf(badbuf_stat, "stat");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
test_stat_path();
|
||||
any_empty(stat, "stat");
|
||||
any_badbuf(badbuf_stat, "stat");
|
||||
}
|
||||
|
||||
|
@@ -37,47 +37,32 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
symlink_empty1(void)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
|
||||
report_begin("symlink -> empty string");
|
||||
rv = symlink("", TESTLINK);
|
||||
result = report_check2(rv, errno, 0, EINVAL);
|
||||
report_check2(rv, errno, 0, EINVAL);
|
||||
remove(TESTLINK);
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
symlink_empty2(void)
|
||||
{
|
||||
int rv;
|
||||
|
||||
report_begin("symlink named empty string");
|
||||
rv = symlink("foo", "");
|
||||
return report_check(rv, errno, EINVAL);
|
||||
report_check(rv, errno, EINVAL);
|
||||
}
|
||||
|
||||
void
|
||||
test_symlink(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
|
||||
|
||||
test_symlink_paths(&ntests, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = symlink_empty1();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = symlink_empty2();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
test_symlink_paths();
|
||||
symlink_empty1();
|
||||
symlink_empty2();
|
||||
}
|
||||
|
@@ -44,49 +44,33 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
time_badsecs(void *ptr, const char *desc)
|
||||
{
|
||||
int rv;
|
||||
|
||||
report_begin("%s", desc);
|
||||
rv = __time(ptr, NULL);
|
||||
return report_check(rv, errno, EFAULT);
|
||||
report_check(rv, errno, EFAULT);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
time_badnsecs(void *ptr, const char *desc)
|
||||
{
|
||||
int rv;
|
||||
|
||||
report_begin("%s", desc);
|
||||
rv = __time(NULL, ptr);
|
||||
return report_check(rv, errno, EFAULT);
|
||||
report_check(rv, errno, EFAULT);
|
||||
}
|
||||
|
||||
void
|
||||
test_time(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
time_badsecs(INVAL_PTR, "__time with invalid seconds pointer");
|
||||
time_badsecs(KERN_PTR, "__time with kernel seconds pointer");
|
||||
|
||||
ntests++;
|
||||
result = time_badsecs(INVAL_PTR, "__time with invalid seconds pointer");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = time_badsecs(KERN_PTR, "__time with kernel seconds pointer");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = time_badnsecs(INVAL_PTR, "__time with invalid nsecs pointer");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = time_badnsecs(KERN_PTR, "__time with kernel nsecs pointer");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
time_badnsecs(INVAL_PTR, "__time with invalid nsecs pointer");
|
||||
time_badnsecs(KERN_PTR, "__time with kernel nsecs pointer");
|
||||
}
|
||||
|
@@ -42,7 +42,7 @@
|
||||
#include "test.h"
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
wait_badpid(pid_t pid, const char *desc)
|
||||
{
|
||||
pid_t rv;
|
||||
@@ -59,24 +59,23 @@ wait_badpid(pid_t pid, const char *desc)
|
||||
else if (err == ENOSYS) {
|
||||
report_saw_enosys();
|
||||
}
|
||||
return report_check2(rv, err, ESRCH, ECHILD);
|
||||
report_check2(rv, err, ESRCH, ECHILD);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
wait_nullstatus(void)
|
||||
{
|
||||
pid_t pid, rv;
|
||||
int x;
|
||||
int result;
|
||||
|
||||
report_begin("wait with NULL status");
|
||||
|
||||
pid = fork();
|
||||
if (pid<0) {
|
||||
report_warn("fork failed");
|
||||
report_aborted(&result);
|
||||
return result;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
if (pid==0) {
|
||||
exit(0);
|
||||
@@ -84,54 +83,50 @@ wait_nullstatus(void)
|
||||
|
||||
/* POSIX explicitly says passing NULL for status is allowed */
|
||||
rv = waitpid(pid, NULL, 0);
|
||||
result = report_check(rv, errno, 0);
|
||||
report_check(rv, errno, 0);
|
||||
waitpid(pid, &x, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
wait_badstatus(void *ptr, const char *desc)
|
||||
{
|
||||
pid_t pid, rv;
|
||||
int x;
|
||||
int result;
|
||||
|
||||
report_begin(desc);
|
||||
|
||||
pid = fork();
|
||||
if (pid<0) {
|
||||
report_warn("fork failed");
|
||||
report_aborted(&result);
|
||||
return result;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
if (pid==0) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
rv = waitpid(pid, ptr, 0);
|
||||
result = report_check(rv, errno, EFAULT);
|
||||
report_check(rv, errno, EFAULT);
|
||||
waitpid(pid, &x, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
wait_unaligned(void)
|
||||
{
|
||||
pid_t pid, rv;
|
||||
int x;
|
||||
int status[2]; /* will have integer alignment */
|
||||
char *ptr;
|
||||
int result;
|
||||
|
||||
report_begin("wait with unaligned status");
|
||||
|
||||
pid = fork();
|
||||
if (pid<0) {
|
||||
report_warn("fork failed");
|
||||
report_aborted(&result);
|
||||
return result;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
if (pid==0) {
|
||||
exit(0);
|
||||
@@ -144,61 +139,55 @@ wait_unaligned(void)
|
||||
ptr++;
|
||||
|
||||
rv = waitpid(pid, (int *)ptr, 0);
|
||||
report_survival(rv, errno, &result);
|
||||
report_survival(rv, errno);
|
||||
if (rv<0) {
|
||||
waitpid(pid, &x, 0);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
wait_badflags(void)
|
||||
{
|
||||
pid_t pid, rv;
|
||||
int x;
|
||||
int result;
|
||||
|
||||
report_begin("wait with bad flags");
|
||||
|
||||
pid = fork();
|
||||
if (pid<0) {
|
||||
report_warn("fork failed");
|
||||
report_aborted(&result);
|
||||
return result;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
if (pid==0) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
rv = waitpid(pid, &x, 309429);
|
||||
result = report_check(rv, errno, EINVAL);
|
||||
report_check(rv, errno, EINVAL);
|
||||
waitpid(pid, &x, 0);
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
wait_self(void)
|
||||
{
|
||||
pid_t rv;
|
||||
int x;
|
||||
int result;
|
||||
|
||||
report_begin("wait for self");
|
||||
|
||||
rv = waitpid(getpid(), &x, 0);
|
||||
report_survival(rv, errno, &result);
|
||||
return result;
|
||||
report_survival(rv, errno);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
wait_parent(void)
|
||||
{
|
||||
pid_t mypid, childpid, rv;
|
||||
int x;
|
||||
int result;
|
||||
|
||||
report_begin("wait for parent");
|
||||
report_hassubs();
|
||||
@@ -207,32 +196,30 @@ wait_parent(void)
|
||||
childpid = fork();
|
||||
if (childpid<0) {
|
||||
report_warn("can't fork");
|
||||
report_aborted(&result);
|
||||
return result;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
if (childpid==0) {
|
||||
/* Child. Wait for parent. */
|
||||
rv = waitpid(mypid, &x, 0);
|
||||
report_beginsub("from child:");
|
||||
report_survival(rv, errno, &result);
|
||||
report_survival(rv, errno);
|
||||
_exit(0);
|
||||
}
|
||||
rv = waitpid(mypid, &x, 0);
|
||||
rv = waitpid(childpid, &x, 0);
|
||||
report_beginsub("from parent:");
|
||||
report_survival(rv, errno, &result);
|
||||
return result;
|
||||
report_survival(rv, errno);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
wait_siblings_child(const char *semname)
|
||||
{
|
||||
pid_t pids[2], mypid, otherpid;
|
||||
int rv, fd, semfd, x;
|
||||
char c;
|
||||
int result;
|
||||
|
||||
mypid = getpid();
|
||||
|
||||
@@ -257,7 +244,7 @@ wait_siblings_child(const char *semname)
|
||||
if (fd<0) {
|
||||
report_warn("child process (pid %d) can't open %s",
|
||||
mypid, TESTFILE);
|
||||
return FAILED;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -270,13 +257,13 @@ wait_siblings_child(const char *semname)
|
||||
if (rv<0) {
|
||||
report_warn("child process (pid %d) lseek error",
|
||||
mypid);
|
||||
return FAILED;
|
||||
return;
|
||||
}
|
||||
rv = read(fd, pids, sizeof(pids));
|
||||
if (rv<0) {
|
||||
report_warn("child process (pid %d) read error",
|
||||
mypid);
|
||||
return FAILED;
|
||||
return;
|
||||
}
|
||||
} while (rv < (int)sizeof(pids));
|
||||
|
||||
@@ -289,25 +276,23 @@ wait_siblings_child(const char *semname)
|
||||
else {
|
||||
report_warn("child process (pid %d) got garbage in comm file",
|
||||
mypid);
|
||||
return FAILED;
|
||||
return;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
rv = waitpid(otherpid, &x, 0);
|
||||
report_beginsub("sibling (pid %d)", mypid);
|
||||
report_survival(rv, errno, &result);
|
||||
return result;
|
||||
report_survival(rv, errno);
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
wait_siblings(void)
|
||||
{
|
||||
pid_t pids[2];
|
||||
int rv, fd, semfd, x;
|
||||
int bad = 0;
|
||||
char semname[32];
|
||||
int result;
|
||||
|
||||
/* This test may also blow up if FS synchronization is substandard */
|
||||
|
||||
@@ -318,26 +303,26 @@ wait_siblings(void)
|
||||
semfd = open(semname, O_WRONLY|O_CREAT|O_TRUNC, 0664);
|
||||
if (semfd < 0) {
|
||||
report_warn("can't make semaphore");
|
||||
report_aborted(&result);
|
||||
return result;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
|
||||
fd = open_testfile(NULL);
|
||||
if (fd<0) {
|
||||
report_aborted(&result);
|
||||
report_aborted();
|
||||
close(semfd);
|
||||
remove(semname);
|
||||
return result;
|
||||
return;
|
||||
}
|
||||
|
||||
pids[0] = fork();
|
||||
if (pids[0]<0) {
|
||||
report_warn("can't fork");
|
||||
report_aborted(&result);
|
||||
report_aborted();
|
||||
close(fd);
|
||||
close(semfd);
|
||||
remove(semname);
|
||||
return result;
|
||||
return;
|
||||
}
|
||||
if (pids[0]==0) {
|
||||
close(fd);
|
||||
@@ -349,12 +334,12 @@ wait_siblings(void)
|
||||
pids[1] = fork();
|
||||
if (pids[1]<0) {
|
||||
report_warn("can't fork");
|
||||
report_aborted(&result);
|
||||
report_aborted();
|
||||
/* abandon the other child process :( */
|
||||
close(fd);
|
||||
close(semfd);
|
||||
remove(semname);
|
||||
return result;
|
||||
return;
|
||||
}
|
||||
if (pids[1]==0) {
|
||||
close(fd);
|
||||
@@ -366,21 +351,21 @@ wait_siblings(void)
|
||||
rv = write(fd, pids, sizeof(pids));
|
||||
if (rv < 0) {
|
||||
report_warn("write error on %s", TESTFILE);
|
||||
report_aborted(&result);
|
||||
report_aborted();
|
||||
/* abandon child procs :( */
|
||||
close(fd);
|
||||
close(semfd);
|
||||
remove(semname);
|
||||
return result;
|
||||
return;
|
||||
}
|
||||
if (rv != (int)sizeof(pids)) {
|
||||
report_warnx("write error on %s: short count", TESTFILE);
|
||||
report_aborted(&result);
|
||||
report_aborted();
|
||||
/* abandon child procs :( */
|
||||
close(fd);
|
||||
close(semfd);
|
||||
remove(semname);
|
||||
return result;
|
||||
return;
|
||||
}
|
||||
|
||||
/* gate the child procs */
|
||||
@@ -403,17 +388,15 @@ wait_siblings(void)
|
||||
}
|
||||
if (bad) {
|
||||
/* XXX: aborted, or failure, or what? */
|
||||
report_aborted(&result);
|
||||
report_aborted();
|
||||
}
|
||||
else {
|
||||
report_passed(&result);
|
||||
report_passed();
|
||||
}
|
||||
close(fd);
|
||||
close(semfd);
|
||||
remove(semname);
|
||||
remove(TESTFILE);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -421,61 +404,20 @@ wait_siblings(void)
|
||||
void
|
||||
test_waitpid(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
int result;
|
||||
wait_badpid(-8, "wait for pid -8");
|
||||
wait_badpid(-1, "wait for pid -1");
|
||||
wait_badpid(0, "pid zero");
|
||||
wait_badpid(NONEXIST_PID, "nonexistent pid");
|
||||
|
||||
ntests++;
|
||||
result = wait_badpid(-8, "wait for pid -8");
|
||||
handle_result(result, &lost_points);
|
||||
wait_nullstatus();
|
||||
wait_badstatus(INVAL_PTR, "wait with invalid pointer status");
|
||||
wait_badstatus(KERN_PTR, "wait with kernel pointer status");
|
||||
|
||||
ntests++;
|
||||
result = wait_badpid(-1, "wait for pid -1");
|
||||
handle_result(result, &lost_points);
|
||||
wait_unaligned();
|
||||
|
||||
ntests++;
|
||||
result = wait_badpid(0, "pid zero");
|
||||
handle_result(result, &lost_points);
|
||||
wait_badflags();
|
||||
|
||||
ntests++;
|
||||
result = wait_badpid(NONEXIST_PID, "nonexistent pid");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
|
||||
ntests++;
|
||||
result = wait_nullstatus();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = wait_badstatus(INVAL_PTR, "wait with invalid pointer status");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = wait_badstatus(KERN_PTR, "wait with kernel pointer status");
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
|
||||
ntests++;
|
||||
result = wait_unaligned();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
|
||||
ntests++;
|
||||
result = wait_badflags();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
|
||||
ntests++;
|
||||
result = wait_self();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = wait_parent();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
ntests++;
|
||||
result = wait_siblings();
|
||||
handle_result(result, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
wait_self();
|
||||
wait_parent();
|
||||
wait_siblings();
|
||||
}
|
||||
|
@@ -36,11 +36,6 @@
|
||||
void
|
||||
test_write(void)
|
||||
{
|
||||
int ntests = 0, lost_points = 0;
|
||||
|
||||
test_write_fd(&ntests, &lost_points);
|
||||
test_write_buf(&ntests, &lost_points);
|
||||
|
||||
if(!lost_points)
|
||||
success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
|
||||
test_write_fd();
|
||||
test_write_buf();
|
||||
}
|
||||
|
@@ -175,46 +175,33 @@ getcwd_badbuf(void *buf)
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
common_badbuf(struct buftest *info, void *buf, const char *bufdesc)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
|
||||
|
||||
report_begin("%s with %s buffer", info->name, bufdesc);
|
||||
info->setup();
|
||||
rv = info->op(buf);
|
||||
result = report_check(rv, errno, EFAULT);
|
||||
report_check(rv, errno, EFAULT);
|
||||
info->cleanup();
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
any_badbuf(struct buftest *info, int *ntests, int *lost_points)
|
||||
void
|
||||
any_badbuf(struct buftest *info)
|
||||
{
|
||||
int result;
|
||||
|
||||
*ntests += 1;
|
||||
result = common_badbuf(info, NULL, "NULL");
|
||||
handle_result(result, lost_points);
|
||||
|
||||
*ntests += 1;
|
||||
result = common_badbuf(info, INVAL_PTR, "invalid");
|
||||
handle_result(result, lost_points);
|
||||
|
||||
*ntests += 1;
|
||||
result = common_badbuf(info, KERN_PTR, "kernel-space");
|
||||
handle_result(result, lost_points);
|
||||
|
||||
return result;
|
||||
common_badbuf(info, NULL, "NULL");
|
||||
common_badbuf(info, INVAL_PTR, "invalid");
|
||||
common_badbuf(info, KERN_PTR, "kernel-space");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#define T(call) \
|
||||
void \
|
||||
test_##call##_buf(int *ntests, int *lost_points) \
|
||||
test_##call##_buf(void) \
|
||||
{ \
|
||||
static struct buftest info = { \
|
||||
call##_setup, \
|
||||
@@ -222,7 +209,7 @@ any_badbuf(struct buftest *info, int *ntests, int *lost_points)
|
||||
call##_cleanup, \
|
||||
#call, \
|
||||
}; \
|
||||
any_badbuf(&info, ntests, lost_points); \
|
||||
any_badbuf(&info); \
|
||||
}
|
||||
|
||||
T(read);
|
||||
|
@@ -138,58 +138,46 @@ dup2_cleanup(void)
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
any_badfd(int (*func)(int fd), void (*cleanup)(void), const char *callname,
|
||||
int fd, const char *fddesc)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
|
||||
report_begin("%s using %s", callname, fddesc);
|
||||
rv = func(fd);
|
||||
result = report_check(rv, errno, EBADF);
|
||||
report_check(rv, errno, EBADF);
|
||||
if (cleanup) {
|
||||
cleanup();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
runtest(int (*func)(int fd), void (*cleanup)(void), const char *callname,
|
||||
enum rwtestmodes rw, int *ntests, int *lost_points)
|
||||
enum rwtestmodes rw)
|
||||
{
|
||||
int fd;
|
||||
int result;
|
||||
|
||||
/*
|
||||
* If adding cases, also see bad_dup2.c
|
||||
*/
|
||||
|
||||
/* basic invalid case: fd -1 */
|
||||
*ntests += 1;
|
||||
result = any_badfd(func, cleanup, callname, -1, "fd -1");
|
||||
handle_result(result, lost_points);
|
||||
any_badfd(func, cleanup, callname, -1, "fd -1");
|
||||
|
||||
/* also try -5 in case -1 is special somehow */
|
||||
*ntests += 1;
|
||||
result = any_badfd(func, cleanup, callname, -5, "fd -5");
|
||||
handle_result(result, lost_points);
|
||||
any_badfd(func, cleanup, callname, -5, "fd -5");
|
||||
|
||||
/* try a fd we know is closed */
|
||||
*ntests += 1;
|
||||
result = any_badfd(func, cleanup, callname, CLOSED_FD, "closed fd");
|
||||
handle_result(result, lost_points);
|
||||
any_badfd(func, cleanup, callname, CLOSED_FD, "closed fd");
|
||||
|
||||
/* try a positive fd we know is out of range */
|
||||
*ntests += 1;
|
||||
result = any_badfd(func, cleanup, callname, IMPOSSIBLE_FD, "impossible fd");
|
||||
handle_result(result, lost_points);
|
||||
any_badfd(func, cleanup, callname, IMPOSSIBLE_FD, "impossible fd");
|
||||
|
||||
/* test for off-by-one errors */
|
||||
#ifdef OPEN_MAX
|
||||
*ntests += 1;
|
||||
result = any_badfd(func, cleanup, callname, OPEN_MAX, "fd OPEN_MAX");
|
||||
handle_result(result, lost_points);
|
||||
any_badfd(func, cleanup, callname, OPEN_MAX, "fd OPEN_MAX");
|
||||
#else
|
||||
warnx("Warning: OPEN_MAX not defined, test skipped");
|
||||
#endif
|
||||
@@ -200,10 +188,8 @@ runtest(int (*func)(int fd), void (*cleanup)(void), const char *callname,
|
||||
/* already printed a message */
|
||||
}
|
||||
else {
|
||||
*ntests += 1;
|
||||
result = any_badfd(func, cleanup, callname, fd,
|
||||
any_badfd(func, cleanup, callname, fd,
|
||||
"fd opened read-only");
|
||||
handle_result(result, lost_points);
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
@@ -213,10 +199,8 @@ runtest(int (*func)(int fd), void (*cleanup)(void), const char *callname,
|
||||
/* already printed a message */
|
||||
}
|
||||
else {
|
||||
*ntests += 1;
|
||||
result = any_badfd(func, cleanup, callname, fd,
|
||||
any_badfd(func, cleanup, callname, fd,
|
||||
"fd opened write-only");
|
||||
handle_result(result, lost_points);
|
||||
}
|
||||
close(fd);
|
||||
}
|
||||
@@ -224,18 +208,18 @@ runtest(int (*func)(int fd), void (*cleanup)(void), const char *callname,
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
#define T(call, rw) \
|
||||
void \
|
||||
test_##call##_fd(int *ntests, int *lost_points) \
|
||||
{ \
|
||||
runtest(call##_badfd, NULL, #call, rw, ntests, lost_points); \
|
||||
#define T(call, rw) \
|
||||
void \
|
||||
test_##call##_fd(void) \
|
||||
{ \
|
||||
runtest(call##_badfd, NULL, #call, rw); \
|
||||
}
|
||||
|
||||
#define TC(call, rw) \
|
||||
void \
|
||||
test_##call##_fd(int *ntests, int *lost_points) \
|
||||
{ \
|
||||
runtest(call##_badfd, call##_cleanup, #call, rw, ntests, lost_points); \
|
||||
#define TC(call, rw) \
|
||||
void \
|
||||
test_##call##_fd(void) \
|
||||
{ \
|
||||
runtest(call##_badfd, call##_cleanup, #call, rw);\
|
||||
}
|
||||
|
||||
T(read, RW_TEST_WRONLY);
|
||||
|
@@ -148,58 +148,46 @@ stat_badpath(const char *name)
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
common_badpath(int (*func)(const char *path), int mk, int rm, const char *path,
|
||||
const char *call, const char *pathdesc)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
|
||||
report_begin("%s with %s path", call, pathdesc);
|
||||
|
||||
if (mk) {
|
||||
if (create_testfile()<0) {
|
||||
report_aborted(&result);
|
||||
return result;
|
||||
report_aborted();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rv = func(path);
|
||||
result = report_check(rv, errno, EFAULT);
|
||||
report_check(rv, errno, EFAULT);
|
||||
|
||||
if (mk || rm) {
|
||||
remove(TESTFILE);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
any_badpath(int (*func)(const char *path), const char *call, int mk, int rm,
|
||||
int *ntests, int *lost_points)
|
||||
any_badpath(int (*func)(const char *path), const char *call, int mk, int rm)
|
||||
{
|
||||
int result;
|
||||
// We have a total of 3 tests
|
||||
*ntests = *ntests + 3;
|
||||
|
||||
result = common_badpath(func, mk, rm, NULL, call, "NULL");
|
||||
handle_result(result, lost_points);
|
||||
|
||||
result = common_badpath(func, mk, rm, INVAL_PTR, call, "invalid-pointer");
|
||||
handle_result(result, lost_points);
|
||||
|
||||
result = common_badpath(func, mk, rm, KERN_PTR, call, "kernel-pointer");
|
||||
handle_result(result, lost_points);
|
||||
common_badpath(func, mk, rm, NULL, call, "NULL");
|
||||
common_badpath(func, mk, rm, INVAL_PTR, call, "invalid-pointer");
|
||||
common_badpath(func, mk, rm, KERN_PTR, call, "kernel-pointer");
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
/* functions with one pathname */
|
||||
#define T(call) \
|
||||
void \
|
||||
test_##call##_path(int *ntests, int *lost_points) \
|
||||
{ \
|
||||
any_badpath(call##_badpath, #call, 0, 0, ntests, lost_points); \
|
||||
#define T(call) \
|
||||
void \
|
||||
test_##call##_path(void) \
|
||||
{ \
|
||||
any_badpath(call##_badpath, #call, 0, 0); \
|
||||
}
|
||||
|
||||
T(open);
|
||||
@@ -212,12 +200,12 @@ T(stat);
|
||||
T(lstat);
|
||||
|
||||
/* functions with two pathnames */
|
||||
#define T2(call) \
|
||||
void \
|
||||
test_##call##_paths(int *ntests, int *lost_points) \
|
||||
{ \
|
||||
any_badpath(call##_badpath1, #call "(arg1)", 0, 1, ntests, lost_points); \
|
||||
any_badpath(call##_badpath2, #call "(arg2)", 1, 1, ntests, lost_points); \
|
||||
#define T2(call) \
|
||||
void \
|
||||
test_##call##_paths(void) \
|
||||
{ \
|
||||
any_badpath(call##_badpath1, #call "(arg1)", 0, 1); \
|
||||
any_badpath(call##_badpath2, #call "(arg2)", 1, 1); \
|
||||
}
|
||||
|
||||
T2(rename);
|
||||
|
@@ -121,18 +121,16 @@ int
|
||||
create_testdir(void)
|
||||
{
|
||||
int rv;
|
||||
int result;
|
||||
|
||||
rv = mkdir(TESTDIR, 0775);
|
||||
if (rv<0) {
|
||||
if (errno == ENOSYS) {
|
||||
report_saw_enosys();
|
||||
report_warnx("mkdir unimplemented; cannot run test");
|
||||
report_skipped(&result);
|
||||
report_skipped();
|
||||
}
|
||||
else {
|
||||
report_warn("mkdir %s failed", TESTDIR);
|
||||
report_aborted(&result);
|
||||
report_aborted();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -200,20 +198,20 @@ menu(void)
|
||||
{
|
||||
int i;
|
||||
for (i=0; ops[i].name; i++) {
|
||||
tprintf("[%c] %-24s", ops[i].ch, ops[i].name);
|
||||
printf("[%c] %-24s", ops[i].ch, ops[i].name);
|
||||
if (i%2==1) {
|
||||
tprintf("\n");
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
if (i%2==1) {
|
||||
tprintf("\n");
|
||||
printf("\n");
|
||||
}
|
||||
tprintf("[1] %-24s", "asst1");
|
||||
tprintf("[2] %-24s\n", "asst2");
|
||||
tprintf("[3] %-24s", "asst3");
|
||||
tprintf("[4] %-24s\n", "asst4");
|
||||
tprintf("[*] %-24s", "all");
|
||||
tprintf("[!] %-24s\n", "quit");
|
||||
printf("[1] %-24s", "asst1");
|
||||
printf("[2] %-24s\n", "asst2");
|
||||
printf("[3] %-24s", "asst3");
|
||||
printf("[4] %-24s\n", "asst4");
|
||||
printf("[*] %-24s", "all");
|
||||
printf("[!] %-24s\n", "quit");
|
||||
}
|
||||
|
||||
static
|
||||
@@ -233,7 +231,7 @@ runit(int op)
|
||||
|
||||
if (op=='*') {
|
||||
for (i=0; ops[i].name; i++) {
|
||||
tprintf("[%s]\n", ops[i].name);
|
||||
printf("[%s]\n", ops[i].name);
|
||||
ops[i].f();
|
||||
}
|
||||
return;
|
||||
@@ -243,7 +241,7 @@ runit(int op)
|
||||
k = op-'0';
|
||||
for (i=0; ops[i].name; i++) {
|
||||
if (ops[i].asst <= k) {
|
||||
tprintf("[%s]\n", ops[i].name);
|
||||
printf("[%s]\n", ops[i].name);
|
||||
ops[i].f();
|
||||
}
|
||||
}
|
||||
@@ -251,7 +249,7 @@ runit(int op)
|
||||
}
|
||||
|
||||
if (op < LOWEST || op > HIGHEST) {
|
||||
tprintf("Invalid request %c\n", op);
|
||||
printf("Invalid request %c\n", op);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -263,12 +261,12 @@ main(int argc, char **argv)
|
||||
{
|
||||
int op, i, j;
|
||||
|
||||
tprintf("[%c-%c, 1-4, *, ?=menu, !=quit]\n", LOWEST, HIGHEST);
|
||||
printf("[%c-%c, 1-4, *, ?=menu, !=quit]\n", LOWEST, HIGHEST);
|
||||
|
||||
if (argc > 1) {
|
||||
for (i=1; i<argc; i++) {
|
||||
for (j=0; argv[i][j]; j++) {
|
||||
tprintf("Choose: %c\n",
|
||||
printf("Choose: %c\n",
|
||||
argv[i][j]);
|
||||
runit(argv[i][j]);
|
||||
}
|
||||
@@ -277,12 +275,12 @@ main(int argc, char **argv)
|
||||
else {
|
||||
menu();
|
||||
while (1) {
|
||||
tprintf("Choose: ");
|
||||
printf("Choose: ");
|
||||
op = getchar();
|
||||
if (op==EOF) {
|
||||
break;
|
||||
}
|
||||
tprintf("%c\n", op);
|
||||
printf("%c\n", op);
|
||||
runit(op);
|
||||
}
|
||||
}
|
||||
|
@@ -251,31 +251,27 @@ report_end(const char *msg)
|
||||
}
|
||||
|
||||
void
|
||||
report_passed(int *status)
|
||||
report_passed(void)
|
||||
{
|
||||
report_end("passed");
|
||||
*status = SUCCESS;
|
||||
}
|
||||
|
||||
void
|
||||
report_failure(int *status)
|
||||
report_failure(void)
|
||||
{
|
||||
report_end("FAILURE");
|
||||
*status = FAILED;
|
||||
}
|
||||
|
||||
void
|
||||
report_skipped(int *status)
|
||||
report_skipped(void)
|
||||
{
|
||||
report_end("------");
|
||||
*status = SKIPPED;
|
||||
}
|
||||
|
||||
void
|
||||
report_aborted(int *status)
|
||||
report_aborted(void)
|
||||
{
|
||||
report_end("ABORTED");
|
||||
*status = ABORTED;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -287,19 +283,18 @@ report_aborted(int *status)
|
||||
*/
|
||||
|
||||
void
|
||||
report_survival(int rv, int error, int *result)
|
||||
report_survival(int rv, int error)
|
||||
{
|
||||
/* allow any error as long as we survive */
|
||||
report_result(rv, error);
|
||||
report_passed(result);
|
||||
report_passed();
|
||||
}
|
||||
|
||||
static
|
||||
int
|
||||
void
|
||||
report_checkN(int rv, int error, int *right_errors, int right_num)
|
||||
{
|
||||
int i, goterror;
|
||||
int result = 1;
|
||||
|
||||
if (rv==-1) {
|
||||
goterror = error;
|
||||
@@ -311,40 +306,39 @@ report_checkN(int rv, int error, int *right_errors, int right_num)
|
||||
for (i=0; i<right_num; i++) {
|
||||
if (goterror == right_errors[i]) {
|
||||
report_result(rv, error);
|
||||
report_passed(&result);
|
||||
return result;
|
||||
report_passed();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (goterror == ENOSYS) {
|
||||
report_saw_enosys();
|
||||
say("(unimplemented) ");
|
||||
report_skipped(&result);
|
||||
report_skipped();
|
||||
}
|
||||
else {
|
||||
report_result(rv, error);
|
||||
report_failure(&result);
|
||||
report_failure();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
report_check(int rv, int error, int right_error)
|
||||
{
|
||||
return report_checkN(rv, error, &right_error, 1);
|
||||
report_checkN(rv, error, &right_error, 1);
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
report_check2(int rv, int error, int okerr1, int okerr2)
|
||||
{
|
||||
int ok[2];
|
||||
|
||||
ok[0] = okerr1;
|
||||
ok[1] = okerr2;
|
||||
return report_checkN(rv, error, ok, 2);
|
||||
report_checkN(rv, error, ok, 2);
|
||||
}
|
||||
|
||||
int
|
||||
void
|
||||
report_check3(int rv, int error, int okerr1, int okerr2, int okerr3)
|
||||
{
|
||||
int ok[3];
|
||||
@@ -352,13 +346,5 @@ report_check3(int rv, int error, int okerr1, int okerr2, int okerr3)
|
||||
ok[0] = okerr1;
|
||||
ok[1] = okerr2;
|
||||
ok[2] = okerr3;
|
||||
return report_checkN(rv, error, ok, 3);
|
||||
report_checkN(rv, error, ok, 3);
|
||||
}
|
||||
|
||||
void
|
||||
handle_result(int result, int *lost_points)
|
||||
{
|
||||
if(result)
|
||||
*lost_points = *lost_points + 1;
|
||||
}
|
||||
|
||||
|
@@ -27,8 +27,6 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <test161/test161.h>
|
||||
|
||||
#define TESTFILE "badcallfile"
|
||||
#define TESTDIR "badcalldir"
|
||||
#define TESTLINK "badcalllink"
|
||||
@@ -39,11 +37,6 @@
|
||||
#define PF(a, b)
|
||||
#endif
|
||||
|
||||
#define SUCCESS 0
|
||||
#define SKIPPED 1
|
||||
#define FAILED 2
|
||||
#define ABORTED 3
|
||||
|
||||
/* driver.c */
|
||||
int open_testfile(const char *str);
|
||||
int reopen_testfile(int openflags);
|
||||
@@ -59,46 +52,46 @@ PF(1, 2) void report_warn(const char *fmt, ...);
|
||||
PF(1, 2) void report_warnx(const char *fmt, ...);
|
||||
void report_result(int rv, int error);
|
||||
void report_saw_enosys(void);
|
||||
void report_passed(int *result);
|
||||
void report_failure(int *result);
|
||||
void report_skipped(int *result);
|
||||
void report_aborted(int *result);
|
||||
void report_survival(int rv, int error, int *result);
|
||||
int report_check(int rv, int error, int right_error);
|
||||
int report_check2(int rv, int error, int okerr1, int okerr2);
|
||||
int report_check3(int rv, int error, int okerr1, int okerr2, int okerr3);
|
||||
void report_passed(void);
|
||||
void report_failure(void);
|
||||
void report_skipped(void);
|
||||
void report_aborted(void);
|
||||
void report_survival(int rv, int error);
|
||||
void report_check(int rv, int error, int right_error);
|
||||
void report_check2(int rv, int error, int okerr1, int okerr2);
|
||||
void report_check3(int rv, int error, int okerr1, int okerr2, int okerr3);
|
||||
|
||||
/* common_buf.c */
|
||||
void test_read_buf(int *ntests, int *lost_points);
|
||||
void test_write_buf(int *ntests, int *lost_points);
|
||||
void test_getdirentry_buf(int *ntests, int *lost_points);
|
||||
void test_getcwd_buf(int *ntests, int *lost_points);
|
||||
void test_readlink_buf(int *ntests, int *lost_points);
|
||||
void test_read_buf(void);
|
||||
void test_write_buf(void);
|
||||
void test_getdirentry_buf(void);
|
||||
void test_getcwd_buf(void);
|
||||
void test_readlink_buf(void);
|
||||
|
||||
/* common_fds.c */
|
||||
void test_read_fd(int *ntests, int *lost_points);
|
||||
void test_write_fd(int *ntests, int *lost_points);
|
||||
void test_close_fd(int *ntests, int *lost_points);
|
||||
void test_ioctl_fd(int *ntests, int *lost_points);
|
||||
void test_lseek_fd(int *ntests, int *lost_points);
|
||||
void test_fsync_fd(int *ntests, int *lost_points);
|
||||
void test_ftruncate_fd(int *ntests, int *lost_points);
|
||||
void test_fstat_fd(int *ntests, int *lost_points);
|
||||
void test_getdirentry_fd(int *ntests, int *lost_points);
|
||||
void test_dup2_fd(int *ntests, int *lost_points);
|
||||
void test_read_fd(void);
|
||||
void test_write_fd(void);
|
||||
void test_close_fd(void);
|
||||
void test_ioctl_fd(void);
|
||||
void test_lseek_fd(void);
|
||||
void test_fsync_fd(void);
|
||||
void test_ftruncate_fd(void);
|
||||
void test_fstat_fd(void);
|
||||
void test_getdirentry_fd(void);
|
||||
void test_dup2_fd(void);
|
||||
|
||||
/* common_path.c */
|
||||
void test_open_path(int *ntests, int *lost_points);
|
||||
void test_remove_path(int *ntests, int *lost_points);
|
||||
void test_rename_paths(int *ntests, int *lost_points);
|
||||
void test_link_paths(int *ntests, int *lost_points);
|
||||
void test_mkdir_path(int *ntests, int *lost_points);
|
||||
void test_rmdir_path(int *ntests, int *lost_points);
|
||||
void test_chdir_path(int *ntests, int *lost_points);
|
||||
void test_symlink_paths(int *ntests, int *lost_points);
|
||||
void test_readlink_path(int *ntests, int *lost_points);
|
||||
void test_stat_path(int *ntests, int *lost_points);
|
||||
void test_lstat_path(int *ntests, int *lost_points);
|
||||
void test_open_path(void);
|
||||
void test_remove_path(void);
|
||||
void test_rename_paths(void);
|
||||
void test_link_paths(void);
|
||||
void test_mkdir_path(void);
|
||||
void test_rmdir_path(void);
|
||||
void test_chdir_path(void);
|
||||
void test_symlink_paths(void);
|
||||
void test_readlink_path(void);
|
||||
void test_stat_path(void);
|
||||
void test_lstat_path(void);
|
||||
|
||||
/* bad_*.c */
|
||||
void test_execv(void);
|
||||
@@ -129,6 +122,3 @@ void test_time(void);
|
||||
void test_getcwd(void);
|
||||
void test_stat(void);
|
||||
void test_lstat(void); /* in bad_stat.c */
|
||||
|
||||
void handle_result(int result, int *lost_points);
|
||||
|
||||
|
Reference in New Issue
Block a user