Many files:
  Checked in e2fsprogs 0.5c

diff --git a/tests/ChangeLog b/tests/ChangeLog
new file mode 100644
index 0000000..f50ef6c
--- /dev/null
+++ b/tests/ChangeLog
@@ -0,0 +1,16 @@
+Mon Sep  4 23:06:06 1995  Remy Card  <card@bbj>
+
+	* Makefile.in (clean, distclean): Use the -f option when removing
+		files.
+
+Fri Aug 11 10:10:30 1995  Theodore Y. Ts'o  <tytso@lurch.mit.edu>
+
+	* test_script: Count up the number of passed and failed tests by
+		tallying the *.ok and *.failed files.
+
+	* run_e2fsck: Create foo.ok and foo.failed files when tests
+		succeed or fail, respectively.
+
+	* test_config (TZ): Set the timezone to be GMT, so that test
+		results are consistent.
+
diff --git a/tests/Makefile.in b/tests/Makefile.in
new file mode 100644
index 0000000..4c77666
--- /dev/null
+++ b/tests/Makefile.in
@@ -0,0 +1,23 @@
+#
+# Makefile for the tests directory
+#
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+top_builddir = ..
+INSTALL = @INSTALL@
+
+all:: @DO_TEST_SUITE@
+
+check::
+	@echo "Running e2fsprogs test suite..."
+	@echo " "
+	@$(srcdir)/test_script $(srcdir)
+
+clean::
+	$(RM) -f *.log *.new *.failed *.ok test.img
+
+distclean:: clean
+	$(RM) -f Makefile
+	
diff --git a/tests/README b/tests/README
new file mode 100644
index 0000000..73e2681
--- /dev/null
+++ b/tests/README
@@ -0,0 +1,67 @@
+These images contain various forms of corrupted filesystem which
+e2fsck will correct.  They are used as a regression test for e2fsck.
+
+The test_script program will automatically run e2fsck against the
+filesystem images.  It will run them two times, and display the exit
+status for each run.  The meaning of the exit status codes are as
+follows:
+
+	0		No filesystem errors were detected
+	1		Filesystem errors detected, but corrected
+	2		System should be rebooted
+	4		Filesystem errors left uncorrected
+	8		Operational error (generally means internal error,
+				or filesystem error that the e2fsck was not
+				prepared to deal with)
+	16		Usage or syntax error
+
+During the regression test, the first exit code should be 1, and the
+second exit code should be 0.  In other words, all (with one
+exception) of the test filesystems in this directory have some sort of
+filesystem corruption, which e2fsck should fix on the first pass.
+After the first pass, e2fsck should leave a fully consistent
+filesystem with no detectable errors found in the second pass.  The
+exception is the okgroup.img filesystem, which contains no errors, and
+so both exit codes should be 0.
+
+NOTE: It appears that at least some versions of the original e2fsck do
+not exit with an exit status code of 1 after correcting filesystem
+errors.  So if you modify the test_script to try running these
+filesystems against the original e2fsck, you will have to inspect the
+test_script.log file manually.
+
+--------------------------------------------------------------
+Here's a one-line descriptons of the various test images in this
+directory:
+
+baddir.img		Filesystem with a corrupted directory
+badbblocks.img		Filesystem with illegal blocks in the bad block inode.
+badinode.img		Filesystem with various different corrupted inode
+				entries.
+badlkcnt.img		Filesystem with deleted files with non-zero link count
+badroot.img		Filesystem with a file for a root directory
+badtable.img		Filesystem with blocks shared between the bitmaps and
+				inode table blocks and the bad block inode
+bbfile.img		Filesystem with files containing bad blocks
+bitmaps.img		Filesystem with corrupted inode and block bitmaps
+dirlink.img		Filesystem with a hard link to a directory
+dup.img			Filesystem with blocks claimed by two different files
+dup2.img		Filesystem with blocks claimed by three different files
+dupfsblks.img		Filesystem with blocks claimed by a file and
+				inode/block bitmaps and inode tables
+dupsuper.img		Filesystem with blocks claimed by a file and
+				the superblock / group descriptors
+end-bitmap.img		Filesystem with corruption at the end of the block 
+				bitmap
+expand.img		Tests e2fsck's ability to expand lost+found if 
+				necessary
+lpf.img			Filesystem with disconnected files and no /lost+found 
+				directory
+mke2fs2b.img		Filesystem with corruption similar to that
+				created by mke2fs version 0.2b
+noroot.img		Filesystem with a deleted root directory
+okgroup.img		Filesystem that's exactly 8193 blocks long 
+				(otherwise OK)
+overfsblks.img		Filesystem with overlapping inode and block bitmaps
+
+
diff --git a/tests/defaults/f_script b/tests/defaults/f_script
new file mode 100644
index 0000000..7a3b34f
--- /dev/null
+++ b/tests/defaults/f_script
@@ -0,0 +1 @@
+. $cmd_dir/run_e2fsck
diff --git a/tests/f_badbblocks/expect.1 b/tests/f_badbblocks/expect.1
new file mode 100644
index 0000000..d819f65
--- /dev/null
+++ b/tests/f_badbblocks/expect.1
@@ -0,0 +1,20 @@
+Pass 1: Checking inodes, blocks, and sizes
+Remove illegal block(s) in bad block inode? yes
+
+Illegal block 101 in bad block inode.  CLEARED
+Illegal block 103 in bad block inode.  CLEARED
+Illegal block 234523 in bad block inode.  CLEARED
+Illegal block 200 in bad block inode.  CLEARED
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: +50.  FIXED
+Free blocks count wrong for group 0 (78, counted=77).  FIXED
+Free blocks count wrong (78, counted=77).  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 23/100 blocks
+Exit status is 1
diff --git a/tests/f_badbblocks/expect.2 b/tests/f_badbblocks/expect.2
new file mode 100644
index 0000000..f18e308
--- /dev/null
+++ b/tests/f_badbblocks/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 23/100 blocks
+Exit status is 0
diff --git a/tests/f_badbblocks/image.gz b/tests/f_badbblocks/image.gz
new file mode 100644
index 0000000..fe39b7f
--- /dev/null
+++ b/tests/f_badbblocks/image.gz
Binary files differ
diff --git a/tests/f_badbblocks/name b/tests/f_badbblocks/name
new file mode 100644
index 0000000..ab20f38
--- /dev/null
+++ b/tests/f_badbblocks/name
@@ -0,0 +1 @@
+illegal blocks in bad block inode
diff --git a/tests/f_baddir/expect.1 b/tests/f_baddir/expect.1
new file mode 100644
index 0000000..8ac16b8
--- /dev/null
+++ b/tests/f_baddir/expect.1
@@ -0,0 +1,39 @@
+Pass 1: Checking inodes, blocks, and sizes
+Directory 12, incorrect size, 182 (counted = 1024). Set size to counted? yes
+
+Inode 13 is a zero length directory.  Clear? yes
+
+Pass 2: Checking directory structure
+Entry 'zero' in / (2) has deleted/unused inode 13.
+Clear? yes
+
+Directory inode 12, block 0, offset 0: directory corrupted
+Salvage? yes
+
+Missing '.' in directory inode 12.
+Fix? yes
+
+Missing '..' in directory inode 12.
+Fix? yes
+
+Pass 3: Checking directory connectivity
+'..' in /block.h (12) is . (0), should be / (2).
+Fix? yes
+
+Pass 4: Checking reference counts
+Inode 12 has ref count 1, expecting 2.
+Set i_nlinks to count? yes
+
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: -22.  FIXED
+Free blocks count wrong (76, counted=77).  FIXED
+Inode bitmap differences: -13.  FIXED
+Free inodes count wrong for group #0 (19, counted=20).  FIXED
+Directories count wrong for group #0 (4, counted=3).  FIXED
+Free inodes count wrong (19, counted=20).  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/32 files, 23/100 blocks
+Exit status is 1
diff --git a/tests/f_baddir/expect.2 b/tests/f_baddir/expect.2
new file mode 100644
index 0000000..c21acaf
--- /dev/null
+++ b/tests/f_baddir/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 12/32 files, 23/100 blocks
+Exit status is 0
diff --git a/tests/f_baddir/image.gz b/tests/f_baddir/image.gz
new file mode 100644
index 0000000..7f6a782
--- /dev/null
+++ b/tests/f_baddir/image.gz
Binary files differ
diff --git a/tests/f_baddir/name b/tests/f_baddir/name
new file mode 100644
index 0000000..ee1947a
--- /dev/null
+++ b/tests/f_baddir/name
@@ -0,0 +1 @@
+corrupted directory
diff --git a/tests/f_baddotdir/expect.1 b/tests/f_baddotdir/expect.1
new file mode 100644
index 0000000..657ccb4
--- /dev/null
+++ b/tests/f_baddotdir/expect.1
@@ -0,0 +1,48 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Missing '.' in directory inode 12.
+Fix? yes
+
+Missing '..' in directory inode 12.
+Fix? yes
+
+First entry in directory inode 13 contains 'X' (inode=11)
+instead of '.'.
+Change to be '.'? yes
+
+Missing '..' in directory inode 14.
+Fix? yes
+
+Second entry in directory inode 15 contains 'XX' (inode=11)
+instead of '..'.
+Change to be '..'? yes
+
+Missing '.' in directory inode 16.
+Fix? yes
+
+Missing '..' in directory inode 16.
+Fix? yes
+
+Pass 3: Checking directory connectivity
+'..' in /a (12) is . (0), should be / (2).
+Fix? yes
+
+'..' in /c (14) is . (0), should be / (2).
+Fix? yes
+
+'..' in /d (15) is . (0), should be / (2).
+Fix? yes
+
+'..' in /e (16) is . (0), should be / (2).
+Fix? yes
+
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Free blocks count wrong for group 0 (72, counted=73).  FIXED
+Free blocks count wrong (72, counted=73).  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 16/32 files, 27/100 blocks
+Exit status is 1
diff --git a/tests/f_baddotdir/expect.2 b/tests/f_baddotdir/expect.2
new file mode 100644
index 0000000..862f94f
--- /dev/null
+++ b/tests/f_baddotdir/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 16/32 files, 27/100 blocks
+Exit status is 0
diff --git a/tests/f_baddotdir/image.gz b/tests/f_baddotdir/image.gz
new file mode 100644
index 0000000..a52bfb1
--- /dev/null
+++ b/tests/f_baddotdir/image.gz
Binary files differ
diff --git a/tests/f_baddotdir/name b/tests/f_baddotdir/name
new file mode 100644
index 0000000..c13ba75
--- /dev/null
+++ b/tests/f_baddotdir/name
@@ -0,0 +1 @@
+bad '.' and '..' entries
diff --git a/tests/f_badinode/expect.1 b/tests/f_badinode/expect.1
new file mode 100644
index 0000000..7ed7b54
--- /dev/null
+++ b/tests/f_badinode/expect.1
@@ -0,0 +1,25 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Inode 12 (/motd) has a bad mode (0110444).
+Clear? yes
+
+i_fsize for inode 13 (/timings) is 4, should be zero.
+Clear i_fsize? yes
+
+i_file_acl for inode 13 (/timings) is 39, should be zero.
+Clear i_file_acl? yes
+
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: -25.  FIXED
+Free blocks count wrong for group 0 (76, counted=77).  FIXED
+Free blocks count wrong (76, counted=77).  FIXED
+Free inodes count wrong for group #0 (19, counted=20).  FIXED
+Free inodes count wrong (19, counted=20).  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/32 files, 23/100 blocks
+Exit status is 1
diff --git a/tests/f_badinode/expect.2 b/tests/f_badinode/expect.2
new file mode 100644
index 0000000..c21acaf
--- /dev/null
+++ b/tests/f_badinode/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 12/32 files, 23/100 blocks
+Exit status is 0
diff --git a/tests/f_badinode/image.gz b/tests/f_badinode/image.gz
new file mode 100644
index 0000000..7b3ccd2
--- /dev/null
+++ b/tests/f_badinode/image.gz
Binary files differ
diff --git a/tests/f_badinode/name b/tests/f_badinode/name
new file mode 100644
index 0000000..38ee2d9
--- /dev/null
+++ b/tests/f_badinode/name
@@ -0,0 +1 @@
+corrupted inode entries
diff --git a/tests/f_badlkcnt/expect.1 b/tests/f_badlkcnt/expect.1
new file mode 100644
index 0000000..d3ad6a7
--- /dev/null
+++ b/tests/f_badlkcnt/expect.1
@@ -0,0 +1,17 @@
+Pass 1: Checking inodes, blocks, and sizes
+
+Deleted inode detected with non-zero link count.
+This is probably due to old ext2fs kernel code.  
+Fix inode(s)? yes
+
+Inode 13 is deleted w/ non-zero link_count.  CLEARED
+Inode 15 is deleted w/ non-zero link_count.  CLEARED
+Inode 16 is deleted w/ non-zero link_count.  CLEARED
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 29/32 files, 32/100 blocks
+Exit status is 1
diff --git a/tests/f_badlkcnt/expect.2 b/tests/f_badlkcnt/expect.2
new file mode 100644
index 0000000..6b2ea70
--- /dev/null
+++ b/tests/f_badlkcnt/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 29/32 files, 32/100 blocks
+Exit status is 0
diff --git a/tests/f_badlkcnt/image.gz b/tests/f_badlkcnt/image.gz
new file mode 100644
index 0000000..3ba07cc
--- /dev/null
+++ b/tests/f_badlkcnt/image.gz
Binary files differ
diff --git a/tests/f_badlkcnt/name b/tests/f_badlkcnt/name
new file mode 100644
index 0000000..d57851d
--- /dev/null
+++ b/tests/f_badlkcnt/name
@@ -0,0 +1 @@
+deleted files with non-zero link count
diff --git a/tests/f_badprimary/expect.1 b/tests/f_badprimary/expect.1
new file mode 100644
index 0000000..5410673
--- /dev/null
+++ b/tests/f_badprimary/expect.1
@@ -0,0 +1,25 @@
+Pass 1: Checking inodes, blocks, and sizes
+The primary superblock (1) is on the bad block list.
+
+If the block is really bad, the filesystem can not be fixed.
+You can clear the this block from the bad block list
+and hope that block is really OK, but there are no guarantees.
+
+Clear (and hope for the best)? yes
+
+Block 2 in the primary group descriptors is on the bad block list
+
+If the block is really bad, the filesystem can not be fixed.
+You can clear the this block from the bad block list
+and hope that block is really OK, but there are no guarantees.
+
+Clear (and hope for the best)? yes
+
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 1
diff --git a/tests/f_badprimary/expect.2 b/tests/f_badprimary/expect.2
new file mode 100644
index 0000000..b8b19f8
--- /dev/null
+++ b/tests/f_badprimary/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 0
diff --git a/tests/f_badprimary/image.gz b/tests/f_badprimary/image.gz
new file mode 100644
index 0000000..7aeb611
--- /dev/null
+++ b/tests/f_badprimary/image.gz
Binary files differ
diff --git a/tests/f_badprimary/name b/tests/f_badprimary/name
new file mode 100644
index 0000000..dacce31
--- /dev/null
+++ b/tests/f_badprimary/name
@@ -0,0 +1 @@
+bad blocks in the primary superblock and group descriptors
diff --git a/tests/f_badroot/expect.1 b/tests/f_badroot/expect.1
new file mode 100644
index 0000000..e04d9cc
--- /dev/null
+++ b/tests/f_badroot/expect.1
@@ -0,0 +1,37 @@
+Pass 1: Checking inodes, blocks, and sizes
+Root inode is not a directory.  Clear? yes
+
+Pass 2: Checking directory structure
+Entry '..' in ??? (11) has deleted/unused inode 2.
+Clear? yes
+
+Pass 3: Checking directory connectivity
+Root inode not allocated.  Rellocate? yes
+
+Unconnected directory inode 11 (...)
+Connect to /lost+found? yes
+
+/lost+found not found.  Create? yes
+
+Pass 4: Checking reference counts
+Inode 11 has ref count 3, expecting 2.
+Set i_nlinks to count? yes
+
+Unattached inode 12
+Connect to /lost+found? yes
+
+Inode 12 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Free blocks count wrong for group 0 (77, counted=76).  FIXED
+Free blocks count wrong (77, counted=76).  FIXED
+Free inodes count wrong for group #0 (20, counted=19).  FIXED
+Directories count wrong for group #0 (2, counted=3).  FIXED
+Free inodes count wrong (20, counted=19).  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 13/32 files, 24/100 blocks
+Exit status is 1
diff --git a/tests/f_badroot/expect.2 b/tests/f_badroot/expect.2
new file mode 100644
index 0000000..7871e7d
--- /dev/null
+++ b/tests/f_badroot/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 13/32 files, 24/100 blocks
+Exit status is 0
diff --git a/tests/f_badroot/image.gz b/tests/f_badroot/image.gz
new file mode 100644
index 0000000..72980a3
--- /dev/null
+++ b/tests/f_badroot/image.gz
Binary files differ
diff --git a/tests/f_badroot/name b/tests/f_badroot/name
new file mode 100644
index 0000000..399e4f2
--- /dev/null
+++ b/tests/f_badroot/name
@@ -0,0 +1 @@
+file in root directory inode
diff --git a/tests/f_badtable/expect.1 b/tests/f_badtable/expect.1
new file mode 100644
index 0000000..f1c00e1
--- /dev/null
+++ b/tests/f_badtable/expect.1
@@ -0,0 +1,29 @@
+Pass 1: Checking inodes, blocks, and sizes
+Group 0's block bitmap (3) is bad.  Relocate? yes
+
+Group 0's inode bitmap (4) is bad.  Relocate? yes
+
+WARNING: Severe data loss possible!!!!
+Bad block 6 in group 0's inode table.  Relocate? yes
+
+WARNING: Severe data loss possible!!!!
+Bad block 8 in group 0's inode table.  Relocate? yes
+
+Relocating group 0's block bitmap from 3 to 22...
+Relocating group 0's inode bitmap from 4 to 23...
+Relocating group 0's inode table from 5 to 24...
+Restarting e2fsck from the beginning...
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: -5 -7 +22 +23 +24 +25 +26 +27.  FIXED
+Free blocks count wrong for group 0 (78, counted=74).  FIXED
+Free blocks count wrong (78, counted=74).  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 26/100 blocks
+Exit status is 1
diff --git a/tests/f_badtable/expect.2 b/tests/f_badtable/expect.2
new file mode 100644
index 0000000..d6a69dd
--- /dev/null
+++ b/tests/f_badtable/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 26/100 blocks
+Exit status is 0
diff --git a/tests/f_badtable/image.gz b/tests/f_badtable/image.gz
new file mode 100644
index 0000000..48dbac1
--- /dev/null
+++ b/tests/f_badtable/image.gz
Binary files differ
diff --git a/tests/f_badtable/name b/tests/f_badtable/name
new file mode 100644
index 0000000..e4a8bae
--- /dev/null
+++ b/tests/f_badtable/name
@@ -0,0 +1 @@
+bad blocks in bitmaps and inode table
diff --git a/tests/f_bbfile/expect.1 b/tests/f_bbfile/expect.1
new file mode 100644
index 0000000..7b6088b
--- /dev/null
+++ b/tests/f_bbfile/expect.1
@@ -0,0 +1,44 @@
+Pass 1: Checking inodes, blocks, and sizes
+Group 0's inode bitmap (4) is bad.  Relocate? yes
+
+Relocating group 0's inode bitmap from 4 to 43...
+Duplicate blocks found... invoking duplicate block passes.
+Pass 1B: Rescan for duplicate/bad blocks
+Duplicate/bad block(s) in inode 2: 21
+Duplicate/bad block(s) in inode 11: 9 10 11 12 13 14 15 16 17 18 19 20
+Duplicate/bad block(s) in inode 12: 25 26
+Pass 1C: Scan directories for inodes with dup blocks.
+Pass 1D: Reconciling duplicate blocks
+(There are 3 inodes containing duplicate/bad blocks.)
+
+File /termcap (inode #12, mod time Sun Jan  2 08:29:13 1994) 
+  has 2 duplicate blocks, shared with 1 file:
+	<The bad blocks inode> (inode #1, mod time Sun Jul 17 00:47:58 1994)
+Clone duplicate/bad blocks? yes
+
+
+File /lost+found (inode #11, mod time Sun Jan  2 08:28:40 1994) 
+  has 12 duplicate blocks, shared with 1 file:
+	<The bad blocks inode> (inode #1, mod time Sun Jul 17 00:47:58 1994)
+Clone duplicate/bad blocks? yes
+
+
+File / (inode #2, mod time Sun Jan  2 08:29:13 1994) 
+  has 1 duplicate blocks, shared with 1 file:
+	<The bad blocks inode> (inode #1, mod time Sun Jul 17 00:47:58 1994)
+Clone duplicate/bad blocks? yes
+
+
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: +43.  FIXED
+Free blocks count wrong for group 0 (57, counted=41).  FIXED
+Free blocks count wrong (57, counted=41).  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/32 files, 59/100 blocks
+Exit status is 1
diff --git a/tests/f_bbfile/expect.2 b/tests/f_bbfile/expect.2
new file mode 100644
index 0000000..3ddc85d
--- /dev/null
+++ b/tests/f_bbfile/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 12/32 files, 59/100 blocks
+Exit status is 0
diff --git a/tests/f_bbfile/image.gz b/tests/f_bbfile/image.gz
new file mode 100644
index 0000000..3b01381
--- /dev/null
+++ b/tests/f_bbfile/image.gz
Binary files differ
diff --git a/tests/f_bbfile/name b/tests/f_bbfile/name
new file mode 100644
index 0000000..8843fbb
--- /dev/null
+++ b/tests/f_bbfile/name
@@ -0,0 +1 @@
+bad blocks in files
diff --git a/tests/f_bitmaps/expect.1 b/tests/f_bitmaps/expect.1
new file mode 100644
index 0000000..0e0b74b
--- /dev/null
+++ b/tests/f_bitmaps/expect.1
@@ -0,0 +1,13 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: +12 -20 +41 -50.  FIXED
+Inode bitmap differences: +11 -15.  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 1
diff --git a/tests/f_bitmaps/expect.2 b/tests/f_bitmaps/expect.2
new file mode 100644
index 0000000..b8b19f8
--- /dev/null
+++ b/tests/f_bitmaps/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 0
diff --git a/tests/f_bitmaps/image.gz b/tests/f_bitmaps/image.gz
new file mode 100644
index 0000000..1c533eb
--- /dev/null
+++ b/tests/f_bitmaps/image.gz
Binary files differ
diff --git a/tests/f_bitmaps/name b/tests/f_bitmaps/name
new file mode 100644
index 0000000..a309bfa
--- /dev/null
+++ b/tests/f_bitmaps/name
@@ -0,0 +1 @@
+corrupted inode and block bitmaps
diff --git a/tests/f_dirlink/expect.1 b/tests/f_dirlink/expect.1
new file mode 100644
index 0000000..c89f34b
--- /dev/null
+++ b/tests/f_dirlink/expect.1
@@ -0,0 +1,12 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Entry 'quux' in /foo (12) is a link to directory /bar (13).
+Clear? yes
+
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 13/32 files, 24/100 blocks
+Exit status is 1
diff --git a/tests/f_dirlink/expect.2 b/tests/f_dirlink/expect.2
new file mode 100644
index 0000000..7871e7d
--- /dev/null
+++ b/tests/f_dirlink/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 13/32 files, 24/100 blocks
+Exit status is 0
diff --git a/tests/f_dirlink/image.gz b/tests/f_dirlink/image.gz
new file mode 100644
index 0000000..2e8def4
--- /dev/null
+++ b/tests/f_dirlink/image.gz
Binary files differ
diff --git a/tests/f_dirlink/name b/tests/f_dirlink/name
new file mode 100644
index 0000000..30dbdce
--- /dev/null
+++ b/tests/f_dirlink/name
@@ -0,0 +1 @@
+directory hard links
diff --git a/tests/f_dup/expect.1 b/tests/f_dup/expect.1
new file mode 100644
index 0000000..996eb07
--- /dev/null
+++ b/tests/f_dup/expect.1
@@ -0,0 +1,34 @@
+Pass 1: Checking inodes, blocks, and sizes
+Duplicate blocks found... invoking duplicate block passes.
+Pass 1B: Rescan for duplicate/bad blocks
+Duplicate/bad block(s) in inode 12: 25 26
+Duplicate/bad block(s) in inode 13: 25 26
+Pass 1C: Scan directories for inodes with dup blocks.
+Pass 1D: Reconciling duplicate blocks
+(There are 2 inodes containing duplicate/bad blocks.)
+
+File /motd (inode #13, mod time Tue Sep 21 03:19:20 1993) 
+  has 2 duplicate blocks, shared with 1 file:
+	/termcap (inode #12, mod time Tue Sep 21 03:19:14 1993)
+Clone duplicate/bad blocks? yes
+
+
+File /termcap (inode #12, mod time Tue Sep 21 03:19:14 1993) 
+  has 2 duplicate blocks, shared with 1 file:
+	/motd (inode #13, mod time Tue Sep 21 03:19:20 1993)
+Duplicated blocks already reassigned or cloned.
+
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Free blocks count wrong for group 0 (44, counted=60).  FIXED
+Free blocks count wrong (62, counted=60).  FIXED
+Padding at end of block bitmap is not set. Fix? yes
+
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 13/16 files, 40/100 blocks
+Exit status is 1
diff --git a/tests/f_dup/expect.2 b/tests/f_dup/expect.2
new file mode 100644
index 0000000..e65d692
--- /dev/null
+++ b/tests/f_dup/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 13/16 files, 40/100 blocks
+Exit status is 0
diff --git a/tests/f_dup/image.gz b/tests/f_dup/image.gz
new file mode 100644
index 0000000..3e04690
--- /dev/null
+++ b/tests/f_dup/image.gz
Binary files differ
diff --git a/tests/f_dup/name b/tests/f_dup/name
new file mode 100644
index 0000000..6296b83
--- /dev/null
+++ b/tests/f_dup/name
@@ -0,0 +1 @@
+blocks claimed by two different files
diff --git a/tests/f_dup2/expect.1 b/tests/f_dup2/expect.1
new file mode 100644
index 0000000..6625f2f
--- /dev/null
+++ b/tests/f_dup2/expect.1
@@ -0,0 +1,42 @@
+Pass 1: Checking inodes, blocks, and sizes
+Duplicate blocks found... invoking duplicate block passes.
+Pass 1B: Rescan for duplicate/bad blocks
+Duplicate/bad block(s) in inode 12: 25 26
+Duplicate/bad block(s) in inode 13: 25 26 57 58
+Duplicate/bad block(s) in inode 14: 57 58
+Pass 1C: Scan directories for inodes with dup blocks.
+Pass 1D: Reconciling duplicate blocks
+(There are 3 inodes containing duplicate/bad blocks.)
+
+File /pass1.c (inode #14, mod time Tue Sep 21 04:28:37 1993) 
+  has 2 duplicate blocks, shared with 1 file:
+	/motd (inode #13, mod time Tue Sep 21 03:19:20 1993)
+Clone duplicate/bad blocks? yes
+
+
+File /motd (inode #13, mod time Tue Sep 21 03:19:20 1993) 
+  has 4 duplicate blocks, shared with 2 files:
+	/pass1.c (inode #14, mod time Tue Sep 21 04:28:37 1993)
+	/termcap (inode #12, mod time Tue Sep 21 03:19:14 1993)
+Clone duplicate/bad blocks? yes
+
+
+File /termcap (inode #12, mod time Tue Sep 21 03:19:14 1993) 
+  has 2 duplicate blocks, shared with 1 file:
+	/motd (inode #13, mod time Tue Sep 21 03:19:20 1993)
+Duplicated blocks already reassigned or cloned.
+
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Free blocks count wrong for group 0 (8, counted=22).  FIXED
+Free blocks count wrong (26, counted=22).  FIXED
+Padding at end of block bitmap is not set. Fix? yes
+
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 16/16 files, 78/100 blocks
+Exit status is 1
diff --git a/tests/f_dup2/expect.2 b/tests/f_dup2/expect.2
new file mode 100644
index 0000000..0700500
--- /dev/null
+++ b/tests/f_dup2/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 16/16 files, 78/100 blocks
+Exit status is 0
diff --git a/tests/f_dup2/image.gz b/tests/f_dup2/image.gz
new file mode 100644
index 0000000..e9b853d
--- /dev/null
+++ b/tests/f_dup2/image.gz
Binary files differ
diff --git a/tests/f_dup2/name b/tests/f_dup2/name
new file mode 100644
index 0000000..3d636e0
--- /dev/null
+++ b/tests/f_dup2/name
@@ -0,0 +1 @@
+blocks claimed by three different files
diff --git a/tests/f_dupfsblks/expect.1 b/tests/f_dupfsblks/expect.1
new file mode 100644
index 0000000..1ff77ac
--- /dev/null
+++ b/tests/f_dupfsblks/expect.1
@@ -0,0 +1,31 @@
+Pass 1: Checking inodes, blocks, and sizes
+Remove illegal block(s) in inode 12? yes
+
+Block #1 (3) is the block bitmap of group 0.  CLEARED
+Block #2 (4) is the inode bitmap of group 0.  CLEARED
+Block #3 (6) is in the inode table of group 0.  CLEARED
+Directory 12, incorrect size, 4096 (counted = 1024). Set size to counted? yes
+
+Inode 12, i_blocks wrong 8 (counted=2).  Set i_blocks to counted? yes
+
+Pass 2: Checking directory structure
+Directory inode 12 has a hole at block #1
+Allocate block? yes
+
+Directory inode 12 has a hole at block #2
+Allocate block? yes
+
+Directory inode 12 has a hole at block #3
+Allocate block? yes
+
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Free blocks count wrong for group 0 (77, counted=74).  FIXED
+Free blocks count wrong (77, counted=74).  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/32 files, 26/100 blocks
+Exit status is 1
diff --git a/tests/f_dupfsblks/expect.2 b/tests/f_dupfsblks/expect.2
new file mode 100644
index 0000000..e506f23
--- /dev/null
+++ b/tests/f_dupfsblks/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 12/32 files, 26/100 blocks
+Exit status is 0
diff --git a/tests/f_dupfsblks/image.gz b/tests/f_dupfsblks/image.gz
new file mode 100644
index 0000000..5514de4
--- /dev/null
+++ b/tests/f_dupfsblks/image.gz
Binary files differ
diff --git a/tests/f_dupfsblks/name b/tests/f_dupfsblks/name
new file mode 100644
index 0000000..84124c9
--- /dev/null
+++ b/tests/f_dupfsblks/name
@@ -0,0 +1 @@
+blocks claimed by a file and bitmaps or inode tables
diff --git a/tests/f_dupsuper/expect.1 b/tests/f_dupsuper/expect.1
new file mode 100644
index 0000000..274744a
--- /dev/null
+++ b/tests/f_dupsuper/expect.1
@@ -0,0 +1,21 @@
+Pass 1: Checking inodes, blocks, and sizes
+Remove illegal block(s) in inode 12? yes
+
+Block #4 (2) is in the group descriptors of group 0.  CLEARED
+Block #5 (3) is the block bitmap of group 0.  CLEARED
+Block #6 (1) is the superblock in group 0.  CLEARED
+Inode 12, i_blocks wrong 34 (counted=28).  Set i_blocks to counted? yes
+
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: -29 -30 -31.  FIXED
+Free blocks count wrong for group 0 (61, counted=64).  FIXED
+Free blocks count wrong (61, counted=64).  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/32 files, 36/100 blocks
+Exit status is 1
diff --git a/tests/f_dupsuper/expect.2 b/tests/f_dupsuper/expect.2
new file mode 100644
index 0000000..4ab9794
--- /dev/null
+++ b/tests/f_dupsuper/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 12/32 files, 36/100 blocks
+Exit status is 0
diff --git a/tests/f_dupsuper/image.gz b/tests/f_dupsuper/image.gz
new file mode 100644
index 0000000..d919e07
--- /dev/null
+++ b/tests/f_dupsuper/image.gz
Binary files differ
diff --git a/tests/f_dupsuper/name b/tests/f_dupsuper/name
new file mode 100644
index 0000000..560a707
--- /dev/null
+++ b/tests/f_dupsuper/name
@@ -0,0 +1 @@
+blocks claimed by a file and superblock or group descriptors
diff --git a/tests/f_end-bitmap/expect.1 b/tests/f_end-bitmap/expect.1
new file mode 100644
index 0000000..71eb6b6
--- /dev/null
+++ b/tests/f_end-bitmap/expect.1
@@ -0,0 +1,14 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Free blocks count wrong for group 0 (44, counted=63).  FIXED
+Padding at end of block bitmap is not set. Fix? yes
+
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 12/16 files, 37/100 blocks
+Exit status is 1
diff --git a/tests/f_end-bitmap/expect.2 b/tests/f_end-bitmap/expect.2
new file mode 100644
index 0000000..a4c2f73
--- /dev/null
+++ b/tests/f_end-bitmap/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 12/16 files, 37/100 blocks
+Exit status is 0
diff --git a/tests/f_end-bitmap/image.gz b/tests/f_end-bitmap/image.gz
new file mode 100644
index 0000000..cb20d0a
--- /dev/null
+++ b/tests/f_end-bitmap/image.gz
Binary files differ
diff --git a/tests/f_end-bitmap/name b/tests/f_end-bitmap/name
new file mode 100644
index 0000000..16baec6
--- /dev/null
+++ b/tests/f_end-bitmap/name
@@ -0,0 +1,2 @@
+corruption at end of block bitmap
+
diff --git a/tests/f_expand/expect.1 b/tests/f_expand/expect.1
new file mode 100644
index 0000000..1126358
--- /dev/null
+++ b/tests/f_expand/expect.1
@@ -0,0 +1,587 @@
+Pass 1: Checking inodes, blocks, and sizes
+Deleted inode 2 has zero dtime.
+Set dtime? yes
+
+Pass 2: Checking directory structure
+Entry '..' in /lost+found (11) has deleted/unused inode 2.
+Clear? yes
+
+Pass 3: Checking directory connectivity
+Root inode not allocated.  Rellocate? yes
+
+Unconnected directory inode 11 (...)
+Connect to /lost+found? yes
+
+/lost+found not found.  Create? yes
+
+Pass 4: Checking reference counts
+Inode 11 has ref count 3, expecting 2.
+Set i_nlinks to count? yes
+
+Unattached inode 12
+Connect to /lost+found? yes
+
+Inode 12 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 13
+Connect to /lost+found? yes
+
+Inode 13 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 14
+Connect to /lost+found? yes
+
+Inode 14 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 15
+Connect to /lost+found? yes
+
+Inode 15 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 16
+Connect to /lost+found? yes
+
+Inode 16 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 17
+Connect to /lost+found? yes
+
+Inode 17 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 18
+Connect to /lost+found? yes
+
+Inode 18 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 19
+Connect to /lost+found? yes
+
+Inode 19 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 20
+Connect to /lost+found? yes
+
+Inode 20 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 21
+Connect to /lost+found? yes
+
+Inode 21 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 22
+Connect to /lost+found? yes
+
+Inode 22 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 23
+Connect to /lost+found? yes
+
+Inode 23 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 24
+Connect to /lost+found? yes
+
+Inode 24 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 25
+Connect to /lost+found? yes
+
+Inode 25 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 26
+Connect to /lost+found? yes
+
+Inode 26 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 27
+Connect to /lost+found? yes
+
+Inode 27 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 28
+Connect to /lost+found? yes
+
+Inode 28 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 29
+Connect to /lost+found? yes
+
+Inode 29 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 30
+Connect to /lost+found? yes
+
+Inode 30 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 31
+Connect to /lost+found? yes
+
+Inode 31 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 32
+Connect to /lost+found? yes
+
+Inode 32 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 33
+Connect to /lost+found? yes
+
+Inode 33 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 34
+Connect to /lost+found? yes
+
+Inode 34 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 35
+Connect to /lost+found? yes
+
+Inode 35 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 36
+Connect to /lost+found? yes
+
+Inode 36 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 37
+Connect to /lost+found? yes
+
+Inode 37 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 38
+Connect to /lost+found? yes
+
+Inode 38 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 39
+Connect to /lost+found? yes
+
+Inode 39 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 40
+Connect to /lost+found? yes
+
+Inode 40 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 41
+Connect to /lost+found? yes
+
+Inode 41 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 42
+Connect to /lost+found? yes
+
+Inode 42 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 43
+Connect to /lost+found? yes
+
+Inode 43 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 44
+Connect to /lost+found? yes
+
+Inode 44 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 45
+Connect to /lost+found? yes
+
+Inode 45 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 46
+Connect to /lost+found? yes
+
+Inode 46 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 47
+Connect to /lost+found? yes
+
+Inode 47 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 48
+Connect to /lost+found? yes
+
+Inode 48 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 49
+Connect to /lost+found? yes
+
+Inode 49 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 50
+Connect to /lost+found? yes
+
+Inode 50 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 51
+Connect to /lost+found? yes
+
+Inode 51 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 52
+Connect to /lost+found? yes
+
+Inode 52 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 53
+Connect to /lost+found? yes
+
+Inode 53 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 54
+Connect to /lost+found? yes
+
+Inode 54 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 55
+Connect to /lost+found? yes
+
+Inode 55 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 56
+Connect to /lost+found? yes
+
+Inode 56 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 57
+Connect to /lost+found? yes
+
+Inode 57 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 58
+Connect to /lost+found? yes
+
+Inode 58 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 59
+Connect to /lost+found? yes
+
+Inode 59 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 60
+Connect to /lost+found? yes
+
+Inode 60 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 61
+Connect to /lost+found? yes
+
+Inode 61 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 62
+Connect to /lost+found? yes
+
+Inode 62 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 63
+Connect to /lost+found? yes
+
+Inode 63 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 64
+Connect to /lost+found? yes
+
+Inode 64 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 65
+Connect to /lost+found? yes
+
+Inode 65 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 66
+Connect to /lost+found? yes
+
+Inode 66 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 67
+Connect to /lost+found? yes
+
+Inode 67 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 68
+Connect to /lost+found? yes
+
+Inode 68 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 69
+Connect to /lost+found? yes
+
+Inode 69 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 70
+Connect to /lost+found? yes
+
+Inode 70 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 71
+Connect to /lost+found? yes
+
+Inode 71 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 72
+Connect to /lost+found? yes
+
+Inode 72 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 73
+Connect to /lost+found? yes
+
+Inode 73 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 74
+Connect to /lost+found? yes
+
+Inode 74 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 75
+Connect to /lost+found? yes
+
+Inode 75 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 76
+Connect to /lost+found? yes
+
+Inode 76 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 77
+Connect to /lost+found? yes
+
+Inode 77 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 78
+Connect to /lost+found? yes
+
+Inode 78 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 79
+Connect to /lost+found? yes
+
+Inode 79 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 80
+Connect to /lost+found? yes
+
+Inode 80 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 81
+Connect to /lost+found? yes
+
+Inode 81 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 82
+Connect to /lost+found? yes
+
+Inode 82 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 83
+Connect to /lost+found? yes
+
+Inode 83 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 84
+Connect to /lost+found? yes
+
+Inode 84 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 85
+Connect to /lost+found? yes
+
+Inode 85 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 86
+Connect to /lost+found? yes
+
+Inode 86 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 87
+Connect to /lost+found? yes
+
+Inode 87 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 88
+Connect to /lost+found? yes
+
+Inode 88 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 89
+Connect to /lost+found? yes
+
+Inode 89 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 90
+Connect to /lost+found? yes
+
+Inode 90 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 91
+Connect to /lost+found? yes
+
+Inode 91 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 92
+Connect to /lost+found? yes
+
+Inode 92 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 93
+Connect to /lost+found? yes
+
+Inode 93 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 94
+Connect to /lost+found? yes
+
+No room in /lost+found; expand /lost+found? yes
+
+Inode 94 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 95
+Connect to /lost+found? yes
+
+Inode 95 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 96
+Connect to /lost+found? yes
+
+Inode 96 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 97
+Connect to /lost+found? yes
+
+Inode 97 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 98
+Connect to /lost+found? yes
+
+Inode 98 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 99
+Connect to /lost+found? yes
+
+Inode 99 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 100
+Connect to /lost+found? yes
+
+Inode 100 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 102
+Connect to /lost+found? yes
+
+Inode 102 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 103
+Connect to /lost+found? yes
+
+Inode 103 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 104
+Connect to /lost+found? yes
+
+Inode 104 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: -33.  FIXED
+Free blocks count wrong for group 0 (68, counted=67).  FIXED
+Free blocks count wrong (68, counted=67).  FIXED
+Free inodes count wrong for group #0 (1, counted=0).  FIXED
+Directories count wrong for group #0 (2, counted=3).  FIXED
+Free inodes count wrong (1, counted=0).  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 104/104 files, 33/100 blocks
+Exit status is 1
diff --git a/tests/f_expand/expect.2 b/tests/f_expand/expect.2
new file mode 100644
index 0000000..49395f2
--- /dev/null
+++ b/tests/f_expand/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 104/104 files, 33/100 blocks
+Exit status is 0
diff --git a/tests/f_expand/image.gz b/tests/f_expand/image.gz
new file mode 100644
index 0000000..e79eb32
--- /dev/null
+++ b/tests/f_expand/image.gz
Binary files differ
diff --git a/tests/f_expand/name b/tests/f_expand/name
new file mode 100644
index 0000000..feebe0f
--- /dev/null
+++ b/tests/f_expand/name
@@ -0,0 +1 @@
+expanding lost+found
diff --git a/tests/f_holedir/expect.1 b/tests/f_holedir/expect.1
new file mode 100644
index 0000000..b0af948
--- /dev/null
+++ b/tests/f_holedir/expect.1
@@ -0,0 +1,31 @@
+Pass 1: Checking inodes, blocks, and sizes
+Hole found in directory inode 11!  (blkcnt=0)
+Hole found in directory inode 11!  (blkcnt=3)
+Remove illegal block(s) in inode 11? yes
+
+Block #6 (200) > BLOCKS (100).  CLEARED
+Hole found in directory inode 11!  (blkcnt=11)
+Directory 11, incorrect size, 12288 (counted = 11264). Set size to counted? yes
+
+Inode 11, i_blocks wrong 24 (counted=16).  Set i_blocks to counted? yes
+
+Pass 2: Checking directory structure
+Directory inode 11 has a hole at block #0
+Allocate block? yes
+
+Directory inode 11 has a hole at block #3
+Allocate block? yes
+
+Directory inode 11 has a hole at block #6
+Allocate block? yes
+
+Directory inode 11 has a hole at block #11
+Allocate block? yes
+
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 1
diff --git a/tests/f_holedir/expect.2 b/tests/f_holedir/expect.2
new file mode 100644
index 0000000..b8b19f8
--- /dev/null
+++ b/tests/f_holedir/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 0
diff --git a/tests/f_holedir/image.gz b/tests/f_holedir/image.gz
new file mode 100644
index 0000000..ee26ab8
--- /dev/null
+++ b/tests/f_holedir/image.gz
Binary files differ
diff --git a/tests/f_holedir/name b/tests/f_holedir/name
new file mode 100644
index 0000000..411f656
--- /dev/null
+++ b/tests/f_holedir/name
@@ -0,0 +1 @@
+directory with holes and illegal blocks
diff --git a/tests/f_illbbitmap/expect.1 b/tests/f_illbbitmap/expect.1
new file mode 100644
index 0000000..4b3b6c3
--- /dev/null
+++ b/tests/f_illbbitmap/expect.1
@@ -0,0 +1,19 @@
+Block bitmap for group 0 is not in group.  (block 4096)
+Relocate? yes
+
+Pass 1: Checking inodes, blocks, and sizes
+Relocating group 0's block bitmap to 4...
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21.  FIXED
+Inode bitmap differences: -12 -13 -14 -15 -16 -17 -18 -19 -20 -21.  FIXED
+Padding at end of block bitmap is not set. Fix? yes
+
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 1
diff --git a/tests/f_illbbitmap/expect.2 b/tests/f_illbbitmap/expect.2
new file mode 100644
index 0000000..b8b19f8
--- /dev/null
+++ b/tests/f_illbbitmap/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 0
diff --git a/tests/f_illbbitmap/image.gz b/tests/f_illbbitmap/image.gz
new file mode 100644
index 0000000..fb16ebc
--- /dev/null
+++ b/tests/f_illbbitmap/image.gz
Binary files differ
diff --git a/tests/f_illbbitmap/name b/tests/f_illbbitmap/name
new file mode 100644
index 0000000..5ed4f59
--- /dev/null
+++ b/tests/f_illbbitmap/name
@@ -0,0 +1 @@
+illegal block bitmap
diff --git a/tests/f_illibitmap/expect.1 b/tests/f_illibitmap/expect.1
new file mode 100644
index 0000000..15fe393
--- /dev/null
+++ b/tests/f_illibitmap/expect.1
@@ -0,0 +1,16 @@
+Inode bitmap group 0 not in group.  (block 4000)
+Relocate? yes
+
+Pass 1: Checking inodes, blocks, and sizes
+Relocating group 0's inode bitmap to 4...
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Inode bitmap differences: +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11.  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 1
diff --git a/tests/f_illibitmap/expect.2 b/tests/f_illibitmap/expect.2
new file mode 100644
index 0000000..b8b19f8
--- /dev/null
+++ b/tests/f_illibitmap/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 0
diff --git a/tests/f_illibitmap/image.gz b/tests/f_illibitmap/image.gz
new file mode 100644
index 0000000..3e0892d
--- /dev/null
+++ b/tests/f_illibitmap/image.gz
Binary files differ
diff --git a/tests/f_illibitmap/name b/tests/f_illibitmap/name
new file mode 100644
index 0000000..bac4003
--- /dev/null
+++ b/tests/f_illibitmap/name
@@ -0,0 +1 @@
+illegal inode bitmap
diff --git a/tests/f_lotsbad/expect.1 b/tests/f_lotsbad/expect.1
new file mode 100644
index 0000000..33079f1
--- /dev/null
+++ b/tests/f_lotsbad/expect.1
@@ -0,0 +1,46 @@
+Pass 1: Checking inodes, blocks, and sizes
+Remove illegal block(s) in inode 12? yes
+
+Block #12 (778398818) > BLOCKS (100).  CLEARED
+Block #13 (1768444960) > BLOCKS (100).  CLEARED
+Block #14 (1752375411) > BLOCKS (100).  CLEARED
+Block #15 (1684829551) > BLOCKS (100).  CLEARED
+Block #16 (1886349344) > BLOCKS (100).  CLEARED
+Block #17 (1819633253) > BLOCKS (100).  CLEARED
+Block #18 (1663072620) > BLOCKS (100).  CLEARED
+Block #19 (1735287144) > BLOCKS (100).  CLEARED
+Block #20 (1310731877) > BLOCKS (100).  CLEARED
+Block #21 (560297071) > BLOCKS (100).  CLEARED
+Block #22 (543512352) > BLOCKS (100).  CLEARED
+Block #23 (1869835361) > BLOCKS (100).  CLEARED
+Block #24 (1634231072) > BLOCKS (100).  CLEARED
+Block #25 (543516526) > BLOCKS (100).  CLEARED
+Block #26 (174418036) > BLOCKS (100).  CLEARED
+Block #27 (1919819811) > BLOCKS (100).  CLEARED
+Block #28 (543584032) > BLOCKS (100).  CLEARED
+Block #29 (1701734764) > BLOCKS (100).  CLEARED
+Block #30 (1869881459) > BLOCKS (100).  CLEARED
+Too many illegal blocks in inode 12.
+Clear inode? yes
+
+Restarting e2fsck from the beginning...
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Entry 'termcap' in / (2) has deleted/unused inode 12.
+Clear? yes
+
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: -27 -28 -29 -30 -31 -32 -33 -34 -35 -36 -37 -38 -39 -40 -41 -44 -45.  FIXED
+Free blocks count wrong for group 0 (41, counted=58).  FIXED
+Free blocks count wrong (41, counted=58).  FIXED
+Inode bitmap differences: -12.  FIXED
+Free inodes count wrong for group #0 (20, counted=21).  FIXED
+Free inodes count wrong (20, counted=21).  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 42/100 blocks
+Exit status is 1
diff --git a/tests/f_lotsbad/expect.2 b/tests/f_lotsbad/expect.2
new file mode 100644
index 0000000..3257a84
--- /dev/null
+++ b/tests/f_lotsbad/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 42/100 blocks
+Exit status is 0
diff --git a/tests/f_lotsbad/image.gz b/tests/f_lotsbad/image.gz
new file mode 100644
index 0000000..9386a9e
--- /dev/null
+++ b/tests/f_lotsbad/image.gz
Binary files differ
diff --git a/tests/f_lotsbad/name b/tests/f_lotsbad/name
new file mode 100644
index 0000000..16b77c1
--- /dev/null
+++ b/tests/f_lotsbad/name
@@ -0,0 +1 @@
+too many illegal blocks in inode
diff --git a/tests/f_lpf/expect.1 b/tests/f_lpf/expect.1
new file mode 100644
index 0000000..b2cef78
--- /dev/null
+++ b/tests/f_lpf/expect.1
@@ -0,0 +1,39 @@
+Pass 1: Checking inodes, blocks, and sizes
+
+Deleted inode detected with non-zero link count.
+This is probably due to old ext2fs kernel code.  
+Fix inode(s)? yes
+
+Inode 11 is deleted w/ non-zero link_count.  CLEARED
+Inode 13 is deleted w/ non-zero link_count.  CLEARED
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Unattached inode 14
+Connect to /lost+found? yes
+
+/lost+found not found.  Create? yes
+
+Inode 14 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Unattached inode 15
+Connect to /lost+found? yes
+
+Inode 15 has ref count 2, expecting 1.
+Set i_nlinks to count? yes
+
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Free blocks count wrong for group 0 (25, counted=38).  FIXED
+Free blocks count wrong (39, counted=38).  FIXED
+Free inodes count wrong for group #0 (2, counted=1).  FIXED
+Directories count wrong for group #0 (1, counted=2).  FIXED
+Free inodes count wrong (2, counted=1).  FIXED
+Padding at end of block bitmap is not set. Fix? yes
+
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 15/16 files, 62/100 blocks
+Exit status is 1
diff --git a/tests/f_lpf/expect.2 b/tests/f_lpf/expect.2
new file mode 100644
index 0000000..800fd55
--- /dev/null
+++ b/tests/f_lpf/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 15/16 files, 62/100 blocks
+Exit status is 0
diff --git a/tests/f_lpf/image.gz b/tests/f_lpf/image.gz
new file mode 100644
index 0000000..659b278
--- /dev/null
+++ b/tests/f_lpf/image.gz
Binary files differ
diff --git a/tests/f_lpf/name b/tests/f_lpf/name
new file mode 100644
index 0000000..ac2dbab
--- /dev/null
+++ b/tests/f_lpf/name
@@ -0,0 +1 @@
+missing lost+found
diff --git a/tests/f_messy_inode/expect.1 b/tests/f_messy_inode/expect.1
new file mode 100644
index 0000000..170bac9
--- /dev/null
+++ b/tests/f_messy_inode/expect.1
@@ -0,0 +1,33 @@
+Pass 1: Checking inodes, blocks, and sizes
+Remove illegal block(s) in inode 14? yes
+
+Block #2 (4294901760) > BLOCKS (100).  CLEARED
+Block #3 (4294901760) > BLOCKS (100).  CLEARED
+Block #4 (4294901760) > BLOCKS (100).  CLEARED
+Block #5 (4294901760) > BLOCKS (100).  CLEARED
+Block #6 (4294901760) > BLOCKS (100).  CLEARED
+Block #7 (4294901760) > BLOCKS (100).  CLEARED
+Block #8 (4294901760) > BLOCKS (100).  CLEARED
+Block #9 (4294901760) > BLOCKS (100).  CLEARED
+Block #10 (4294901760) > BLOCKS (100).  CLEARED
+Inode 14, i_blocks wrong 18 (counted=4).  Set i_blocks to counted? yes
+
+Pass 2: Checking directory structure
+i_file_acl for inode 14 (/MAKEDEV) is 4294901760, should be zero.
+Clear i_file_acl? yes
+
+i_dir_acl for inode 14 (/MAKEDEV) is 4294901760, should be zero.
+Clear i_dir_acl? yes
+
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: -43 -44 -45 -46 -47 -48 -49.  FIXED
+Free blocks count wrong for group 0 (68, counted=75).  FIXED
+Free blocks count wrong (68, counted=75).  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 29/32 files, 25/100 blocks
+Exit status is 1
diff --git a/tests/f_messy_inode/expect.2 b/tests/f_messy_inode/expect.2
new file mode 100644
index 0000000..e9c7880
--- /dev/null
+++ b/tests/f_messy_inode/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 29/32 files, 25/100 blocks
+Exit status is 0
diff --git a/tests/f_messy_inode/image.gz b/tests/f_messy_inode/image.gz
new file mode 100644
index 0000000..630a689
--- /dev/null
+++ b/tests/f_messy_inode/image.gz
Binary files differ
diff --git a/tests/f_messy_inode/name b/tests/f_messy_inode/name
new file mode 100644
index 0000000..f1485ea
--- /dev/null
+++ b/tests/f_messy_inode/name
@@ -0,0 +1 @@
+bad file and directory acl pointers
diff --git a/tests/f_mke2fs2b/expect.1 b/tests/f_mke2fs2b/expect.1
new file mode 100644
index 0000000..e60580c
--- /dev/null
+++ b/tests/f_mke2fs2b/expect.1
@@ -0,0 +1,36 @@
+Pass 1: Checking inodes, blocks, and sizes
+Root inode has dtime set (probably due to old mke2fs).  Fix? yes
+
+Note: /lost+found will probably be deleted as well, due to the mke2fs bug.
+Be sure to run mklost+found to recreate it after e2fsck finishes.
+
+
+Deleted inode detected with non-zero link count.
+This is probably due to old ext2fs kernel code.  
+Fix inode(s)? yes
+
+Inode 11 is deleted w/ non-zero link_count.  CLEARED
+Inode 15 is deleted w/ non-zero link_count.  CLEARED
+Pass 2: Checking directory structure
+Entry 'lost+found' in / (2) has deleted/unused inode 11.
+Clear? yes
+
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Inode 2 has ref count 4, expecting 3.
+Set i_nlinks to count? yes
+
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Block bitmap differences: -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20.  FIXED
+Free blocks count wrong for group 0 (75, counted=87).  FIXED
+Free blocks count wrong (75, counted=87).  FIXED
+Inode bitmap differences: -11.  FIXED
+Free inodes count wrong for group #0 (17, counted=18).  FIXED
+Directories count wrong for group #0 (4, counted=3).  FIXED
+Free inodes count wrong (17, counted=18).  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 14/32 files, 13/100 blocks
+Exit status is 1
diff --git a/tests/f_mke2fs2b/expect.2 b/tests/f_mke2fs2b/expect.2
new file mode 100644
index 0000000..447fcb5
--- /dev/null
+++ b/tests/f_mke2fs2b/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 14/32 files, 13/100 blocks
+Exit status is 0
diff --git a/tests/f_mke2fs2b/image.gz b/tests/f_mke2fs2b/image.gz
new file mode 100644
index 0000000..6b7412c
--- /dev/null
+++ b/tests/f_mke2fs2b/image.gz
Binary files differ
diff --git a/tests/f_mke2fs2b/name b/tests/f_mke2fs2b/name
new file mode 100644
index 0000000..bf2202a
--- /dev/null
+++ b/tests/f_mke2fs2b/name
@@ -0,0 +1 @@
+mke2fs version 0.2b created filesystem
diff --git a/tests/f_noroot/expect.1 b/tests/f_noroot/expect.1
new file mode 100644
index 0000000..df77568
--- /dev/null
+++ b/tests/f_noroot/expect.1
@@ -0,0 +1,44 @@
+Pass 1: Checking inodes, blocks, and sizes
+
+Deleted inode detected with non-zero link count.
+This is probably due to old ext2fs kernel code.  
+Fix inode(s)? yes
+
+Inode 15 is deleted w/ non-zero link_count.  CLEARED
+Pass 2: Checking directory structure
+Entry '..' in /lost+found (11) has deleted/unused inode 2.
+Clear? yes
+
+Entry '..' in /foo (12) has deleted/unused inode 2.
+Clear? yes
+
+Pass 3: Checking directory connectivity
+Root inode not allocated.  Rellocate? yes
+
+Unconnected directory inode 11 (...)
+Connect to /lost+found? yes
+
+/lost+found not found.  Create? yes
+
+Unconnected directory inode 12 (...)
+Connect to /lost+found? yes
+
+Pass 4: Checking reference counts
+Inode 11 has ref count 3, expecting 2.
+Set i_nlinks to count? yes
+
+Inode 12 has ref count 4, expecting 3.
+Set i_nlinks to count? yes
+
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Free blocks count wrong for group 0 (75, counted=74).  FIXED
+Free blocks count wrong (75, counted=74).  FIXED
+Free inodes count wrong for group #0 (17, counted=16).  FIXED
+Directories count wrong for group #0 (4, counted=5).  FIXED
+Free inodes count wrong (17, counted=16).  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 16/32 files, 26/100 blocks
+Exit status is 1
diff --git a/tests/f_noroot/expect.2 b/tests/f_noroot/expect.2
new file mode 100644
index 0000000..8cf7758
--- /dev/null
+++ b/tests/f_noroot/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 16/32 files, 26/100 blocks
+Exit status is 0
diff --git a/tests/f_noroot/image.gz b/tests/f_noroot/image.gz
new file mode 100644
index 0000000..0a87e99
--- /dev/null
+++ b/tests/f_noroot/image.gz
Binary files differ
diff --git a/tests/f_noroot/name b/tests/f_noroot/name
new file mode 100644
index 0000000..a70ebc2
--- /dev/null
+++ b/tests/f_noroot/name
@@ -0,0 +1 @@
+missing root directory
diff --git a/tests/f_okgroup/expect.1 b/tests/f_okgroup/expect.1
new file mode 100644
index 0000000..8ee1a4b
--- /dev/null
+++ b/tests/f_okgroup/expect.1
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/2048 files, 274/8193 blocks
+Exit status is 0
diff --git a/tests/f_okgroup/expect.2 b/tests/f_okgroup/expect.2
new file mode 100644
index 0000000..8ee1a4b
--- /dev/null
+++ b/tests/f_okgroup/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/2048 files, 274/8193 blocks
+Exit status is 0
diff --git a/tests/f_okgroup/image.gz b/tests/f_okgroup/image.gz
new file mode 100644
index 0000000..06b67c7
--- /dev/null
+++ b/tests/f_okgroup/image.gz
Binary files differ
diff --git a/tests/f_okgroup/name b/tests/f_okgroup/name
new file mode 100644
index 0000000..3da66af
--- /dev/null
+++ b/tests/f_okgroup/name
@@ -0,0 +1 @@
+8193 block long filesystem
diff --git a/tests/f_overfsblks/expect.1 b/tests/f_overfsblks/expect.1
new file mode 100644
index 0000000..91c9ae2
--- /dev/null
+++ b/tests/f_overfsblks/expect.1
@@ -0,0 +1,16 @@
+Pass 1: Checking inodes, blocks, and sizes
+Group 0's inode bitmap at 3 conflicts with some other fs block.
+Relocate? yes
+
+Relocating group 0's inode bitmap from 3 to 4...
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+Fix summary information? yes
+
+Inode bitmap differences: -12 -13 -14 -15 -16 -17 -18 -19 -20 -21.  FIXED
+
+test_filesys: ***** FILE SYSTEM WAS MODIFIED *****
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 1
diff --git a/tests/f_overfsblks/expect.2 b/tests/f_overfsblks/expect.2
new file mode 100644
index 0000000..b8b19f8
--- /dev/null
+++ b/tests/f_overfsblks/expect.2
@@ -0,0 +1,7 @@
+Pass 1: Checking inodes, blocks, and sizes
+Pass 2: Checking directory structure
+Pass 3: Checking directory connectivity
+Pass 4: Checking reference counts
+Pass 5: Checking group summary information
+test_filesys: 11/32 files, 22/100 blocks
+Exit status is 0
diff --git a/tests/f_overfsblks/image.gz b/tests/f_overfsblks/image.gz
new file mode 100644
index 0000000..60b6b2e
--- /dev/null
+++ b/tests/f_overfsblks/image.gz
Binary files differ
diff --git a/tests/f_overfsblks/name b/tests/f_overfsblks/name
new file mode 100644
index 0000000..8ab6040
--- /dev/null
+++ b/tests/f_overfsblks/name
@@ -0,0 +1 @@
+overlapping inode and block bitmaps
diff --git a/tests/run_e2fsck b/tests/run_e2fsck
new file mode 100644
index 0000000..4923c66
--- /dev/null
+++ b/tests/run_e2fsck
@@ -0,0 +1,72 @@
+if [ "$IMAGE"x = x ]; then
+	IMAGE=$test_dir/image.gz
+fi
+
+if [ "$FSCK_OPT"x = x ]; then
+	FSCK_OPT=-yf
+fi
+
+if [ "$SECOND_FSCK_OPT"x = x ]; then
+	SECOND_FSCK_OPT=-yf
+fi
+
+if [ "$OUT1"x = x ]; then
+	OUT1=$test_name.1.log
+fi
+
+if [ "$OUT2"x = x ]; then
+	OUT2=$test_name.2.log
+fi
+
+if [ "$EXP1"x = x ]; then
+	EXP1=$test_dir/expect.1
+fi
+
+if [ "$EXP2"x = x ]; then
+	EXP2=$test_dir/expect.2
+fi
+
+gunzip < $IMAGE > $TMPFILE
+
+$FSCK $FSCK_OPT  -N test_filesys $TMPFILE > $OUT1.new 2>&1
+status=$?
+echo Exit status is $status >> $OUT1.new
+sed -e '1d' $OUT1.new > $OUT1
+rm -f $OUT1.new
+
+if [ "$ONE_PASS_ONLY" != "true" ]; then
+	$FSCK $SECOND_FSCK_OPT -N test_filesys $TMPFILE > $OUT2.new 2>&1 
+	status=$?
+	echo Exit status is $status >> $OUT2.new
+	sed -e '1d' $OUT2.new > $OUT2
+	rm -f $OUT2.new
+fi
+
+rm $TMPFILE
+
+if [ "$SKIP_VERIFY" != "true" ] ; then
+	rm -f $test_name.ok $test_name.failed
+	cmp -s $OUT1 $EXP1
+	status1=$?
+	if [ "$ONE_PASS_ONLY" != "true" ]; then
+		cmp -s $OUT2 $EXP2
+		status2=$?
+	else
+		status2=0
+	fi
+
+	if [ "$status1" = 0 -a "$status2" = 0 ] ; then
+		echo "ok"
+		touch $test_name.ok
+	else
+		echo "failed"
+		diff -c $EXP1 $OUT1 > $test_name.failed
+		if [ "$ONE_PASS_ONLY" != "true" ]; then
+			diff -c $EXP2 $OUT2 >> $test_name.failed
+		fi
+	fi
+fi
+
+if [ "$SKIP_CLEANUP" != "true" ] ; then
+	unset IMAGE FSCK_OPT SECOND_FSCK_OPT OUT1 OUT2 EXP1 EXP2
+fi
diff --git a/tests/test_config b/tests/test_config
new file mode 100644
index 0000000..86a5bde
--- /dev/null
+++ b/tests/test_config
@@ -0,0 +1,9 @@
+#
+# Test configuration
+#
+
+FSCK=../e2fsck/e2fsck
+LD_LIBRARY_PATH=../lib:../lib/ext2fs:../lib/e2p:../lib/et:../lib/ss
+export LD_LIBRARY_PATH
+TZ=GMT
+export TZ
diff --git a/tests/test_script b/tests/test_script
new file mode 100644
index 0000000..dc104f4
--- /dev/null
+++ b/tests/test_script
@@ -0,0 +1,43 @@
+#!/bin/sh
+#
+# Test script for e2fsck
+#
+
+if test "$1"x = x ; then
+SRCDIR=.
+else
+SRCDIR=$1
+fi
+
+cmd_dir=$SRCDIR
+TMPFILE=./test.img
+
+. $SRCDIR/test_config
+
+for test_dir in $SRCDIR/[a-zA-Z]_*
+do
+	test_name=`echo $test_dir | sed -e 's;.*/;;'`
+	if [ -f $test_dir/name ]; then
+		test_description=`cat $test_dir/name`
+		echo -n "$test_name: $test_description: "
+	else
+		echo -n "$test_name: "
+	fi
+	if [ -f $test_dir/script ]; then
+		. $test_dir/script
+	else
+		test_base=`echo $test_name | sed -e 's/_.*//'`
+		default_script=$SRCDIR/defaults/${test_base}_script
+		if [ -f $default_script ]; then
+			. $SRCDIR/defaults/${test_base}_script
+		else
+			echo "Missing test script!"
+		fi
+	fi
+done
+
+num_ok=`ls *.ok | wc -l`
+num_failed=`ls *.failed 2>/dev/null | wc -l`
+
+echo "$num_ok tests succeeded	$num_failed tests failed"
+