aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/CommandLineTest.cpp
diff options
context:
space:
mode:
authorAlexander Kornienko <alexfh@google.com>2012-08-13 10:43:36 +0000
committerAlexander Kornienko <alexfh@google.com>2012-08-13 10:43:36 +0000
commit8c724a758b176fd1d1cb12c59e6492ef554bf115 (patch)
tree9f9342d81c0d1d58d30be97dc824db2d161aca35 /llvm/unittests/Support/CommandLineTest.cpp
parentb4abb84d9c1d5e495c5990edc07efbae2807785b (diff)
downloadllvm-8c724a758b176fd1d1cb12c59e6492ef554bf115.zip
llvm-8c724a758b176fd1d1cb12c59e6492ef554bf115.tar.gz
llvm-8c724a758b176fd1d1cb12c59e6492ef554bf115.tar.bz2
Added test for non-static use of cl::opt (fixed in r160170)
llvm-svn: 161751
Diffstat (limited to 'llvm/unittests/Support/CommandLineTest.cpp')
-rw-r--r--llvm/unittests/Support/CommandLineTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp
index 72fa24a..13e9038 100644
--- a/llvm/unittests/Support/CommandLineTest.cpp
+++ b/llvm/unittests/Support/CommandLineTest.cpp
@@ -55,6 +55,17 @@ TEST(CommandLineTest, ParseEnvironment) {
EXPECT_EQ("hello", EnvironmentTestOption);
}
+// This test used to make valgrind complain
+// ("Conditional jump or move depends on uninitialised value(s)")
+TEST(CommandLineTest, ParseEnvironmentToLocalVar) {
+ // Put cl::opt on stack to check for proper initialization of fields.
+ cl::opt<std::string> EnvironmentTestOptionLocal("env-test-opt-local");
+ TempEnvVar TEV(test_env_var, "-env-test-opt-local=hello-local");
+ EXPECT_EQ("", EnvironmentTestOptionLocal);
+ cl::ParseEnvironmentOptions("CommandLineTest", test_env_var);
+ EXPECT_EQ("hello-local", EnvironmentTestOptionLocal);
+}
+
#endif // SKIP_ENVIRONMENT_TESTS
} // anonymous namespace