-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: ELBERT: CIT: Add test cases Add test cases: test_cpu_utilization test_emmc test_fans test_process_running test_spi_driver_presence test_watchdog (disabled for now) Note: FSCD and some other processes are not running yet, so ELBERTTODO in place Testing: All CIT tests pass [cit.txt](https://github.com/facebookexternal/openbmc.arista/files/5405089/cit.txt) Pull Request resolved: facebookexternal/openbmc.arista#99 Reviewed By: mikechoifb fbshipit-source-id: 853cb59c06
- Loading branch information
1 parent
2988044
commit 6c17d6c
Showing
6 changed files
with
334 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright 2020-present Facebook. All Rights Reserved. | ||
# | ||
# This program file is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License as published by the | ||
# Free Software Foundation; version 2 of the License. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
# for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program in a file named COPYING; if not, write to the | ||
# Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, | ||
# Boston, MA 02110-1301 USA | ||
# | ||
|
||
from common.base_cpu_utilization_test import BaseCpuUtilizationTest | ||
|
||
|
||
class CpuUtilizationTest(BaseCpuUtilizationTest): | ||
def init_cpu_variables(self): | ||
""" | ||
It is noticeable that the sys cpu consumption goes up | ||
quite high where it varies a lot ,so we are setting | ||
the expected cpu consumption to 60 (several processes | ||
that tend to consume lots of cpu will be skipped). A | ||
retry of 10 times will be used to isolate flaky test. | ||
result_threshold is set to 8 because we will target 80% of failure. | ||
""" | ||
self.expected_cpu_utilization = 75 | ||
self.number_of_retry = 10 | ||
self.result_threshold = 8 | ||
self.wait_time = 5 | ||
|
||
def skip_cpu_utilization_processes(self): | ||
""" | ||
we will define a list of processes here that we | ||
want to skip. Those tend to be proccesses that we need | ||
which consume a large amount of cpu consumption, or where | ||
the cpu consumption varies a lot. | ||
""" | ||
self.skip_processes = [ | ||
"u-fb", | ||
"ipmid", | ||
"rest.py", | ||
"fscd.py", | ||
"top", | ||
"awk", | ||
"spatula_wrapper", | ||
"rotor_client", | ||
"rsyslogd", | ||
"sensord", | ||
"front-paneld", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright 2020-present Facebook. All Rights Reserved. | ||
# | ||
# This program file is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License as published by the | ||
# Free Software Foundation; version 2 of the License. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
# for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program in a file named COPYING; if not, write to the | ||
# Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, | ||
# Boston, MA 02110-1301 USA | ||
# | ||
import unittest | ||
|
||
from common.base_emmc_test import BaseEmmcTest | ||
|
||
|
||
class ElbertEmmcTest(BaseEmmcTest, unittest.TestCase): | ||
def set_emmc_mount_point(self): | ||
self.emmc_mountpoint = "/mnt/data1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright 2020-present Facebook. All Rights Reserved. | ||
# | ||
# This program file is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License as published by the | ||
# Free Software Foundation; version 2 of the License. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
# for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program in a file named COPYING; if not, write to the | ||
# Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, | ||
# Boston, MA 02110-1301 USA | ||
# | ||
import time | ||
import unittest | ||
|
||
from common.base_fans_test import CommonShellBasedFansTest | ||
from utils.cit_logger import Logger | ||
|
||
|
||
class FansTest(CommonShellBasedFansTest, unittest.TestCase): | ||
def setUp(self): | ||
Logger.start(name=self._testMethodName) | ||
self.read_fans_cmd = "/usr/local/bin/get_fan_speed.sh" | ||
self.write_fans_cmd = "/usr/local/bin/set_fan_speed.sh" | ||
self.kill_fan_ctrl_cmd = ["/usr/bin/sv stop fscd", "/usr/local/bin/wdtcli stop"] | ||
self.start_fan_ctrl_cmd = [ | ||
"/usr/local/bin/set_fan_speed.sh 40" | ||
] # ELBERTTODO FSCD not enabled | ||
# self.start_fan_ctrl_cmd = ["/usr/bin/sv start fscd"] | ||
|
||
def tearDown(self): | ||
Logger.info("Finished logging for {}".format(self._testMethodName)) | ||
self.kill_fan_controller() | ||
self.start_fan_controller() | ||
|
||
def test_fan1_read(self): | ||
""" | ||
For each fan read and test speed | ||
""" | ||
Logger.log_testname(self._testMethodName) | ||
self.assertNotEqual(self.read_fans_cmd, None, "Get Fan cmd not set") | ||
# Sleep needed to test and make sure that we won't run | ||
# into accessing sysfs path issue causing test to fail | ||
time.sleep(2) | ||
super().fan_read(fan=1) | ||
|
||
def test_fan2_read(self): | ||
""" | ||
For each fan read and test speed | ||
""" | ||
Logger.log_testname(self._testMethodName) | ||
self.assertNotEqual(self.read_fans_cmd, None, "Get Fan cmd not set") | ||
# Sleep needed to test and make sure that we won't run | ||
# into accessing sysfs path issue causing test to fail | ||
time.sleep(2) | ||
super().fan_read(fan=2) | ||
|
||
def test_fan3_read(self): | ||
""" | ||
For each fan read and test speed | ||
""" | ||
Logger.log_testname(self._testMethodName) | ||
self.assertNotEqual(self.read_fans_cmd, None, "Get Fan cmd not set") | ||
# Sleep needed to test and make sure that we won't run | ||
# into accessing sysfs path issue causing test to fail | ||
time.sleep(2) | ||
super().fan_read(fan=3) | ||
|
||
def test_fan4_read(self): | ||
""" | ||
For each fan read and test speed | ||
""" | ||
Logger.log_testname(self._testMethodName) | ||
self.assertNotEqual(self.read_fans_cmd, None, "Get Fan cmd not set") | ||
# Sleep needed to test and make sure that we won't run | ||
# into accessing sysfs path issue causing test to fail | ||
time.sleep(2) | ||
super().fan_read(fan=4) | ||
|
||
def test_fan5_read(self): | ||
""" | ||
For each fan read and test speed | ||
""" | ||
Logger.log_testname(self._testMethodName) | ||
self.assertNotEqual(self.read_fans_cmd, None, "Get Fan cmd not set") | ||
# Sleep needed to test and make sure that we won't run | ||
# into accessing sysfs path issue causing test to fail | ||
time.sleep(2) | ||
super().fan_read(fan=5) | ||
|
||
def test_fan1_pwm_set(self): | ||
""" | ||
For each fan read and test speed | ||
""" | ||
Logger.log_testname(self._testMethodName) | ||
self.assertNotEqual(self.write_fans_cmd, None, "Set Fan cmd not set") | ||
# Sleep needed to test and make sure that we won't run | ||
# into accessing sysfs path issue causing test to fail | ||
time.sleep(2) | ||
super().fan_set_and_read(fan_id=1, pwm=0) | ||
|
||
def test_fan2_pwm_set(self): | ||
""" | ||
For each fan read and test speed | ||
""" | ||
Logger.log_testname(self._testMethodName) | ||
self.assertNotEqual(self.write_fans_cmd, None, "Set Fan cmd not set") | ||
# Sleep needed to test and make sure that we won't run | ||
# into accessing sysfs path issue causing test to fail | ||
time.sleep(2) | ||
super().fan_set_and_read(fan_id=2, pwm=30) | ||
|
||
def test_fan3_pwm_set(self): | ||
""" | ||
For each fan read and test speed | ||
""" | ||
Logger.log_testname(self._testMethodName) | ||
self.assertNotEqual(self.write_fans_cmd, None, "Set Fan cmd not set") | ||
# Sleep needed to test and make sure that we won't run | ||
# into accessing sysfs path issue causing test to fail | ||
time.sleep(2) | ||
super().fan_set_and_read(fan_id=3, pwm=50) | ||
|
||
def test_fan4_pwm_set(self): | ||
""" | ||
For each fan read and test speed | ||
""" | ||
Logger.log_testname(self._testMethodName) | ||
self.assertNotEqual(self.write_fans_cmd, None, "Set Fan cmd not set") | ||
# Sleep needed to test and make sure that we won't run | ||
# into accessing sysfs path issue causing test to fail | ||
time.sleep(2) | ||
super().fan_set_and_read(fan_id=4, pwm=70) | ||
|
||
def test_fan5_pwm_set(self): | ||
""" | ||
For each fan read and test speed | ||
""" | ||
Logger.log_testname(self._testMethodName) | ||
self.assertNotEqual(self.write_fans_cmd, None, "Set Fan cmd not set") | ||
# Sleep needed to test and make sure that we won't run | ||
# into accessing sysfs path issue causing test to fail | ||
time.sleep(2) | ||
super().fan_set_and_read(fan_id=4, pwm=80) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright 2020-present Facebook. All Rights Reserved. | ||
# | ||
# This program file is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License as published by the | ||
# Free Software Foundation; version 2 of the License. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
# for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program in a file named COPYING; if not, write to the | ||
# Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, | ||
# Boston, MA 02110-1301 USA | ||
# | ||
import unittest | ||
|
||
from common.base_process_running_test import BaseProcessRunningTest | ||
|
||
|
||
class ProcessRunningTest(BaseProcessRunningTest, unittest.TestCase): | ||
def set_processes(self): | ||
self.expected_process = [ | ||
"dhclient -6 -d -D LL", | ||
"dhclient -pf /var/run/dhclient.eth0.pid eth0", | ||
# "front-paneld", | ||
# "fscd", # ELBERTODO FSCD not supported yet | ||
# "ipmid", # ELBERTTODO IPMID not enabled | ||
# "sensord", | ||
"mTerm_server", | ||
"rest.py", | ||
"restapi", | ||
"rsyslogd", | ||
"spatula_wrapper.py", | ||
"usbmon.sh", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright 2020-present Facebook. All Rights Reserved. | ||
# | ||
# This program file is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License as published by the | ||
# Free Software Foundation; version 2 of the License. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
# for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program in a file named COPYING; if not, write to the | ||
# Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, | ||
# Boston, MA 02110-1301 USA | ||
# | ||
import unittest | ||
|
||
from common.base_spi_driver_presence_test import BaseSpiDriverPresenceTest | ||
|
||
|
||
class ElbertSpiDriverPresenceTest(BaseSpiDriverPresenceTest, unittest.TestCase): | ||
def set_spi_driver_list(self): | ||
self.spi_driver_list = ["spidev"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env python3 | ||
# | ||
# Copyright 2020-present Facebook. All Rights Reserved. | ||
# | ||
# This program file is free software; you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License as published by the | ||
# Free Software Foundation; version 2 of the License. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
# for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program in a file named COPYING; if not, write to the | ||
# Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, | ||
# Boston, MA 02110-1301 USA | ||
# | ||
import unittest | ||
|
||
from common.base_watchdog_test import WatchdogTest | ||
|
||
|
||
@unittest.skip("ELBERTODO Test not supported on platform yet") | ||
class WatchdogTest(WatchdogTest, unittest.TestCase): | ||
def set_kill_watchdog_daemon_cmd(self): | ||
self.kill_watchdog_daemon_cmd = ["/usr/bin/sv stop fscd"] | ||
|
||
def set_start_watchdog_daemon_cmd(self): | ||
self.start_watchdog_daemon_cmd = ["/usr/bin/sv start fscd"] |