Test cases

The umsdos_progs/tests directory holds two utilities. utstgen is a general test suite "UMSDOS independant". It tests the general behavior of UMSDOS as a true UNIX-like file system. utstspc is truely UMSDOS oriented. It (will) tests the proper behavior of UMSDOS especially when the EMD and the MSDOS directory are out of sync. Currently utstspc is not testing much!

utstgen

[umsdos_progs/tests/utstgen.c,7]
#Specification: umsdos / automated test / general

utstgen.c is a sequence of test for the UMSDOS file system. These test are not really specific to the UMSDOS file system. You will find extensive testing of some stuff which are specific to the UMSDOS file system. There is a long section on hard link which could hardly fail on a normal UNIX file system and were a nightmare to implement in UMSDOS.

[umsdos_progs/tests/gen/hlink.c,108]
#Specification: utstgen / hard link / cases / across directory boundary

The target of the link is not in the same directory as the new link.

[umsdos_progs/tests/gen/hlink.c,121]
#Specification: utstgen / hard link / cases / target does not exist

Many hard links are attempted to a file which does not exist.

[umsdos_progs/tests/gen/hlink.c,127]
#Specification: utstgen / hard link / to a directory

A hard link can't be made to a directory.

[umsdos_progs/tests/gen/hlink.c,50]
#Specification: utstgen / hard links / case / link 2 link 2 link ...

hlink_simple does test a link made to a link made to a link and so on. On a normal UNIX file system, this test is not really an issue. Given the fact that a hardlink on UMSDOS is a symlink to a hidden file, it make sense to test at least the two cases:

hard link to an existing file with no link hard link to an existing file with more than one link.

[umsdos_progs/tests/gen/multi.c,67]
#Specification: utstgen / multi task / basic test

A simple test is performed on a directory, by many task. Only one task must succeeded at a time. The others must fail with specific error code.

So we fork 10 time.

This test hopes it is a sufficient test :-(

[umsdos_progs/tests/gen/file.c,176]
#Specification: utstgen / Rename test

Rename test are done with files and directories. The following case are tested

-In the same directory -In the root directory -In two independant directory -In a subdirectory and the parent

The same test is also done on an open file.

[umsdos_progs/tests/gen/file.c,199]
#Specification: utstgen / Rename test / open file

Rename test is done on an open file. We do the following sequence.

create a file Open it Rename it Write to the open handle Close it Open the file using the news name Read back the data and check it.

This test does not succeed if the file is renamed accross directories. This sounds like a limitation of the linux msdos driver. I am not sure at this point. I hope it is not a critical feature of a Unix file system. Comments are welcome about this topics. Comments with solution also :-)

[umsdos_progs/tests/gen/rename.c,104]
#Specification: utstgen / rename / destination exist

The following rename tests are done. The source is always file1 and the destination file2 always exist. file2 is a file or a directory. Here a the different case.

file1 is a file, file2 is a file. file1 is a file, file2 is a hard link to a file. file1 is a file, file2 exist and is a empty directory. file1 is a file, file2 exist and is a non empty directory.

file1 is a directory, file2 is a file. file1 is a directory, file2 is a hard link to a file. file1 is a directory, file2 exist and is a empty directory. file1 is a directory, file2 exist and is a non empty directory.

This sequence is performed in the same directory and accros. The following combination are tested.

path/dir1 -> path/dir1 path/dir1 -> path/dir2 path/dir1 -> path path -> path/dir1

[umsdos_progs/tests/gen/syml.c,49]
#Specification: utstgen / symbolic links / link 2 link 2 link ...

