View of xos/tests/vfat.c


XOS | Parent Directory | View | Download

/* Copyright (C) 2008  Emmanuel Varoquaux
 
   This file is part of XOS.
 
   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.
 
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
 
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
#include "common.h"
 
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
 
#define STOP_ON_ERROR 1
 
int main()
{
  chdir("/floppy");
  TEST(remove("TOTO.TXT"), 0);
  TEST(remove("rfc1945.txt"), 0);
  TEST(creat("TITI.TXT", 0), 0);
  TEST(creat("tata.txt", 0), 0);
  TEST(creat("aaaaaaaa1.txt", 0), 0);
  TEST(creat("aaaaaaaa2.txt", 0), 0);
  TEST(creat("aaaaaaaa3.txt", 0), 0);
  TEST(creat("The quick.fox", 0), 0);
  TEST(rmdir("noms"), ENOTEMPTY);
  TEST(remove("noms/a.txt"), 0);
  TEST(remove("noms/B.TXT"), 0);
  TEST(remove("noms/C.txt"), 0);
  TEST(remove("noms/d.TXT"), 0);
  TEST(rmdir("noms"), 0);
  TEST(rmdir("."), EBUSY);
  TEST(rmdir("noms/."), ENOENT);
  TEST(rmdir("noms/.."), ENOENT);
  TEST(mkdir("dir1", 0), 0);
  TEST(mkdir("dir1", 0), EEXIST);
  TEST(mkdir("dir2/", 0), 0);
  TEST(mkdir("/floppy/dir3", 0), 0);
  TEST(mkdir("bla", 0), 0);
  TEST(mkdir("bla/dir", 0), 0);
  TEST(rename("empty", "vide"), 0);
  TEST(rename("gpl.txt", "bla/gpl.txt"), 0);
  TEST(mkdir(".", 0), EEXIST);
  TEST(mkdir("..", 0), EEXIST);
  TEST(mkdir("bla/.", 0), EEXIST);
  TEST(mkdir("bla/..", 0), EEXIST);
  TEST(rename("bla", "dir2/BLA"), 0);
  TEST(rename("dir2/BLA/dir", "pouet"), 0);
  TEST(rename("pouet", "titi.txt"), EEXIST);
  TEST(rename("pouet", "pouet"), 0);
  TEST(mkdir("/", 0), EEXIST);
  TEST(rename("pouet", "/"), EEXIST);
  TEST(rename("/", "pouet"), EEXIST);
 
  return 0;
}