f3c5d9a59c
git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@108 9fe90eed-be63-e94b-8204-d34ff4c2ff93
215 lines
6.5 KiB
Bash
215 lines
6.5 KiB
Bash
#!/bin/sh
|
|
|
|
# Functionality:
|
|
# The EEPROM is write protected. The actual used i2c driver in the kernel
|
|
# only supports reading on the EEPROM.
|
|
# The test reads all EEPROM block contents. Each block should not be
|
|
# empty. This will be checked. If all eight blocks are read as not-empty,
|
|
# test passes.
|
|
|
|
# Hint: "ori" = ORIginal; "rb" = ReadBack; "res" = RESult; "err" = ERRor
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# PREPERATIONS
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# 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/eeprom.res ]
|
|
then
|
|
rm /test/result/eeprom.res
|
|
fi
|
|
|
|
# Make shure that error file of Test does NOT exists
|
|
if [ -s /test/result/eeprom.err ]
|
|
then
|
|
rm /test/result/eeprom.err
|
|
fi
|
|
|
|
# Make shure that Original file of Test does NOT exists
|
|
if [ -s /test/result/eeprom.ori ]
|
|
then
|
|
rm /test/result/eeprom.ori
|
|
fi
|
|
|
|
# Make shure that readback file of Test does NOT exists
|
|
if [ -s /test/result/eeprom.rb ]
|
|
then
|
|
rm /test/result/eeprom.rb
|
|
fi
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# TEST
|
|
#-----------------------------------------------------------------------------
|
|
|
|
if [ ! -d /sys/bus/i2c/devices/0-0050 ]
|
|
then
|
|
# First Block in EEPROM not available - Write Message to result file
|
|
echo "FIRST Block unavailable" >> /test/result/eeprom.res
|
|
else
|
|
# First Block in EEPROM available - Check Size
|
|
if [ -s /sys/bus/i2c/devices/0-0050/eeprom ]
|
|
then
|
|
# File is available and its size greater zero - Test passed
|
|
echo -e "First Block OK"
|
|
else
|
|
# File is not available or its size is zero - Test failed
|
|
echo "First Block File error" >> /test/result/eeprom.res
|
|
fi
|
|
fi
|
|
|
|
if [ ! -d /sys/bus/i2c/devices/0-0051 ]
|
|
then
|
|
# Second Block in EEPROM not available - Write Message to result file
|
|
echo "Second Block unavailable" >> /test/result/eeprom.res
|
|
else
|
|
# Second Block in EEPROM available - Check Size
|
|
if [ -s /sys/bus/i2c/devices/0-0051/eeprom ]
|
|
then
|
|
# File is available and its size greater zero - Test passed
|
|
echo -e "Second Block OK"
|
|
else
|
|
# File is not available or its size is zero - Test failed
|
|
echo "Second Block File error" >> /test/result/eeprom.res
|
|
fi
|
|
fi
|
|
|
|
if [ ! -d /sys/bus/i2c/devices/0-0052 ]
|
|
then
|
|
# Third Block in EEPROM not available - Write Message to result file
|
|
echo "Third Block unavailable" >> /test/result/eeprom.res
|
|
else
|
|
# Third Block in EEPROM available - Check Size
|
|
if [ -s /sys/bus/i2c/devices/0-0052/eeprom ]
|
|
then
|
|
# File is available and its size greater zero - Test passed
|
|
echo -e "Third Block OK"
|
|
else
|
|
# File is not available or its size is zero - Test failed
|
|
echo "Third Block File error" >> /test/result/eeprom.res
|
|
fi
|
|
fi
|
|
|
|
if [ ! -d /sys/bus/i2c/devices/0-0053 ]
|
|
then
|
|
# Fourth Block in EEPROM not available - Write Message to result file
|
|
echo "Fourth Block unavailable" >> /test/result/eeprom.res
|
|
else
|
|
# Fourth Block in EEPROM available - Check Size
|
|
if [ -s /sys/bus/i2c/devices/0-0053/eeprom ]
|
|
then
|
|
# File is available and its size greater zero - Test passed
|
|
echo -e "Fourth Block OK"
|
|
else
|
|
# File is not available or its size is zero - Test failed
|
|
echo "Fourth Block File error" >> /test/result/eeprom.res
|
|
fi
|
|
fi
|
|
|
|
if [ ! -d /sys/bus/i2c/devices/0-0054 ]
|
|
then
|
|
# Fifth Block in EEPROM not available - Write Message to result file
|
|
echo "Fifth Block unavailable" >> /test/result/eeprom.res
|
|
else
|
|
# Fifth Block in EEPROM available - Check Size
|
|
if [ -s /sys/bus/i2c/devices/0-0054/eeprom ]
|
|
then
|
|
# File is available and its size greater zero - Test passed
|
|
echo -e "Fifth Block OK"
|
|
else
|
|
# File is not available or its size is zero - Test failed
|
|
echo "Fifth Block File error" >> /test/result/eeprom.res
|
|
fi
|
|
fi
|
|
|
|
if [ ! -d /sys/bus/i2c/devices/0-0055 ]
|
|
then
|
|
# Sixth Block in EEPROM not available - Write Message to result file
|
|
echo "Sixth Block unavailable" >> /test/result/eeprom.res
|
|
else
|
|
# Sixth Block in EEPROM available - Check Size
|
|
if [ -s /sys/bus/i2c/devices/0-0055/eeprom ]
|
|
then
|
|
# File is available and its size greater zero - Test passed
|
|
echo -e "Sixth Block OK"
|
|
else
|
|
# File is not available or its size is zero - Test failed
|
|
echo "Sixth Block File error" >> /test/result/eeprom.res
|
|
fi
|
|
fi
|
|
|
|
if [ ! -d /sys/bus/i2c/devices/0-0056 ]
|
|
then
|
|
# Seventh Block in EEPROM not available - Write Message to result file
|
|
echo "Seventh Block unavailable" >> /test/result/eeprom.res
|
|
else
|
|
# Seventh Block in EEPROM available - Check Size
|
|
if [ -s /sys/bus/i2c/devices/0-0056/eeprom ]
|
|
then
|
|
# File is available and its size greater zero - Test passed
|
|
echo -e "Seventh Block OK"
|
|
else
|
|
# File is not available or its size is zero - Test failed
|
|
echo "Seventh Block File error" >> /test/result/eeprom.res
|
|
fi
|
|
fi
|
|
|
|
if [ ! -d /sys/bus/i2c/devices/0-0057 ]
|
|
then
|
|
# Eigth Block in EEPROM not available - Write Message to result file
|
|
echo "Eigth Block unavailable" >> /test/result/eeprom.res
|
|
else
|
|
# Eigth Block in EEPROM available - Check Size
|
|
if [ -s /sys/bus/i2c/devices/0-0057/eeprom ]
|
|
then
|
|
# File is available and its size greater zero - Test passed
|
|
echo -e "Eigth Block OK"
|
|
else
|
|
# File is not available or its size is zero - Test failed
|
|
echo "Eigth Block File error" >> /test/result/eeprom.res
|
|
fi
|
|
fi
|
|
|
|
#-----------------------------------------------------------------------------
|
|
# OUTPUT AND RESULT CALCULATION
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Display content of /test/result/eeprom.res
|
|
if [ -s /test/result/eeprom.res ]
|
|
then
|
|
echo -e "\n\rContent of eeprom.res"
|
|
cat /test/result/eeprom.res
|
|
fi
|
|
|
|
# Display content of /test/result/eeprom.err
|
|
if [ -s /test/result/eeprom.err ]
|
|
then
|
|
echo -e "\n\rContent of eeprom.err"
|
|
cat /test/result/eeprom.err
|
|
fi
|
|
|
|
# If comparison returned neither results nor errors, the copying and
|
|
# comparision was successful
|
|
if [ ! -s /test/result/eeprom.res -a ! -s /test/result/eeprom.err ]
|
|
|
|
then
|
|
# Test was successful
|
|
echo -e "\n\rEEPROM TEST-PASSED"
|
|
echo "EEPROM TEST-PASSED" >> /test/result/eeprom.res
|
|
else
|
|
# Test failed
|
|
echo -e "\n\rEEPROM TEST-FAIL"
|
|
echo "EEPROM TEST-FAILED" >> /test/result/eeprom.res
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|