Home | History | Annotate | Download | only in fs-bench
      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 (at] 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 
     32 MTD_RAM=mtdram
     33 MTD_BLOCK=mtdblock
     34 JFFS2=jffs2
     35 LOOP=loop
     36 MTD_BLKDEVS=mtd_blkdevs
     37 ZLIB_DEFLATE=zlib_deflate
     38 ZLIB_INFLATE=zlib_inflate
     39 MTD_CORE=mtdcore
     40 MOUNT_DIR=/mnt
     41 LOG_DIR=/tmp/log
     42 LOG_DIR1=/tmp/log1
     43 HOME_DIR=/home
     44 BLOCK_DIR=/dev/mtdblock
     45 export PATH=$PATH:/sbin
     46 	if [ $(id -ru) -ne 0 ];
     47 then
     48 	echo "must be root to run this"
     49 	exit
     50 fi
     51 
     52 
     53 
     54 lsmod |grep $MTD_RAM
     55 
     56 	if [ $? -ne 0 ];
     57 then
     58 	echo "inserting mtd ram and its dependencies"
     59 fi
     60 modprobe $MTD_RAM  total_size=32768 erase_size=256
     61 	if [ $? -ne 0 ];
     62 then
     63 	echo "check wheather MTD -mtdram is been compiled in the kernel"
     64 fi
     65 lsmod |grep $MTD_BLOCK
     66 	if [ $? -ne 0 ]; then
     67 	echo "inserting mtdblock  and its dependencies"
     68 fi
     69 modprobe $MTD_BLOCK
     70 	if [ $? -ne 0 ]; then
     71 	echo "check wheather mtdblock is been compiled in the kernel"
     72 fi
     73 
     74 lsmod |grep $JFFS2
     75 	if [ $? -ne 0 ]; then
     76 	echo "inserting jffs2  and its dependencies"
     77 fi
     78 modprobe $JFFS2
     79 	if [ $? -ne 0 ]; then
     80 	echo "check wheather jffs2 is been compiled in the kernel"
     81 fi
     82 
     83 lsmod |grep $LOOP
     84 	if [ $? -ne 0 ]; then
     85 	echo "inserting loopback device module"
     86 fi
     87 modprobe $LOOP
     88 	if [ $? -ne 0 ]; then
     89 	echo "check wheather loopback device option is been compiled in the kernel"
     90 fi
     91 mkdir -p $BLOCK_DIR
     92 mknod $BLOCK_DIR/0 b 31 0 >/dev/null 2>&1
     93 mount -t jffs2 $BLOCK_DIR/0 $MOUNT_DIR
     94 mount|grep $JFFS2
     95 	if [ $? -eq 0 ]; then
     96  echo "jffs2 mounted sucessfully"
     97 	else
     98  echo "mount unsucessfull"
     99 fi
    100 cd $MOUNT_DIR
    101 echo "This is will take long time "
    102 ./test.sh    >log 2>&1
    103 ./test2.sh    >log1 2>&1
    104 
    105 mv log   $LOG_DIR
    106 mv log1  $LOG_DIR1
    107 cd $HOME_DIR
    108 
    109 
    110 #cleanup
    111 echo "unmounting $MOUNT_DIR "
    112 umount $MOUNT_DIR
    113 echo "removing the modules inserted"
    114 rmmod  $MTD_BLOCK
    115 rmmod  $MTD_BLKDEVS
    116 rmmod  $LOOP
    117 rmmod  $JFFS2
    118 rmmod  $ZLIB_DEFLATE
    119 rmmod  $ZLIB_INFLATE
    120 rmmod  $MTD_RAM
    121 rmmod  $MTD_CORE
    122 rm -rf /dev/mtdblock
    123 echo "TEST COMPLETE"
    124 echo "RESULTS LOGGED IN FILE  /tmp/log and /tmp/log1  "
    125