runpwtests02.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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_Management02"
  21. export TST_TOTAL=1
  22. . test.sh
  23. . pm_include.sh
  24. test_sched_smt() {
  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. 2000000000000000000000000000000000000000000000000000000000000000000000
  29. ox324 -0xfffffffffffffffffffff"
  30. test_file="/sys/devices/system/cpu/sched_smt_power_savings"
  31. if [ ! -f ${test_file} ] ; then
  32. tst_brkm TBROK "MISSING_FILE: missing file ${test_file}"
  33. fi
  34. echo "${0}: ---Valid test cases---"
  35. check_input "${valid_input}" valid $test_file
  36. RC=$?
  37. echo "${0}: ---Invalid test cases---"
  38. check_input "${invalid_input}" invalid $test_file
  39. RC=$(( RC | $? ))
  40. return $RC
  41. }
  42. # Checking test environment
  43. check_kervel_arch
  44. # Check sched_smt_power_savings interface on HT machines
  45. hyper_threaded=$(is_hyper_threaded)
  46. if [ ! -f /sys/devices/system/cpu/sched_smt_power_savings ] ; then
  47. tst_brkm TCONF "Required kernel configuration for SCHED_SMT NOT set"
  48. else
  49. if [ $hyper_threaded -ne 0 ]; then
  50. tst_brkm TCONF "sched_smt_power_saving interface in system" \
  51. "not hyper-threaded"
  52. fi
  53. fi
  54. if test_sched_smt ; then
  55. tst_resm TPASS "SCHED_SMT sysfs test"
  56. else
  57. tst_resm TFAIL "SCHED_SMT sysfs test"
  58. fi
  59. tst_exit