aboutsummaryrefslogtreecommitdiffstats
path: root/util/flashrom_tester/src/tester.rs
Commit message (Collapse)AuthorAgeFilesLines
* flashrom_tester: Drop dediprog, ec, and servo targetsNikolai Artemiev2022-12-211-9/+0
| | | | | | | | | | | | | | | | | | | | | | | | | None of these targets have been maintained or used for several years: dediprog: - Wasn't accepted by the argument filter in main.rs. ec: - Is incompatible with most tests because the EC only supports one protection range. servo: - Has been broken for >3 years because it uses the programmer string "ft2231_spi:type=servo-v2", where "ft2231" should be "ft2232". BUG=b:239357853 BRANCH=none TEST=flashrom_tester on dedede Change-Id: Iee94f6bb5ff8c5451acb8bcaabf28119006d0ef5 Signed-off-by: Nikolai Artemiev <nartemiev@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69921 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* flashrom_tester: partial_lock: Use WriteProtectState cacheEvan Benn2022-11-241-0/+18
| | | | | | | | | | | | | | | | | | partial_lock test was bypassing the WriteProtectState cache of the software write protect by directly calling env.cmd.wp_range. It was also unnesesarily disabling software WP. Fix those issues and more clearly document what the test is doing and expecting. BUG=b:244663741 BRANCH=None TEST=flashrom_tester --libflashrom host Change-Id: Ic3f89ff5d22e74e4e6c94e755b936e58cb27182d Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69418 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* flashrom_tester: Log some cros lsb-release informationEvan Benn2022-11-241-0/+2
| | | | | | | | | | | | | | | os-release does not quite have as much information so use lsb-release. BUG=b:258289727 BRANCH=None TEST=flashrom_tester --libflashrom host Lock Change-Id: If3452ead9e02e0ddeaa0fdf4852d7c17a8ab7650 Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69403 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* flashrom_tester: Check the WP state when settingEvan Benn2022-11-241-9/+25
| | | | | | | | | | | | | | | | Check that the hardware and software WP state are as expected in the setter methods. BUG=b:244663741 BRANCH=None TEST=flashrom_tester --libflashrom host Change-Id: Ie7f90ab478dca6f92eaa0908443e3cb156ea0319 Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69402 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* flashrom_tester: Simplify WriteProtectStateEvan Benn2022-11-241-187/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the WriteProtectState 'stack' implementation and the push function. This functionality allowed states to be stacked and then automatically unrolled via RAII lifetimes. This was useful. However this unrolling could make errors in a flashrom_tester run much harder to understand, as the actual failure would be followed by multiple write protect calls that could subsequently fail, potentially causing panicing inside the panic handler and the process to be hard aborted and the restore golden image function would not be run. The new approach is to prefer code simplicity. Ideally this makes errors easier to diagnose from logs. To that end the lifetime has been simplified. The stack has been removed. The mutex has been removed. This means tests may not be running in the same environment they were previously. However if they continue to specify their requirements with set_sw and set_hw there will be no difference and the errors will be clear. BUG=b:259494812 BRANCH=None TEST=flashrom_tester --libflashrom host Change-Id: I1c4251f69b42a327383b8a99fa933f411feb9568 Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69401 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* flashrom_tester: Only print color when stdout isattyEvan Benn2022-11-171-4/+9
| | | | | | | | | | | | | | | | | Add the atty crate as a dependency. Print log and report in color only when isatty is true. BUG=b:246250254 BRANCH=None TEST=ssh dut flashrom_tester # no color TEST=ssh -t dut flashrom_tester # color Change-Id: Ia3cc527fb98e53eda6773622340cf10764df2cba Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69270 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* flashrom_tester: Use path types for things that are pathsEvan Benn2022-11-091-11/+10
| | | | | | | | | | | | | | | | Use Path and PathBuf for things that are paths. BUG=b:243460685 BRANCH=None TEST=/usr/bin/flashrom_tester --flashrom_binary /usr/sbin/flashrom host TEST=/usr/bin/flashrom_tester --libflashrom host Change-Id: I69531bec5436a60430eae975eeab02c8835962bf Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69064 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* flashrom_tester: Move layout_file to TestEnvEvan Benn2022-11-091-2/+33
| | | | | | | | | | | | | | | | | | layout_file is part of the test environment, move it from a global to a member of the TestEnv struct. This allows layout to be part of the tempdir in a subsequent patch. BUG=b:243460685 BRANCH=None TEST=/usr/bin/flashrom_tester --flashrom_binary /usr/sbin/flashrom host TEST=/usr/bin/flashrom_tester --libflashrom host Change-Id: Ia7e8efeb4fbac0a46627f079956d671aed43f1c7 Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/69063 Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
* flashrom_tester: Fix cargo check and clippy warningsEvan Benn2022-09-191-4/+4
| | | | | | | | | Change-Id: I50c5af61e06df1bb6956f347cb6806a7eca6ce0e Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/67472 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* flashrom_tester: Add _into_file to function namesEvan Benn2022-08-261-5/+7
| | | | | | | | | | | | | | | Rename Flashrom trait function names to reflect that the data is read to/from a file provided as an argument. BUG=None BRANCH=None TEST=cargo test; cargo check Change-Id: I0015c9bf64349a5512dbdb0ef6f3dad38aa2fd8e Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/66956 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* flashrom_tester: Refactor Error typeEvan Benn2022-07-211-12/+17
| | | | | | | | | | | | | | | | | Use a type implementing Error instead of a string for errors. Error implements Display so can be easily converted to a String. This will allow libflashrom to be more easily integrated. BUG=b:230545739 BRANCH=None TEST=cargo test Change-Id: Id166053c7edfd07576e7823692cfa0ea4d438948 Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/65277 Reviewed-by: Peter Marheine <pmarheine@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* flashrom_tester: Use Flashrom trait instead of struct FlashromCmdEvan Benn2022-07-211-24/+27
| | | | | | | | | | | | | | To allow FlashromCmd to be reimplemented with libflashrom move all concrete cmd functions into the FlashromCmd type that implements the Flashrom trait. This allows users to be generalised upon the Flashrom trait as the contract rather than the concrete FlashromCmd type. Change-Id: Ie2b4e7e91d69043fd50d1c57f6585fc9946fab10 Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/64849 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
* CHROMIUM: avl_tool: more gracefully handle termination by SIGINTPeter Marheine2021-02-111-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Since interrupting the test process may be dangerous (leaving the flash in an inconsistent state), we'll catch SIGINT and print a warning the first time, also using it as a signal that we should stop at a convenient time. Any following SIGINT will be handled as normal (killing the process). BUG=b:143251344 TEST=Run tool and verify it exits after a test with a single ^C, exits immediately given two. BRANCH=None Original-Cq-Depend: chromium:2059548 Original-Change-Id: Ib8a7799cba6dbca57dc7f1d3c87521f132c21818 Original-Signed-off-by: Peter Marheine <pmarheine@chromium.org> Original-Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/flashrom/+/2050050 Original-Tested-by: Edward O'Callaghan <quasisec@chromium.org> Original-Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Change-Id: If43aea0580fcc7e698daad2ffe085a3c9da5bc41 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/49915 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Angel Pons <th3fanbus@gmail.com>
* util/flashrom_tester: Upstream E2E testing frameworkEdward O'Callaghan2020-02-241-0/+636
The following is a E2E tester for a specific chip/chipset combo. The tester itself is completely self-contained and allows the user to specify which tests they wish to preform. Supported tests include: - chip-name - read - write - erase - wp-locking Change-Id: Ic2905a76cad90b1546b9328d668bf8abbf8aed44 Signed-off-by: Edward O'Callaghan <quasisec@google.com> Reviewed-on: https://review.coreboot.org/c/flashrom/+/38951 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: David Hendricks <david.hendricks@gmail.com>