Attention is currently required from: Anastasia Klimchuk, Edward O'Callaghan, Evan Benn.
Hsuan-ting Chen has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/79304?usp=email )
Change subject: flashrom_tester: Fix partial_lock_test on libflashrom ......................................................................
Patch Set 4:
(1 comment)
File util/flashrom_tester/flashrom/src/cmd.rs:
https://review.coreboot.org/c/flashrom/+/79304/comment/96ba8561_f2faa87d : PS3, Line 301: // TODO From a syntax perspective:
In Rust, `pub trait Flashrom` is an interface that defines method signatures, such as `write_from_file()` and `wp_range()`.
We have two structs, `pub struct FlashromLib` (from `util/flashrom_tester/flashrom/src/flashromlib.rs`) and `pub struct FlashromCmd` (from `util/flashrom_tester/flashrom/src/cmd.rs`), that implement the `Flashrom` trait. This enables polymorphism.
To prevent runtime errors, both `FlashromLib` and `FlashromCmd` must implement the `fn set_flags()` method from the `Flashrom` trait.
---
From the `flashrom_tester`'s perspective:
flashrom_tester supports two execution scenarios: "cmd" and "lib".
lib: In this scenario, a `flashrom_lib` instance is created at the beginning of the test. Its constructor (link to constructor: [gerrit]( https://review.coreboot.org/c/flashrom/+/79304/4/util/flashrom_tester/src/te...)) should set default flags that will be used by all commands with `set_flags()`.
cmd: Methods are interpreted as sequences of flashrom commands. Each command resets flags to default values (link to cli_classic: [github](https://github.com/flashrom/flashrom/blob/main/cli_classic.c#L1226)). Therefore, no action is needed within set_flags().
---
I am not sure whether we get votes from Ed and Evan, maybe not, I will try to finish review by myself, so that's why I am having questions :)
Thanks! I am not deeply familiar with `flashrom_tester` or Rust either, but I'll try to answer all the further questions.