Added two test cases to TestSettings.py which exercise the lldb's:
(lldb) settings set process.run-args A B C
(lldb) settings set process.env-vars ["MY_ENV_VAR"]=YES
commands. The main.cpp checks whether A, B, C is passed to main and whether
the $MY_ENV_VAR env variable is defined and outputs the findings to a file.
llvm-svn: 114031
diff --git a/lldb/test/settings/main.cpp b/lldb/test/settings/main.cpp
new file mode 100644
index 0000000..b2acd64
--- /dev/null
+++ b/lldb/test/settings/main.cpp
@@ -0,0 +1,44 @@
+//===-- main.cpp ------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstdlib>
+#include <string>
+#include <fstream>
+
+int
+main(int argc, char const *argv[])
+{
+ char const *cptr = NULL;
+ // The program writes its output to the "output.txt" file.
+ std::ofstream outfile("output.txt");
+
+ for (unsigned i = 0, e = sizeof(argv); i < e; ++i) {
+ if ((cptr = argv[i]) == NULL)
+ break;
+
+ std::string str(cptr);
+ if (i == 1 && "A" == str)
+ outfile << "argv[1] matches\n";
+
+ if (i == 2 && "B" == str)
+ outfile << "argv[2] matches\n";
+
+ if (i == 3 && "C" == str)
+ outfile << "argv[3] matches\n";
+ }
+
+ if (::getenv("MY_ENV_VAR")) {
+ std::string MY_ENV_VAR(getenv("MY_ENV_VAR"));
+ if ("YES" == MY_ENV_VAR) {
+ outfile << "Environment variable 'MY_ENV_VAR' successfully passed.\n";
+ }
+ }
+
+ return 0;
+}