Hardik Goyal | b09d6b0 | 2019-08-13 16:15:50 -0700 | [diff] [blame] | 1 | // Copyright 2019 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "debugd/src/helper_utils.h" |
| 6 | |
Simon Glass | b51cc13 | 2020-06-10 12:30:53 -0600 | [diff] [blame] | 7 | #include <limits.h> |
| 8 | |
Hardik Goyal | b09d6b0 | 2019-08-13 16:15:50 -0700 | [diff] [blame] | 9 | #include <gtest/gtest.h> |
| 10 | |
| 11 | namespace debugd { |
| 12 | |
| 13 | TEST(SandboxedProcessTest, GetHelperPath) { |
| 14 | std::string full_path; |
| 15 | |
| 16 | EXPECT_TRUE(GetHelperPath("", &full_path)); |
| 17 | EXPECT_EQ("/usr/libexec/debugd/helpers/", full_path); |
| 18 | |
| 19 | EXPECT_TRUE(GetHelperPath("test/me", &full_path)); |
| 20 | EXPECT_EQ("/usr/libexec/debugd/helpers/test/me", full_path); |
Simon Glass | b51cc13 | 2020-06-10 12:30:53 -0600 | [diff] [blame] | 21 | |
| 22 | std::string str(PATH_MAX, 'x'); |
| 23 | EXPECT_FALSE(GetHelperPath(str, &full_path)); |
Hardik Goyal | b09d6b0 | 2019-08-13 16:15:50 -0700 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | } // namespace debugd |