apolyakov created this revision.
apolyakov added reviewers: aprantl, clayborg, jingham, labath.
Herald added a subscriber: ki.stfu.

In this patch I move some of interpreter tests from python to LIT(I will move 
all interpreter test if these are OK). It's a WIP since I want to get your 
opinion about tests like target-list.test. As you may see, in this test we must 
run lldb-mi without passing an executable, it means that we can't pass it to 
lldb-mi through LIT. As a solution, I hardcoded executable name as a.exe. What 
do you think about this approach? We already have one test with hardcoded 
executable name - lit/tools/lldb-mi/breakpoint/break-insert.test, but I want to 
be sure that it's OK.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D50525

Files:
  lit/tools/lldb-mi/interpreter/cli-support/breakpoint-set.test
  lit/tools/lldb-mi/interpreter/cli-support/inputs/main.cpp
  lit/tools/lldb-mi/interpreter/cli-support/lit.local.cfg
  lit/tools/lldb-mi/interpreter/cli-support/settings-set-target-run-after.test
  lit/tools/lldb-mi/interpreter/cli-support/settings-set-target-run-before.test
  lit/tools/lldb-mi/interpreter/cli-support/target-create.test
  lit/tools/lldb-mi/interpreter/cli-support/target-list.test

Index: lit/tools/lldb-mi/interpreter/cli-support/target-list.test
===================================================================
--- /dev/null
+++ lit/tools/lldb-mi/interpreter/cli-support/target-list.test
@@ -0,0 +1,20 @@
+# XFAIL: windows
+# -> llvm.org/pr24452
+#
+# We should hardcode executable name since at the moment of running of
+# lldb-mi the name must be known.
+# RUN: %cxx -o a.exe %p/inputs/main.cpp -g
+# RUN: %lldbmi < %s | FileCheck %s
+
+# Test lldb-mi CLI support. 'target list' command.
+
+target list
+# CHECK: ~"No targets.\n"
+
+-file-exec-and-symbols a.exe
+# CHECK: ^done
+
+target list
+# CHECK: ~"Current targets:\n* target #0: {{.*}}a.exe{{.*}}\n"
+
+-gdb-exit
Index: lit/tools/lldb-mi/interpreter/cli-support/target-create.test
===================================================================
--- /dev/null
+++ lit/tools/lldb-mi/interpreter/cli-support/target-create.test
@@ -0,0 +1,21 @@
+# XFAIL: windows
+# -> llvm.org/pr24452
+#
+# We should hardcode executable name since at the moment of running of
+# lldb-mi the name must be known.
+# RUN: %cxx -o a.exe %p/inputs/main.cpp -g
+# RUN: %lldbmi < %s | FileCheck %s
+
+# Test lldb-mi CLI support. 'target create' command.
+
+target create a.exe
+# CHECK: ^done
+
+-break-insert -f main
+# CHECK: ^done,bkpt={number="1"
+
+-exec-run
+# CHECK: ^running
+# CHECK: *stopped,reason="breakpoint-hit"
+
+-gdb-exit
Index: lit/tools/lldb-mi/interpreter/cli-support/settings-set-target-run-before.test
===================================================================
--- /dev/null
+++ lit/tools/lldb-mi/interpreter/cli-support/settings-set-target-run-before.test
@@ -0,0 +1,23 @@
+# XFAIL: windows
+# -> llvm.org/pr24452
+#
+# We should hardcode executable name since at the moment of running of
+# lldb-mi the name must be known.
+# RUN: %cxx -o a.exe %p/inputs/main.cpp -g
+# RUN: %lldbmi < %s | FileCheck %s
+
+# Test lldb-mi CLI support. 'setting set target.run-args' command before than
+# target was created.
+
+# FIXME: --arg1 causes an error.
+setting set target.run-args arg1 "2nd arg" third_arg fourth="4th arg"
+# CHECK: ^done
+
+-file-exec-and-symbols a.exe
+# CHECK: ^done
+
+-exec-run
+# CHECK: ^running
+# CHECK: @"argc=5\r\n"
+
+-gdb-exit
Index: lit/tools/lldb-mi/interpreter/cli-support/settings-set-target-run-after.test
===================================================================
--- /dev/null
+++ lit/tools/lldb-mi/interpreter/cli-support/settings-set-target-run-after.test
@@ -0,0 +1,21 @@
+# XFAIL: windows
+# -> llvm.org/pr24452
+#
+# RUN: %cxx -o %t %p/inputs/main.cpp -g
+# RUN: %lldbmi %t < %s | FileCheck %s
+
+# Test lldb-mi CLI support. 'setting set target.run-args' command after than
+# target was created.
+
+# Check that we have a valid target created via '%lldbmi %t'.
+# CHECK: ^done
+
+# FIXME: --arg1 causes an error.
+setting set target.run-args arg1 "2nd arg" third_arg fourth="4th arg"
+# CHECK: ^done
+
+-exec-run
+# CHECK: ^running
+# CHECK: @"argc=5\r\n"
+
+-gdb-exit
Index: lit/tools/lldb-mi/interpreter/cli-support/lit.local.cfg
===================================================================
--- /dev/null
+++ lit/tools/lldb-mi/interpreter/cli-support/lit.local.cfg
@@ -0,0 +1 @@
+config.suffixes = ['.test']
Index: lit/tools/lldb-mi/interpreter/cli-support/inputs/main.cpp
===================================================================
--- /dev/null
+++ lit/tools/lldb-mi/interpreter/cli-support/inputs/main.cpp
@@ -0,0 +1,19 @@
+//===-- 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 <cstdio>
+
+int
+main(int argc, char const *argv[])
+{
+    printf("argc=%d\n", argc);
+    for (int i = 0; i < argc; ++i)
+        printf("argv[%d]=%s\n", i, argv[i]);
+    return 0;
+}
Index: lit/tools/lldb-mi/interpreter/cli-support/breakpoint-set.test
===================================================================
--- /dev/null
+++ lit/tools/lldb-mi/interpreter/cli-support/breakpoint-set.test
@@ -0,0 +1,21 @@
+# XFAIL: windows
+# -> llvm.org/pr24452
+#
+# RUN: %cxx -o %t %p/inputs/main.cpp -g
+# RUN: %lldbmi %t < %s | FileCheck %s
+
+# Test lldb-mi CLI support. 'breakpoint set' command.
+
+# Check that we have a valid target created via '%lldbmi %t'.
+# CHECK: ^done
+
+breakpoint set --name main
+# CHECK: ^done
+# CHECK: =breakpoint-created,bkpt={number="1"
+
+-exec-run
+# CHECK: ^running
+# CHECK: =breakpoint-modified,bkpt={number="1"
+# CHECK: *stopped,reason="breakpoint-hit"
+
+-gdb-exit
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to