summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* test/motion_angle.c: Format with clang-formatJack Rosenthal2022-06-281-19/+16
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I77d8dc7f45a7608e2a242c6924c162430429fc1c Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730512 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* test/powerdemo.c: Format with clang-formatJack Rosenthal2022-06-281-14/+8
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Iab6cf319cdf1a3d2fbd5ee696735fa154893db06 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730530 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* test/stillness_detector.c: Format with clang-formatJack Rosenthal2022-06-281-18/+14
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I8f01bc7a954c89b4fd19da2feb69f1ede7a6eb0f Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730523 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* test/usb_pd_console.c: Format with clang-formatJack Rosenthal2022-06-281-29/+28
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I31cda5899b36d87bd5d4ab25052cda6ce9efb654 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730550 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* test/usb_pd_int.c: Format with clang-formatJack Rosenthal2022-06-281-47/+45
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I916de5a57216e7bd726d8ac8d512e998dc5be369 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730540 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* test/charge_manager.c: Format with clang-formatJack Rosenthal2022-06-281-14/+9
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I4f274078d3aa5ff4ac9ff93dcb9bffd900c765fe Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730473 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* test/entropy.c: Format with clang-formatJack Rosenthal2022-06-281-3/+3
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: If0496251d6ad350168b5126092a82ae267a908ba Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730498 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* test/usb_tcpmv2_compliance.h: Format with clang-formatJack Rosenthal2022-06-281-16/+9
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I748a3f1301bffeee4ea92193154134ad043bf025 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3730552 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* tcpmv2: debug: Add console command to print CC stateVijay Hiremath2022-06-221-0/+5
| | | | | | | | | | | | BUG=none BRANCH=none TEST=Manually tested on MTLRVP 'pd <port> cc' prints correct CC state Change-Id: Ic1b4b697ed3ed99e8940fd3c1202f8325cd178ea Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3698274 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* RGBKBD: Set scale per keyDaisuke Nojiri2022-06-071-6/+4
| | | | | | | | | | | | | | | | | Currently, rgbkbd_set_scale can only set a scale of all keys. This patch makes it set a scale of an individual key. rgbkbd_reset_scale will replace the previous rgbkbd_set_scale. BUG=b:233986174, b:234530397 BRANCH=None TEST=Run ectool rgbkbd scale on Vell. TEST=Run ectool rgbkbd scale on Taniks. TEST=Run rgb all, demo, reset, scale, command in EC console. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I34e6b3e41c40510eca148fcf879e8caaf57317be Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3689778 Reviewed-by: Parth Malkan <parthmalkan@google.com>
* RGBKBD: Add demo sub-command to EC_CMD_RGBKBDDaisuke Nojiri2022-06-071-1/+1
| | | | | | | | | | | BUG=None BRANCH=None TEST=Vell Change-Id: Ie486b9ae6731622882b21d5273f79280770bbd17 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3657839 Reviewed-by: Parth Malkan <parthmalkan@google.com>
* clock-stm32f4: Fix minimal time the RTC alarm can be set forPatryk Duda2022-06-071-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, SET_RTC_MATCH_DELAY was set to 120 us which was way too small to setup RTC alarm properly. As a result, watchdog could reset FPMCU while it was in deep sleep (also known as STOP mode in STM32 documentation) with no additional information (because interrupts were disabled in __idle() and the core was sleeping). The problem ocurred when number of microseconds provided to set_rtc_alarm() was between 120 - 125 (typically a value slightly smaller than HOOK_TICK_INTERVAL is provided), so the probability was very low. New value was found by running this code on STM32F4 (placed in chip/stm32/clock-f.c) +volatile uint32_t int_received; + static void __rtc_alarm_irq(void) { + int_received++; + rtc_alarm_irq(); } DECLARE_IRQ(STM32_IRQ_RTC_ALARM, __rtc_alarm_irq, 1); +static int measure_rtc_setup(int argc, char** argv) +{ + struct rtc_time_reg rtc0; + + for (int us = 180; us <= 200; us++) { + int_received = 0; + for (int i = 0; i < 100000; i++) { + set_rtc_alarm(0, us, &rtc0, 0); + usleep(1000); + } + ccprints("%d us - %d received", us, int_received); + } + + return EC_SUCCESS; +} + +DECLARE_CONSOLE_COMMAND(measure_rtc, measure_rtc_setup, "", ""); The code adds 'measure_rtc' console command which is setting RTC alarm and waits 1 ms for interrupt to be triggered. In this code we are testing range from 180us to 200us, 100k times. Results from 120us to 200us, 1k times: [6.667189 120 us - 0 received] [7.680241 121 us - 0 received] [8.693295 122 us - 0 received] [9.706348 123 us - 0 received] [10.719404 124 us - 0 received] [11.732460 125 us - 466 received] [12.745519 126 us - 953 received] [13.758578 127 us - 952 received] [14.771637 128 us - 952 received] [15.784697 129 us - 953 received] [16.797757 130 us - 955 received] ... [67.450714 180 us - 950 received] [68.463772 181 us - 954 received] [69.476831 182 us - 961 received] [70.489890 183 us - 941 received] [71.502949 184 us - 950 received] [72.516008 185 us - 941 received] [73.529068 186 us - 957 received] [74.542128 187 us - 956 received] [75.555187 188 us - 1000 received] [76.568248 189 us - 1000 received] [77.581310 190 us - 1000 received] [78.594371 191 us - 1000 received] [79.607431 192 us - 1000 received] [80.620493 193 us - 1000 received] [81.633554 194 us - 1000 received] [82.646615 195 us - 1000 received] [83.659676 196 us - 1000 received] [84.672737 197 us - 1000 received] [85.685798 198 us - 1000 received] [86.698859 199 us - 1000 received] [87.711920 200 us - 1000 received] We see that with setting RTC alarm to 120us we are guaranteed to not receive an interrupt. Starting from 188us we receive all interrupts. Results from 180us to 200us, 100k times: [107.697820 180 us - 95144 received] [208.997886 181 us - 95250 received] [310.297953 182 us - 95259 received] [411.598017 183 us - 95167 received] [512.898079 184 us - 95245 received] [614.198148 185 us - 95149 received] [715.498217 186 us - 95166 received] [816.798283 187 us - 95235 received] [918.098345 188 us - 100000 received] [1019.398414 189 us - 100000 received] [1120.698484 190 us - 100000 received] [1221.998555 191 us - 100000 received] [1323.298622 192 us - 100000 received] [1424.598695 193 us - 100000 received] [1525.898759 194 us - 100000 received] [1627.198827 195 us - 100000 received] [1728.498897 196 us - 100000 received] [1829.798961 197 us - 100000 received] [1931.099025 198 us - 100000 received] [2032.399095 199 us - 100000 received] [2133.699164 200 us - 100000 received] Again, we see that starting from 188us all interrupts are received. The new value was set to 200us, so we have 12us of safe margin. BUG=b:200828093 BRANCH=none TEST=Set HOOK_TICK_INTERVAL in chip/stm32/config_chip.h to value that is a sum of STOP_MODE_LATENCY, PLL_LOCK_LATENCY and SET_RTC_MATCH_DELAY and value between 50us to 100us (to give enough time to do context switches). For SET_RTC_MATCH_DELAY equal to 120us, good value is 400. For 200us, the value should be 450. Compile bloonchipper and flash it on dragonclaw development board. Make sure that there are no reboots caused by watchdog. TEST=./test/run_device_tests.py --board bloonchipper \ --flasher servo_micro --tests stm32f_rtc Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: Ica2036c142ac7fd792c6365b97cb39fab656d227 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3688190 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Craig Hesling <hesling@chromium.org> Reviewed-by: Bobby Casey <bobbycasey@google.com>
* ec: Add sleep in stillness_detector testJeremy Bettis2022-06-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Sometimes some of the background tasks, that don't affect test results, haven't even started or are still doing their initialization at the end of the test. Wait a short time (2s was determined through trial and error) before printing the test results. This should cause the test to emit a consistent number of lines in the coverage report. BRANCH=None BUG=b:213374060,b:234225228 TEST=Ran this command many times make clobber ; \ make TEST_COVERAGE=y build/coverage/stillness_detector.info \ >&/dev/null && lcov --summary build/coverage/stillness_detector.info \ && lcov --list build/coverage/stillness_detector.info \ | grep common/mkbp_event.c Change-Id: Ic889dfa55ed8f8dba3e26ef94c85c760ed47037b Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3681941 Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org>
* RGBKBD: Run rgbkbd_task only when demo is enabledDaisuke Nojiri2022-05-251-0/+6
| | | | | | | | | | | | | | | | | | Currently, the rgbkbd task runs even when demo is off (and immediately goes back to sleep). This patch enables the task only when demo is enabled. BUG=b:233099161 BRANCH=None TEST=By ectool on Vell. Set color on single key. Set colors on multiple keys. Run demos. TEST=Change brightness by Alt+F6/F7 on Vell. TEST=Cold reboot. Warm reboot. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I20770208038a034c285a9838e6d096d4055e986d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3657838 Reviewed-by: Parth Malkan <parthmalkan@google.com>
* RGBKBD: Add reset, enable, disable, scale console commandsDaisuke Nojiri2022-05-191-8/+13
| | | | | | | | | | | | | | | This patch renames rgbk command to rgb and adds reset, enable, disable and scale command to the command. BUG=b:233099161 BRANCH=None TEST=Vell Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I0f01f99199400489d418234449c9f9b38969647d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3654486 Reviewed-by: Parth Malkan <parthmalkan@google.com> Commit-Queue: Parth Malkan <parthmalkan@google.com>
* ec: Make tests pass with TEST_ASAN=yJeremy Bettis2022-05-113-10/+11
| | | | | | | | | | | | | | | | | | | | | | | There are some mismatched enums and other errors that prevent building with asan. Fix them all. Change the cq builder to prevent these breakages in the future. If the tests pass with ASAN in the chroot, they will likely pass in gitlab with coverage enabled. BRANCH=None BUG=None TEST=make clobber ; make -j8 runtests && echo PASS make clobber ; make -j8 TEST_ASAN=y runtests && echo PASS Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I6d86fd5750282e0257eb97f65b31046a1613a453 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3631365 Reviewed-by: Keith Short <keithshort@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* ec: Disable the host-interrupt testJeremy Bettis2022-05-111-1/+3
| | | | | | | | | | | | | | | | | It's generally not useful, as it is testing test-only code. We already skip it for code coverage, because it times out so often. BRANCH=None BUG=b:227793011 TEST=make runtests |& grep -i interrupt Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I34ab231421d1e52673a90831e297cd80df44f234 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3639491 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* ec: Changes to get usb_tcpmv2_compliance to passJeremy Bettis2022-05-094-4/+4
| | | | | | | | | | | | | | | | | | | The command `make clobber ; make TEST_ASAN=y run-usb_tcpmv2_compliance` doesn't pass because of several mismatched enums and an array out of bounds error. BRANCH=None BUG=b:214087135 TEST=make clobber ; make TEST_ASAN=y run-usb_tcpmv2_compliance Change-Id: I27cad82d2350e43c7891d5ff86e565553199cd7a Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3632185 Commit-Queue: Yuval Peress <peress@google.com> Reviewed-by: Jameson Thies <jthies@google.com> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Yuval Peress <peress@google.com>
* common/usbc: add new DPM for sink capability and request mismatchScott Chao2022-05-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | In TBT EV - Host Source Power Provisioning test item. The port partner will return sink capability that it can support 3A, but it will request 1.5A at the end. In this case, EC will provide 3A for it and provide 1.5A for the second port partner. This case will cause test failed due to EC only provide 1.5A for both port. BUG=b:229683022 BRANCH=none TEST=make -j BOARD=primus TEST=make buildall TEST=verified by GRL Change-Id: Icc4904ec1267b7a34e64c01b626f607999072410 Signed-off-by: Scott Chao <scott_chao@wistron.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3592313 Commit-Queue: Diana Z <dzigterman@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* TCPMv2: Request partner's revision information in src/snk startupJameson Thies2022-05-042-2/+29
| | | | | | | | | | | | | | | | | | | | | Adding features from the USB PD 3.1 revision of the specification requires us to know the difference between USB PD Rev 3.0 and USB PD Rev 3.1 devices. But, the message header only has 2 bits for revision and only provides the major revision. To determine a devices minor revision, TCPMv2 will need to send a Get_Revision command and store the Revision response which has major/minor revision/version information. This CL adds support for sending Get_Revision, and receiving Revision. BUG=b:214087135 TEST=Checked that the PE state was correctly holding the Revision response from a USB PD Rev 3.1 partner, and also checked that the stored RMDO value was 0 for a USB PD Rev 3.0 partner. BRANCH=none Signed-off-by: Jameson Thies <jthies@google.com> Change-Id: I99f10c15750c3a1fee1d8bad89b0c4a0b0a6b2ba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3607054 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* PRL test: Correct received data and power rolesDiana Z2022-05-041-4/+16
| | | | | | | | | | | | | | | Simulated partner messages should contain the opposite data and power roles to our own unless they're specifically testing error handling for data role mismatch. BRANCH=None BUG=b:155418161 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I38879eb5e2caf9833d6efa8cd0d36f9363a80fe5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3612213 Reviewed-by: Scott Collyer <scollyer@chromium.org>
* PRL old Test: Correct data and power roles in messagesDiana Z2022-05-031-15/+30
| | | | | | | | | | | | | | | The PRL old test sends all simulated messages as its own data and power role, which would be a violation of the specification. BRANCH=None BUG=b:155418161 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I097aca2eca3c648ab9045517b6e22aab346fa595 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3612212 Commit-Queue: Scott Collyer <scollyer@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org>
* CTVPD: Fix unit test Discovery simulationDiana Z2022-05-031-1/+1
| | | | | | | | | | | | | | | | The CTVPD unit test sends DiscoverIdentity to itself, but was sending as a Source/UFP with no data role swap. Correct the header to be Source/DFP. BRANCH=None BUG=b:155418161 TEST=zmake testall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I73c217374faa6334e5539e37a5278393bd7c5376 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3612211 Reviewed-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* TCMPV2: Add state to send Status extended messagesJameson Thies2022-05-021-0/+5
| | | | | | | | | | | | | | | | | | | | When a USB PD partner sends a Get_Status message, the EC should respond with a Status message. This CL adds the Status message response and creates a new function in usb_pd_dpm which will be used to build the Status Data Block (SDB). BUG=b:227236917 TEST=triggered Status message and saw that it correctly sent data from a modified dpm_get_status_msg function on a twinkie. BRANCH=None Signed-off-by: Jameson Thies <jthies@google.com> Change-Id: Ifafa6e9ee7d9a62ef75e5c9e96606ffba64c98b0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3602226 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Jameson Thies <jthies@google.com> Tested-by: Jameson Thies <jthies@google.com>
* RGBKBD: Move initialization to keyboard backlightDaisuke Nojiri2022-05-021-7/+4
| | | | | | | | | | | | | | | This patch removes initialization code for RGB keyboard and let keyboard backlight module handle it. This patch also removes RGB keyboard integration from pwm.c since it's not used or needed. BUG=b:226215987, b:228525798, 223465912 BRANCH=None TEST=ectool rgbkbd, pwmsetkblight, pwmgetkblight on Vell & Taniks Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I01fa445f802607106f2f4a0a8e1469ab759c604b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3615851 Reviewed-by: Parth Malkan <parthmalkan@google.com>
* ec: Mock out mkbp_send_event in kasa test.Jeremy Bettis2022-04-271-0/+8
| | | | | | | | | | | | | | | | | | | | Very rarely, the kasa test triggers 52 lines of coverage in common/mkbp_event.c, with the entry point mkbp_send_event(). Add an empty implementation of that function to prevent any code from calling into common/mkbp_event.c. BRANCH=None BUG=b:230610934 TEST=Ran kasa test 50 times Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I5adee0b44ce65af6dc2abddb57b004af7388d12f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3610685 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Al Semjonovs <asemjonovs@google.com> Commit-Queue: Al Semjonovs <asemjonovs@google.com> Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org>
* ec: Mock out mkbp_send_event in gyro_cal test.Jeremy Bettis2022-04-261-0/+8
| | | | | | | | | | | | | | | | | | | | Very rarely, the gyro_cal test triggers 52 lines of coverage in common/mkbp_event.c, with the entry point mkbp_send_event(). Add an empty implementation of that function to prevent any code from calling into common/mkbp_event.c. BRANCH=None BUG=b:230478817 TEST=Ran gyro_cal test hundreds of times Change-Id: Ic068980766680d486b6a21a12f8612f278f6a800 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3609111 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Aaron Massey <aaronmassey@google.com> Commit-Queue: Aaron Massey <aaronmassey@google.com>
* Add option to connect to remote FPMCU consoleTom Hughes2022-04-221-46/+118
| | | | | | | | | | | | | BRANCH=none BUG=none TEST=./test/run_device_tests.py --remote 127.0.0.1 --jlink_port 19020 \ --console_port 10000 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I7ba43a2fb162ac3f28fae0ccce8139810ac3d233 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3511549 Reviewed-by: Andrea Grandi <agrandi@google.com> Reviewed-by: Bobby Casey <bobbycasey@google.com>
* TCPMv2: Switch unit tests to use usb_pe_private.hCaveh Jalali2022-04-212-59/+5
| | | | | | | | | | | | | | | | | | | * API update: pe_*_flag() changes to pe_*_fn(). flags are now identified by number instead of bit mask. these are only used by unit tests. * update usb_pe unit tests to use the newly introduced usb_pe_private.h header file to avoid duplicate definitions. * usb_pe_drp_old_noextended.c should ideally also be updated like usb_pe_drp_old.c, but this file has not been part of the build for a long time and is very stale. BRANCH=none BUG=b:229655319,b:229942100 TEST=buildall passes, compare_builds passes. Signed-off-by: Caveh Jalali <caveh@chromium.org> Change-Id: I46638436ca2cf9f38eadaa8336d31cb79cbfe189 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3591910 Reviewed-by: Keith Short <keithshort@chromium.org>
* tests: usb_pd_timers: verify more portsDawid Niedzwiecki2022-04-202-36/+88
| | | | | | | | | | | | | | | | Increase the number of USB PD ports and verify if the initialization of pd_timers and bitwise operators work well in this scenario. BUG=b:208435177 TEST=make runhosttests BRANCH=none Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: If495bd6260ffe6a6304ee60dce6a9663410aaf8e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3586435 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Dawid Niedzwiecki <dawidn@google.com> Commit-Queue: Dawid Niedzwiecki <dawidn@google.com>
* TCPMv2: Remove unused pe_[sg]et_all_flags functionsCaveh Jalali2022-04-191-2/+0
| | | | | | | | | | | | BRANCH=none BUG=b:229655319 TEST=buildall passes. compare_builds passes Change-Id: I1529f65d6385e046c40ff502ba65b1db6397eafd Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3591908 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* compile_time_macros: Add WRITE_BITDaisuke Nojiri2022-04-181-0/+40
| | | | | | | | | | | | | | | | | | WRITE_BIT macro sets a bit if a given condition is true or clears it if not. BUG=None BRANCH=None TEST=make run-compile_time_macros Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Id3a73afbc48a49ec9df9dcf8f494974fb274b192 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3587152 Reviewed-by: Parth Malkan <parthmalkan@google.com> Reviewed-by: Rob Barnes <robbarnes@google.com> Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Reviewed-by: Bobby Casey <bobbycasey@google.com> Reviewed-by: Craig Hesling <hesling@chromium.org>
* run_device_tests: Improve test results outputPatryk Duda2022-04-111-111/+83
| | | | | | | | | | | | | | | | | | | | | | | | Until now run_device_tests script prints test name passed to EC build system. This patch modifies the script to print name of the test definition in the script. Each test can have variants, eg. system_is_locked test can be run with write protect on and off, so in the script there are two definitions of the test: system_is_locked_wp_on and system_is_locked_wp_off. BUG=b:221087395 BRANCH=none TEST=./test/run_device_tests.py -b dartmonkey --test system_is_locked.* TEST=./test/run_device_tests.py -b dartmonkey Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I9d441cdc0897dff6b1de9ebe4e02cec311a005eb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3569763 Reviewed-by: Bobby Casey <bobbycasey@google.com> Tested-by: Patryk Duda <patrykd@google.com> Reviewed-by: Andrea Grandi <agrandi@google.com> Commit-Queue: Patryk Duda <patrykd@google.com>
* test: add test for fifo popYuval Peress2022-04-081-0/+53
| | | | | | | | | | | | | | | | | | Test the case where the entry being removed has fewer than 2 entries in the fifo. This would trigger us to look at other sensors to see if timestamp spreading is still needed. The test verifies that the correct sample is at the head of the sensor data and that the timestamps were spread. BRANCH=none BUG=b:224614211 TEST=make run-motion_sense_fifo -j Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I5771247722d0e2cc4b1765d9da2b6d66e649303d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3575698 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* ec: Exclude kb_scan test from coverageJeremy Bettis2022-04-081-1/+2
| | | | | | | | | | | | | | | | Even though this test doesn't flake when I run it locally, it does flake on gitlab. BRANCH=None BUG=b:228321906 TEST=Nope Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I4c659f3c7c90faaa6b2c693a66ea4fafc7468597 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3578298 Reviewed-by: Yuval Peress <peress@google.com> Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* ec: Exclude kb_scan_strict test from coverageJeremy Bettis2022-04-081-1/+1
| | | | | | | | | | | | | | | | | Even though this test doesn't flake when I run it locally, it does flake on gitlab. BRANCH=None BUG=b:228344537 TEST=Nope Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I120701e24b9169a9be979eb4c0c1310ad471c0f9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3578297 Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* ec: Exclude flash test from coverageJeremy Bettis2022-04-081-1/+1
| | | | | | | | | | | | | | | | | | Even though this test doesn't flake when I run it locally, it does flake on gitlab. BRANCH=None BUG=b:228371835 TEST=Nope Change-Id: I7b9007815c7ce078f980a4eaf097dc857cea8f8a Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3578296 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Sam Hurst <shurst@google.com> Commit-Queue: Sam Hurst <shurst@google.com>
* test/run_device_tests.py: Add private testsAndrea Grandi2022-04-082-2/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the list of tests is hard-coded in the Python script. Add ability to fetch additional tests from the private folder, if available. This is a reland of commit b97ba790690d1ee86c001ef0a82be5897645ae2f BRANCH=none BUG=b:226385185 TEST=cros lint test/run_device_tests.py TEST=make V=1 run-<private_test> TEST=test/run_device_tests.py --flasher=jtrace --remote=localhost --board=dartmonkey TEST=test/run_device_tests.py --flasher=jtrace --remote=localhost --board=dartmonkey --tests=<private_test> Cq-Depend: chrome-internal:4650299, chrome-internal:4650281, chrome-internal:4650279 Signed-off-by: Andrea Grandi <agrandi@google.com> Change-Id: I67866ced27414d495bfad5eff9825cf68c8c22cf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3562041 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Feels: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Bobby Casey <bobbycasey@google.com> Feels: Bobby Casey <bobbycasey@google.com>
* ec: Delete /dev/shm/EC_persist_* before testsJeremy Bettis2022-04-061-1/+1
| | | | | | | | | | | | | | | | | | Some tests (specifically flash) leave /dev/shm/EC_persist_* files on the disk and the behavior of the test changes when they exist. To get a consistent test, remove the corresponding files before running a host test. BRANCH=None BUG=b:213374060 TEST=Ran flash test 50 times Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I27a92adee1b181fdedf0b75bdd19a39e27bfa6af Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3572892 Tested-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* ec: Stop excluding some formerly flaky testsJeremy Bettis2022-04-061-2/+1
| | | | | | | | | | | | | | | | Now that the flaky lines in core/host/task.c are excluded, these tests don't flaky in coverage any more. BRANCH=None BUG=b:213374060 TEST=Ran tests 50 times each Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I493c84900518663df622c19a6d0c217937ad9296 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3572889 Reviewed-by: Al Semjonovs <asemjonovs@google.com> Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* ec: Add a sleep to make coverage stableJeremy Bettis2022-04-061-0/+3
| | | | | | | | | | | | | | | | | | The function tc_error_recovery_run is getting called by the PD task after the end of the test, so sometimes it appears in the coverage report and sometimes not. Add a sleep to make sure it always has time to run. BRANCH=None BUG=b:213374060 TEST=Ran usb_typec_ctvpd 50 times Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: Ibf3019e7add2522ae8e5287c6053df2a8f9ea596 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3572888 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org>
* motion_sense_fifo: Add tests for the get_info functionYuval Peress2022-04-061-0/+35
| | | | | | | | | | | | | | | Verify that all the fields returned by the get_info function are correctly filled per several different test scenarios. BRANCH=none BUG=b:224614211 TEST=make run-motion_sense_fifo -j Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Ib544e3f1acbca21eb0d8a2bf7bf8ecf351a0a172 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3572852 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* test: Introduce panic data persistency testPatryk Duda2022-04-064-1/+198
| | | | | | | | | | | | | | | | | | | | | | | | | The test is going to check if panic data are correct after crash, soft reboot and hard reboot. In the last case we expect to have only 16 bits of a panic reason and info associated with reason. Checking panic data after soft reboot will make sure that RO doesn't overwrite part of panic data created by RW (eg. when doing sysjump). Doing the same checks after hard reboot will make sure that RO is able to restore panic data from backup RAM and RW is restoring any additional data which RO is not aware of (eg. panic flags) correctly. BUG=b:221087395 BRANCH=none TEST=./test/run_device_tests.py -b dartmonkey --test panic_data.* TEST=./test/run_device_tests.py -b bloonchipper --test panic_data.* Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: If84af40fc0045b633effbb32d61061ec20505516 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3555750 Reviewed-by: Andrea Grandi <agrandi@google.com> Reviewed-by: Bobby Casey <bobbycasey@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Patryk Duda <patrykd@google.com>
* run_device_tests: Add support for overriding board by the testPatryk Duda2022-04-061-7/+14
| | | | | | | | | | | | | | | | | | | | | | | Dartmonkey board has siblings (nocturne_fp, nami_fp). They share the same codebase, but nocturne_fp and nami_fp board are configured differently (nocturne_fp and nami_fp support different panic data structure layout). Since it's necessary to run only panic data test (which will be introduced later) on nocturne_fp and nami_fp and all three boards are tested on the same physical board we add support for providing information which board should be compiled. BUG=b:221087395 BRANCH=none TEST=./test/run_device_tests.py --board dartmonkey Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I6f8548f77ec3b1126fbdd9c9fb61cedc6425fa98 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3561619 Reviewed-by: Andrea Grandi <agrandi@google.com> Reviewed-by: Bobby Casey <bobbycasey@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Feels: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Patryk Duda <patrykd@google.com>
* run_device_tests: Add option to replace RO with provided onePatryk Duda2022-04-061-1/+93
| | | | | | | | | | | | | | | | | | | | RO/RW compatibility tests need to be run with RO version used in production. This patch introduces support for replacing RO part of compiled firmware with provided one. The RO part should contain developer public keys in order to verify RW successfully. BUG=b:221087395 BRANCH=none TEST=run_device_tests.py -b dartmonkey Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I5f11896df5d8048009b2c512c92818d7af673077 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3555749 Reviewed-by: Andrea Grandi <agrandi@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Bobby Casey <bobbycasey@google.com> Feels: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Patryk Duda <patrykd@google.com>
* tree: Add OWNERS files for fingerprint-related filesTom Hughes2022-04-051-0/+84
| | | | | | | | | | | | | | | There are already OWNERS files for the core fingerprint-related code, but we were missing some utilities and tests. BRANCH=none BUG=b:227673625 TEST=none Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I0adf9bebf651ff34eab29d127bf749e4f101405d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3565043 Reviewed-by: Andrea Grandi <agrandi@google.com> Reviewed-by: Bobby Casey <bobbycasey@google.com>
* run_device_tests: Use 'tests' argument as a regex patternPatryk Duda2022-04-051-3/+5
| | | | | | | | | | | | | | | | | | | | | | This change makes possible to run multiple similar tests with one 'tests' command line argument. For example, the script with 'system_is_locked.*' argument will run 'system_is_locked_wp_on' and 'system_is_locked_wp_off' tests. BUG=b:221087395 BRANCH=none TEST=Run './test/run_device_tests.py --board dartmonkey \ --tests system_is_locked.*' make sure that 'system_is_locked_wp_on' and 'system_is_locked_wp_off' tests were run. TEST=Run './test/run_device_tests.py --board dartmonkey \ --tests sha256' make sure that only 'sha256' was run. Signed-off-by: Patryk Duda <pdk@semihalf.com> Change-Id: I36325e89f2319afdc7eedd4ef5ee80fc79402b9a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3561618 Tested-by: Patryk Duda <patrykd@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Patryk Duda <patrykd@google.com>
* ec: Stop excluding some tests for coverageJeremy Bettis2022-04-041-8/+3
| | | | | | | | | | | | | | | | | | These tests are not causing any coverage flakiness in 50 runs after merging with the other existing tests. BRANCH=None BUG=b:213374060 TEST=See bash commands in bug Change-Id: Iabcb703ebeb67f69c61cb16081d3bcd1287ed334 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3569782 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Yuval Peress <peress@google.com> Commit-Queue: Yuval Peress <peress@google.com>
* ec: Stop excluding some tests for coverageJeremy Bettis2022-04-011-2/+1
| | | | | | | | | | | | | | | | | | | These tests are not causing any coverage flakiness in 50 runs after merging with the other existing tests. BRANCH=None BUG=b:213374060 TEST=See bash commands in bug Change-Id: Ib107a6a466c0f54dec9cd73bf5f8ea395eee3f29 Signed-off-by: Jeremy Bettis <jbettis@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3566209 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Yuval Peress <peress@google.com> Commit-Queue: Yuval Peress <peress@google.com> Feels: Yuval Peress <peress@google.com>
* test: add motion_sense_fifo back to test-coverageYuval Peress2022-04-013-3/+5
| | | | | | | | | | | | | | | | | | | | motion_sense_fifo was removed due to being non-deterministic. This appears to be caused by the motion_sense task pulling values from the fifo (but the tests still passing). - Remove the motion_sense task from the tasklist (not needed) - Add missing mutex that's needed for linking - Remove the test from the don't test list BRANCH=none BUG=none TEST=zmake test-coverage -j Signed-off-by: Yuval Peress <peress@google.com> Change-Id: Idb9a49166d578190458bfa4bf0125ec244559999 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3566112 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>