summaryrefslogtreecommitdiffstats
path: root/lldb/lit/ExecControl/StopHook/Inputs
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-10-09 16:38:47 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-10-09 16:38:47 +0000
commit22314179f0660c172514b397060fd8f34b586e82 (patch)
treeafb3f04cd285733772ffceec4ccf3d8539dca91c /lldb/lit/ExecControl/StopHook/Inputs
parentdf14bd315db94d286c0c75b4b6ee5d760f311399 (diff)
downloadbcm5719-llvm-22314179f0660c172514b397060fd8f34b586e82.tar.gz
bcm5719-llvm-22314179f0660c172514b397060fd8f34b586e82.zip
[test] Split LLDB tests into API, Shell & Unit
LLDB has three major testing strategies: unit tests, tests that exercise the SB API though dotest.py and what we currently call lit tests. The later is rather confusing as we're now using lit as the driver for all three types of tests. As most of this grew organically, the directory structure in the LLDB repository doesn't really make this clear. The 'lit' tests are part of the root and among these tests there's a Unit and Suite folder for the unit and dotest-tests. This layout makes it impossible to run just the lit tests. This patch changes the directory layout to match the 3 testing strategies, each with their own directory and their own configuration file. This means there are now 3 directories under lit with 3 corresponding targets: - API (check-lldb-api): Test exercising the SB API. - Shell (check-lldb-shell): Test exercising command line utilities. - Unit (check-lldb-unit): Unit tests. Finally, there's still the `check-lldb` target that runs all three test suites. Finally, this also renames the lit folder to `test` to match the LLVM repository layout. Differential revision: https://reviews.llvm.org/D68606 llvm-svn: 374184
Diffstat (limited to 'lldb/lit/ExecControl/StopHook/Inputs')
-rw-r--r--lldb/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit1
-rw-r--r--lldb/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit1
-rw-r--r--lldb/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit3
-rw-r--r--lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit7
-rw-r--r--lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit5
-rw-r--r--lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp79
-rw-r--r--lldb/lit/ExecControl/StopHook/Inputs/stop-hook.c53
7 files changed, 0 insertions, 149 deletions
diff --git a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit
deleted file mode 100644
index 4ab5d56f036..00000000000
--- a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-1.lldbinit
+++ /dev/null
@@ -1 +0,0 @@
-target stop-hook add -n b -o "expr ptr"
diff --git a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit
deleted file mode 100644
index 31817bdaaa5..00000000000
--- a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-2.lldbinit
+++ /dev/null
@@ -1 +0,0 @@
-target stop-hook add -f stop-hook.c -l 29 -e 34 -o "expr ptr"
diff --git a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit
deleted file mode 100644
index 36e144deecc..00000000000
--- a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-3.lldbinit
+++ /dev/null
@@ -1,3 +0,0 @@
-target stop-hook add -f stop-hook.c -l 29 -e 34
-expr ptr
-DONE
diff --git a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit
deleted file mode 100644
index 004bd34abfb..00000000000
--- a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-1.lldbinit
+++ /dev/null
@@ -1,7 +0,0 @@
-break set -f stop-hook-threads.cpp -p "Break here to set up the stop hook"
-break set -f stop-hook-threads.cpp -p "Break here to test that the stop-hook"
-run
-target stop-hook add -G true
-expr lldb_val += 1
-thread list
-DONE
diff --git a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit
deleted file mode 100644
index 3b7d23953c3..00000000000
--- a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads-2.lldbinit
+++ /dev/null
@@ -1,5 +0,0 @@
-break set -f stop-hook-threads.cpp -p "Break here to set up the stop hook"
-break set -f stop-hook-threads.cpp -p "Break here to test that the stop-hook"
-run
-target stop-hook add -x 2 -o "expr lldb_val += 1" -o "thread list"
-target stop-hook add -G true -o "script print('Hit stop hook')
diff --git a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp
deleted file mode 100644
index 46aae8346be..00000000000
--- a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook-threads.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-//===-- stop-hook-threads.cpp -----------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#include <chrono>
-#include <cstdio>
-#include <mutex>
-#include <random>
-#include <thread>
-
-std::default_random_engine g_random_engine{std::random_device{}()};
-std::uniform_int_distribution<> g_distribution{0, 3000};
-
-uint32_t g_val = 0;
-uint32_t lldb_val = 0;
-
-uint32_t
-access_pool (bool flag = false)
-{
- static std::mutex g_access_mutex;
- if (!flag)
- g_access_mutex.lock();
-
- uint32_t old_val = g_val;
- if (flag)
- g_val = old_val + 1;
-
- if (!flag)
- g_access_mutex.unlock();
- return g_val;
-}
-
-void
-thread_func (uint32_t thread_index)
-{
- // Break here to test that the stop-hook mechanism works for multiple threads.
- printf ("%s (thread index = %u) startng...\n", __FUNCTION__, thread_index);
-
- uint32_t count = 0;
- uint32_t val;
- while (count++ < 4)
- {
- // random micro second sleep from zero to .3 seconds
- int usec = g_distribution(g_random_engine);
- printf ("%s (thread = %u) doing a usleep (%d)...\n", __FUNCTION__, thread_index, usec);
- std::this_thread::sleep_for(std::chrono::microseconds{usec}); // Set break point at this line
-
- if (count < 2)
- val = access_pool ();
- else
- val = access_pool (true);
-
- printf ("%s (thread = %u) after usleep access_pool returns %d (count=%d)...\n", __FUNCTION__, thread_index, val, count);
- }
- printf ("%s (thread index = %u) exiting...\n", __FUNCTION__, thread_index);
-}
-
-
-int main (int argc, char const *argv[])
-{
- std::thread threads[3];
- // Break here to set up the stop hook
- printf("Stop hooks engaged.\n");
- // Create 3 threads
- for (auto &thread : threads)
- thread = std::thread{thread_func, std::distance(threads, &thread)};
-
- // Join all of our threads
- for (auto &thread : threads)
- thread.join();
-
- // print lldb_val so we can check it here.
- printf ("lldb_val was set to: %d.\n", lldb_val);
- return 0;
-}
diff --git a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook.c b/lldb/lit/ExecControl/StopHook/Inputs/stop-hook.c
deleted file mode 100644
index e1b2579526d..00000000000
--- a/lldb/lit/ExecControl/StopHook/Inputs/stop-hook.c
+++ /dev/null
@@ -1,53 +0,0 @@
-//===-- main.c --------------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-#include <stdio.h>
-#include <stdlib.h>
-
-int a(int);
-int b(int);
-int c(int);
-
-int a(int val)
-{
- if (val <= 1)
- return b(val);
- else if (val >= 3)
- return c(val);
-
- return val;
-}
-
-int b(int val)
-{
- int rc = c(val);
- void *ptr = malloc(1024);
- if (!ptr) // Set breakpoint here to test target stop-hook.
- return -1;
- else
- printf("ptr=%p\n", ptr); // We should stop here after stepping.
- return rc; // End of the line range for which stop-hook is to be run.
-}
-
-int c(int val)
-{
- return val + 3;
-}
-
-int main (int argc, char const *argv[])
-{
- int A1 = a(1);
- printf("a(1) returns %d\n", A1);
-
- int C2 = c(2); // Another breakpoint which is outside of the stop-hook range.
- printf("c(2) returns %d\n", C2);
-
- int A3 = a(3);
- printf("a(3) returns %d\n", A3);
-
- return 0;
-}
OpenPOWER on IntegriCloud