summaryrefslogtreecommitdiff
path: root/cts/common
Commit message (Collapse)AuthorAgeFilesLines
* cts/common/cts_testlist.h: Format with clang-formatJack Rosenthal2022-06-291-1/+1
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I15510c38f0d4b4adcf5438e98343de03563dc9a3 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3729757 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* cts/common/cts_common.h: Format with clang-formatJack Rosenthal2022-06-281-8/+8
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Ic04639838f2be7b1942974e0224d069997011e08 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3729740 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* tree: Files should end with single newlineTom Hughes2021-10-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | One of the checks that runs as part of "repo upload" looks for a single newline at the end of each file. I'm getting warnings about this when I touch files that do not follow this, even though I didn't add the extra newlines. This commit fixes all files by running the following: for f in $(find . -name '*.[ch]'); do printf '%s\n' "$(cat ${f})" > ${f}; done BRANCH=none BUG=b:172020503 TEST=./util/compare_build.sh -b all -j 120 => MATCH Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: Ia3ece5b64b549d21ca11708791368002bb6e9b0e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3229797 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* pylintrc: Copy Chromium OS platform2's configCraig Hesling2021-08-021-0/+4
| | | | | | | | | | | | | | | | | | | | This requests that cros lint (and repo upload hook) use the new Chromium OS 4 space indent policy. Since legacy python scripts still use 2 space, I added pylint ignore statements to the individual files to disable indentation checking. Note: There are still valid pylint errors in some of these legacy scripts. BRANCH=none BUG=none TEST=cros lint util/*.py Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I439f5a87bc50f1f43a4996e574bbc0626922a88e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3064761 Reviewed-by: Mike Frysinger <vapier@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* cts: Migrate cts.py to python2/3 compatibleYilin Yang2020-09-291-9/+20
| | | | | | | | | | | | BUG=chromium:1031705 BRANCH=master TEST=None Signed-off-by: kerker <kerker@chromium.org> Change-Id: If043aa2d7d8b758571f43730635f741e3b81d8ad Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2431316 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* eCTS: Run openocd and lsusb as a rootDaisuke Nojiri2017-07-081-3/+4
| | | | | | | | | | | | | | | | Running lsusb (to get iSerial) and openocd requires a privilege. This patch makes cts.py run these commands as a root. Opening ttyACM0 requires a privilege as well but it'll be done by asking a user to add themselves to dialout group. BUG=chromium:664309 BRANCH=none TEST=Run cts.py on a freshly set up cros_sdk chroot. Change-Id: Ib9d007459c4b1322b15f521a5253d833e2304c3c Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/558804 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* eCTS: Use proper methods to reset boardsDaisuke Nojiri2017-06-281-5/+9
| | | | | | | | | | | | | | This patch makes cts.py call reset_halt and resume instead of calling send_openocd_commands directly. BUG=none BRANCH=none TEST=Run util/run_ects.py. Change-Id: I179fb73d41842b927fda81c153848887bb2dff57 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/553581 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* eCTS: Use pySerial to read from tty portsDaisuke Nojiri2017-06-281-29/+20
| | | | | | | | | | | | | | | In a different environment, returned characters are corrupted if baudrate isn't specified. This patch replaces tty_read method with the one using pySerial. BUG=chromium:736778 BRANCH=none TEST=Run run_ects.py and verify all tests pass. Change-Id: I8c14f6a04c900d2670ad86c1b91f3fe6625ba69c Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/550848 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* eCTS: Print start marker before syncDaisuke Nojiri2017-06-277-65/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes each test print start marker before sync. This will allow us to distinguish the failure before even sync is attempted (CTS_RC_DID_NOT_START, thus probably caused by the previous test) and the failure caused by the hanging partner, in which case the one good and alive will be stuck in sync (and should return _DID_NOT_END or even better _BAD_SYNC once we implement timeout in sync). This patch also: * Adds did_not_start_test to and removes debug_test from meta suite * Consolidates test runner loops into common cts_main_loop * Removes dut_common.h and th_common.h * Removes debug print macro and CTS_DEBUG * Replaces all infinite loops after tests with task_wait_event(-1) * Removes meaningless comments and debug printfs * Removes CTS_TEST_ID_* * Adds sync() to task suite BUG=chromium:736104 BRANCH=none TEST=Run run_ects.sh and verify all tests pass Change-Id: I6ccdf26afac6b8e8cb16483c5d75e4e77e7962f4 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/545176
* eCTS: Convert hook test suite to current formatDaisuke Nojiri2017-06-271-0/+2
| | | | | | | | | | | | | | | | | | This patch updates the hook test suite so that it can be run within the current framework. BUG=chromium:736047 BRANCH=none TEST=cts.py -m hook test name TH_RETURN_CODE DUT_RETURN_CODE TH_STR DUT_STR RESULT test_init_hook SUCCESS SUCCESS 1 1 PASS test_ticks SUCCESS SUCCESS 1 1 PASS test_priority SUCCESS SUCCESS 1 1 PASS test_deferred SUCCESS SUCCESS 1 1 PASS Change-Id: I3e7f29da61e794b06b03241f3d7706c2db94b5be Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/545084
* eCTS: Close ttyDaisuke Nojiri2017-06-231-2/+5
| | | | | | | | | | | | | This patch makes cts.py close tty files explicitly. BUG=none BRANCH=none TEST=cts.py -m meta Change-Id: Ifebfdd9607a603075492a59b5fb588e3cbc4ab12 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/544106 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* eCTS: Strip board serial stringDaisuke Nojiri2017-06-231-4/+11
| | | | | | | | | | | | | | | | | | If we don't strip a serial string read from a file, TH serial doesn't match with the one read from lsusb. It causes TH to be recognized as a DUT. This patch also makes error messages more helpful when DUT is not found or multiple DUTs are connected. BUG=none BRANCH=none TEST=cts/cts.py -m meta, task Change-Id: Ifcf96089b9620ef8809a7d2924dacf67d3af419c Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/542019 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* eCTS: Switch execution environment to chrootDaisuke Nojiri2017-06-231-1/+1
| | | | | | | | | | | | | | | | Openocd is upgraded to 0.10.0, which supports stm32l476. So, now we can run eCTS inside chroot. This allows new developers to spend no time on setting up software as all necessary tools (e.g. specific version of make, openocd, lsusb, ARM toolchains) come with cros_sdk. BUG=chromium:653949 BRANCH=none TEST=cts/cts.py -m meta Change-Id: Iba7ba94e95ceadcedcb53b76e47054ba1b2b47dd Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/542017 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* eCTS: Check order and expectation of test resultsDaisuke Nojiri2017-06-233-43/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes the framework verify not only the result but also the execution order of the tests. It also allows each test to specify expected return code and strings printed by TH and DUT. The final test results depends on the return code and the expectation. Therefore, the output now includes 'RESULT' column showing PASS or FAIL: test name TH_RETURN_CODE DUT_RETURN_CODE TH_STR DUT_STR RESULT test_task_switch SUCCESS SUCCESS 1 1 PASS test_task_priority SUCCESS FAILURE 1 1 FAIL test_stack_overflow DID_NOT_END DID_NOT_END 1 1 PASS Additionally, this patch: * Adds CTS_RC_DID_NOT_START and CTS_RC_DID_NOT_END to indicate whether the test did start or end, respectively. * Makes stack overflow test check whether stack overflow was detected and reboot occurred * Removes post_corruption_test and conflict test since now the test results are stricly compared against expected results. * Fixes gpylint errors. BUG=none BRANCH=none TEST=Run gpio, meta, timer, interrupt, and cts/cts.py -m task Change-Id: I3b7005236e705dcac0c8f4711b44c85ff9a4f676 Reviewed-on: https://chromium-review.googlesource.com/538878 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* eCTS: Refactor return code handlingDaisuke Nojiri2017-06-171-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | This patch adds host only return codes to cts.rc and derive names from there. BUG=chromium:664309 BRANCH=none TEST=cts.py -m task, interrupt, gpio test name TH DUT debug_test SUCCESS SUCCESS success_test SUCCESS SUCCESS fail_dut_test SUCCESS FAILURE fail_th_test FAILURE SUCCESS fail_both_test FAILURE FAILURE bad_sync_and_success_test BAD_SYNC BAD_SYNC bad_sync_both_test BAD_SYNC BAD_SYNC bad_sync_failure_test FAILURE BAD_SYNC hang_test SUCCESS NO_RESULT post_corruption_success NO_RESULT NO_RESULT Change-Id: I169b2466646d6236571a8a4c5d3e208d928b9dd2 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/410282 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* eCTS: Limit tty reads by boot countsDaisuke Nojiri2017-06-161-45/+40
| | | | | | | | | | | | | | | | | | | | | | | | Currently, read_tty reads characters from tty as long as there is something to read. This causes read_tty to loop forever if the board is in reboot loop. This patch makes cts.py stop reading tty if boot count exceeds max_boot_count. Reboot is detected by detecting REBOOT_MARKER. This patch also does: - Remove debug option: This adds complexity for no real value. Developers should debug tests using regular tools (make, uart console, etc.). - Remove html output. Nobody use it. Should be redone when it's needed using proper libraries. BUG=chromium:664309 BRANCH=none TEST=cts.py -m task/gpio/interrupt Change-Id: I51d1dd51c4097e8115ef04ad46853720295141b4 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/410281 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* eCTS: Hide expected messagesDaisuke Nojiri2017-06-161-14/+55
| | | | | | | | | | | | | | | | | | | | | | | This patch hides expected messages from output to the terminal and reorganizes log directory as follows: - All test output goes under /tmp/ects/$dut/$module - Openocd output is recorded in openocd.log - uart outputs are recorded in uart_th.log and uart_dut.log - build output is recorded in build.log - Check exit code from all subprocess calls - Dump build log if build fails - Dump openocd log if openocd fails BUG=chromium:664309 BRANCH=none TEST=cts.py --setup and build images in chroot then run cts.py -m meta outside chroot. Change-Id: I13294c3bf777ad7ae590459d3cf5aea405d59f96 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/409536 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* board: Add support for nucleo-f411reGwendal Grignou2017-06-061-1/+3
| | | | | | | | | | | | | | | | | Add nucleo-f411re for testing STM32F411. Fix registers.h to include F411 specific features. TEST=Check uart,gpio works. Check BMI160 accel/gyro sensor works over i2c Install firmware with "make BOARD=nucleo-f411re flash" BUG=b:38018926 BRANCH=none Change-Id: I8514d1aa48e06708053e72f8d4be15738eda6cf4 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/249994 Reviewed-by: Alexandru M Stan <amstan@chromium.org>
* cts: Fix back-to-back buildDaisuke Nojiri2016-10-141-4/+2
| | | | | | | | | | | | | | | | | | | Currently eCTS suites share the same directory (e.g. build/stm32l476g -eval) to put build artifacts even though some files (e.g. board.c) compile differently suite to suite. So, if cts-i2c-stm32l476g-eval is built, followed by cts-gpio-stm32l476g-eval, build fails or produces incorrect binary. This patch makes eCTS create different directories for each suite. As a bonus, we can now builds eCTS suites in parallel. BUG=chromium:654549 BRANCH=none TEST=make buildall -j (with uncommitted change) Change-Id: I4abedc917787be5f79b97e0e50d0d08e01bd5f9d Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/398281
* cts: Add real interrupt testDaisuke Nojiri2016-10-071-1/+2
| | | | | | | | | | | | | | | | | | Interrupt test checks whether DUT can be interrupted by an interrupt and an interrupt handler can be invoked as expected. Note the previous interrupt test ported from test/interrupt.c runs in an emulated environment on the host, thus does not test the real interrupt capability of the chip. BUG=chromium:653195 BRANCH=none TEST=Run cts.py -m interrupt Change-Id: I21cecff07594f048633d1c1b699fb3a1876379e0 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/363943 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cts: Add a return code indicating timeoutDaisuke Nojiri2016-10-051-0/+1
| | | | | | | | | | | | | | This patch adds CTS_RC_TIMEOUT, which is returned when test encounters some sort of timeout. BUG=none BRANCH=none TEST=Run cts.py -m i2c. Make buildall Change-Id: I6d5cbcdde40f24e797e795f30f002da7621d089e Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/393330 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cts: Fix error message for uart port being occupiedDaisuke Nojiri2016-10-051-3/+3
| | | | | | | | | | | | | This patch fixes the error messages displayed when a UART port connected to DUT or TH is being occupied. BUG=none BRANCH=none TEST=run cts.py -m i2c Change-Id: I3fbb4068e8ee3af7a1b04f70ae70b3d870a19d2e Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/393327
* cts: Fail script when build or flash failsDaisuke Nojiri2016-10-051-3/+3
| | | | | | | | | | | | | | This change makes cts.py fail when building or flashing a module for DUT or TH fails. BUG=none BRANCH=none TEST=Made cts.py fail by injecting build and flash error Change-Id: Iec1e11f4a8c261eb4c989b118df218e86cb6f5f1 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/393326 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cts: Refactor cts.pyDaisuke Nojiri2016-09-132-0/+319
| | | | | | | | | | | | | | | | | | | | Noteworthy changes: - Move Board and its child classes in common/board.py - Separate flashing and resetting. Flashing used to imply running tests. - Move up constants up for better visibility - Change default suite to 'meta' - Removed redundant code - Lots of renames (all lower case names, shorter names, etc.) BUG=none BRANCH=none TEST=Ran meta test and verify the results match the expectations Change-Id: I158d96e2ee104767d25b2e721d5206e528600381 Reviewed-on: https://chromium-review.googlesource.com/383911 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cts: Debug message support added to cts testsChris Chen2016-08-101-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | You can now add debug messages into a cts test and they will be displayed with the test report html page. The macro to use is CTS_DEBUG_PRINTF Adding debug messages can potentially change test results by slowing down the test, so you can choose when compiling a test suite if you want the debug messages present or not by adding --debug as an argument when you call ./cts --build. BRANCH=None BUG=None TEST=Manual - Add a debug statement to a test - Build the test suite with --debug specified - Flash the boards - Run './cts/cts.py -r' - Open /tmp/cts_results/<board_name>/<test_suite>.html to view see your debug message for the test Change-Id: Icad8e0ac5cc905010caa4e7616f81572ce6ac771 Reviewed-on: https://chromium-review.googlesource.com/362475 Commit-Ready: Chris Chen <twothreecc@google.com> Tested-by: Chris Chen <twothreecc@google.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cts: Added parsing for cts suitesChris Chen2016-07-262-3/+9
| | | | | | | | | | | | | | | | | | | | | | Added test recording when calling reset from command line. These results are printed on the screen and saved in /tmp/results/<board>/<module>.txt BRANCH=None BUG=None TEST=Manual - Connect, build and flash boards - Navigate to ec/cts - ./cts.py --run - Find test results /tmp/results/<board>/<module>.txt - Tests names should be left aligned in one column and their results right aligned in a 2nd column Change-Id: I3429d6092f2bd5d5f6825245f5439ace3f47f1fa Reviewed-on: https://chromium-review.googlesource.com/360653 Commit-Ready: Chris Chen <twothreecc@google.com> Tested-by: Chris Chen <twothreecc@google.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cts: Added file to list error codes as integersChris Chen2016-07-217-12/+20
| | | | | | | | | | | | | | | | | | | | BRANCH=None BUG=None TEST=Manual - Connect handshake and gpio test lines between th and dut - Build tests - run 'cat /dev/ttyACM0' in one terminal - run 'cat /def/ttyACM1' in another - Flash boards - All test results print their test name followed by a space and and integer error code Change-Id: If52e9b50705779b3a291e2d0f6b0721a5b6197d8 Reviewed-on: https://chromium-review.googlesource.com/359988 Commit-Ready: Chris Chen <twothreecc@google.com> Tested-by: Chris Chen <twothreecc@google.com> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cts: Disambiguate enum cts_error_codeDaisuke Nojiri2016-07-153-6/+6
| | | | | | | | | | | BUG=none BRANCH=none TEST=make -j buildall Change-Id: I8008fcf8ea5a429ec6c3bd2cc59fe86f43d87ada Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/360180 Reviewed-by: Chris Chen <twothreecc@google.com>
* cts: Use pointers for test functionsDaisuke Nojiri2016-07-152-0/+23
| | | | | | | | | | | | | | | | Test functions are listed in cts.testlist and shared by th.c and dut.c. This way, we can gurantee the two files are in sync. Also, cts.testlist is used to count the number of tests automatically. This allows us to use a for loop to execute each test. BUG=none BRANCH=none TEST=build buildall Change-Id: I0c811405134fad04f5c6914b1ac38835e212cbd2 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/359619
* cts: Added GPIO test suiteChris Chen2016-07-152-0/+2
| | | | | | | | | | | | | | | | | | | | | | | Contains code for all the gpio tests so far. Code in cts_task for th and dut is for testing purposes and test result reporting will be updated in the next patch. BRANCH=None BUG=None TEST=Manual - Connect handshake and gpio test lines between th and dut - Build tests - run 'cat /dev/ttyACM0' in one terminal - run 'cat /def/ttyACM1' in another - Flash boards - All test results should print either passed or unknown Change-Id: I7142fb87a6ce0a20c571cde608fbbe60e35898ea Reviewed-on: https://chromium-review.googlesource.com/359935 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* cts: Added sync() functionChris Chen2016-07-125-0/+118
sync() involves 2 gpios on each board, each labeled GPIO_HANDSHAKE_OUTPUT and GPIO_HANDSHAKE_INPUT on their respective boards. They both start low, then the th wiggles his line up and down, waiting for the dut to mimic it. BRANCH=None BUG=None TEST=manual - Connect handshake lines to appropriate pins on each board (pins found in board's gpio.inc) - Build tests - Flash boards - run 'cat /dev/ttyACM0' in one terminal - run 'cat /dev/ttyACM1' in another - They should each have printed 'successful sync' Change-Id: I61233bca9605ba89c3628c2a65ca9013c56365ea Reviewed-on: https://chromium-review.googlesource.com/359355 Commit-Ready: Chris Chen <twothreecc@google.com> Tested-by: Chris Chen <twothreecc@google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>