| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium 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 <sys/stat.h> | 5 #include <sys/stat.h> |
| 6 #include <sys/types.h> | 6 #include <sys/types.h> |
| 7 #include <unistd.h> | 7 #include <unistd.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include <gtest/gtest.h> | 10 #include <gtest/gtest.h> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 TEST_F(PostinstallRunnerActionTest, RunAsRootErrScriptTest) { | 50 TEST_F(PostinstallRunnerActionTest, RunAsRootErrScriptTest) { |
| 51 ASSERT_EQ(0, getuid()); | 51 ASSERT_EQ(0, getuid()); |
| 52 DoTest(true, true); | 52 DoTest(true, true); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void PostinstallRunnerActionTest::DoTest(bool do_losetup, bool do_err_script) { | 55 void PostinstallRunnerActionTest::DoTest(bool do_losetup, bool do_err_script) { |
| 56 ASSERT_EQ(0, getuid()) << "Run me as root. Ideally don't run other tests " | 56 ASSERT_EQ(0, getuid()) << "Run me as root. Ideally don't run other tests " |
| 57 << "as root, tho."; | 57 << "as root, tho."; |
| 58 | 58 |
| 59 const string mountpoint(utils::kStatefulPartition + "/au_destination"); | 59 const string mountpoint(string(utils::kStatefulPartition) + |
| 60 "/au_destination"); |
| 60 | 61 |
| 61 string cwd; | 62 string cwd; |
| 62 { | 63 { |
| 63 vector<char> buf(1000); | 64 vector<char> buf(1000); |
| 64 ASSERT_EQ(&buf[0], getcwd(&buf[0], buf.size())); | 65 ASSERT_EQ(&buf[0], getcwd(&buf[0], buf.size())); |
| 65 cwd = string(&buf[0], strlen(&buf[0])); | 66 cwd = string(&buf[0], strlen(&buf[0])); |
| 66 } | 67 } |
| 67 | 68 |
| 68 // create the au destination, if it doesn't exist | 69 // create the au destination, if it doesn't exist |
| 69 ASSERT_EQ(0, System(string("mkdir -p ") + mountpoint)); | 70 ASSERT_EQ(0, System(string("mkdir -p ") + mountpoint)); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 | 147 |
| 147 // Death tests don't seem to be working on Hardy | 148 // Death tests don't seem to be working on Hardy |
| 148 TEST_F(PostinstallRunnerActionTest, DISABLED_RunAsRootDeathTest) { | 149 TEST_F(PostinstallRunnerActionTest, DISABLED_RunAsRootDeathTest) { |
| 149 ASSERT_EQ(0, getuid()); | 150 ASSERT_EQ(0, getuid()); |
| 150 PostinstallRunnerAction runner_action; | 151 PostinstallRunnerAction runner_action; |
| 151 ASSERT_DEATH({ runner_action.TerminateProcessing(); }, | 152 ASSERT_DEATH({ runner_action.TerminateProcessing(); }, |
| 152 "postinstall_runner_action.h:.*] Check failed"); | 153 "postinstall_runner_action.h:.*] Check failed"); |
| 153 } | 154 } |
| 154 | 155 |
| 155 } // namespace chromeos_update_engine | 156 } // namespace chromeos_update_engine |
| OLD | NEW |