aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Hunter <ext-adrian.hunter@nokia.com>2007-03-21 11:54:35 +0200
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-03-29 17:17:27 +0300
commit842f19e7a67e0dd9ca53d1760fb8b3f2c94ab826 (patch)
tree3b93b357493356caf5a4369bd6bfc5bd6c5dc50a
parent9c37b558705b776e51f7d522f376de019a6ea203 (diff)
UBI-Utils: Add a run_all.sh script
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
-rw-r--r--ubi-utils/scripts/Makefile2
-rwxr-xr-xubi-utils/scripts/run_all.sh101
-rwxr-xr-x[-rw-r--r--]ubi-utils/scripts/ubi_jffs2_test.sh3
3 files changed, 103 insertions, 3 deletions
diff --git a/ubi-utils/scripts/Makefile b/ubi-utils/scripts/Makefile
index e8850fd..ebd9bc6 100644
--- a/ubi-utils/scripts/Makefile
+++ b/ubi-utils/scripts/Makefile
@@ -15,7 +15,7 @@ mkpfi_cfg = test.cfg
# on those values. If you do it wrong your card has no valid PDD data.
#
-PATH := $(PATH):/opt/ppc/usr/bin
+PATH := $(PATH):/opt/ppc/usr/bin:../perl:..
dd = dd
sed = sed
diff --git a/ubi-utils/scripts/run_all.sh b/ubi-utils/scripts/run_all.sh
new file mode 100755
index 0000000..040bcbd
--- /dev/null
+++ b/ubi-utils/scripts/run_all.sh
@@ -0,0 +1,101 @@
+#!/bin/sh
+
+exit_success ()
+{
+ echo "UBI Utils Test Scripts - SUCCESS!"
+ exit 0
+}
+
+exit_failure ()
+{
+ echo $1
+ echo "UBI Utils Test Scripts - FAILED!"
+ exit 1
+}
+
+echo UBI Utils Test Scripts
+
+devno=$1
+logfile=temp-test-log.txt
+
+if test -z "$devno";
+then
+ echo "Usage is $0 <mtd device number>"
+ exit 1
+fi
+
+cwd=`pwd` || exit_failure "pwd failed"
+
+log="${cwd}/${logfile}"
+
+PATH=$PATH:$cwd:..
+
+cat /dev/null > $log || exit_failure "Failed to create $log"
+
+echo "Setting up for jffs2_test.sh" | tee -a $log
+
+avail=`cat /sys/class/ubi/ubi${devno}/avail_eraseblocks`
+size=`cat /sys/class/ubi/ubi${devno}/eraseblock_size`
+
+bytes=`expr $avail \* $size`
+
+ubimkvol -d$devno -s$bytes -n0 -Njtstvol || exit_failure "ubimkvol failed"
+
+mkdir -p /mnt/test_file_system || exit_failure "mkdir failed"
+
+mtd=`cat /proc/mtd | grep jtstvol | cut -d: -f1`
+
+if test -z "$mtd";
+then
+ exit_failure "mtd device not found"
+fi
+
+mount -t jffs2 $mtd /mnt/test_file_system || exit_failure "mount failed"
+
+cd /mnt/test_file_system || exit_failure "cd failed"
+
+echo Running jffs2_test.sh | tee -a $log
+
+jffs2_test.sh >> $log 2>&1 || exit_failure "jffs2_test.sh failed"
+
+rm -f *
+
+cd $cwd || exit_failure "cd failed"
+
+umount /mnt/test_file_system || exit_failure "umount failed"
+
+ubirmvol -d$devno -n0 || exit_failure "ubirmvol failed"
+
+major=`cat /sys/class/ubi/ubi${devno}/dev | cut -d: -f1`
+
+for minor in `seq 0 32`; do
+ if test ! -e /dev/ubi${devno}_$minor ;
+ then
+ mknod /dev/ubi${devno}_$minor c $major $(($minor + 1))
+ fi
+done
+
+rm -f testdata.bin readdata.bin
+
+echo Running ubi_jffs2_test.sh | tee -a $log
+
+ubi_jffs2_test.sh >> $log 2>&1 || exit_failure "ubi_jffs2_test.sh failed"
+
+echo Running ubi_test.sh | tee -a $log
+
+ubi_test.sh >> $log 2>&1 || exit_failure "ubi_test.sh failed"
+
+for minor in `seq 0 32`; do
+ if test -e /sys/class/ubi/ubi${devno}/$minor;
+ then
+ ubirmvol -d$devno -n$minor || exit_failure "ubirmvol failed"
+ fi
+done
+
+echo Running ubi_tools_test.sh | tee -a $log
+
+ubi_tools_test.sh >> $log 2>&1 || exit_failure "ubi_tools_test failed"
+
+rm -f $log
+
+exit_success
diff --git a/ubi-utils/scripts/ubi_jffs2_test.sh b/ubi-utils/scripts/ubi_jffs2_test.sh
index 4d97431..883903d 100644..100755
--- a/ubi-utils/scripts/ubi_jffs2_test.sh
+++ b/ubi-utils/scripts/ubi_jffs2_test.sh
@@ -216,8 +216,7 @@ writevol_test ()
jffs2_torture ()
{
- rm -f $TLOG
- touch $TLOG
+ cat /dev/null > TLOG
echo "*** Torture test ... "