OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 #include <glib.h> | 7 #include <glib.h> |
8 #include <pthread.h> | 8 #include <pthread.h> |
9 #include <gtest/gtest.h> | 9 #include <gtest/gtest.h> |
10 #include "update_engine/download_action.h" | 10 #include "update_engine/download_action.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 BondActions(&update_check_action, &response_handler_action); | 126 BondActions(&update_check_action, &response_handler_action); |
127 BondActions(&response_handler_action, &download_action); | 127 BondActions(&response_handler_action, &download_action); |
128 BondActions(&download_action, &install_action); | 128 BondActions(&download_action, &install_action); |
129 BondActions(&install_action, &postinstall_runner_action); | 129 BondActions(&install_action, &postinstall_runner_action); |
130 BondActions(&postinstall_runner_action, &set_bootable_flag_action); | 130 BondActions(&postinstall_runner_action, &set_bootable_flag_action); |
131 | 131 |
132 // Set up filesystem to trick some of the actions | 132 // Set up filesystem to trick some of the actions |
133 ASSERT_EQ(0, System(string("rm -rf ") + kTestDir)); | 133 ASSERT_EQ(0, System(string("rm -rf ") + kTestDir)); |
134 ASSERT_EQ(0, system("rm -f /tmp/update_engine_test_postinst_out.txt")); | 134 ASSERT_EQ(0, system("rm -f /tmp/update_engine_test_postinst_out.txt")); |
135 ASSERT_EQ(0, System(string("mkdir -p ") + kTestDir + "/etc")); | 135 ASSERT_EQ(0, System(string("mkdir -p ") + kTestDir + "/etc")); |
| 136 ASSERT_EQ(0, system((string("mkdir -p ") + kTestDir + |
| 137 utils::kStatefulPartition + |
| 138 "/etc").c_str())); |
136 ASSERT_TRUE(WriteFileString(string(kTestDir) + "/etc/lsb-release", | 139 ASSERT_TRUE(WriteFileString(string(kTestDir) + "/etc/lsb-release", |
137 "GOOGLE_RELEASE=0.2.0.0\n" | 140 "GOOGLE_RELEASE=0.2.0.0\n" |
138 "GOOGLE_TRACK=unittest-track")); | 141 "GOOGLE_TRACK=unittest-track")); |
139 ASSERT_EQ(0, System(string("touch ") + kTestDir + "/dev1")); | 142 ASSERT_EQ(0, System(string("touch ") + kTestDir + "/dev1")); |
140 ASSERT_EQ(0, System(string("touch ") + kTestDir + "/dev2")); | 143 ASSERT_EQ(0, System(string("touch ") + kTestDir + "/dev2")); |
141 ASSERT_TRUE(WriteFileVector(string(kTestDir) + "/dev", GenerateSampleMbr())); | 144 ASSERT_TRUE(WriteFileVector(string(kTestDir) + "/dev", GenerateSampleMbr())); |
142 | 145 |
143 request_prep_action.set_root(kTestDir); | 146 request_prep_action.set_root(kTestDir); |
144 response_handler_action.set_boot_device(string(kTestDir) + "/dev1"); | 147 response_handler_action.set_boot_device(string(kTestDir) + "/dev1"); |
145 | 148 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 "/tmp/update_engine_test_postinst_out.txt", | 183 "/tmp/update_engine_test_postinst_out.txt", |
181 &file_data)); | 184 &file_data)); |
182 EXPECT_EQ("POSTINST_DONE\n", file_data); | 185 EXPECT_EQ("POSTINST_DONE\n", file_data); |
183 | 186 |
184 // cleanup | 187 // cleanup |
185 ASSERT_EQ(0, System(string("rm -rf ") + kTestDir)); | 188 ASSERT_EQ(0, System(string("rm -rf ") + kTestDir)); |
186 ASSERT_EQ(0, system("rm -f /tmp/update_engine_test_postinst_out.txt")); | 189 ASSERT_EQ(0, system("rm -f /tmp/update_engine_test_postinst_out.txt")); |
187 } | 190 } |
188 | 191 |
189 } // namespace chromeos_update_engine | 192 } // namespace chromeos_update_engine |
OLD | NEW |