aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2021-07-29tests/helpers: handle os.listdir() exceptionsHEADmasterAdrian Ratiu4-71/+83
os.listdir() can throw exceptions like for eg FileNotFoundError if the path passed as argument does not exist, so we need to handle these exceptions otherwise RESULT=unknown is returned. Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2020-03-31docs: Use python3 command instead of python for the examplesEnric Balletbo i Serra1-2/+2
In the section 'Using the unittest Command-Line Interface' there are some examples that use the python command instead of python3. python usually points to python2 which is deprecated, so update the examples to use python3. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2020-03-31test_cros_ec_gyro: Check trigger attribute only when is availableEnric Balletbo i Serra1-1/+12
Since kernel commit aa984f1ba4a4 ("iio: cros_ec: Register to cros_ec_sensorhub when EC supports FIFO") the trigger attribute for some sensors is only exposed when the FIFO feature is not supported. So only check that attribute when that feature is not supported and on kernels before that patch was introduced. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2020-03-31test_cros_ec_accel: Check trigger attribute only when is availableEnric Balletbo i Serra1-1/+13
Since kernel commit aa984f1ba4a4 ("iio: cros_ec: Register to cros_ec_sensorhub when EC supports FIFO") the trigger attribute for some sensors is only exposed when the FIFO feature is not supported. So only check that attribute when that feature is not supported and on kernels before that patch was introduced. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2020-03-04test_cros_ec_gyro: Remove non-standard frequency entryEnric Balletbo i Serra1-5/+0
The 'frequency' IIO sysfs entry doesn't seem to exist neither is documented in the Documentation/ABI, so remove it. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2020-03-04test_cros_ec_accel: Remove non-standard frequency entryEnric Balletbo i Serra1-5/+0
The 'frequency' IIO sysfs entry doesn't seem to exist neither is documented in the Documentation/ABI, so remove it. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2020-01-30cros_ec_mcu: test_cros_fp_reboot: Check firmware transitions to RW copyFabien Lahoudere2-0/+71
There is a bug where, after a reboot, the Fingerprint firmware stays in a loop and can't switch to the RW firmware. This test checks that the transition from RO to RW happens. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2020-01-23test_cros_ec_abi: Use complete device name instead of a suffixFabien Lahoudere2-7/+6
To check the sysfs ABI, we use only the suffix ec, fp, pd and tp as name. We will have in the future, though, other embedded controllers that will not start with the "cros_" prefix, like the "wilco_ec". To solve those cases change the code to use the full device name. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2020-01-23docs: Fix Title underline too short warningsEnric Balletbo i Serra1-2/+2
When we renamed the test suite we introduced some warnings when generating the documentations. Fix those warning by aligning the title underline with the title. docs/source/install.rst:15: WARNING: Title underline too short. docs/source/install.rst:22: WARNING: Title underline too short. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2020-01-23test_cros_ec_hello: Deploy hello test to all MCUsFabien Lahoudere2-17/+37
We want to ensure that all available MCUs reply to the basic hello command. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2020-01-16docs: Rename references to the Chromebooks Test SuiteEnric Balletbo i Serra2-5/+5
As now is name Chome OS EC Test Suite, rename all occurences to the old name in documentation to the new name. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2020-01-09Rename crostests to cros-ec-testsEnric Balletbo i Serra6-24/+26
This test suite is meant for test the Chrome OS Embedded Controller and all its drivers, rename the project to cros-ec-tests to make it explicit that the focus is the Chrome OS Embedded Controller. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-24docs: Document the Test CasesFabien Lahoudere7-3/+20
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>
2019-12-24docs: Document the helper functionsFabien Lahoudere3-2/+23
Create the in-code documentation for helper functions for automodule documentation. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-24docs: Add Testing GuidelinesEnric Balletbo i Serra1-0/+115
This section describes the testing framework and format standards for tests in crostests package. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-24runners: lava_runner: Return only the specific test short nameEnric Balletbo i Serra1-4/+8
The id() method returns a string identifying the specific test case. This is usually the full name of the test method, including the module and class name. For now it is not really useful have this information printed on this runner, so strip the module and the class name and only print the specific test name. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-24docs: Add documentation to describe how to install the packageEnric Balletbo i Serra1-0/+51
This chapter explains how to install the crostests package and build its documentation. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-24Create a main 'cros' python packageEnric Balletbo i Serra19-30/+30
Have a helpers and runners packages is too generic, so create a 'cros' package to avoid future conflicts and to make clear the scope of the modules inside the 'cros' package. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-24crostests.yaml: Rename cros-ec.yaml to crostestsEnric Balletbo i Serra2-9/+9
To be coherent with the name, rename the test definition name from cros-ec.yaml to crostests.yaml. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-23docs: Add initial structure for documentationEnric Balletbo i Serra10-0/+413
Use Sphinx to for documenting the project. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-23cros_ec_extcon: Check also the cable APIFabien Lahoudere1-7/+14
The test was buggy and only checked the device name and state. Now, we also check all the cable names and states. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-23helpers: kernel: Fix 2 blank lines before function callEnric Balletbo i Serra1-0/+1
This fixes the following error: helpers/kernel.py:5:1: E302 expected 2 blank lines, found 1 Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-23Autoformat the code to conform with PEP 8 using 'black'Enric Balletbo i Serra11-154/+249
'black' is a program that autoformats code following most of the rules in PEP 8. Run that program in order to autformat current files. Install 'black' using pip. It requires Python 3.6+ to run: $ pip install black Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-23Reorganize test-cros-ec.py into multiple filesFabien Lahoudere18-414/+1005
Use one file for all the tests is unmaintaneable and not scalable. Now that we have some basic tests already implemented is time to reorganize the test suite and split the unique test script in a structured set of python scripts. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06cros-ec.yaml: Add Lava-Test Test Definition 1.0Enric Balletbo i Serra1-0/+9
Add a Lava-Test Definition to be able to run the test suite in the LAVA dispatcher using lqa. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06test_cros_{ec,fp,pd,tp}_abi: Check standard MCU ABIFabien Lahoudere1-0/+18
The scripts checks the embedded controller and other MCU ABI to ensure that all required files are present. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06Use explicitily Python 3Enric Balletbo i Serra1-1/+1
Python community recommends against making the python name point to Python 3. The PEP-394 states that: "If the python command is installed, it should invoke the same version of Python as the python2 command." Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06test_cros_ec_battery_cutoff_at_shutdown: Remove the testEnric Balletbo i Serra1-33/+0
This feature never landed to mainline and is failing for all devices, so remove the test. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06test_cros_ec_gyro_iio_abi: Add a condition for frequency attributeFabien Lahoudere1-8/+8
Frequency sysfs attribute have been replaced by the standard sampling_frequency after 5.4.0. We need to check the version of running kernel to decide if we must check it. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06test_cros_ec_accel_iio_abi: Add a condition for frequency attributeFabien Lahoudere1-0/+2
Frequency sysfs attribute have been replaced by the standard sampling_frequency after 5.4.0. We need to check the version of running kernel to decide if we must check it. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06Add helper to check sysfs attributesFabien Lahoudere1-63/+52
Implement a helper to simplify the code and avoid code duplication. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06Add helper to convert kernel releaseFabien Lahoudere1-0/+22
Add one function to convert version major and minor to an integer. Add a function to get the running kernel version and convert it using the previous function. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06test_cros_ec_accel_iio_data_is_valid: Fix inexisting base_path variableFabien Lahoudere1-1/+2
The line where base_patch was defined was dropped during merge or commit rework. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06Add helper to read file contentsFabien Lahoudere1-12/+12
In order to avoid code duplication or errors and to simplify code, this patch adds a function to return the content of a file. It also replaces pieces of code reading sysfs files by the new function. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06test_cros_ec_accel_iio_data_is_valid: Fix the use of local variablesFabien Lahoudere1-2/+2
ACCEL_1G_IN_MS2 and ACCEL_MAG_VALID_OFFSET variables are not global to the class but local to the function. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06test_cros_ec_pwm_backlight: Test backlight brightness behaviourFabien Lahoudere1-0/+41
This patch adds a function to check that the backlight brightness affects value of duty cycle of the PWM in debugfs. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06test_cros_ec_accel_iio_data_is_valid: test data validityFabien Lahoudere1-0/+29
In order to verify that accelerometer data are consistent, we compute the magnitude that should beclose to 1G. This patch is inspired from kernel_CrosECSysfsAccel.py [1] [1] https://chromium.googlesource.com/chromiumos/third_party/autotest/+/refs/heads/master/client/site_tests/kernel_CrosECSysfs/kernel_CrosECSysfs.py Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06test_cros_ec_rtc_abi: Test RTC ABIFabien Lahoudere1-0/+16
The script checks the RTC ABI that all required files are present. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06test_cros_ec_extcon_usbc: Test extcon usbc ABIFabien Lahoudere1-0/+15
The scripts checks the extcon usbc ABI that all required files are present. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06test_cros_ec_battery_abi: Test battery ABIFabien Lahoudere1-0/+16
The scripts checks the battery ABI that all required files are present. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06test_cros_ec_usbpd_charger_abi: Test CrOS USBPD charger ABIFabien Lahoudere1-0/+15
The scripts checks in the charger power supply ABI that all required files are present. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06test_cros_ec_gyro_iio_abi: Test gyrsocope ABIFabien Lahoudere1-0/+22
The scripts checks the IIO gyroscope ABI by verifying that all required files are present. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06test_cros_ec_accel_iio_abi: Test the CrOS EC accelerometer ABIFabien Lahoudere1-0/+22
The scripts checks the IIO accelerometer ABI by verifying that all required files are present. Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06test_cros_ec_battery_cutoff_at_shutdown: Check if EC_FEATURE_BATTERY is ↵Enric Balletbo i Serra1-1/+5
supported for cutoff tests The cutoff tests should only run if the EC_FEATURE_BATTERY is supported by the Embedded Controller. Also assert the sysfs ile exists. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2019-12-06Add basic tests for CrOS ECEnric Balletbo i Serra1-0/+235
This is a basic script test written in python to test basic functionality on CrOS EC. The purpose is use this script as a base for a more complex tests. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>