Skip to content

Commit

Permalink
Make compiler tests more robust and enable in xplat
Browse files Browse the repository at this point in the history
Differential Revision: D70565415

fbshipit-source-id: 62e904e49d1863346ca529ee8ff80cb0b25e33a7
  • Loading branch information
vitaut authored and facebook-github-bot committed Mar 4, 2025
1 parent b4bb333 commit fd7d527
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions third-party/thrift/src/thrift/compiler/test/compiler_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,6 @@
using apache::thrift::compiler::test::check_compile;
using apache::thrift::compiler::test::check_compile_options;

namespace {

// Change the current directory to a subdirectory to avoid relative annotations
// being found via relative includes. The exact directory doesn't matter so
// pick "thrift" since we know it exists.
void disable_relative_includes() {
std::filesystem::current_path("thrift");
}

} // namespace

// Note: To see a reference on the expected lint message format: see the regex
// in thrift/compiler/test/compiler.cc
TEST(CompilerTest, diagnostic_in_last_line) {
Expand Down Expand Up @@ -2220,7 +2209,11 @@ TEST(CompilerTest, duplicate_include) {
TEST(CompilerTest, not_bundled_annotation) {
auto options = check_compile_options();
options.add_standard_includes = false;
disable_relative_includes();

// Change the current directory to a temp directory to avoid annotations
// being found via relative includes.
std::filesystem::current_path(std::filesystem::temp_directory_path());

check_compile(
R"(
include "thrift/annotation/baz.thrift"
Expand Down

0 comments on commit fd7d527

Please sign in to comment.