minix/test/testisofs.sh
Ben Gras 89f651d08a testmfs, testisofs: MFS format, ISO functionality
testmfs: catch MFS format changes

This test tests mkfs.mfs will generate the same FS image given the same
input files. mkproto creates a proto file (normalizing directory entry
order). The assumption is that a change in the output flags a tacit
change in FS format, and that a FS format change will cause the image
to change.

        . Changes to mkfs.mfs that innocently change the format can
          change the sha1 output in the script along with it.
        . The assumption is that corresponding versions of mkfs.mfs and
          MFS will always work together; otherwise a lot breaks (ramdisk etc.)
        . Therefore, as long as a generated FS image stays the same with the
          same input now, incompatible MFS changes will still be flagged,
          even if they work together with the current mkfs.mfs.

testisofs: test ISO filesystem

        . to test isofs: prepare an ISO FS image using writeisofs, copy it
          to a RAM device, mount it using the iso9660fs server, compare the
          SHA1 contents of the files on the ISO with the inputs.
        . use su to run certain commands in the script as root

run script: run shell script tests

	. they are installed without .sh so should be
	  searched for as such
	. add diagnostic when tests are skipped

Change-Id: I30daff58e1e43903dacf3c99996a4a0e7d819b6b
2013-11-20 16:29:22 +00:00

66 lines
1.2 KiB
Bash

# Create and verify a simple ISO filesystem
#
#!/bin/sh
set -e
echo -n "isofs test "
ramdev=/dev/ram
mp=/mnt
testdir=isofstest
fsimage=isofsimage
contents=CONTENTS
out1=v1
out2=v2
rm -rf $testdir $fsimage $out1 $out2
if [ -d $testdir ]
then echo "dir?"
exit 1
fi
mkdir -p $testdir $testdir/$contents
if [ ! -d $testdir ]
then echo "no dir?"
exit 1
fi
# Make some small & big & bigger files
prevf=$testdir/$contents/FILE
echo "Test contents 123" >$prevf
for double in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
do fn=$testdir/$contents/FN.$double
cat $prevf $prevf >$fn
prevf=$fn
done
# Make an ISO filesystem image out of it
writeisofs -s0x0 -l MINIX $testdir $fsimage >/dev/null 2>&1
# umount previous things
su root -c "umount $ramdev >/dev/null 2>&1 || true"
su root -c "umount $mp >/dev/null 2>&1 || true"
# Mount it on a RAM disk
su root -c "ramdisk 50000 $ramdev >/dev/null 2>&1"
su root -c "cp $fsimage $ramdev"
su root -c "mount -t isofs $ramdev $mp >/dev/null 2>&1"
# compare contents
(cd $testdir/$contents && sha1 * | sort) >$out1
(cd $mp/$contents && sha1 * | sort) >$out2
diff -u $out1 $out2
su root -c "umount $ramdev >/dev/null 2>&1"
# cleanup
rm -rf $testdir $fsimage $out1 $out2
echo ok
exit 0