runpwtests01.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #! /bin/sh
  2. #
  3. # Copyright (c) International Business Machines Corp., 2001
  4. # Author: Nageswara R Sastry <nasastry@in.ibm.com>
  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, but
  12. # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  13. # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  14. # 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 Foundation,
  18. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. #
  20. export TCID="Power_Management01"
  21. export TST_TOTAL=1
  22. . test.sh
  23. . pm_include.sh
  24. test_sched_mc() {
  25. get_kernel_version
  26. get_valid_input $kernel_version
  27. invalid_input="3 4 5 6 7 8 a abcefg x1999 xffff -1 -00000
  28. 2000000000000000000000000000000000000000000000000000000000000000000
  29. ox324 -0xfffffffffffffffffffff"
  30. test_file="/sys/devices/system/cpu/sched_mc_power_savings"
  31. if [ ! -f ${test_file} ] ; then
  32. tst_brkm TBROK "MISSING_FILE: missing file ${test_file}"
  33. fi
  34. RC=0
  35. echo "${0}: ---Valid test cases---"
  36. check_input "${valid_input}" valid $test_file
  37. RC=$?
  38. echo "${0}: ---Invalid test cases---"
  39. check_input "${invalid_input}" invalid $test_file
  40. RC=$(( RC | $? ))
  41. return $RC
  42. }
  43. # Checking test environment
  44. check_kervel_arch
  45. # Checking sched_mc sysfs interface
  46. multi_socket=$(is_multi_socket)
  47. multi_core=$(is_multi_core)
  48. if [ ! -f /sys/devices/system/cpu/sched_mc_power_savings ] ; then
  49. tst_brkm TCONF "Required kernel configuration for SCHED_MC" \
  50. "NOT set"
  51. else
  52. if [ $multi_socket -ne 0 -a $multi_core -ne 0 ] ; then
  53. tst_brkm TCONF "sched_mc_power_savings interface in system" \
  54. "which is not a multi socket &(/) multi core"
  55. fi
  56. fi
  57. if test_sched_mc ; then
  58. tst_resm TPASS "SCHED_MC sysfs tests"
  59. else
  60. tst_resm TFAIL "SCHED_MC sysfs tests"
  61. fi
  62. tst_exit