modaltr.sh 3.3 KB

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