This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Prevent tests from failing when /tmp/compile_flags.txt exists
AcceptedPublic

Authored by adamcz on Jan 8 2021, 10:16 AM.

Details

Reviewers
hokein
Summary

The BuildDir test uses RealFS and would fail when /tmp/compile_flags.txt
or /tmp/compile_commands.json would exist, since it would read it for
files not covered by the CDB it creates and then fail an IsEmpty() test.

With this change, we create a compile_flags.txt file simply to prevent
CDB from looking for it in parent directory.

Long-term, all CDB implementations should use VFS and the test should
use MemoryFS instead, and be fully hermetic, but for now this will do.

Fixes https://github.com/clangd/clangd/issues/354

Diff Detail

Event Timeline

adamcz created this revision.Jan 8 2021, 10:16 AM
adamcz requested review of this revision.Jan 8 2021, 10:16 AM
hokein accepted this revision.Jan 8 2021, 11:45 AM

Thanks, this looks like a reasonable workaround.

This revision is now accepted and ready to land.Jan 8 2021, 11:45 AM