Browse Source

When doing make distcheck, a src/google/protobuf/compiler/ruby is created to
put built libraries. This directory hides the one that contains
ruby_generated_code.proto and ruby_generated_code.rb.

Bo Yang 10 years ago
parent
commit
83d334f713
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc

+ 3 - 3
src/google/protobuf/compiler/ruby/ruby_generator_unittest.cc

@@ -45,10 +45,10 @@ namespace compiler {
 namespace ruby {
 namespace ruby {
 namespace {
 namespace {
 
 
-string FindRubyTestDir() {
+string FindRubyTestDir(const string& file) {
   // Inspired by TestSourceDir() in src/google/protobuf/testing/googletest.cc.
   // Inspired by TestSourceDir() in src/google/protobuf/testing/googletest.cc.
   string prefix = ".";
   string prefix = ".";
-  while (!File::Exists(prefix + "/src/google/protobuf/compiler/ruby")) {
+  while (!File::Exists(prefix + "/src/google/protobuf/compiler/ruby" + file)) {
     if (!File::Exists(prefix)) {
     if (!File::Exists(prefix)) {
       GOOGLE_LOG(FATAL)
       GOOGLE_LOG(FATAL)
           << "Could not find Ruby test directory. Please run tests from "
           << "Could not find Ruby test directory. Please run tests from "
@@ -67,7 +67,7 @@ string FindRubyTestDir() {
 // extensions to the point where we can do this test in a more automated way.
 // extensions to the point where we can do this test in a more automated way.
 
 
 TEST(RubyGeneratorTest, GeneratorTest) {
 TEST(RubyGeneratorTest, GeneratorTest) {
-  string ruby_tests = FindRubyTestDir();
+  string ruby_tests = FindRubyTestDir("/ruby_generated_code.proto");
 
 
   google::protobuf::compiler::CommandLineInterface cli;
   google::protobuf::compiler::CommandLineInterface cli;
   cli.SetInputsAreProtoPathRelative(true);
   cli.SetInputsAreProtoPathRelative(true);