Add a feature to get the last UpdateAttempt ErrorCode from update_engine
For autotest, update_engine test failures are always hard to debug,
since the error message is not clear. Add a new flag 'last_attempt_error'
to get the last UpdateAttempt ErrorCode from update_engine.
Bug:25598547
Test:emerge-peppy update_engine
emerge-peppy update_engine_client
cros flash a test image to DUT.
(on the DUT):update_engine_client --last_attempt_error
Compare the results with the update_engine logs, matched.
Change-Id: Id12681097ed30b0826cad68809f17f934a07e5b2
diff --git a/payload_state.h b/payload_state.h
index bec5823..46711b6 100644
--- a/payload_state.h
+++ b/payload_state.h
@@ -147,6 +147,10 @@
return p2p_url_;
}
+ inline ErrorCode GetAttemptErrorCode() const override {
+ return attempt_error_code_;
+ }
+
private:
enum class AttemptType {
kUpdate,
@@ -559,6 +563,9 @@
// The connection type when the attempt started.
metrics::ConnectionType attempt_connection_type_;
+ // The attempt error code when the attempt finished.
+ ErrorCode attempt_error_code_;
+
// Whether we're currently rolling back.
AttemptType attempt_type_;