aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabien Lahoudere <fabien.lahoudere@collabora.com>2019-12-24 12:42:48 +0100
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>2019-12-24 12:42:48 +0100
commit4949031ec64eb5994e1dceca28aa1068c8d12a3d (patch)
tree536ff0979e6f2afe093808d7a43852dd5f722504
parent5524f19e2fb2ad93874339e8db2618292eb8c594 (diff)
downloadcros-ec-tests-4949031ec64eb5994e1dceca28aa1068c8d12a3d.tar.gz
docs: Document the Test Cases
Create the in-code documentation for the test cases for automodule documentation. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
-rw-r--r--cros/tests/cros_ec_accel.py8
-rw-r--r--cros/tests/cros_ec_extcon.py1
-rw-r--r--cros/tests/cros_ec_gyro.py1
-rw-r--r--cros/tests/cros_ec_mcu.py6
-rw-r--r--cros/tests/cros_ec_power.py2
-rw-r--r--cros/tests/cros_ec_pwm.py4
-rw-r--r--cros/tests/cros_ec_rtc.py1
7 files changed, 20 insertions, 3 deletions
diff --git a/cros/tests/cros_ec_accel.py b/cros/tests/cros_ec_accel.py
index 6884ab5..9e0ac16 100644
--- a/cros/tests/cros_ec_accel.py
+++ b/cros/tests/cros_ec_accel.py
@@ -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
diff --git a/cros/tests/cros_ec_extcon.py b/cros/tests/cros_ec_extcon.py
index b72a1ec..ec934b2 100644
--- a/cros/tests/cros_ec_extcon.py
+++ b/cros/tests/cros_ec_extcon.py
@@ -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")
diff --git a/cros/tests/cros_ec_gyro.py b/cros/tests/cros_ec_gyro.py
index 0f48d2e..4a0cec1 100644
--- a/cros/tests/cros_ec_gyro.py
+++ b/cros/tests/cros_ec_gyro.py
@@ -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",
diff --git a/cros/tests/cros_ec_mcu.py b/cros/tests/cros_ec_mcu.py
index f108d44..06fc96f 100644
--- a/cros/tests/cros_ec_mcu.py
+++ b/cros/tests/cros_ec_mcu.py
@@ -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
diff --git a/cros/tests/cros_ec_power.py b/cros/tests/cros_ec_power.py
index 6cc0e8c..e72ce90 100644
--- a/cros/tests/cros_ec_power.py
+++ b/cros/tests/cros_ec_power.py
@@ -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",
diff --git a/cros/tests/cros_ec_pwm.py b/cros/tests/cros_ec_pwm.py
index 2950ee2..bcc9fbc 100644
--- a/cros/tests/cros_ec_pwm.py
+++ b/cros/tests/cros_ec_pwm.py
@@ -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
diff --git a/cros/tests/cros_ec_rtc.py b/cros/tests/cros_ec_rtc.py
index 60ca265..f8ac511 100644
--- a/cros/tests/cros_ec_rtc.py
+++ b/cros/tests/cros_ec_rtc.py
@@ -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