Author: zturner Date: Tue Aug 25 17:25:21 2015 New Revision: 245983 URL: http://llvm.org/viewvc/llvm-project?rev=245983&view=rev Log: Fix a bunch of portability issues in test executables.
Added: lldb/trunk/test/expression_command/expr-in-syscall/main.cpp - copied, changed from r245961, lldb/trunk/test/expression_command/expr-in-syscall/main.c lldb/trunk/test/functionalities/process_attach/main.cpp - copied, changed from r245961, lldb/trunk/test/functionalities/process_attach/main.c lldb/trunk/test/functionalities/thread/state/main.cpp - copied, changed from r245961, lldb/trunk/test/functionalities/thread/state/main.c Removed: lldb/trunk/test/expression_command/expr-in-syscall/main.c lldb/trunk/test/functionalities/process_attach/main.c lldb/trunk/test/functionalities/thread/state/main.c Modified: lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py lldb/trunk/test/expression_command/expr-in-syscall/Makefile lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py lldb/trunk/test/functionalities/process_attach/Makefile lldb/trunk/test/functionalities/register/main.cpp lldb/trunk/test/functionalities/signal/TestSendSignal.py lldb/trunk/test/functionalities/thread/exit_during_break/main.cpp lldb/trunk/test/functionalities/thread/exit_during_step/main.cpp lldb/trunk/test/functionalities/thread/state/Makefile lldb/trunk/test/functionalities/thread/state/TestThreadStates.py lldb/trunk/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py lldb/trunk/test/lang/c/tls_globals/TestTlsGlobals.py Modified: lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py?rev=245983&r1=245982&r2=245983&view=diff ============================================================================== --- lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py (original) +++ lldb/trunk/test/expression_command/call-restarts/TestCallThatRestarts.py Tue Aug 25 17:25:21 2015 @@ -1,4 +1,4 @@ -""" +""" Test calling a function that hits a signal set to auto-restart, make sure the call completes. """ Modified: lldb/trunk/test/expression_command/expr-in-syscall/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/expr-in-syscall/Makefile?rev=245983&r1=245982&r2=245983&view=diff ============================================================================== --- lldb/trunk/test/expression_command/expr-in-syscall/Makefile (original) +++ lldb/trunk/test/expression_command/expr-in-syscall/Makefile Tue Aug 25 17:25:21 2015 @@ -1,5 +1,5 @@ LEVEL = ../../make -C_SOURCES := main.c +CXX_SOURCES := main.cpp include $(LEVEL)/Makefile.rules Removed: lldb/trunk/test/expression_command/expr-in-syscall/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/expr-in-syscall/main.c?rev=245982&view=auto ============================================================================== --- lldb/trunk/test/expression_command/expr-in-syscall/main.c (original) +++ lldb/trunk/test/expression_command/expr-in-syscall/main.c (removed) @@ -1,11 +0,0 @@ -#include <unistd.h> - -volatile int release_flag = 0; - -int main(int argc, char const *argv[]) -{ - while (! release_flag) // Wait for debugger to attach - sleep(3); - - return 0; -} Copied: lldb/trunk/test/expression_command/expr-in-syscall/main.cpp (from r245961, lldb/trunk/test/expression_command/expr-in-syscall/main.c) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/expr-in-syscall/main.cpp?p2=lldb/trunk/test/expression_command/expr-in-syscall/main.cpp&p1=lldb/trunk/test/expression_command/expr-in-syscall/main.c&r1=245961&r2=245983&rev=245983&view=diff ============================================================================== --- lldb/trunk/test/expression_command/expr-in-syscall/main.c (original) +++ lldb/trunk/test/expression_command/expr-in-syscall/main.cpp Tue Aug 25 17:25:21 2015 @@ -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; } Modified: lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py?rev=245983&r1=245982&r2=245983&view=diff ============================================================================== --- lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py (original) +++ lldb/trunk/test/functionalities/load_unload/TestLoadUnload.py Tue Aug 25 17:25:21 2015 @@ -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.""" Modified: lldb/trunk/test/functionalities/process_attach/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/process_attach/Makefile?rev=245983&r1=245982&r2=245983&view=diff ============================================================================== --- lldb/trunk/test/functionalities/process_attach/Makefile (original) +++ lldb/trunk/test/functionalities/process_attach/Makefile Tue Aug 25 17:25:21 2015 @@ -1,6 +1,6 @@ LEVEL = ../../make -C_SOURCES := main.c +CXX_SOURCES := main.cpp EXE := ProcessAttach Removed: lldb/trunk/test/functionalities/process_attach/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/process_attach/main.c?rev=245982&view=auto ============================================================================== --- lldb/trunk/test/functionalities/process_attach/main.c (original) +++ lldb/trunk/test/functionalities/process_attach/main.c (removed) @@ -1,35 +0,0 @@ -#include <stdio.h> -#include <unistd.h> - -#if defined(__linux__) -#include <sys/prctl.h> -#endif - -int main(int argc, char const *argv[]) { - int temp; -#if defined(__linux__) - // Immediately enable any ptracer so that we can allow the stub attach - // operation to succeed. Some Linux kernels are locked down so that - // only an ancestor process can be a ptracer of a process. This disables that - // restriction. Without it, attach-related stub tests will fail. -#if defined(PR_SET_PTRACER) && defined(PR_SET_PTRACER_ANY) - int prctl_result; - - // For now we execute on best effort basis. If this fails for - // some reason, so be it. - prctl_result = prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0); - (void) prctl_result; -#endif -#endif - - // Waiting to be attached by the debugger. - temp = 0; - - while (temp < 30) // Waiting to be attached... - { - sleep(1); - temp++; - } - - printf("Exiting now\n"); -} Copied: lldb/trunk/test/functionalities/process_attach/main.cpp (from r245961, lldb/trunk/test/functionalities/process_attach/main.c) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/process_attach/main.cpp?p2=lldb/trunk/test/functionalities/process_attach/main.cpp&p1=lldb/trunk/test/functionalities/process_attach/main.c&r1=245961&r2=245983&rev=245983&view=diff ============================================================================== --- lldb/trunk/test/functionalities/process_attach/main.c (original) +++ lldb/trunk/test/functionalities/process_attach/main.cpp Tue Aug 25 17:25:21 2015 @@ -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++; } Modified: lldb/trunk/test/functionalities/register/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/register/main.cpp?rev=245983&r1=245982&r2=245983&view=diff ============================================================================== --- lldb/trunk/test/functionalities/register/main.cpp (original) +++ lldb/trunk/test/functionalities/register/main.cpp Tue Aug 25 17:25:21 2015 @@ -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); Modified: lldb/trunk/test/functionalities/signal/TestSendSignal.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/signal/TestSendSignal.py?rev=245983&r1=245982&r2=245983&view=diff ============================================================================== --- lldb/trunk/test/functionalities/signal/TestSendSignal.py (original) +++ lldb/trunk/test/functionalities/signal/TestSendSignal.py Tue Aug 25 17:25:21 2015 @@ -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.""" Modified: lldb/trunk/test/functionalities/thread/exit_during_break/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/exit_during_break/main.cpp?rev=245983&r1=245982&r2=245983&view=diff ============================================================================== --- lldb/trunk/test/functionalities/thread/exit_during_break/main.cpp (original) +++ lldb/trunk/test/functionalities/thread/exit_during_break/main.cpp Tue Aug 25 17:25:21 2015 @@ -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; Modified: lldb/trunk/test/functionalities/thread/exit_during_step/main.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/exit_during_step/main.cpp?rev=245983&r1=245982&r2=245983&view=diff ============================================================================== --- lldb/trunk/test/functionalities/thread/exit_during_step/main.cpp (original) +++ lldb/trunk/test/functionalities/thread/exit_during_step/main.cpp Tue Aug 25 17:25:21 2015 @@ -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 Modified: lldb/trunk/test/functionalities/thread/state/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/state/Makefile?rev=245983&r1=245982&r2=245983&view=diff ============================================================================== --- lldb/trunk/test/functionalities/thread/state/Makefile (original) +++ lldb/trunk/test/functionalities/thread/state/Makefile Tue Aug 25 17:25:21 2015 @@ -1,4 +1,4 @@ LEVEL = ../../../make -C_SOURCES := main.c +CXX_SOURCES := main.cpp include $(LEVEL)/Makefile.rules Modified: lldb/trunk/test/functionalities/thread/state/TestThreadStates.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/state/TestThreadStates.py?rev=245983&r1=245982&r2=245983&view=diff ============================================================================== --- lldb/trunk/test/functionalities/thread/state/TestThreadStates.py (original) +++ lldb/trunk/test/functionalities/thread/state/TestThreadStates.py Tue Aug 25 17:25:21 2015 @@ -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) Removed: lldb/trunk/test/functionalities/thread/state/main.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/state/main.c?rev=245982&view=auto ============================================================================== --- lldb/trunk/test/functionalities/thread/state/main.c (original) +++ lldb/trunk/test/functionalities/thread/state/main.c (removed) @@ -1,44 +0,0 @@ -//===-- main.cpp ------------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// This test is intended to verify that thread states are properly maintained -// when transitional actions are performed in the debugger. Most of the logic -// is in the test script. This program merely provides places where the test -// can create the intended states. - -#include <unistd.h> - -volatile int g_test = 0; - -int addSomething(int a) -{ - return a + g_test; -} - -int doNothing() -{ - int temp = 0; // Set first breakpoint here - - while (!g_test && temp < 5) - { - ++temp; - sleep(1); - } - - return temp; // Set second breakpoint here -} - -int main () -{ - int result = doNothing(); - - int i = addSomething(result); - - return 0; -} Copied: lldb/trunk/test/functionalities/thread/state/main.cpp (from r245961, lldb/trunk/test/functionalities/thread/state/main.c) URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/thread/state/main.cpp?p2=lldb/trunk/test/functionalities/thread/state/main.cpp&p1=lldb/trunk/test/functionalities/thread/state/main.c&r1=245961&r2=245983&rev=245983&view=diff ============================================================================== --- lldb/trunk/test/functionalities/thread/state/main.c (original) +++ lldb/trunk/test/functionalities/thread/state/main.cpp Tue Aug 25 17:25:21 2015 @@ -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 Modified: lldb/trunk/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py?rev=245983&r1=245982&r2=245983&view=diff ============================================================================== --- lldb/trunk/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py (original) +++ lldb/trunk/test/functionalities/unwind/noreturn/TestNoreturnUnwind.py Tue Aug 25 17:25:21 2015 @@ -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() Modified: lldb/trunk/test/lang/c/tls_globals/TestTlsGlobals.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/tls_globals/TestTlsGlobals.py?rev=245983&r1=245982&r2=245983&view=diff ============================================================================== --- lldb/trunk/test/lang/c/tls_globals/TestTlsGlobals.py (original) +++ lldb/trunk/test/lang/c/tls_globals/TestTlsGlobals.py Tue Aug 25 17:25:21 2015 @@ -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() _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits