1#!/bin/sh 2#To run this script the following is necessary 3# 1.kernel should mtd support as module. 4# 2.kernel should hsve jffs2 support as module. 5# 3.kernel should have loopback device support . 6# 4.you should have fs-bench utility (http://h2np.net/tools/fs-bench-0.2.tar.gz) 7# 5.results will be copied to /tmp/log and /tmp/log1 files 8 9#DESCRIPTION: This testscript creates a jffs2 file system type and tests the filesystem test 10#and places the log in the log directory.The file system test actually creates a tree of large 11#directories and performs the delete and random delete operations as per the filesystem stress 12#algorithim and gives a report of real time ,user time,system time taken to perform the file 13#operations. 14 15#script created G.BANU PRAKASH (mailto:prakash.banu@wipro.com). 16# 17# This program is free software; you can redistribute it and/or modify 18# it under the terms of the GNU General Public License as published by 19# the Free Software Foundation; either version 2 of the License, or 20# (at your option) any later version. 21# 22# This program is distributed in the hope that it will be useful, 23# but WITHOUT ANY WARRANTY; without even the implied warranty of 24# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 25# the GNU General Public License for more details. 26# 27# You should have received a copy of the GNU General Public License 28# along with this program; if not, write to the Free Software 29# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 30# 31 32MTD_RAM=mtdram 33MTD_BLOCK=mtdblock 34JFFS2=jffs2 35LOOP=loop 36MTD_BLKDEVS=mtd_blkdevs 37ZLIB_DEFLATE=zlib_deflate 38ZLIB_INFLATE=zlib_inflate 39MTD_CORE=mtdcore 40MOUNT_DIR=/mnt 41LOG_DIR=/tmp/log 42LOG_DIR1=/tmp/log1 43HOME_DIR=/home 44BLOCK_DIR=/dev/mtdblock 45export PATH=$PATH:/sbin 46 if [ $(id -ru) -ne 0 ]; 47then 48 echo "must be root to run this" 49 exit 50fi 51 52 53 54lsmod |grep $MTD_RAM 55 56 if [ $? -ne 0 ]; 57then 58 echo "inserting mtd ram and its dependencies" 59fi 60modprobe $MTD_RAM total_size=32768 erase_size=256 61 if [ $? -ne 0 ]; 62then 63 echo "check wheather MTD -mtdram is been compiled in the kernel" 64fi 65lsmod |grep $MTD_BLOCK 66 if [ $? -ne 0 ]; then 67 echo "inserting mtdblock and its dependencies" 68fi 69modprobe $MTD_BLOCK 70 if [ $? -ne 0 ]; then 71 echo "check wheather mtdblock is been compiled in the kernel" 72fi 73 74lsmod |grep $JFFS2 75 if [ $? -ne 0 ]; then 76 echo "inserting jffs2 and its dependencies" 77fi 78modprobe $JFFS2 79 if [ $? -ne 0 ]; then 80 echo "check wheather jffs2 is been compiled in the kernel" 81fi 82 83lsmod |grep $LOOP 84 if [ $? -ne 0 ]; then 85 echo "inserting loopback device module" 86fi 87modprobe $LOOP 88 if [ $? -ne 0 ]; then 89 echo "check wheather loopback device option is been compiled in the kernel" 90fi 91mkdir -p $BLOCK_DIR 92mknod $BLOCK_DIR/0 b 31 0 >/dev/null 2>&1 93mount -t jffs2 $BLOCK_DIR/0 $MOUNT_DIR 94mount|grep $JFFS2 95 if [ $? -eq 0 ]; then 96 echo "jffs2 mounted sucessfully" 97 else 98 echo "mount unsucessfull" 99fi 100cd $MOUNT_DIR 101echo "This is will take long time " 102./test.sh >log 2>&1 103./test2.sh >log1 2>&1 104 105mv log $LOG_DIR 106mv log1 $LOG_DIR1 107cd $HOME_DIR 108 109 110#cleanup 111echo "unmounting $MOUNT_DIR " 112umount $MOUNT_DIR 113echo "removing the modules inserted" 114rmmod $MTD_BLOCK 115rmmod $MTD_BLKDEVS 116rmmod $LOOP 117rmmod $JFFS2 118rmmod $ZLIB_DEFLATE 119rmmod $ZLIB_INFLATE 120rmmod $MTD_RAM 121rmmod $MTD_CORE 122rm -rf /dev/mtdblock 123echo "TEST COMPLETE" 124echo "RESULTS LOGGED IN FILE /tmp/log and /tmp/log1 " 125