diff options
author | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2009-12-19 04:50:00 +0000 |
---|---|---|
committer | kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d> | 2009-12-19 04:50:00 +0000 |
commit | 684d45b2feac114a0152cf4458846fbeca61b5d9 (patch) | |
tree | 781a604308f2866d6b321d6cfbe238c2732cc469 /src/google/protobuf/compiler/command_line_interface_unittest.cc | |
parent | bdbb863099c7ef3e1ecdeefa732798e095b85fb8 (diff) | |
download | protobuf-684d45b2feac114a0152cf4458846fbeca61b5d9.tar.gz protobuf-684d45b2feac114a0152cf4458846fbeca61b5d9.tar.bz2 protobuf-684d45b2feac114a0152cf4458846fbeca61b5d9.zip |
Fix build on MinGW/Win32 (including implementing Subprocess using CreateProcess()).
Diffstat (limited to 'src/google/protobuf/compiler/command_line_interface_unittest.cc')
-rw-r--r-- | src/google/protobuf/compiler/command_line_interface_unittest.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/google/protobuf/compiler/command_line_interface_unittest.cc b/src/google/protobuf/compiler/command_line_interface_unittest.cc index b43f781c..abe58af0 100644 --- a/src/google/protobuf/compiler/command_line_interface_unittest.cc +++ b/src/google/protobuf/compiler/command_line_interface_unittest.cc @@ -248,7 +248,11 @@ void CommandLineInterfaceTest::Run(const string& command) { if (!disallow_plugins_) { cli_.AllowPlugins("prefix-"); +#ifdef _WIN32 + args.push_back("--plugin=prefix-gen-plug=test_plugin.exe"); +#else args.push_back("--plugin=prefix-gen-plug=test_plugin"); +#endif } scoped_array<const char*> argv(new const char*[args.size()]); @@ -1026,9 +1030,16 @@ TEST_F(CommandLineInterfaceTest, GeneratorPluginCrash) { ExpectErrorSubstring("Saw message type MockCodeGenerator_Abort."); +#ifdef _WIN32 + // Windows doesn't have signals. It looks like abort()ing causes the process + // to exit with status code 3, but let's not depend on the exact number here. + ExpectErrorSubstring( + "--plug_out: prefix-gen-plug: Plugin failed with status code"); +#else // Don't depend on the exact signal number. ExpectErrorSubstring( "--plug_out: prefix-gen-plug: Plugin killed by signal"); +#endif } TEST_F(CommandLineInterfaceTest, GeneratorPluginNotFound) { @@ -1042,11 +1053,19 @@ TEST_F(CommandLineInterfaceTest, GeneratorPluginNotFound) { "--plugin=prefix-gen-badplug=no_such_file " "--proto_path=$tmpdir error.proto"); +#ifdef _WIN32 + ExpectErrorSubstring( + "--badplug_out: prefix-gen-badplug: The system cannot find the file " + "specified."); +#else + // Error written to stdout by child process after exec() fails. ExpectErrorSubstring( "no_such_file: program not found or is not executable"); + // Error written by parent process when child fails. ExpectErrorSubstring( "--badplug_out: prefix-gen-badplug: Plugin failed with status code 1."); +#endif } TEST_F(CommandLineInterfaceTest, GeneratorPluginNotAllowed) { |