Merging in 2.0.2.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user