1#!/bin/sh 2#To exectute this you need mongo filesystem utility. 3#Run this inside the mongo directory. 4#mongo utility can be found in www.namesys.com/benchmarks/mongo-xxx.tgz 5#Description-this script tests the mongo utility which actulally give the time ie cpu time 6#Real time etc on reiserfile system and jfs filesystem. 7#created by prakash.banu@wipro.com 8# 9# This program is free software; you can redistribute it and/or modify 10# it under the terms of the GNU General Public License as published by 11# the Free Software Foundation; either version 2 of the License, or 12# (at your option) any later version. 13# 14# This program is distributed in the hope that it will be useful, 15# but WITHOUT ANY WARRANTY; without even the implied warranty of 16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 17# the GNU General Public License for more details. 18# 19# You should have received a copy of the GNU General Public License 20# along with this program; if not, write to the Free Software 21# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22# 23 24LOG_DIR=$PWD 25TEST_DIR=testdir 26 27 28 #should be root to execute this script . 29 if [ $(id -ru) -ne 0 ]; then 30 echo "This script must be run as root" 31 exit 32 fi 33 #set the PATH variable if its not done . 34export PATH=$PATH:/sbin 35lsmod |grep reiserfs 36 37 if [ $? -ne 0 ]; then 38 echo "inserting reiserfs and its dependencies" 39 fi 40modprobe reiserfs 41 if [ $? -ne 0 ]; then 42 echo "check wheather reiserfs is been compiled in the kernel" 43 fi 44 45lsmod |grep loop 46 if [ $? -ne 0 ]; then 47 echo "inserting loopback device module" 48 fi 49modprobe loop 50 if [ $? -ne 0 ]; then 51 echo "check wheather loopback device option is been compiled in the kernel" 52 fi 53 54 #run the mongo test on reiserfs file system type 55reiserfs() 56{ 57cat > fs.sh <<EOF 58echo "performing mongo on reiserfs" 59dd if=/dev/zero of=reiserfs bs=8k count=10240 > /dev/null 2>&1 60losetup /dev/loop0 reiserfs 61mkdir -p $TEST_DIR 62./mongo.pl LOG=/tmp/logfile1 file_size=10000 bytes=100000 fstype=reiserfs dev=/dev/loop0 dir=$TEST_DIR RUN log=$LOG_DIR/reiserlog > /dev/null 2>&1 63 64echo "RESULTS LOGGED IN $LOG_DIR/reiserlog" 65export PATH=$PATH:/sbin 66losetup -d /dev/loop0 67 68EOF 69} 70 71 72#To run on jfs file system type 73JFS() 74{ 75cat >> fs.sh <<EOF 76echo "performing mongo on jfs file system" 77mkdir -p $TEST_DIR 78dd if=/dev/zero of=jfs bs=8k count=10240 > /dev/null 2>&1 79losetup /dev/loop0 jfs 80./mongo.pl LOG=/tmp/logfile1 file_size=10000 bytes=100000 fstype=jfs dev=/dev/loop0 dir=$TEST_DIR RUN log=$LOG_DIR/jfslog 81 82echo "RESULTS LOGGED IN $LOG_DIR/jfslog" 83export PATH=$PATH:/sbin 84losetup -d /dev/loop0 85echo "rm -rf ./fs.sh" >> ./fs.sh 2>&1 86EOF 87} 88 89 90echo -ne "TEST ON REISERFS?[y/N]:" 91read ker 92 93case $ker in 94y|Y) reiserfs 95esac 96 97echo -ne "TEST ON JFS[y/N]: " 98read ker 99 100case $ker in 101y|Y) JFS 102esac 103 104echo "THIS MAY TAKE SOME MINUTES" 105sh fs.sh 106 107#performing cleanup 108#losetup -d /dev/loop0 109rm -rf $TEST_DIR 110