blob: d2a3f5f5a4983db58a4c44c1b993a23c3c3c15d4 [file] [log] [blame]
Amin Hassani23795032020-11-24 14:38:55 -08001//
2// Copyright (C) 2020 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8// http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17#include <gtest/gtest.h>
18
19#include "update_engine/payload_consumer/install_plan.h"
20
21namespace chromeos_update_engine {
22
23TEST(InstallPlanTest, Dump) {
Tomasz Wasilczyk95bc6fb2023-11-16 09:19:50 -080024 InstallPlan install_plan;
25 install_plan.download_url = "foo-download-url";
26 install_plan.version = "foo-version";
27 install_plan.payloads = {{
28 .payload_urls = {"url1", "url2"},
29 .metadata_signature = "foo-signature",
30 .hash = {0xb2, 0xb3},
31 .fp = "foo-fp",
32 .app_id = "foo-app-id",
33 }};
34 install_plan.source_slot = BootControlInterface::kInvalidSlot;
35 install_plan.target_slot = BootControlInterface::kInvalidSlot;
36 install_plan.partitions = {{
37 .name = "foo-partition_name",
38 .source_path = "foo-source-path",
39 .source_hash = {0xb1, 0xb2},
40 .target_path = "foo-target-path",
41 .readonly_target_path = "mountable-device",
42 .target_hash = {0xb3, 0xb4},
43 .postinstall_path = "foo-path",
44 .filesystem_type = "foo-type",
45 }};
Amin Hassani23795032020-11-24 14:38:55 -080046
47 EXPECT_EQ(install_plan.ToString(),
48 R"(type: new_update
49version: foo-version
50source_slot: INVALID
51target_slot: INVALID
52initial url: foo-download-url
53hash_checks_mandatory: false
54powerwash_required: false
55switch_slot_on_reboot: true
56run_post_install: true
Amin Hassani23795032020-11-24 14:38:55 -080057rollback_data_save_requested: false
58write_verity: true
59Partition: foo-partition_name
60 source_size: 0
61 source_path: foo-source-path
62 source_hash: B1B2
63 target_size: 0
64 target_path: foo-target-path
65 target_hash: B3B4
66 run_postinstall: false
67 postinstall_path: foo-path
Kelvin Zhanga9b5d8c2021-05-05 09:17:46 -040068 readonly_target_path: mountable-device
Amin Hassani23795032020-11-24 14:38:55 -080069 filesystem_type: foo-type
70Payload: 0
71 urls: (url1,url2)
72 size: 0
73 metadata_size: 0
74 metadata_signature: foo-signature
75 hash: B2B3
76 type: unknown
77 fingerprint: foo-fp
78 app_id: foo-app-id
79 already_applied: false)");
80}
81
82} // namespace chromeos_update_engine