Skip to content

Commit e989656

Browse files
authored
Merge pull request #227 from pridhiviraj/tb_fix
Few fixes
2 parents 58281b0 + d9f8424 commit e989656

3 files changed

Lines changed: 31 additions & 1 deletion

File tree

common/OpTestIPMI.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1423,3 +1423,9 @@ def is_tpm_enabled(self):
14231423
elif "State Asserted" in res:
14241424
print "#TPM is enabled"
14251425
return True
1426+
1427+
def disable_sensor_polling(self):
1428+
self.ipmitool.run("raw 0x30 0x70 0xdf 0")
1429+
1430+
def enable_sensor_polling(self):
1431+
self.ipmitool.run("raw 0x30 0x70 0xdf 1")

testcases/OpalSysfsTests.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def setUp(self):
4040
self.cv_HOST = conf.host()
4141
self.cv_IPMI = conf.ipmi()
4242
self.cv_SYSTEM = conf.system()
43+
self.bmc_type = conf.args.bmc_type
4344

4445
def get_proc_gen(self):
4546
try:
@@ -69,6 +70,16 @@ def set_power_cap(self, value):
6970
time.sleep(2)
7071
self.assertTrue((int(cur_powercap) == int(value)), "OPAL failed to set power cap value")
7172

73+
def disable_sensor_polling(self):
74+
if "SMC" in self.bmc_type :
75+
self.cv_IPMI.disable_sensor_polling()
76+
return
77+
78+
def enable_sensor_polling(self):
79+
if "SMC" in self.bmc_type :
80+
self.cv_IPMI.enable_sensor_polling()
81+
return
82+
7283
def test_opal_powercap(self):
7384
self.setup_test()
7485
self.c.run_command("stty cols 300; stty rows 30;")
@@ -79,13 +90,15 @@ def test_opal_powercap(self):
7990
max_powercap = self.c.run_command("cat %s" % str(POWERCAP_MAX))[-1]
8091
min_powercap = self.c.run_command("cat %s" % str(POWERCAP_MIN))[-1]
8192

93+
self.disable_sensor_polling()
8294
print cur_powercap, max_powercap, min_powercap
8395
for i in range(3):
8496
value = random.randint(int(min_powercap), int(max_powercap))
8597
self.set_power_cap(value)
8698
# Set back to cur_powercap
8799
self.set_power_cap(cur_powercap)
88100

101+
self.enable_sensor_polling()
89102

90103
def test_opal_psr(self):
91104
self.setup_test()

testcases/TrustedBoot.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@
2222
# and also a secureboot mode enabled/disabled accordingly.
2323
# If TPM chip is installed --> provide --trusted-mode in command line
2424
# If secureboot is enabled --> provide --secure-mode in command line
25+
#
26+
# The "TPM Required" policy means:
27+
# enabled: Node must have at least 1 functional TPM to boot, otherwise system will terminate
28+
# disabled: Node can boot without a functional TPM
29+
# ==================
30+
# If system has a working TPM, the policy is a don't care. If secure mode is not enabled, the policy is a don't care.
31+
# if you set policy to "enabled" and remove/inject error on TPM -and- system is in secure mode, system boot will terminate
32+
# if you set policy to disable and remove/inject error on the TPM -and- system is in secure mode, system will still boot
33+
#
2534

2635
import unittest
2736
import pexpect
@@ -105,7 +114,9 @@ def verify_dt_tb(self):
105114
c.run_command("ls %s/link-id" % tpm_path)
106115

107116
def tearDown(self):
108-
self.cv_SYSTEM.sys_enable_tpm()
117+
if self.securemode and not self.trustedmode:
118+
self.cv_SYSTEM.sys_disable_tpm()
119+
return
109120

110121
class VerifyOPALTrustedBoot(TrustedBoot):
111122
'''

0 commit comments

Comments
 (0)