forked from OSchip/llvm-project
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
This commit is contained in:
parent
26d7fcfc38
commit
719ec93a74
|
@ -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 )
|
||||
|
|
|
@ -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 <file name>:<line number> 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)
|
|
@ -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 = "<group>"; };
|
||||
236ED33419D49081008CA7D7 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
|
||||
236ED33619D490B0008CA7D7 /* Makefile.rules */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Makefile.rules; sourceTree = "<group>"; };
|
||||
33064C981A5C7A1A0033D415 /* UriParserTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UriParserTest.cpp; path = Utility/UriParserTest.cpp; sourceTree = "<group>"; };
|
||||
33064C9D1A5C7AC90033D415 /* do-gtest.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "do-gtest.py"; sourceTree = "<group>"; };
|
||||
330E475C1A609CF600FD2884 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; name = Makefile; path = Host/Makefile; sourceTree = "<group>"; };
|
||||
330E475D1A609CF600FD2884 /* SocketTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SocketTest.cpp; path = Host/SocketTest.cpp; sourceTree = "<group>"; };
|
||||
330E475E1A60B31F00FD2884 /* SocketTestMock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SocketTestMock.cpp; path = Host/SocketTestMock.cpp; sourceTree = "<group>"; };
|
||||
330E47621A62451800FD2884 /* SocketAddressTest.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; name = SocketAddressTest.cpp; path = Host/SocketAddressTest.cpp; sourceTree = "<group>"; };
|
||||
338C47F41A1E67B900B46077 /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; name = Makefile; path = Utility/Makefile; sourceTree = "<group>"; };
|
||||
338C47F51A1E67B900B46077 /* StringExtractorTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringExtractorTest.cpp; path = Utility/StringExtractorTest.cpp; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
236ED32F19D4901D008CA7D7 /* unittest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
330E475B1A609CDF00FD2884 /* Host */,
|
||||
338C47F31A1E677900B46077 /* Utility */,
|
||||
236ED33019D4903E008CA7D7 /* Plugins */,
|
||||
);
|
||||
path = unittest;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
236ED33019D4903E008CA7D7 /* Plugins */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
236ED33119D4904B008CA7D7 /* Process */,
|
||||
);
|
||||
path = Plugins;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
236ED33119D4904B008CA7D7 /* Process */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
236ED33219D4905B008CA7D7 /* Linux */,
|
||||
);
|
||||
path = Process;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
236ED33219D4905B008CA7D7 /* Linux */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
236ED33419D49081008CA7D7 /* Makefile */,
|
||||
236ED33319D49076008CA7D7 /* ThreadStateCoordinatorTest.cpp */,
|
||||
);
|
||||
path = Linux;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
236ED33519D49098008CA7D7 /* make */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
236ED33619D490B0008CA7D7 /* Makefile.rules */,
|
||||
);
|
||||
path = make;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
23CDD8EE19D4790700461DDC = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
33064C9D1A5C7AC90033D415 /* do-gtest.py */,
|
||||
236ED33519D49098008CA7D7 /* make */,
|
||||
236ED32F19D4901D008CA7D7 /* unittest */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
330E475B1A609CDF00FD2884 /* Host */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
330E475E1A60B31F00FD2884 /* SocketTestMock.cpp */,
|
||||
330E475C1A609CF600FD2884 /* Makefile */,
|
||||
330E475D1A609CF600FD2884 /* SocketTest.cpp */,
|
||||
330E47621A62451800FD2884 /* SocketAddressTest.cpp */,
|
||||
);
|
||||
name = Host;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
338C47F31A1E677900B46077 /* Utility */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
33064C981A5C7A1A0033D415 /* UriParserTest.cpp */,
|
||||
338C47F41A1E67B900B46077 /* Makefile */,
|
||||
338C47F51A1E67B900B46077 /* StringExtractorTest.cpp */,
|
||||
);
|
||||
name = Utility;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* 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 */;
|
||||
}
|
|
@ -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
|
|
@ -1,3 +0,0 @@
|
|||
add_subdirectory(Host)
|
||||
add_subdirectory(Plugins)
|
||||
add_subdirectory(Utility)
|
|
@ -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
|
|
@ -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
|
|
@ -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)
|
Loading…
Reference in New Issue