aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/functionalities/darwin_log/basic/main.c')
-rw-r--r--packages/Python/lldbsuite/test/functionalities/darwin_log/basic/main.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/main.c b/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/main.c
new file mode 100644
index 000000000000..e6554564411f
--- /dev/null
+++ b/packages/Python/lldbsuite/test/functionalities/darwin_log/basic/main.c
@@ -0,0 +1,32 @@
+//===-- main.c --------------------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include <os/log.h>
+#include <stdio.h>
+
+#include "../common/darwin_log_common.h"
+
+int main(int argc, char** argv)
+{
+ os_log_t logger = os_log_create("org.llvm.lldb.test", "basic-test");
+ if (!logger)
+ return 1;
+
+ // Note we cannot use the os_log() line as the breakpoint because, as of
+ // the initial writing of this test, we get multiple breakpoints for that
+ // line, which confuses the pexpect test logic.
+ printf("About to log\n"); // break here
+ os_log(logger, "Hello, world");
+
+ // Sleep, as the darwin log reporting doesn't always happen until a bit
+ // later. We need the message to come out before the process terminates.
+ sleep(FINAL_WAIT_SECONDS);
+
+ return 0;
+}