Skip to content

Commit e2f118d

Browse files
authored
Write file to tmp directory (#141668)
This makes the test more portable. In google, the test was failing because a test cannot write to its own directory in a sandbox.
1 parent 90232cb commit e2f118d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

llvm/unittests/Object/OffloadingBundleTest.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,11 @@ TEST(OffloadingBundleTest, checkExtractCodeObject) {
7474
int64_t Offset = 8192;
7575
int64_t Size = 4048;
7676

77-
Error Err = extractCodeObject(**ObjOrErr, Offset, Size,
78-
StringRef("checkExtractCodeObject.co"));
77+
llvm::unittest::TempDir Tmp("tmpdir", /*Unique=*/true);
78+
SmallString<128> FileName(Tmp.path().begin(), Tmp.path().end());
79+
sys::path::append(FileName, "checkExtractCodeObject.co");
80+
81+
Error Err = extractCodeObject(**ObjOrErr, Offset, Size, StringRef(FileName));
7982
EXPECT_FALSE(errorToBool(std::move(Err)));
8083
}
8184

0 commit comments

Comments
 (0)