summaryrefslogtreecommitdiffstats
path: root/recipes-test/ddt-runner/files/scripts/t1042rdb/spi
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/t1042rdb/spi')
-rwxr-xr-xrecipes-test/ddt-runner/files/scripts/t1042rdb/spi35
1 files changed, 35 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/t1042rdb/spi b/recipes-test/ddt-runner/files/scripts/t1042rdb/spi
new file mode 100755
index 0000000..06475a7
--- /dev/null
+++ b/recipes-test/ddt-runner/files/scripts/t1042rdb/spi
@@ -0,0 +1,35 @@
1#!/bin/bash
2
3SPIDEVS=`cat /proc/mtd | grep -e "^mtd" | grep -i spi | gawk -e '{print $1}' | sed 's/://'`
4if [ -z "$SPIDEVS" ]; then
5 echo "SKIP: no spi device found"
6 exit 1
7fi
8
9
10MTD_DEBUG=`which mtd_debug`
11if [ -z "$MTD_DEBUG" ] ; then
12 echo "FAIL: mtd_debug utility not found on the system"
13 exit 1
14fi
15
16ERRCODE=0
17
18for DV in $SPIDEVS ; do
19 FNAME=`cat /proc/mtd | grep $DV | gawk -F\" '{print $2}'`
20 FDEV=/dev/$DV
21 MTDSIZE=`$MTD_DEBUG info $FDEV | grep "mtd.size" | gawk -e '{print $3}'`
22 if [ $MTDSIZE -eq 0 ] ; then
23 echo "SKIP: $FNAME size is $MTDSIZE (skipped)"
24 else
25 $MTD_DEBUG read $FDEV 0 $MTDSIZE /dev/null > /dev/null 2>&1
26 if [ $? -eq 0 ] ; then
27 echo "PASS: \"$FNAME\" read $MTDSIZE bytes"
28 else
29 echo "FAIL: \"$FNAME\" trying to read $MTDSIZE bytes"
30 ERRCODE=2
31 fi
32 fi
33done
34
35exit $ERRCODE