b769685b66
updated code files git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@132 9fe90eed-be63-e94b-8204-d34ff4c2ff93
75 lines
1.9 KiB
Bash
75 lines
1.9 KiB
Bash
#!/bin/sh
|
|
|
|
|
|
# Hint: "ori" = ORIginal; "rb" = ReadBack; "res" = RESult; "err" = ERRor
|
|
|
|
|
|
|
|
# Make shure that mounting Directory exists
|
|
if [ ! -d /mnt/usb1 ]
|
|
then
|
|
mkdir /mnt/usb1
|
|
fi
|
|
|
|
# Make shure that result Directory exists
|
|
if [ ! -d /test/result ]
|
|
then
|
|
mkdir /test/result
|
|
fi
|
|
|
|
# Make shure that result file of Test does NOT exists
|
|
if [ -s /test/result/usb1.res ]
|
|
then
|
|
rm /test/result/usb1.res
|
|
fi
|
|
|
|
# Make shure that error file of Test does NOT exists
|
|
if [ -s /test/result/usb1.err ]
|
|
then
|
|
rm /test/result/usb1.err
|
|
fi
|
|
|
|
# Mount USB-Stick to /mnt/usb1
|
|
mount /dev/sda1 /mnt/usb1 2>> /test/result/usb1.err
|
|
|
|
# Copy Testfile from Test Directory to USB-Stick
|
|
cp /test/testfile /mnt/usb1 2>> /test/result/usb1.err
|
|
|
|
# Compare original Testfile and copied Testfile on USB-Stick
|
|
# Print compare results to /test/result/usb1.res
|
|
# Print compare errors to /test/result/usb1.err
|
|
if [ ! -e /mnt/usb1/testfile ]
|
|
then
|
|
echo "TESTFILE DOES NOT EXIST" >> /test/result/usb1.err
|
|
fi
|
|
diff /test/testfile /mnt/usb1/testfile 1>> /test/result/usb1.res
|
|
2>> /test/result/usb1.err
|
|
|
|
# Delete Testfile on USB-Stick
|
|
rm /mnt/usb1/testfile 2>> /test/result/usb1.err
|
|
|
|
# Unmount USB-Stick
|
|
umount /mnt/usb1 2>> /test/result/usb1.err
|
|
|
|
# Delete Folder usb1 in /mnt
|
|
rmdir /mnt/usb1 2>> /test/result/usb1.err
|
|
|
|
# Display content of /test/result/usb1.res
|
|
echo -e "\n\rContent of usb1.res"
|
|
cat /test/result/usb1.res
|
|
|
|
# Display content of /test/result/usb1.err
|
|
echo -e "\n\rContent of usb1.err"
|
|
cat /test/result/usb1.err
|
|
|
|
# If comparison returned neither results nor errors, the copying and comparision was successful
|
|
if [ ! -s /test/result/usb1.res -a ! -s /test/result/usb1.err ]
|
|
then
|
|
# Test was successful
|
|
echo -e "\n\rUSB1 TEST-PASSED"
|
|
echo "USB1 TEST-PASSED" >> /test/result/usb1.res
|
|
else
|
|
# Test failed
|
|
echo -e "\n\rUSB1 TEST-FAIL"
|
|
echo "USB1 TEST-FAILED" >> /test/result/usb1.res
|
|
fi |