| 1 |
#!/bin/sh |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
LOG="test/test.log.$1" |
|---|
| 11 |
|
|---|
| 12 |
echo "Testing afdisk" |
|---|
| 13 |
echo "Testing afdisk with test $1" > $LOG |
|---|
| 14 |
echo "==================================" >> $LOG |
|---|
| 15 |
echo "" >> $LOG |
|---|
| 16 |
|
|---|
| 17 |
if test -e test/desc.$1; |
|---|
| 18 |
then |
|---|
| 19 |
cat test/desc.$1 >> $LOG |
|---|
| 20 |
echo "" >> $LOG |
|---|
| 21 |
else |
|---|
| 22 |
echo "No description found for test case $1" >> $LOG |
|---|
| 23 |
exit 1 |
|---|
| 24 |
fi |
|---|
| 25 |
|
|---|
| 26 |
if test -e test/devices.$1; |
|---|
| 27 |
then |
|---|
| 28 |
DEVICES=`cat test/devices.$1` |
|---|
| 29 |
else |
|---|
| 30 |
echo "Device list missing for test case $1" >> $LOG |
|---|
| 31 |
exit 1 |
|---|
| 32 |
fi |
|---|
| 33 |
|
|---|
| 34 |
for dev in $DEVICES; do |
|---|
| 35 |
if test -e test/sfdisk.$dev.$1; |
|---|
| 36 |
then |
|---|
| 37 |
sfdisk /dev/$dev < test/sfdisk.$dev.$1 |
|---|
| 38 |
fi |
|---|
| 39 |
echo "Partitioning of $dev before using afdisk :" >> $LOG |
|---|
| 40 |
echo "------------------------------------------" >> $LOG |
|---|
| 41 |
sfdisk -l /dev/$dev >> $LOG |
|---|
| 42 |
done |
|---|
| 43 |
|
|---|
| 44 |
echo "Preparing the afdisk run..." >> $LOG |
|---|
| 45 |
echo "---------------------------" >> $LOG |
|---|
| 46 |
if test -e test/before.$1; |
|---|
| 47 |
then |
|---|
| 48 |
source test/before.$1 |
|---|
| 49 |
fi |
|---|
| 50 |
|
|---|
| 51 |
if test -e test/afdisk.conf.$1; |
|---|
| 52 |
then |
|---|
| 53 |
cp afdisk.conf afdisk.conf.old |
|---|
| 54 |
cp test/afdisk.conf.$1 afdisk.conf |
|---|
| 55 |
else |
|---|
| 56 |
echo "Warning: No afdisk.conf provides for test case $1, using previously used configuration.\n" >> $LOG |
|---|
| 57 |
fi |
|---|
| 58 |
|
|---|
| 59 |
echo "Running afdisk with the following configuration :" >> $LOG |
|---|
| 60 |
echo "-------------------------------------------------" >> $LOG |
|---|
| 61 |
cat afdisk.conf >> $LOG |
|---|
| 62 |
echo "afdisk output :" >> $LOG |
|---|
| 63 |
echo "---------------" >> $LOG |
|---|
| 64 |
./afdisk >> $LOG |
|---|
| 65 |
|
|---|
| 66 |
if test -e test/after.$1; |
|---|
| 67 |
then |
|---|
| 68 |
echo "Running post-afdisk script..." >> $LOG |
|---|
| 69 |
source test/after.$1 |
|---|
| 70 |
fi |
|---|
| 71 |
|
|---|
| 72 |
for dev in $DEVICES; do |
|---|
| 73 |
echo "Partitioning of /dev/$dev after running afdisk :" >> $LOG |
|---|
| 74 |
echo "------------------------------------------------" >> $LOG |
|---|
| 75 |
sfdisk -l /dev/$dev >> $LOG |
|---|
| 76 |
done |
|---|
| 77 |
|
|---|
| 78 |
if test -e afdisk.conf.old; |
|---|
| 79 |
then |
|---|
| 80 |
cp afdisk.conf.old afdisk.conf |
|---|
| 81 |
rm afdisk.conf.old |
|---|
| 82 |
fi |
|---|
| 83 |
|
|---|
| 84 |
echo "Test run finished." >> $LOG |
|---|
| 85 |
echo "Finished test run. Output was written to $LOG" |
|---|