From 719ec93a7447e31fcff92bcebf015a758c8df841 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Fri, 13 Mar 2015 20:54:57 +0000 Subject: [PATCH] Rework the gtest directory structure. This makes the directory structure mirror the canonical LLVM directory structure for a gtest suite. Additionally, this patch deletes the xcode project. Nobody is currently depending on this, and it would be better to have gtest unit tests be hand-maintained in the Xcode workspace rather than using this python test runner. Patches to that effect will be submitted as followups. llvm-svn: 232211 --- lldb/CMakeLists.txt | 2 +- lldb/gtest/do-gtest.py | 157 ------------ lldb/gtest/gtest.xcodeproj/project.pbxproj | 264 --------------------- lldb/gtest/make/Makefile.rules | 96 -------- lldb/gtest/unittest/CMakeLists.txt | 3 - lldb/gtest/unittest/Host/Makefile | 36 --- lldb/gtest/unittest/Utility/Makefile | 19 -- lldb/{gtest => unittests}/CMakeLists.txt | 6 +- .../unittest => unittests}/Host/CMakeLists.txt | 0 .../Host/SocketAddressTest.cpp | 0 .../unittest => unittests}/Host/SocketTest.cpp | 0 .../unittest => unittests}/Host/SocketTestMock.cpp | 0 .../unittest => unittests}/Plugins/CMakeLists.txt | 0 .../Plugins/Process/CMakeLists.txt | 0 .../Plugins/Process/Linux/CMakeLists.txt | 0 .../Plugins/Process/Linux/Makefile | 0 .../Process/Linux/ThreadStateCoordinatorTest.cpp | 0 .../Linux/ThreadStateCoordinatorTestMock.cpp | 0 .../unittest => unittests}/Utility/CMakeLists.txt | 0 .../Utility/StringExtractorTest.cpp | 0 .../Utility/UriParserTest.cpp | 0 lldb/{gtest/include => unittests}/gtest_common.h | 0 22 files changed, 5 insertions(+), 578 deletions(-) delete mode 100755 lldb/gtest/do-gtest.py delete mode 100644 lldb/gtest/gtest.xcodeproj/project.pbxproj delete mode 100644 lldb/gtest/make/Makefile.rules delete mode 100644 lldb/gtest/unittest/CMakeLists.txt delete mode 100644 lldb/gtest/unittest/Host/Makefile delete mode 100644 lldb/gtest/unittest/Utility/Makefile rename lldb/{gtest => unittests}/CMakeLists.txt (77%) rename lldb/{gtest/unittest => unittests}/Host/CMakeLists.txt (100%) rename lldb/{gtest/unittest => unittests}/Host/SocketAddressTest.cpp (100%) rename lldb/{gtest/unittest => unittests}/Host/SocketTest.cpp (100%) rename lldb/{gtest/unittest => unittests}/Host/SocketTestMock.cpp (100%) rename lldb/{gtest/unittest => unittests}/Plugins/CMakeLists.txt (100%) rename lldb/{gtest/unittest => unittests}/Plugins/Process/CMakeLists.txt (100%) rename lldb/{gtest/unittest => unittests}/Plugins/Process/Linux/CMakeLists.txt (100%) rename lldb/{gtest/unittest => unittests}/Plugins/Process/Linux/Makefile (100%) rename lldb/{gtest/unittest => unittests}/Plugins/Process/Linux/ThreadStateCoordinatorTest.cpp (100%) rename lldb/{gtest/unittest => unittests}/Plugins/Process/Linux/ThreadStateCoordinatorTestMock.cpp (100%) rename lldb/{gtest/unittest => unittests}/Utility/CMakeLists.txt (100%) rename lldb/{gtest/unittest => unittests}/Utility/StringExtractorTest.cpp (100%) rename lldb/{gtest/unittest => unittests}/Utility/UriParserTest.cpp (100%) rename lldb/{gtest/include => unittests}/gtest_common.h (100%) diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt index 4629f40..5f8c188 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -10,7 +10,7 @@ endif () add_subdirectory(source) add_subdirectory(test) add_subdirectory(tools) -add_subdirectory(gtest) +add_subdirectory(unittests) if ( LLDB_ENABLE_PYTHON_SCRIPTS_SWIG_API_GENERATION AND NOT LLDB_DISABLE_PYTHON ) diff --git a/lldb/gtest/do-gtest.py b/lldb/gtest/do-gtest.py deleted file mode 100755 index d2d4357..0000000 --- a/lldb/gtest/do-gtest.py +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/env python - -from __future__ import print_function - -import os -import re -import select -import subprocess -import sys - -# Wrapping this rather than os.devnull since os.devnull does not seem to implement 'write'. -class NullWriter(object): - def write (self, *args): - pass - def writelines (self, *args): - pass - def close (self, *args): - pass - -# Find all "Makefile"-s in the current directory. -def find_makefile_dirs(): - makefile_dirs = [] - for root, dirs, files in os.walk("."): - for file in files: - if file == "Makefile": - makefile_dirs.append(root) - return makefile_dirs - -# Test if line starts with : pattern -_TESTDIR_RELATIVE_REGEX = re.compile(r"^([^/:]+:\d+:)") - -# Test if the line starts with the string "[ FAILED ]" (whitespace -# independent) what displayed on the end of a failed test case -_COMBINER_TERMINATION_REGEX = re.compile(r"^\[ *FAILED *\]") - -# Prepends directory before each file name in line matching the regular -# expression "_TESTDIR_RELATIVE_REGEX" and returns the new value of line and the -# number of file names modified as a tuple. -def expand_file_name(directory, line): - return _TESTDIR_RELATIVE_REGEX.subn(directory + r"/\1", line) - -# Combine the failure report information from the output of gtest into a -# single line for better displaying inside IDEs -def line_combine_printer(file, previous_data, new_line_subn_result): - (incoming_line, sub_match_count) = new_line_subn_result - - if sub_match_count > 0: - # New line was a match for a file name. It means is the first line of - # a failure report. Don't print yet, start an accumulation for more - # info about the failure. - if len(previous_data) > 0: - # Flush anything previously accumulated (most likely part of the - # previous failure report). - print(previous_data, file=file) - return incoming_line + ": " - else: - # If we're combining and incoming is a "[ FAILED ]" line then we have - # to stop combining now. - if (len(previous_data) > 0) and _COMBINER_TERMINATION_REGEX.match(incoming_line): - # Stop the combine and print out its data and the FAIL line also. - print(previous_data, file=file) - print(incoming_line, file=file) - return "" - - if len(previous_data) > 0: - # Previous data is available what means we are currently - # accumulating a failure report. Append this line to it. - if len(previous_data) >= 2 and previous_data[-2:] != ": ": - return previous_data + ", " + incoming_line - else: - return previous_data + incoming_line - else: - # No previous data and don't have to start new accumulation. Just - # print the incoming line if it is not empty. - if len(incoming_line) > 0: - print(incoming_line, file=file) - return "" - -def call_make(makefile_dir, extra_args=None, stdout=sys.stdout, stderr=sys.stderr): - command = ["make", "-C", makefile_dir] - if extra_args: - command.extend(extra_args) - - # Execute make as a new subprocess - proc = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - - stdout_data, stderr_data = "", "" - - while True: - reads = [proc.stdout.fileno(), proc.stderr.fileno()] - select_result = select.select(reads, [], []) - - # Copy the currently available output from make to the standard output - # streams (stdout or stderr) - for fd in select_result[0]: - if fd == proc.stdout.fileno(): - line = proc.stdout.readline() - stdout_data = line_combine_printer(stdout, stdout_data, expand_file_name(makefile_dir, line.rstrip())) - elif fd == proc.stderr.fileno(): - line = proc.stderr.readline() - stderr_data = line_combine_printer(stderr, stderr_data, expand_file_name(makefile_dir, line.rstrip())) - - proc_retval = proc.poll() - if proc_retval != None: - # Process stopped. Drain output before finishing up. - - # Drain stdout. - while True: - line = proc.stdout.readline() - if line and len(line) > 0: - stdout_data = line_combine_printer(stdout, stdout_data, expand_file_name(makefile_dir, line.rstrip())) - else: - break - - # Drain stderr. - while True: - line = proc.stderr.readline() - if line and len(line) > 0: - stderr_data = line_combine_printer(stderr, stderr_data, expand_file_name(makefile_dir, line.rstrip())) - else: - break - - return proc_retval - - -global_retval = 0 - -do_clean_only = ('clean' in sys.argv) - -for makefile_dir in find_makefile_dirs(): - # If we're not only cleaning, we do the normal build. - if not do_clean_only: - print("making: {}".format(makefile_dir)) - retval = call_make(makefile_dir) - # Remember any errors that happen here. - if retval != 0: - print() - print("-" * 80) - print("Tests failed for Makefile in directory: %s" % makefile_dir) - print("-" * 80) - print() - global_retval = retval - - # Now clean - call_make(makefile_dir, ['clean'], stdout=NullWriter(), stderr=NullWriter()) - -if global_retval == 0: - print() - print("========================") - print("| All tests are PASSED |") - print("========================") -else: - print() - print("=========================================================") - print("| Some of the test cases are FAILED with return code: %d |" % global_retval) - print("=========================================================") -sys.exit(global_retval) diff --git a/lldb/gtest/gtest.xcodeproj/project.pbxproj b/lldb/gtest/gtest.xcodeproj/project.pbxproj deleted file mode 100644 index e6c4362..0000000 --- a/lldb/gtest/gtest.xcodeproj/project.pbxproj +++ /dev/null @@ -1,264 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXFileReference section */ - 236ED33319D49076008CA7D7 /* ThreadStateCoordinatorTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadStateCoordinatorTest.cpp; sourceTree = ""; }; - 236ED33419D49081008CA7D7 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; - 236ED33619D490B0008CA7D7 /* Makefile.rules */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.rules; sourceTree = ""; }; - 33064C981A5C7A1A0033D415 /* UriParserTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UriParserTest.cpp; path = Utility/UriParserTest.cpp; sourceTree = ""; }; - 33064C9D1A5C7AC90033D415 /* do-gtest.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "do-gtest.py"; sourceTree = ""; }; - 330E475C1A609CF600FD2884 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; name = Makefile; path = Host/Makefile; sourceTree = ""; }; - 330E475D1A609CF600FD2884 /* SocketTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SocketTest.cpp; path = Host/SocketTest.cpp; sourceTree = ""; }; - 330E475E1A60B31F00FD2884 /* SocketTestMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SocketTestMock.cpp; path = Host/SocketTestMock.cpp; sourceTree = ""; }; - 330E47621A62451800FD2884 /* SocketAddressTest.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = SocketAddressTest.cpp; path = Host/SocketAddressTest.cpp; sourceTree = ""; }; - 338C47F41A1E67B900B46077 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; name = Makefile; path = Utility/Makefile; sourceTree = ""; }; - 338C47F51A1E67B900B46077 /* StringExtractorTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringExtractorTest.cpp; path = Utility/StringExtractorTest.cpp; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXGroup section */ - 236ED32F19D4901D008CA7D7 /* unittest */ = { - isa = PBXGroup; - children = ( - 330E475B1A609CDF00FD2884 /* Host */, - 338C47F31A1E677900B46077 /* Utility */, - 236ED33019D4903E008CA7D7 /* Plugins */, - ); - path = unittest; - sourceTree = ""; - }; - 236ED33019D4903E008CA7D7 /* Plugins */ = { - isa = PBXGroup; - children = ( - 236ED33119D4904B008CA7D7 /* Process */, - ); - path = Plugins; - sourceTree = ""; - }; - 236ED33119D4904B008CA7D7 /* Process */ = { - isa = PBXGroup; - children = ( - 236ED33219D4905B008CA7D7 /* Linux */, - ); - path = Process; - sourceTree = ""; - }; - 236ED33219D4905B008CA7D7 /* Linux */ = { - isa = PBXGroup; - children = ( - 236ED33419D49081008CA7D7 /* Makefile */, - 236ED33319D49076008CA7D7 /* ThreadStateCoordinatorTest.cpp */, - ); - path = Linux; - sourceTree = ""; - }; - 236ED33519D49098008CA7D7 /* make */ = { - isa = PBXGroup; - children = ( - 236ED33619D490B0008CA7D7 /* Makefile.rules */, - ); - path = make; - sourceTree = ""; - }; - 23CDD8EE19D4790700461DDC = { - isa = PBXGroup; - children = ( - 33064C9D1A5C7AC90033D415 /* do-gtest.py */, - 236ED33519D49098008CA7D7 /* make */, - 236ED32F19D4901D008CA7D7 /* unittest */, - ); - sourceTree = ""; - }; - 330E475B1A609CDF00FD2884 /* Host */ = { - isa = PBXGroup; - children = ( - 330E475E1A60B31F00FD2884 /* SocketTestMock.cpp */, - 330E475C1A609CF600FD2884 /* Makefile */, - 330E475D1A609CF600FD2884 /* SocketTest.cpp */, - 330E47621A62451800FD2884 /* SocketAddressTest.cpp */, - ); - name = Host; - sourceTree = ""; - }; - 338C47F31A1E677900B46077 /* Utility */ = { - isa = PBXGroup; - children = ( - 33064C981A5C7A1A0033D415 /* UriParserTest.cpp */, - 338C47F41A1E67B900B46077 /* Makefile */, - 338C47F51A1E67B900B46077 /* StringExtractorTest.cpp */, - ); - name = Utility; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXLegacyTarget section */ - 23CDD8F319D4790700461DDC /* gtest */ = { - isa = PBXLegacyTarget; - buildArgumentsString = "do-gtest.py $(ACTION)"; - buildConfigurationList = 23CDD8F619D4790700461DDC /* Build configuration list for PBXLegacyTarget "gtest" */; - buildPhases = ( - ); - buildToolPath = /usr/bin/python; - buildWorkingDirectory = .; - dependencies = ( - ); - name = gtest; - passBuildSettingsInEnvironment = 1; - productName = gtest; - }; -/* End PBXLegacyTarget section */ - -/* Begin PBXProject section */ - 23CDD8EF19D4790700461DDC /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0600; - ORGANIZATIONNAME = LLVM; - TargetAttributes = { - 23CDD8F319D4790700461DDC = { - CreatedOnToolsVersion = 6.1; - }; - }; - }; - buildConfigurationList = 23CDD8F219D4790700461DDC /* Build configuration list for PBXProject "gtest" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 0; - knownRegions = ( - en, - ); - mainGroup = 23CDD8EE19D4790700461DDC; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 23CDD8F319D4790700461DDC /* gtest */, - ); - }; -/* End PBXProject section */ - -/* Begin XCBuildConfiguration section */ - 23CDD8F419D4790700461DDC /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 23CDD8F519D4790700461DDC /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; - MTL_ENABLE_DEBUG_INFO = NO; - SDKROOT = macosx; - }; - name = Release; - }; - 23CDD8F719D4790700461DDC /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEBUGGING_SYMBOLS = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - 23CDD8F819D4790700461DDC /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 23CDD8F219D4790700461DDC /* Build configuration list for PBXProject "gtest" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 23CDD8F419D4790700461DDC /* Debug */, - 23CDD8F519D4790700461DDC /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 23CDD8F619D4790700461DDC /* Build configuration list for PBXLegacyTarget "gtest" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 23CDD8F719D4790700461DDC /* Debug */, - 23CDD8F819D4790700461DDC /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 23CDD8EF19D4790700461DDC /* Project object */; -} diff --git a/lldb/gtest/make/Makefile.rules b/lldb/gtest/make/Makefile.rules deleted file mode 100644 index 913be0c..0000000 --- a/lldb/gtest/make/Makefile.rules +++ /dev/null @@ -1,96 +0,0 @@ -# Retrieve this Makefile's location. -THIS_FILE_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ - -# Set default target to be test -.DEFAULT_GOAL := test - -# Set up GTEST for canonical Linux and MacOSX source trees. -ifneq ($(wildcard $(THIS_FILE_DIR)../../llvm/utils/unittest/googletest),) - # Assume lldb/llvm (MacOSX Xcode) directory form. - LLVM_BASE_DIR := $(realpath $(THIS_FILE_DIR)../../llvm) -else - ifneq ($(wildcard $(THIS_FILE_DIR)../../../llvm/utils/unittest/googletest),) - # Assume lldb/llvm side-by-side configuration (with symbolic links) - LLVM_BASE_DIR := $(realpath $(THIS_FILE_DIR)../../../llvm) - else - # Assume llvm/tools/lldb (Non-MacOSX) directory form. - LLVM_BASE_DIR := $(realpath $(THIS_FILE_DIR)../../../..) - endif -endif - -ifeq ($(GTEST_DIR),) - GTEST_DIR := $(LLVM_BASE_DIR)/utils/unittest/googletest -endif -GTEST_INCLUDE_DIR := $(GTEST_DIR)/include - -ifeq ($(LLVM_BUILD_DIR),) - ifneq ($(wildcard $(THIS_FILE_DIR)../../llvm-build/Release+Asserts/x86_64/Release+Asserts),) - LLVM_BUILD_DIR := $(realpath $(THIS_FILE_DIR)../../llvm-build/Release+Asserts/x86_64/Release+Asserts) - else ifneq ($(wildcard $(THIS_FILE_DIR)../../../../../build-debug/lib),) - LLVM_BUILD_DIR := $(realpath $(THIS_FILE_DIR)../../../../../build-debug) - endif -endif - -ifeq ($(LLVM_BUILD_DIR),) - $(error Could not find LLVM build output dir, please set it with LLVM_BUILD_DIR) -endif -GTEST_STATIC_LIB_DIR := $(LLVM_BUILD_DIR)/lib - -ifeq ($(LLVM_BUILD_INCLUDE_DIR),) - ifneq ($(wildcard $(LLVM_BUILD_DIR)/../include),) - LLVM_BUILD_INCLUDE_DIR := $(realpath $(LLVM_BUILD_DIR)/../include) - else ifneq ($(wildcard $(LLVM_BUILD_DIR)/include),) - LLVM_BUILD_INCLUDE_DIR := $(realpath $(LLVM_BUILD_DIR)/include) - endif -endif - -ifeq ($(LLVM_BUILD_INCLUDE_DIR),) - $(error Could not find LLVM build directory include dir, please set it with LLVM_BUILD_INCLUDE_DIR) -endif - -# $(info LLVM_BASE_DIR = $(LLVM_BASE_DIR)) -# $(info LLVM_BUILD_DIR = $(LLVM_BUILD_DIR)) -# $(info GTEST_DIR = $(GTEST_DIR)) -# $(info GTEST_INCLUDE_DIR = $(GTEST_INCLUDE_DIR)) -# $(info GTEST_STATIC_LIB_DIR = $(GTEST_STATIC_LIB_DIR)) - -# Note lldb/include is already added for us by test/make/Makefile.rules -LLDB_HEADER_DIRS += \ - -I $(realpath $(THIS_FILE_DIR)../../source/) -# -I $(realpath $(THIS_FILE_DIR)../../include) - -CFLAGS_EXTRAS += -I $(GTEST_INCLUDE_DIR) -I $(LLVM_BASE_DIR)/include -I $(LLVM_BUILD_INCLUDE_DIR) $(LLDB_HEADER_DIRS) -LD_EXTRAS += $(GTEST_STATIC_LIB_DIR)/libgtest.a $(GTEST_STATIC_LIB_DIR)/libgtest_main.a $(GTEST_STATIC_LIB_DIR)/libLLVMSupport.a - -.PHONY: clean test - -# Handle subdirs -ifneq ($(SUBDIRS),) - -.PHONY: subdirs $(SUBDIRS) - -subdirs: $(SUBDIRS) - -test:: subdirs - -clean:: subdirs - -$(SUBDIRS): - $(MAKE) -C $@ $(MAKECMDGOALS) - -endif - - -# Skip pulling in build rules when we don't have an CXX_SOURCES defined. -# If this is the case, then we're just recursing directories. -# Consider doing directory handling/makefile running via a python script -# like test/dotest.py. - -ifneq ($(CXX_SOURCES),) - -include $(realpath $(THIS_FILE_DIR)../../test/make/Makefile.rules) - -test:: $(EXE) - $(realpath $(EXE)) - -endif diff --git a/lldb/gtest/unittest/CMakeLists.txt b/lldb/gtest/unittest/CMakeLists.txt deleted file mode 100644 index fd57dd9..0000000 --- a/lldb/gtest/unittest/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_subdirectory(Host) -add_subdirectory(Plugins) -add_subdirectory(Utility) diff --git a/lldb/gtest/unittest/Host/Makefile b/lldb/gtest/unittest/Host/Makefile deleted file mode 100644 index f541dd7..0000000 --- a/lldb/gtest/unittest/Host/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -THIS_FILE_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ - -LEVEL := $(realpath $(THIS_FILE_DIR)../../make) - -CFLAGS_EXTRAS := -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -ENABLE_THREADS := YES -# the fact that we need all of these source files to compile Socket.cpp -# is a good indication that we need some refactoring -CXX_SOURCES := $(wildcard *.cpp) \ - $(realpath $(LEVEL)/../../source/Core/Error.cpp) \ - $(realpath $(LEVEL)/../../source/Core/RegularExpression.cpp) \ - $(realpath $(LEVEL)/../../source/Core/Stream.cpp) \ - $(realpath $(LEVEL)/../../source/Core/StreamString.cpp) \ - $(realpath $(LEVEL)/../../source/Host/common/Socket.cpp) \ - $(realpath $(LEVEL)/../../source/Host/common/SocketAddress.cpp) \ - $(realpath $(LEVEL)/../../source/Host/common/StringConvert.cpp) \ - $(realpath $(LEVEL)/../../source/Host/common/TimeValue.cpp) - -OS := $(shell uname -s) -ifeq ($(OS),Windows) -CXX_SOURCES := $(CXX_SOURCES) \ - $(LEVEL)/../../source/Host/windows/Condition.cpp \ - $(LEVEL)/../../source/Host/windows/Mutex.cpp -else -CXX_SOURCES := $(CXX_SOURCES) \ - $(LEVEL)/../../source/Host/common/Condition.cpp \ - $(LEVEL)/../../source/Host/common/Mutex.cpp -endif - -ifeq ($(OS),Linux) - LD_EXTRAS := -lncurses -ldl -endif - -MAKE_DSYM := NO - -include $(LEVEL)/Makefile.rules diff --git a/lldb/gtest/unittest/Utility/Makefile b/lldb/gtest/unittest/Utility/Makefile deleted file mode 100644 index 6b444f5..0000000 --- a/lldb/gtest/unittest/Utility/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -THIS_FILE_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/ - -LEVEL := $(realpath $(THIS_FILE_DIR)../../make) - -CFLAGS_EXTRAS := -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -ENABLE_THREADS := YES -CXX_SOURCES := $(wildcard *.cpp) \ - $(realpath $(LEVEL)/../../source/Host/common/StringConvert.cpp) \ - $(realpath $(LEVEL)/../../source/Utility/StringExtractor.cpp) \ - $(realpath $(LEVEL)/../../source/Utility/UriParser.cpp) -MAKE_DSYM := NO - -OS := $(shell uname -s) -# $(info OS $(OS)) -ifeq ($(OS),Linux) - LD_EXTRAS := -lncurses -ldl -endif - -include $(LEVEL)/Makefile.rules diff --git a/lldb/gtest/CMakeLists.txt b/lldb/unittests/CMakeLists.txt similarity index 77% rename from lldb/gtest/CMakeLists.txt rename to lldb/unittests/CMakeLists.txt index 467dd12..e9b3770 100644 --- a/lldb/gtest/CMakeLists.txt +++ b/lldb/unittests/CMakeLists.txt @@ -3,7 +3,7 @@ set_target_properties(LLDBUnitTests PROPERTIES FOLDER "LLDB tests") include_directories(${LLDB_SOURCE_ROOT}) -set(LLDB_GTEST_COMMON_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/include/gtest_common.h) +set(LLDB_GTEST_COMMON_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/gtest_common.h) if (MSVC) list(APPEND LLVM_COMPILE_FLAGS /FI ${LLDB_GTEST_COMMON_INCLUDE}) else () @@ -18,4 +18,6 @@ function(add_lldb_unittest test_name) target_link_libraries(${test_name} liblldb) endfunction() -add_subdirectory(unittest) +add_subdirectory(Host) +add_subdirectory(Plugins) +add_subdirectory(Utility) diff --git a/lldb/gtest/unittest/Host/CMakeLists.txt b/lldb/unittests/Host/CMakeLists.txt similarity index 100% rename from lldb/gtest/unittest/Host/CMakeLists.txt rename to lldb/unittests/Host/CMakeLists.txt diff --git a/lldb/gtest/unittest/Host/SocketAddressTest.cpp b/lldb/unittests/Host/SocketAddressTest.cpp similarity index 100% rename from lldb/gtest/unittest/Host/SocketAddressTest.cpp rename to lldb/unittests/Host/SocketAddressTest.cpp diff --git a/lldb/gtest/unittest/Host/SocketTest.cpp b/lldb/unittests/Host/SocketTest.cpp similarity index 100% rename from lldb/gtest/unittest/Host/SocketTest.cpp rename to lldb/unittests/Host/SocketTest.cpp diff --git a/lldb/gtest/unittest/Host/SocketTestMock.cpp b/lldb/unittests/Host/SocketTestMock.cpp similarity index 100% rename from lldb/gtest/unittest/Host/SocketTestMock.cpp rename to lldb/unittests/Host/SocketTestMock.cpp diff --git a/lldb/gtest/unittest/Plugins/CMakeLists.txt b/lldb/unittests/Plugins/CMakeLists.txt similarity index 100% rename from lldb/gtest/unittest/Plugins/CMakeLists.txt rename to lldb/unittests/Plugins/CMakeLists.txt diff --git a/lldb/gtest/unittest/Plugins/Process/CMakeLists.txt b/lldb/unittests/Plugins/Process/CMakeLists.txt similarity index 100% rename from lldb/gtest/unittest/Plugins/Process/CMakeLists.txt rename to lldb/unittests/Plugins/Process/CMakeLists.txt diff --git a/lldb/gtest/unittest/Plugins/Process/Linux/CMakeLists.txt b/lldb/unittests/Plugins/Process/Linux/CMakeLists.txt similarity index 100% rename from lldb/gtest/unittest/Plugins/Process/Linux/CMakeLists.txt rename to lldb/unittests/Plugins/Process/Linux/CMakeLists.txt diff --git a/lldb/gtest/unittest/Plugins/Process/Linux/Makefile b/lldb/unittests/Plugins/Process/Linux/Makefile similarity index 100% rename from lldb/gtest/unittest/Plugins/Process/Linux/Makefile rename to lldb/unittests/Plugins/Process/Linux/Makefile diff --git a/lldb/gtest/unittest/Plugins/Process/Linux/ThreadStateCoordinatorTest.cpp b/lldb/unittests/Plugins/Process/Linux/ThreadStateCoordinatorTest.cpp similarity index 100% rename from lldb/gtest/unittest/Plugins/Process/Linux/ThreadStateCoordinatorTest.cpp rename to lldb/unittests/Plugins/Process/Linux/ThreadStateCoordinatorTest.cpp diff --git a/lldb/gtest/unittest/Plugins/Process/Linux/ThreadStateCoordinatorTestMock.cpp b/lldb/unittests/Plugins/Process/Linux/ThreadStateCoordinatorTestMock.cpp similarity index 100% rename from lldb/gtest/unittest/Plugins/Process/Linux/ThreadStateCoordinatorTestMock.cpp rename to lldb/unittests/Plugins/Process/Linux/ThreadStateCoordinatorTestMock.cpp diff --git a/lldb/gtest/unittest/Utility/CMakeLists.txt b/lldb/unittests/Utility/CMakeLists.txt similarity index 100% rename from lldb/gtest/unittest/Utility/CMakeLists.txt rename to lldb/unittests/Utility/CMakeLists.txt diff --git a/lldb/gtest/unittest/Utility/StringExtractorTest.cpp b/lldb/unittests/Utility/StringExtractorTest.cpp similarity index 100% rename from lldb/gtest/unittest/Utility/StringExtractorTest.cpp rename to lldb/unittests/Utility/StringExtractorTest.cpp diff --git a/lldb/gtest/unittest/Utility/UriParserTest.cpp b/lldb/unittests/Utility/UriParserTest.cpp similarity index 100% rename from lldb/gtest/unittest/Utility/UriParserTest.cpp rename to lldb/unittests/Utility/UriParserTest.cpp diff --git a/lldb/gtest/include/gtest_common.h b/lldb/unittests/gtest_common.h similarity index 100% rename from lldb/gtest/include/gtest_common.h rename to lldb/unittests/gtest_common.h -- 2.7.4