Added userland/testbin

This commit is contained in:
Guru Prasad Srinivasa
2016-02-29 20:10:59 -05:00
parent a5963a0e31
commit d466eb7102
53 changed files with 1538 additions and 460 deletions

View File

@@ -44,33 +44,48 @@
#include "test.h"
static
void
int
time_badsecs(void *ptr, const char *desc)
{
int rv;
report_begin("%s", desc);
rv = __time(ptr, NULL);
report_check(rv, errno, EFAULT);
return report_check(rv, errno, EFAULT);
}
static
void
int
time_badnsecs(void *ptr, const char *desc)
{
int rv;
report_begin("%s", desc);
rv = __time(NULL, ptr);
report_check(rv, errno, EFAULT);
return report_check(rv, errno, EFAULT);
}
void
test_time(void)
{
time_badsecs(INVAL_PTR, "__time with invalid seconds pointer");
time_badsecs(KERN_PTR, "__time with kernel seconds pointer");
int ntests = 0, lost_points = 0;
int result;
time_badnsecs(INVAL_PTR, "__time with invalid nsecs pointer");
time_badnsecs(KERN_PTR, "__time with kernel nsecs 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);
partial_credit(SECRET, "/testbin/badcall-time", ntests - lost_points, ntests);
}