Commit 4949031e authored by Fabien Lahoudere's avatar Fabien Lahoudere Committed by Enric Balletbo i Serra

docs: Document the Test Cases

Create the in-code documentation for the test cases for automodule
documentation.
Signed-off-by: default avatarFabien Lahoudere <fabien.lahoudere@collabora.com>
Signed-off-by: default avatarEnric Balletbo i Serra <enric.balletbo@collabora.com>
parent 5524f19e
......@@ -9,6 +9,7 @@ import unittest
class TestCrosECAccel(unittest.TestCase):
def test_cros_ec_accel_iio_abi(self):
""" Checks the cros-ec accelerometer IIO ABI. """
files = [
"buffer",
"calibrate",
......@@ -38,10 +39,11 @@ class TestCrosECAccel(unittest.TestCase):
self, "/sys/bus/iio/devices", "cros-ec-accel", ["frequency"], True
)
# This function validate accelerometer data by computing the magnitude.
# If the magnitude is not closed to 1G, that means data are invalid or
# the machine is in movement or there is a earth quake.
def test_cros_ec_accel_iio_data_is_valid(self):
""" Validates accelerometer data by computing the magnitude. If the
magnitude is not closed to 1G, that means data are invalid or
the machine is in movement or there is a earth quake.
"""
ACCEL_1G_IN_MS2 = 9.8185
ACCEL_MAG_VALID_OFFSET = 0.25
match = 0
......
......@@ -7,6 +7,7 @@ import unittest
class TestCrosECextcon(unittest.TestCase):
def test_cros_ec_extcon_usbc_abi(self):
""" Checks the cros-ec extcon ABI. """
match = 0
for devname in os.listdir("/sys/class/extcon"):
devtype = read_file("/sys/class/extcon/" + devname + "/name")
......
......@@ -8,6 +8,7 @@ import unittest
class TestCrosECGyro(unittest.TestCase):
def test_cros_ec_gyro_iio_abi(self):
""" Checks the cros-ec gyroscope IIO ABI. """
files = [
"buffer/",
"calibrate",
......
......@@ -8,21 +8,27 @@ import unittest
class TestCrosECMCU(unittest.TestCase):
def test_cros_ec_abi(self):
""" Checks the standard ABI for the main Embedded Controller. """
check_mcu_abi(self, "ec")
def test_cros_fp_abi(self):
""" Checks the standard ABI for the Fingerprint EC. """
check_mcu_abi(self, "fp")
def test_cros_tp_abi(self):
""" Checks the standard ABI for the Touchpad EC. """
check_mcu_abi(self, "tp")
def test_cros_pd_abi(self):
""" Checks the standard ABI for the Power Delivery EC. """
check_mcu_abi(self, "pd")
def test_cros_ec_chardev(self):
""" Checks the main Embedded controller character device. """
self.assertEqual(os.path.exists("/dev/cros_ec"), 1)
def test_cros_ec_hello(self):
""" Checks basic comunication with the main Embedded controller. """
fd = open("/dev/cros_ec", "r")
param = ec_params_hello()
param.in_data = 0xA0B0C0D0 # magic number that the EC expects on HELLO
......
......@@ -7,6 +7,7 @@ import unittest
class TestCrosECPower(unittest.TestCase):
def test_cros_ec_usbpd_charger_abi(self):
""" Check the cros USBPD charger ABI. """
files = [
"current_max",
"input_current_limit",
......@@ -26,6 +27,7 @@ class TestCrosECPower(unittest.TestCase):
)
def test_cros_ec_battery_abi(self):
""" Check the cros battery ABI. """
files = [
"alarm",
"capacity_level",
......
......@@ -7,6 +7,10 @@ import unittest
class TestCrosECPWM(unittest.TestCase):
def test_cros_ec_pwm_backlight(self):
""" Check that the backlight is connected to a pwm of the EC and that
programming a brightness level to the backlight affects the PWM
duty cycle.
"""
if not os.path.exists("/sys/class/backlight/backlight/max_brightness"):
self.skipTest("No backlight pwm found, skipping")
is_ec_pwm = False
......
......@@ -8,6 +8,7 @@ import unittest
class TestCrosECRTC(unittest.TestCase):
def test_cros_ec_rtc_abi(self):
""" Check the cros RTC ABI. """
if not is_feature_supported(EC_FEATURE_RTC):
self.skipTest("EC_FEATURE_RTC not supported, skipping")
match = 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment