test_controllers.sh 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #!/bin/bash
  2. #usage ./test_controllers.sh
  3. ##################################################################################
  4. # Copyright (c) International Business Machines Corp., 2007 #
  5. # #
  6. # This program is free software; you can redistribute it and/or modify #
  7. # it under the terms of the GNU General Public License as published by #
  8. # the Free Software Foundation; either version 2 of the License, or #
  9. # (at your option) any later version. #
  10. # #
  11. # This program is distributed in the hope that it will be useful, #
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of #
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See #
  14. # the GNU General Public License for more details. #
  15. # #
  16. # You should have received a copy of the GNU General Public License #
  17. # along with this program; if not, write to the Free Software #
  18. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #
  19. # #
  20. ##################################################################################
  21. # Name Of File: test_controllers.sh #
  22. # #
  23. # Description: #
  24. # This file runs the tests for resource management ie to test cpu #
  25. # controller and memory controller. (for now cpu controller only) #
  26. # #
  27. # Author: Sudhir Kumar <sudhirkumarmalik@In.ibm.com> #
  28. # #
  29. # History: #
  30. # #
  31. # DATE NAME EMAIL DESC #
  32. # #
  33. # 20/12/07 Sudhir Kumar <sudhirkumarmalik@in.ibm.com> Created this test #
  34. # 02/03/09 Miao Xie <miaox@cn.fujitsu.com> Add cpuset testset #
  35. # 07/07/09 Shi Weihua <shiwh@cn.fujitsu.com> Add cpu testset of Fujitsu #
  36. # 30/12/09 Rishikesh <risrajak@linux.vnet.ibm.com> Added enable/disable #
  37. # #
  38. ##################################################################################
  39. if [ -f /proc/cgroups ]
  40. then
  41. CPU_CONTROLLER=`grep -w cpu /proc/cgroups | cut -f1`;
  42. CPU_CONTROLLER_VALUE=`grep -w cpu /proc/cgroups | cut -f4`;
  43. MEM_CONTROLLER=`grep -w memory /proc/cgroups | cut -f1`;
  44. MEM_CONTROLLER_VALUE=`grep -w memory /proc/cgroups | cut -f4`;
  45. IOTHROTTLE_CONTROLLER=`grep -w blockio /proc/cgroups | cut -f1`;
  46. IOTHROTTLE_CONTROLLER_VALUE=`grep -w blockio /proc/cgroups | cut -f4`;
  47. FREEZER=`grep -w freezer /proc/cgroups | cut -f1`;
  48. FREEZER_VALUE=`grep -w freezer /proc/cgroups | cut -f4`;
  49. CPUACCOUNT_CONTROLLER=`grep -w cpuacct /proc/cgroups | cut -f1`
  50. CPUACCOUNT_CONTROLLER_VALUE=`grep -w cpuacct /proc/cgroups | cut -f4`
  51. if [ "$CPU_CONTROLLER" = "cpu" ] && [ "$CPU_CONTROLLER_VALUE" = "1" ]
  52. then
  53. $LTPROOT/testcases/bin/run_cpuctl_test.sh 1;
  54. $LTPROOT/testcases/bin/run_cpuctl_test.sh 3;
  55. $LTPROOT/testcases/bin/run_cpuctl_test.sh 4;
  56. $LTPROOT/testcases/bin/run_cpuctl_test.sh 5;
  57. $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 6;
  58. $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 7;
  59. $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 8;
  60. $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 9;
  61. $LTPROOT/testcases/bin/run_cpuctl_stress_test.sh 10;
  62. # Add the latency testcase to be run
  63. $LTPROOT/testcases/bin/run_cpuctl_latency_test.sh 1;
  64. $LTPROOT/testcases/bin/run_cpuctl_latency_test.sh 2;
  65. # Add the testcases from Fujitsu
  66. $LTPROOT/testcases/bin/run_cpuctl_test_fj.sh
  67. else
  68. echo "CONTROLLERS TESTCASES: WARNING";
  69. echo "Either Kernel does not support for cpu controller or functionality is not enabled";
  70. echo "Skipping all cpu controller testcases....";
  71. fi;
  72. if [ "$MEM_CONTROLLER" = "memory" ] && [ "$MEM_CONTROLLER_VALUE" = "1" ]
  73. then
  74. $LTPROOT/testcases/bin/run_memctl_test.sh 1;
  75. $LTPROOT/testcases/bin/run_memctl_test.sh 2;
  76. else
  77. echo "CONTROLLERS TESTCASES: WARNING";
  78. echo "Either Kernel does not support for memory controller or functionality is not enabled";
  79. echo "Skipping all memory controller testcases....";
  80. fi
  81. if [ "$IOTHROTTLE_CONTROLLER" = "blockio" ] && [ "$IOTHROTTLE_CONTROLLER_VALUE" = "1" ]
  82. then
  83. $LTPROOT/testcases/bin/run_io_throttle_test.sh;
  84. else
  85. echo "CONTROLLERS TESTCASES: WARNING";
  86. echo "Either Kernel does not support for io controller or functionality is not enabled";
  87. echo "Skipping all block device I/O throttling testcases....";
  88. fi
  89. if [ "$FREEZER" = "freezer" ] && [ "$FREEZER_VALUE" = "1" ]
  90. then
  91. "$LTPROOT/testcases/bin/run_freezer.sh"
  92. else
  93. echo "CONTROLLERS TESTCASES: WARNING";
  94. echo "Either Kernel does not support for freezer or functionality is not enabled";
  95. echo "Kernel does not support freezer controller";
  96. echo "Skipping all freezer testcases....";
  97. fi
  98. if [ "$CPUACCOUNT_CONTROLLER" = "cpuacct" ] && [ "$CPUACCOUNT_CONTROLLER_VALUE" = "1" ]
  99. then
  100. $LTPROOT/testcases/bin/run_cpuacct_test.sh 1;
  101. $LTPROOT/testcases/bin/run_cpuacct_test.sh 2;
  102. else
  103. echo "Could not start cpu accounting controller test";
  104. echo "Either Kernel does not support for cpu accounting controller or functionality is not enabled";
  105. echo "usage: run_cpuacct_test.sh $TEST_NUM ";
  106. echo "Skipping the cpu accounting controller test...";
  107. fi
  108. else
  109. echo "CONTROLLERS TESTCASES: WARNING"
  110. echo "Kernel does not support any controller";
  111. echo "Skipping all controllers testcases....";
  112. fi
  113. exit 0;