Skip to content

[lldb][test] Fix ComputeClangResourceDirectory test when CLANG_RESOURCE_DIR is set #98464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion lldb/unittests/Expression/ClangParserTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,17 @@ TEST_F(ClangHostTest, ComputeClangResourceDirectory) {
#endif
std::string path_to_clang_dir = clang::driver::Driver::GetResourcesPath(
path_to_liblldb + "liblldb", CLANG_RESOURCE_DIR);
EXPECT_EQ(ComputeClangResourceDir(path_to_liblldb), path_to_clang_dir);
llvm::SmallString<256> path_to_clang_lib_dir_real;
llvm::sys::fs::real_path(path_to_clang_dir, path_to_clang_lib_dir_real);

std::string computed_path = ComputeClangResourceDir(path_to_liblldb);
llvm::SmallString<256> computed_path_real;
llvm::sys::fs::real_path(computed_path, computed_path_real);

// When CLANG_RESOURCE_DIR is set, both the functions we use here behave in
// such a way that leads to one path being lib/ and the other bin/. Check that
// they are equivalent after any ".." have been resolved.
EXPECT_EQ(path_to_clang_lib_dir_real, computed_path_real);

// The path doesn't really exist, so setting verify to true should make
// ComputeClangResourceDir not give you path_to_clang_dir.
Expand Down
Loading