diff options
author | Jeffrey Yasskin <jyasskin@google.com> | 2009-09-25 21:07:20 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@google.com> | 2009-09-25 21:07:20 +0000 |
commit | 14a5cc54e58316fd514e6f6865575b65d8d088c3 (patch) | |
tree | bf923ac5b1556630b96aefd18797aff6840c21bf /llvm/unittests/Support | |
parent | f6a987b784800c04add49b0b50d8d383f8ed4c0b (diff) | |
download | bcm5719-llvm-14a5cc54e58316fd514e6f6865575b65d8d088c3.tar.gz bcm5719-llvm-14a5cc54e58316fd514e6f6865575b65d8d088c3.zip |
Fix a compile failure introduced by r82675 on MinGW which doesn't have
setenv(). This patch just disables the test rather than getting putenv() to
work. Thanks to Sandeep Patel for reporting the problem.
llvm-svn: 82797
Diffstat (limited to 'llvm/unittests/Support')
-rw-r--r-- | llvm/unittests/Support/CommandLineTest.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp index 70d6950f8b0..72fa24a5ac0 100644 --- a/llvm/unittests/Support/CommandLineTest.cpp +++ b/llvm/unittests/Support/CommandLineTest.cpp @@ -8,6 +8,7 @@ //===----------------------------------------------------------------------===// #include "llvm/Support/CommandLine.h" +#include "llvm/Config/config.h" #include "gtest/gtest.h" @@ -24,17 +25,26 @@ class TempEnvVar { : name(name) { const char *old_value = getenv(name); EXPECT_EQ(NULL, old_value) << old_value; +#if HAVE_SETENV setenv(name, value, true); +#else +# define SKIP_ENVIRONMENT_TESTS +#endif } ~TempEnvVar() { +#if HAVE_SETENV + // Assume setenv and unsetenv come together. unsetenv(name); +#endif } private: const char *const name; }; +#ifndef SKIP_ENVIRONMENT_TESTS + const char test_env_var[] = "LLVM_TEST_COMMAND_LINE_FLAGS"; cl::opt<std::string> EnvironmentTestOption("env-test-opt"); @@ -45,4 +55,6 @@ TEST(CommandLineTest, ParseEnvironment) { EXPECT_EQ("hello", EnvironmentTestOption); } +#endif // SKIP_ENVIRONMENT_TESTS + } // anonymous namespace |