@@ -23,9 +23,9 @@ class BusyboxInfoTest : public ::testing::Test {
23
23
explicit BusyboxInfoTest () {
24
24
const char * tmpdir = std::getenv (" TEST_TMPDIR" );
25
25
CARBON_CHECK (tmpdir);
26
- dir_ = MakeDir (
26
+ dir_ = MakeDir (std::filesystem::absolute (
27
27
std::filesystem::path (tmpdir) /
28
- ::testing::UnitTest::GetInstance ()->current_test_info()->name());
28
+ ::testing::UnitTest::GetInstance ()->current_test_info()->name())) ;
29
29
}
30
30
31
31
// Delete the test case's temp directory.
@@ -137,6 +137,20 @@ TEST_F(BusyboxInfoTest, RelativeSymlink) {
137
137
EXPECT_THAT (info->mode , Eq (" carbon" ));
138
138
}
139
139
140
+ TEST_F (BusyboxInfoTest, AbsoluteSymlink) {
141
+ MakeDir (dir_ / " lib" );
142
+ MakeDir (dir_ / " lib/carbon" );
143
+ auto busybox = MakeFile (dir_ / " lib/carbon/carbon-busybox" );
144
+ ASSERT_TRUE (busybox.is_absolute ());
145
+ MakeDir (dir_ / " bin" );
146
+ auto target = MakeSymlink (dir_ / " bin/carbon" , busybox);
147
+
148
+ auto info = GetBusyboxInfo (target.string ());
149
+ ASSERT_TRUE (info.ok ()) << info.error ();
150
+ EXPECT_THAT (info->bin_path , Eq (busybox));
151
+ EXPECT_THAT (info->mode , Eq (" carbon" ));
152
+ }
153
+
140
154
TEST_F (BusyboxInfoTest, NotBusyboxFile) {
141
155
auto target = MakeFile (dir_ / " file" );
142
156
0 commit comments