|
|
830a0c2 |
#!/bin/sh
|
|
|
830a0c2 |
# Simple test for est e2tools <URL:http://home.earthlink.net/~k_sheff/sw/e2tools/>
|
|
|
830a0c2 |
# Copyright (C) 2006 Hans Ulrich Niedermann
|
|
|
830a0c2 |
#
|
|
|
830a0c2 |
# This program is free software; you can redistribute it and/or modify
|
|
|
830a0c2 |
# it under the terms of the GNU General Public License as published by
|
|
|
830a0c2 |
# the Free Software Foundation; either version 2 of the License, or
|
|
|
830a0c2 |
# (at your option) any later version.
|
|
|
830a0c2 |
#
|
|
|
830a0c2 |
# This program is distributed in the hope that it will be useful,
|
|
|
830a0c2 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
830a0c2 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
830a0c2 |
# GNU General Public License for more details.
|
|
|
830a0c2 |
#
|
|
|
830a0c2 |
# You should have received a copy of the GNU General Public License
|
|
|
830a0c2 |
# along with this program; if not, write to the Free Software
|
|
|
830a0c2 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
830a0c2 |
|
|
|
830a0c2 |
set -ex
|
|
|
830a0c2 |
|
|
|
830a0c2 |
# Caution: An image of 100G size needs 1.6GB on disk just to be formatted!
|
|
|
830a0c2 |
for imgsize in 1M; do
|
|
|
830a0c2 |
testimg="test-${imgsize}.img"
|
|
|
830a0c2 |
trap "" EXIT
|
|
|
830a0c2 |
# create sparse image file full of zeros
|
|
|
830a0c2 |
rm -f "${testimg}"
|
|
|
830a0c2 |
/bin/dd if=/dev/null of="${testimg}" bs=1 count=1 seek="$imgsize"
|
|
|
830a0c2 |
# create file system on image file
|
|
|
830a0c2 |
/sbin/mkfs.ext2 -F "${testimg}"
|
|
|
830a0c2 |
# check a few things
|
|
|
830a0c2 |
./e2mkdir "${testimg}:/foo"
|
|
|
830a0c2 |
./e2ls -l "${testimg}:"
|
|
|
830a0c2 |
|
|
|
830a0c2 |
./e2mkdir "${testimg}:/bar"
|
|
|
830a0c2 |
./e2mkdir "${testimg}:/bla"
|
|
|
830a0c2 |
./e2ls -l "${testimg}:"
|
|
|
830a0c2 |
|
|
|
830a0c2 |
for file in README configure; do
|
|
|
830a0c2 |
|
|
|
830a0c2 |
./e2cp "${file}" "${testimg}:/foo"
|
|
|
830a0c2 |
./e2ls -l "${testimg}:/foo"
|
|
|
830a0c2 |
|
|
|
830a0c2 |
trap "rm -f ${file}.test-c" EXIT
|
|
|
830a0c2 |
./e2cp "${testimg}:/foo/${file}" "${file}.test-c"
|
|
|
830a0c2 |
|
|
|
830a0c2 |
./e2rm ${testimg}:/foo/${file}
|
|
|
830a0c2 |
./e2ls -l "${testimg}:/foo"
|
|
|
830a0c2 |
|
|
|
830a0c2 |
cmp ${file} ${file}.test-c
|
|
|
830a0c2 |
rm -f ${file}.test-c
|
|
|
830a0c2 |
done
|
|
|
830a0c2 |
|
|
|
830a0c2 |
# remove the test image
|
|
|
830a0c2 |
rm -f "${testimg}"
|
|
|
830a0c2 |
trap "" EXIT
|
|
|
830a0c2 |
done
|
|
|
830a0c2 |
|
|
|
830a0c2 |
exit 0
|