add test for rm .

This commit is contained in:
rsc 2007-08-10 17:53:09 +00:00
parent 15b326b630
commit 5e03dd86c8
2 changed files with 41 additions and 3 deletions

3
BUGS
View file

@ -31,9 +31,6 @@ sysfile.c:
general: general:
sizeof parens? sizeof parens?
usertests.c:
check for rm of . or ..
L=$HOME/mit/l L=$HOME/mit/l
(for i in *.c; do xoc -x xgnu -x ./nodecleq.zeta --typesonly $i; done) 2>&1 | grep warning (for i in *.c; do xoc -x xgnu -x ./nodecleq.zeta --typesonly $i; done) 2>&1 | grep warning

View file

@ -984,6 +984,7 @@ fourteen(void)
{ {
int fd; int fd;
// DIRSIZ is 14.
printf(1, "fourteen test\n"); printf(1, "fourteen test\n");
if(mkdir("12345678901234") != 0){ if(mkdir("12345678901234") != 0){
@ -1019,6 +1020,45 @@ fourteen(void)
printf(1, "fourteen ok\n"); printf(1, "fourteen ok\n");
} }
void
rmdot(void)
{
printf(1, "rmdot test\n");
if(mkdir("dots") != 0){
printf(1, "mkdir dots failed\n");
exit();
}
if(chdir("dots") != 0){
printf(1, "chdir dots failed\n");
exit();
}
if(unlink(".") == 0){
printf(1, "rm . worked!\n");
exit();
}
if(unlink("..") == 0){
printf(1, "rm .. worked!\n");
exit();
}
if(chdir("/") != 0){
printf(1, "chdir / failed\n");
exit();
}
if(unlink("dots/.") == 0){
printf(1, "unlink dots/. worked!\n");
exit();
}
if(unlink("dots/..") == 0){
printf(1, "unlink dots/.. worked!\n");
exit();
}
if(unlink("dots") != 0){
printf(1, "unlink dots failed!\n");
exit();
}
printf(1, "rmdot ok\n");
}
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
@ -1040,6 +1080,7 @@ main(int argc, char *argv[])
preempt(); preempt();
exitwait(); exitwait();
rmdot();
fourteen(); fourteen();
bigfile(); bigfile();
subdir(); subdir();