summaryrefslogtreecommitdiff
path: root/unittests
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
commit8932fe4d2b9d06e6bef261198e694b1263603636 (patch)
tree494d385060c379d050b12c7d8d79e7aac388fe90 /unittests
parent88fc697b7c86ec7ff4305220b1c9cd600c45bd00 (diff)
downloadllvm-8932fe4d2b9d06e6bef261198e694b1263603636.tar.gz
llvm-8932fe4d2b9d06e6bef261198e694b1263603636.tar.bz2
llvm-8932fe4d2b9d06e6bef261198e694b1263603636.tar.xz
Added test for non-static use of cl::opt (fixed in r160170)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161751 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Support/CommandLineTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/unittests/Support/CommandLineTest.cpp b/unittests/Support/CommandLineTest.cpp
index 72fa24a5ac..13e903858a 100644
--- a/unittests/Support/CommandLineTest.cpp
+++ b/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