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