syml_simple does test the number of connected symlink the kernel can handle (A symlink pointing to another pointing to another ... and finally pointing to something.

[umsdos_progs/tests/gen/dir.c,142]
#Specification: utstgen / creating . and ..

A check is done that the special entries . and .. can't be created nor removed.

[umsdos_progs/tests/gen/dir.c,160]
#Specification: utstgen / removing a busy directory

A check is done that a busy directory can't be removed. Here is the sequence we test. It must fail with EBUSY.

mkdir dir cd dir rm ../dir

utstspc

[umsdos_progs/tests/utstspc.c,27]
#Specification: umsdos / automated test / specific

utstspc.c is a sequence of test for the UMSDOS file system. These tests are specific to the UMSDOS file system.

[umsdos_progs/tests/utstspc.c,38]
#Specification: utstspc / default environnement

utstspc needs to start from a fresh partition (it reformats it). So we normally use it on a floppy. utstspc do mount and umount of that floppy. The default mount point is /mnt and the default drive (for mformat) is F:.

This value F: looks very odd. This comes from my own setup. Here is my definition for /etc/mtools

A /dev/fd0 12 0 0 0 B /dev/fd1 12 0 0 0 E /dev/fd0h1200 12 80 2 15 # A: 5 1/4 F /dev/fd1H1440 12 80 2 18 # B: 3 1/2

Using /dev/fd0 and /dev/fd1 on A and B, this gives me flexibility for normal operation. I can read any type of floppy without much question. I can't do a mformat A: or B:. I always get an error. I guess /dev/fd0 are flexible driver, so do not impose a format.

The entries E and F replicate A and B but this time use the specific device. So I can do a "mformat f:" and expect to format a 1.44 3 1/2 floppy correctly.

Of course if you know better, please tell me!

[umsdos_progs/tests/utstspc.c,129]
#Specification: utstspc / floppy only

To avoid desaster, utstspc will only work on floppy. A test is done before everything to ensure that the drive is indeed a floppy.

It use /etc/mtools to locate the proper device. It also assume a floppy device have a path starting with "/dev/fd". This is not fool proof!

[umsdos_progs/tests/utilspc.c,86]
#Specification: utstspc / what's needed

utstspc use different other program to achieve its test. It has to reformat, mount, unmount etc... the floppy on which it is doing the test.

utstspc assume that the following utility are available.

/usr/bin/mformat /etc/mount or /bin/mount /etc/umount or /bin/umount

Also, it requieres /etc/mtools

[umsdos_progs/tests/spc/hlink.c,119]
#Specification: utstspc / hard link / cases / across directory boundary

The target of the link is not in the same directory as the new link.

[umsdos_progs/tests/spc/hlink.c,144]
#Specification: utstspc / hard link / cases / target does not exist

Many hard links are attempted to a file which does not exist.

[umsdos_progs/tests/spc/hlink.c,134]
#Specification: utstspc / hard link / in a DOS directory

A test is done to demonstrate that a hard link can't be created in a DOS directory.

[umsdos_progs/tests/spc/hlink.c,100]
#Specification: utstspc / hard link / subdirectory of a dos directory

We create two subdirectory in a DOS directory. We switch those to Umsdos mode (umssync). We set a lot of hard link between those two directories.

This test try to demonstrate that the only thing that matter is that both subdirectory must be umsdos directories. But the parents don't have to.

[umsdos_progs/tests/spc/hlink.c,150]
#Specification: utstspc / hard link / to a directory

A hard link can't be made to a directory.

[umsdos_progs/tests/spc/hlink.c,50]
#Specification: utstspc / hard links / case / link 2 link 2 link ...

hlink_simple does test a link made to a link made to a link and so on. On a normal UNIX file system, this test is not really an issue. Given the fact that a hardlink on UMSDOS is a symlink to a hidden file, it make sense to test at least the two cases:

hard link to an existing file with no link hard link to an existing file with more than one link.

[umsdos_progs/tests/spc/read.c,109]
#Specification: utstspc / read write

We write files with special pattern and read it back using different blocking scheme. This is to make sure the new read ahead support in the msdos fs is not screwing.

[umsdos_progs/tests/spc/read.c,152]
#Specification: utstspc / read write / text mode

The read/write test is done is text conversion mode also. This prove the read ahead of fs/msdos/file.c is working even in conv=text mode.