diff options
author | Karel Zak | 2009-01-19 16:50:51 +0100 |
---|---|---|
committer | Karel Zak | 2009-02-11 23:21:52 +0100 |
commit | 8387a824b576c41a0a4077cb1973046e91f7d1f6 (patch) | |
tree | 9cd1bd84ff46b051d1da990321e7624aaabe94ba /tests/ts/cramfs | |
parent | blkid: refresh TODO file (diff) | |
download | kernel-qcow2-util-linux-8387a824b576c41a0a4077cb1973046e91f7d1f6.tar.gz kernel-qcow2-util-linux-8387a824b576c41a0a4077cb1973046e91f7d1f6.tar.xz kernel-qcow2-util-linux-8387a824b576c41a0a4077cb1973046e91f7d1f6.zip |
tests: create subdirs for test scripts
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'tests/ts/cramfs')
-rwxr-xr-x | tests/ts/cramfs/mkfs | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/tests/ts/cramfs/mkfs b/tests/ts/cramfs/mkfs new file mode 100755 index 000000000..651f4e342 --- /dev/null +++ b/tests/ts/cramfs/mkfs @@ -0,0 +1,91 @@ +#!/bin/bash + +# +# Copyright (C) 2007 Karel Zak <kzak@redhat.com> +# +# This file is part of util-linux-ng. +# +# This file 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 2 of the License, or +# (at your option) any later version. +# +# This file 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. +# +. ./commands.sh +. ./functions.sh + +TS_COMPONENT="mkfs.cramfs" +TS_DESC="mkfs" + +ts_init "$*" +ts_skip_nonroot + +set -o pipefail + +IMAGE="$TS_OUTDIR/cramfs-loop.img" +IMAGE_DATA="$TS_OUTDIR/cramfs-data" +LABEL="testCramfs" +TS_MOUNTPOINT="$TS_OUTDIR/cramfs-mnt" + +ts_log "create mountpoint dir" + +[ -d "$TS_MOUNTPOINT" ] || mkdir -p $TS_MOUNTPOINT + +ts_log "generate data" +if [ ! -d "$IMAGE_DATA" ]; then + mkdir -p $IMAGE_DATA + for d in `seq 0 110`; do + DIRNAME="$IMAGE_DATA/$(printf "dir-%03d" $d)" + mkdir -p $DIRNAME + for f in `seq 0 10`; do + FILENAME="$DIRNAME/$(printf "data.%03d" $f)" + printf "data in %03d-%03d" $d $f >> $FILENAME + done + done +fi + +ts_log "list checksums from original data" +find $IMAGE_DATA -type f -exec md5sum {} \; | sort >> $TS_OUTPUT +echo >> $TS_OUTPUT + +ts_log "create cramfs image" +$TS_CMD_MKCRAMFS -n $LABEL $IMAGE_DATA $IMAGE 2>&1 >> $TS_OUTPUT +[ -s "$IMAGE" ] || ts_die "Cannot create $IMAGE" + +ts_log "count MD5 from the image" +md5sum $IMAGE 2>&1 | sort >> $TS_OUTPUT +echo >> $TS_OUTPUT + +ts_log "create loop device from image" +DEVICE=$( $TS_CMD_LOSETUP -s -f $IMAGE) + +ts_log "check the image" +ts_device_has "TYPE" "cramfs" $DEVICE +[ "$?" == "0" ] || ts_die "Cannot found cramfs on $DEVICE" $DEVICE + +ts_udev_dev_support "by-label" $LABEL +[ "$?" == "0" ] || ts_skip "udev ignores /dev/loop*" $DEVICE + +ts_log "mount the image" +$TS_CMD_MOUNT -L $LABEL $TS_MOUNTPOINT 2>&1 >> $TS_OUTPUT + +# check it +ts_is_mounted $DEVICE || ts_die "Cannot found $DEVICE in /proc/mounts" $DEVICE + +ts_log "list the image" +ls -laR --time-style=long-iso $TS_MOUNTPOINT >> $TS_OUTPUT +echo >> $TS_OUTPUT + +ts_log "list checksums from new data" +find $TS_MOUNTPOINT -type f -exec md5sum {} \; | sort >> $TS_OUTPUT +echo >> $TS_OUTPUT + +ts_log "umount the image" +$TS_CMD_UMOUNT $DEVICE +$TS_CMD_LOSETUP -d $DEVICE 2>&1 >> $TS_OUTPUT +ts_finalize + |