Fix a bunch of portability issues in test executables.
llvm-svn: 245983
This commit is contained in:
parent
289287060b
commit
d1c5b6f66b
|
@ -1,4 +1,4 @@
|
|||
"""
|
||||
"""
|
||||
Test calling a function that hits a signal set to auto-restart, make sure the call completes.
|
||||
"""
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
LEVEL = ../../make
|
||||
|
||||
C_SOURCES := main.c
|
||||
CXX_SOURCES := main.cpp
|
||||
|
||||
include $(LEVEL)/Makefile.rules
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
#include <unistd.h>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
volatile int release_flag = 0;
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
while (! release_flag) // Wait for debugger to attach
|
||||
sleep(3);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(3));
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
"""
|
||||
"""
|
||||
Test that breakpoint by symbol name works correctly with dynamic libs.
|
||||
"""
|
||||
|
||||
|
@ -69,6 +69,7 @@ class LoadUnloadTestCase(TestBase):
|
|||
|
||||
@skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
|
||||
@not_remote_testsuite_ready
|
||||
@skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
|
||||
def test_modules_search_paths(self):
|
||||
"""Test target modules list after loading a different copy of the library libd.dylib, and verifies that it works with 'target modules search-paths add'."""
|
||||
|
||||
|
@ -122,6 +123,7 @@ class LoadUnloadTestCase(TestBase):
|
|||
@skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
|
||||
@skipUnlessListedRemote(['android'])
|
||||
@expectedFailureAndroid # wrong source file shows up for hidden library
|
||||
@skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
|
||||
def test_dyld_library_path(self):
|
||||
"""Test (DY)LD_LIBRARY_PATH after moving libd.dylib, which defines d_function, somewhere else."""
|
||||
|
||||
|
@ -177,6 +179,7 @@ class LoadUnloadTestCase(TestBase):
|
|||
@skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
|
||||
@skipUnlessListedRemote(['android'])
|
||||
@expectedFailureAndroid # dlopen and dlclose prefixed with "__dl_" on android causing JIT compilation issues
|
||||
@skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
|
||||
def test_lldb_process_load_and_unload_commands(self):
|
||||
"""Test that lldb process load/unload command work correctly."""
|
||||
|
||||
|
@ -279,6 +282,7 @@ class LoadUnloadTestCase(TestBase):
|
|||
|
||||
@skipIfFreeBSD # llvm.org/pr14424 - missing FreeBSD Makefiles/testcase support
|
||||
@skipUnlessListedRemote(['android'])
|
||||
@skipIfWindows # Windows doesn't have dlopen and friends, dynamic libraries work differently
|
||||
def test_step_over_load (self):
|
||||
"""Test stepping over code that loads a shared library works correctly."""
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
LEVEL = ../../make
|
||||
|
||||
C_SOURCES := main.c
|
||||
CXX_SOURCES := main.cpp
|
||||
|
||||
EXE := ProcessAttach
|
||||
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
int main(int argc, char const *argv[]) {
|
||||
int temp;
|
||||
#if defined(__linux__)
|
||||
|
@ -27,7 +29,7 @@ int main(int argc, char const *argv[]) {
|
|||
|
||||
while (temp < 30) // Waiting to be attached...
|
||||
{
|
||||
sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||
temp++;
|
||||
}
|
||||
|
|
@ -7,12 +7,14 @@
|
|||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
int main (int argc, char const *argv[])
|
||||
{
|
||||
#if defined(__linux__)
|
||||
|
@ -36,7 +38,7 @@ int main (int argc, char const *argv[])
|
|||
{
|
||||
volatile int wait_for_attach=1;
|
||||
while (wait_for_attach)
|
||||
usleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(1));
|
||||
}
|
||||
|
||||
printf("my_string=%s\n", my_string);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
"""Test that lldb command 'process signal SIGUSR1' to send a signal to the inferior works."""
|
||||
"""Test that lldb command 'process signal SIGUSR1' to send a signal to the inferior works."""
|
||||
|
||||
import os, time, signal
|
||||
import unittest2
|
||||
|
@ -19,6 +19,7 @@ class SendSignalTestCase(TestBase):
|
|||
self.send_signal()
|
||||
|
||||
@expectedFailureFreeBSD("llvm.org/pr23318: does not report running state")
|
||||
@skipIfWindows # Windows does not support signals
|
||||
@dwarf_test
|
||||
def test_with_dwarf_and_run_command(self):
|
||||
"""Test that lldb command 'process signal SIGUSR1' sends a signal to the inferior process."""
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
// breakpoint is hit. The test case should be flexible enough to treat that
|
||||
// as success.
|
||||
|
||||
#include <unistd.h>
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
volatile int g_test = 0;
|
||||
|
@ -83,7 +83,7 @@ exit_thread_func ()
|
|||
pseudo_barrier_wait(g_barrier2);
|
||||
|
||||
// Try to make sure this thread doesn't exit until the breakpoint is hit.
|
||||
usleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(1));
|
||||
|
||||
// Return
|
||||
return NULL;
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
// This test is intended to create a situation in which one thread will exit
|
||||
// while the debugger is stepping in another thread.
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <thread>
|
||||
|
||||
// Note that although hogging the CPU while waiting for a variable to change
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
LEVEL = ../../../make
|
||||
|
||||
C_SOURCES := main.c
|
||||
CXX_SOURCES := main.cpp
|
||||
include $(LEVEL)/Makefile.rules
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
"""
|
||||
"""
|
||||
Test thread states.
|
||||
"""
|
||||
|
||||
|
@ -95,8 +95,8 @@ class ThreadStateTestCase(TestBase):
|
|||
# Call super's setUp().
|
||||
TestBase.setUp(self)
|
||||
# Find the line numbers for our breakpoints.
|
||||
self.break_1 = line_number('main.c', '// Set first breakpoint here')
|
||||
self.break_2 = line_number('main.c', '// Set second breakpoint here')
|
||||
self.break_1 = line_number('main.cpp', '// Set first breakpoint here')
|
||||
self.break_2 = line_number('main.cpp', '// Set second breakpoint here')
|
||||
|
||||
def thread_state_after_breakpoint_test(self):
|
||||
"""Test thread state after breakpoint."""
|
||||
|
@ -104,11 +104,11 @@ class ThreadStateTestCase(TestBase):
|
|||
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
|
||||
|
||||
# This should create a breakpoint in the main thread.
|
||||
lldbutil.run_break_set_by_file_and_line (self, "main.c", self.break_1, num_expected_locations=1)
|
||||
lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
|
||||
|
||||
# The breakpoint list should show 1 breakpoint with 1 location.
|
||||
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
|
||||
substrs = ["1: file = 'main.c', line = %d, locations = 1" % self.break_1])
|
||||
substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.break_1])
|
||||
|
||||
# Run the program.
|
||||
self.runCmd("run", RUN_SUCCEEDED)
|
||||
|
@ -144,12 +144,12 @@ class ThreadStateTestCase(TestBase):
|
|||
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
|
||||
|
||||
# This should create a breakpoint in the main thread.
|
||||
lldbutil.run_break_set_by_file_and_line (self, "main.c", self.break_1, num_expected_locations=1)
|
||||
lldbutil.run_break_set_by_file_and_line (self, "main.c", self.break_2, num_expected_locations=1)
|
||||
lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
|
||||
lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1)
|
||||
|
||||
# The breakpoint list should show 1 breakpoints with 1 location.
|
||||
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
|
||||
substrs = ["1: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.break_1])
|
||||
substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.break_1])
|
||||
|
||||
# Run the program.
|
||||
self.runCmd("run", RUN_SUCCEEDED)
|
||||
|
@ -193,12 +193,12 @@ class ThreadStateTestCase(TestBase):
|
|||
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
|
||||
|
||||
# This should create a breakpoint in the main thread.
|
||||
lldbutil.run_break_set_by_file_and_line (self, "main.c", self.break_1, num_expected_locations=1)
|
||||
lldbutil.run_break_set_by_file_and_line (self, "main.c", self.break_2, num_expected_locations=1)
|
||||
lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
|
||||
lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1)
|
||||
|
||||
# The breakpoint list should show 1 breakpoints with 1 location.
|
||||
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
|
||||
substrs = ["1: file = 'main.c', line = %d, locations = 1" % self.break_1])
|
||||
substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.break_1])
|
||||
|
||||
# Run the program.
|
||||
self.runCmd("run", RUN_SUCCEEDED)
|
||||
|
@ -238,11 +238,11 @@ class ThreadStateTestCase(TestBase):
|
|||
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
|
||||
|
||||
# This should create a breakpoint in the main thread.
|
||||
lldbutil.run_break_set_by_file_and_line (self, "main.c", self.break_1, num_expected_locations=1)
|
||||
lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
|
||||
|
||||
# The breakpoint list should show 1 breakpoints with 1 location.
|
||||
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
|
||||
substrs = ["1: file = 'main.c', line = %d, locations = 1" % self.break_1])
|
||||
substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.break_1])
|
||||
|
||||
# Run the program.
|
||||
self.runCmd("run", RUN_SUCCEEDED)
|
||||
|
@ -291,13 +291,13 @@ class ThreadStateTestCase(TestBase):
|
|||
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
|
||||
|
||||
# This should create a breakpoint in the main thread.
|
||||
lldbutil.run_break_set_by_file_and_line (self, "main.c", self.break_1, num_expected_locations=1)
|
||||
lldbutil.run_break_set_by_file_and_line (self, "main.c", self.break_2, num_expected_locations=1)
|
||||
lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_1, num_expected_locations=1)
|
||||
lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.break_2, num_expected_locations=1)
|
||||
|
||||
# The breakpoint list should show 2 breakpoints with 1 location each.
|
||||
self.expect("breakpoint list -f", "Breakpoint location shown correctly",
|
||||
substrs = ["1: file = 'main.c', line = %d, locations = 1" % self.break_1,
|
||||
"2: file = 'main.c', line = %d, locations = 1" % self.break_2])
|
||||
substrs = ["1: file = 'main.cpp', line = %d, locations = 1" % self.break_1,
|
||||
"2: file = 'main.cpp', line = %d, locations = 1" % self.break_2])
|
||||
|
||||
# Run the program.
|
||||
self.runCmd("run", RUN_SUCCEEDED)
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
// is in the test script. This program merely provides places where the test
|
||||
// can create the intended states.
|
||||
|
||||
#include <unistd.h>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
volatile int g_test = 0;
|
||||
|
||||
|
@ -28,7 +29,7 @@ int doNothing()
|
|||
while (!g_test && temp < 5)
|
||||
{
|
||||
++temp;
|
||||
sleep(1);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||
}
|
||||
|
||||
return temp; // Set second breakpoint here
|
|
@ -21,6 +21,7 @@ class NoreturnUnwind(TestBase):
|
|||
|
||||
@dwarf_test
|
||||
@expectedFailurei386 #xfail to get buildbot green, failing config: i386 binary running on ubuntu 14.04 x86_64
|
||||
@skipIfWindows # clang-cl does not support gcc style attributes.
|
||||
def test_with_dwarf (self):
|
||||
"""Test that we can backtrace correctly with 'noreturn' functions on the stack"""
|
||||
self.buildDwarf()
|
||||
|
|
|
@ -20,6 +20,7 @@ class TlsGlobalTestCase(TestBase):
|
|||
|
||||
@dwarf_test
|
||||
@unittest2.expectedFailure("rdar://7796742")
|
||||
@skipIfWindows # TLS works differently on Windows, this would need to be implemented separately.
|
||||
def test_with_dwarf(self):
|
||||
"""Test thread-local storage."""
|
||||
self.buildDwarf()
|
||||
|
|
Loading…
Reference in New Issue