<div dir="ltr">BTW I'll have that fixed up and checked in soon, I'm just fixing a couple issues with build directory changes and getting it hooked into Xcode.</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 25, 2014 at 10:43 AM, Todd Fiala <span dir="ltr"><<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span class=""><span style="font-family:arial,sans-serif;font-size:13px">> Yeah, took me a minute to sort that out since the Python package that the regular testsuite uses is called "unittest"...</span><div style="font-family:arial,sans-serif;font-size:13px"></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div></span><div><span style="font-family:arial,sans-serif;font-size:13px">Ahhhh, ok.  Yeah I didn't even consider that.  I'm not too worried about confusion there.  I'm expecting this will be a relatively low-traffic directory, and it's scoped to gtest already, so I think we're likely okay there.  But something to watch out for, thanks for bringing that up!</span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 25, 2014 at 9:59 AM,  <span dir="ltr"><<a href="mailto:jingham@apple.com" target="_blank">jingham@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><br>
> On Sep 25, 2014, at 9:51 AM, Todd Fiala <<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>> wrote:<br>
><br>
> Right - that was the reason I wanted the "unittest" level.<br>
<br>
</span>Yeah, took me a minute to sort that out since the Python package that the regular testsuite uses is called "unittest"...<br>
<span><font color="#888888"><br>
Jim<br>
</font></span><div><div><br>
><br>
> I'm trying this scheme out now.<br>
><br>
> On Thu, Sep 25, 2014 at 9:47 AM, <<a href="mailto:jingham@apple.com" target="_blank">jingham@apple.com</a>> wrote:<br>
> I don't know what kinds of tests you are going to write.  If they are all 1-1 test->source file, this seems a reasonable scheme.  Then if you have other tests that aren't this kind of direct white box test, we can make a parallel directory to unittest to hold them - and think of the name for it at that point...<br>
><br>
> Jim<br>
><br>
> > On Sep 25, 2014, at 7:42 AM, Todd Fiala <<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>> wrote:<br>
> ><br>
> > > Any thoughts on the structure underneath gtest?<br>
> ><br>
> > One idea is, for the case of unittests, where the goal is to directly test class functionality:<br>
> ><br>
> > gtest/unittest/{MIRROR_lldb_source_path_to_class_dir}<br>
> ><br>
> > e.g. for the new source/Plugins/Process/Linux/ThreadStateCoordinator.cpp:<br>
> ><br>
> > gtest/unittest/Plugins/Process/Linux/ThreadStateCoordinatorTest.cpp<br>
> ><br>
> > ?<br>
> ><br>
> > -Todd<br>
> ><br>
> > On Thu, Sep 25, 2014 at 7:34 AM, Todd Fiala <<a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a>> wrote:<br>
> > > Maybe it would be better to make a parallel gtest directory, so the unittest2 framework crawler doesn't accidentally find its way into any of these tests.<br>
> ><br>
> > I'm expecting we'll push things around a bit.  gtest at the top level sounds reasonable to me.<br>
> ><br>
> > > Also, can you think of a better outer directory name than c++?<br>
> ><br>
> > I think gtest at the top level covers this.  Sound reasonable?<br>
> ><br>
> > > I would naively think some of the lang/cpp tests had wandered their way out of their proper directory...<br>
> ><br>
> > Agreed.<br>
> ><br>
> > Any thoughts on the structure underneath gtest?  My personal objectives are to be able to unit test low-level code that is hard to test via the more high level system tests that we do with Python.  I don't anticipate there will be a lot of tests in here (relatively speaking).  Certainly on my end it's just a handful of classes.<br>
> ><br>
> > -Todd<br>
> ><br>
> > On Wed, Sep 24, 2014 at 4:17 PM, <<a href="mailto:jingham@apple.com" target="_blank">jingham@apple.com</a>> wrote:<br>
> > Maybe it would be better to make a parallel gtest directory, so the unittest2 framework crawler doesn't accidentally find its way into any of these tests.  Also, can you think of a better outer directory name than c++?  I assume that name choice is because these are white box tests of the lldb_private C++ API, but I don't think that would be obvious to anyone looking at the directories.  I would naively think some of the lang/cpp tests had wandered their way out of their proper directory...<br>
> ><br>
> > Jim<br>
> ><br>
> ><br>
> > > On Sep 24, 2014, at 3:57 PM, Todd Fiala <<a href="mailto:todd.fiala@gmail.com" target="_blank">todd.fiala@gmail.com</a>> wrote:<br>
> > ><br>
> > > Author: tfiala<br>
> > > Date: Wed Sep 24 17:57:33 2014<br>
> > > New Revision: 218422<br>
> > ><br>
> > > URL: <a href="http://llvm.org/viewvc/llvm-project?rev=218422&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=218422&view=rev</a><br>
> > > Log:<br>
> > > The beginnings of a gtest-based test framework.<br>
> > ><br>
> > > Makes use of LLVM gtest support.  This does *not* run as part of<br>
> > > the lldb test suite.<br>
> > ><br>
> > > I'm using it to start testing some components that<br>
> > > I'll be adding to the inner guts of NativeThreadLinux to more<br>
> > > maintainably handle thread states and deferred thread state notification.<br>
> > ><br>
> > > Runs with default Makefile target "test" using gmake within a given<br>
> > > test directory (currently only test/c++/native_process/thread_state_coordinator).<br>
> > ><br>
> > > The Makefile.rules currently assume it is using the LLVM gtest.  It works on<br>
> > > a canonical MacOSX dir structture (i.e. lldb, lldb/llvm, lldb/llvm/tools/clang).<br>
> > > It also works on Ubuntu assuming the standard dir layout of llvm, llvm/tools/clang,<br>
> > > llvm/tools/lldb.  In this case, it expects a directory called build-debug parallel<br>
> > > to the llvm source dir.  All directory assumptions can be overridden with<br>
> > > environment variables.  See test/c++/make/Makefile.rules for details.<br>
> > ><br>
> > > We'll want to make this smarter in the future, particularly around finding the LLVM build<br>
> > > output dir.<br>
> > ><br>
> > > Added:<br>
> > >    lldb/trunk/test/c++/<br>
> > >    lldb/trunk/test/c++/make/<br>
> > >    lldb/trunk/test/c++/make/Makefile.rules<br>
> > >    lldb/trunk/test/c++/native_process/<br>
> > >    lldb/trunk/test/c++/native_process/thread_state_coordinator/<br>
> > >    lldb/trunk/test/c++/native_process/thread_state_coordinator/Makefile<br>
> > >    lldb/trunk/test/c++/native_process/thread_state_coordinator/ThreadStateCoordinatorTest.cpp<br>
> > ><br>
> > > Added: lldb/trunk/test/c++/make/Makefile.rules<br>
> > > URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/c%2B%2B/make/Makefile.rules?rev=218422&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/c%2B%2B/make/Makefile.rules?rev=218422&view=auto</a><br>
> > > ==============================================================================<br>
> > > --- lldb/trunk/test/c++/make/Makefile.rules (added)<br>
> > > +++ lldb/trunk/test/c++/make/Makefile.rules Wed Sep 24 17:57:33 2014<br>
> > > @@ -0,0 +1,58 @@<br>
> > > +# Retrieve this Makefile's location.<br>
> > > +THIS_FILE_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))/<br>
> > > +<br>
> > > +# Set default target to be test<br>
> > > +.DEFAULT_GOAL := test<br>
> > > +<br>
> > > +# Set up GTEST for canonical Linux and MacOSX source trees.<br>
> > > +ifeq ($(wildcard ../../../../llvm/utils/unittest/googletest),)<br>
> > > +    # Assume llvm/tools/lldb (Non-MacOSX) directory form.<br>
> > > +    LLVM_BASE_DIR := $(realpath ../../../../../..)<br>
> > > +else<br>
> > > +    # Assume lldb/llvm (MacOSX Xcode) directory form.<br>
> > > +    LLVM_BASE_DIR := $(realpath ../../../../llvm)<br>
> > > +endif<br>
> > > +<br>
> > > +ifeq ($(GTEST_DIR),)<br>
> > > +    GTEST_DIR := $(LLVM_BASE_DIR)/utils/unittest/googletest<br>
> > > +endif<br>
> > > +GTEST_INCLUDE_DIR := $(GTEST_DIR)/include<br>
> > > +<br>
> > > +ifeq ($(LLVM_BUILD_DIR),)<br>
> > > +    ifneq ($(wildcard $(THIS_FILE_DIR)../../../llvm-build/Release+Asserts/x86_64/Release+Asserts),)<br>
> > > +        LLVM_BUILD_DIR := $(realpath $(THIS_FILE_DIR)../../../llvm-build/Release+Asserts/x86_64/Release+Asserts)<br>
> > > +    else ifneq ($(wildcard $(THIS_FILE_DIR)../../../../../../build-debug/lib),)<br>
> > > +        LLVM_BUILD_DIR := $(realpath $(THIS_FILE_DIR)../../../../../../build-debug)<br>
> > > +    endif<br>
> > > +endif<br>
> > > +<br>
> > > +ifeq ($(LLVM_BUILD_DIR),)<br>
> > > +    $(error Could not find LLVM build output dir, please set it with LLVM_BUILD_DIR)<br>
> > > +endif<br>
> > > +GTEST_STATIC_LIB_DIR := $(LLVM_BUILD_DIR)/lib<br>
> > > +<br>
> > > +ifeq ($(LLVM_BUILD_INCLUDE_DIR),)<br>
> > > +    ifneq ($(wildcard $(LLVM_BUILD_DIR)/../include),)<br>
> > > +        LLVM_BUILD_INCLUDE_DIR := $(realpath $(LLVM_BUILD_DIR)/../include)<br>
> > > +    else ifneq ($(wildcard $(LLVM_BUILD_DIR)/include),)<br>
> > > +        LLVM_BUILD_INCLUDE_DIR := $(realpath $(LLVM_BUILD_DIR)/include)<br>
> > > +    endif<br>
> > > +endif<br>
> > > +<br>
> > > +ifeq ($(LLVM_BUILD_INCLUDE_DIR),)<br>
> > > +    $(error Could not find LLVM build directory include dir, please set it with LLVM_BUILD_INCLUDE_DIR)<br>
> > > +endif<br>
> > > +<br>
> > > +$(info LLVM_BASE_DIR = $(LLVM_BASE_DIR))<br>
> > > +$(info LLVM_BUILD_DIR = $(LLVM_BUILD_DIR))<br>
> > > +$(info GTEST_DIR = $(GTEST_DIR))<br>
> > > +$(info GTEST_INCLUDE_DIR = $(GTEST_INCLUDE_DIR))<br>
> > > +$(info GTEST_STATIC_LIB_DIR = $(GTEST_STATIC_LIB_DIR))<br>
> > > +<br>
> > > +CFLAGS_EXTRAS += -I $(GTEST_INCLUDE_DIR) -I $(LLVM_BASE_DIR)/include -I $(LLVM_BUILD_INCLUDE_DIR)<br>
> > > +LD_EXTRAS += $(GTEST_STATIC_LIB_DIR)/libgtest.a  $(GTEST_STATIC_LIB_DIR)/libgtest_main.a $(GTEST_STATIC_LIB_DIR)/libLLVMSupport.a<br>
> > > +<br>
> > > +include $(THIS_FILE_DIR)../../make/Makefile.rules<br>
> > > +<br>
> > > +test:: $(EXE)<br>
> > > +     $(realpath $(EXE))<br>
> > ><br>
> > > Added: lldb/trunk/test/c++/native_process/thread_state_coordinator/Makefile<br>
> > > URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/c%2B%2B/native_process/thread_state_coordinator/Makefile?rev=218422&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/c%2B%2B/native_process/thread_state_coordinator/Makefile?rev=218422&view=auto</a><br>
> > > ==============================================================================<br>
> > > --- lldb/trunk/test/c++/native_process/thread_state_coordinator/Makefile (added)<br>
> > > +++ lldb/trunk/test/c++/native_process/thread_state_coordinator/Makefile Wed Sep 24 17:57:33 2014<br>
> > > @@ -0,0 +1,14 @@<br>
> > > +LEVEL = ../../make<br>
> > > +<br>
> > > +CFLAGS_EXTRAS := -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS<br>
> > > +ENABLE_THREADS := YES<br>
> > > +CXX_SOURCES := $(wildcard *.cpp)<br>
> > > +MAKE_DSYM :=NO<br>
> > > +<br>
> > > +OS := $(shell uname -s)<br>
> > > +$(info OS $(OS))<br>
> > > +ifeq ($(OS),Linux)<br>
> > > +    LD_EXTRAS += -lncurses -ldl<br>
> > > +endif<br>
> > > +<br>
> > > +include $(LEVEL)/Makefile.rules<br>
> > ><br>
> > > Added: lldb/trunk/test/c++/native_process/thread_state_coordinator/ThreadStateCoordinatorTest.cpp<br>
> > > URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/test/c%2B%2B/native_process/thread_state_coordinator/ThreadStateCoordinatorTest.cpp?rev=218422&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/test/c%2B%2B/native_process/thread_state_coordinator/ThreadStateCoordinatorTest.cpp?rev=218422&view=auto</a><br>
> > > ==============================================================================<br>
> > > --- lldb/trunk/test/c++/native_process/thread_state_coordinator/ThreadStateCoordinatorTest.cpp (added)<br>
> > > +++ lldb/trunk/test/c++/native_process/thread_state_coordinator/ThreadStateCoordinatorTest.cpp Wed Sep 24 17:57:33 2014<br>
> > > @@ -0,0 +1,7 @@<br>
> > > +#include <limits.h><br>
> > > +#include "gtest/gtest.h"<br>
> > > +<br>
> > > +TEST(ThreadStateCoordinatorTest, ExpectEqualsWorks)<br>
> > > +{<br>
> > > +     EXPECT_EQ(1, 1);<br>
> > > +}<br>
> > ><br>
> > ><br>
> > > _______________________________________________<br>
> > > lldb-commits mailing list<br>
> > > <a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">lldb-commits@cs.uiuc.edu</a><br>
> > > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><br>
> ><br>
> > _______________________________________________<br>
> > lldb-commits mailing list<br>
> > <a href="mailto:lldb-commits@cs.uiuc.edu" target="_blank">lldb-commits@cs.uiuc.edu</a><br>
> > <a href="http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits</a><br>
> ><br>
> ><br>
> ><br>
> > --<br>
> > Todd Fiala |   Software Engineer |     <a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a> |     <a href="tel:650-943-3180" value="+16509433180" target="_blank">650-943-3180</a><br>
> ><br>
> ><br>
> ><br>
> ><br>
> > --<br>
> > Todd Fiala |   Software Engineer |     <a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a> |     <a href="tel:650-943-3180" value="+16509433180" target="_blank">650-943-3180</a><br>
> ><br>
><br>
><br>
><br>
><br>
> --<br>
> Todd Fiala |   Software Engineer |     <a href="mailto:tfiala@google.com" target="_blank">tfiala@google.com</a> |     <a href="tel:650-943-3180" value="+16509433180" target="_blank">650-943-3180</a><br>
><br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><table cellspacing="0" cellpadding="0" style="color:rgb(136,136,136);font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Todd Fiala |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div>
</div>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div dir="ltr"><table cellspacing="0" cellpadding="0" style="color:rgb(136,136,136);font-family:'Times New Roman'"><tbody><tr style="color:rgb(85,85,85);font-family:sans-serif;font-size:small"><td nowrap style="border-top-style:solid;border-top-color:rgb(213,15,37);border-top-width:2px">Todd Fiala |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(51,105,232);border-top-width:2px"> Software Engineer |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(0,153,57);border-top-width:2px"> <a href="mailto:tfiala@google.com" style="color:rgb(17,85,204)" target="_blank"><span style="background-color:rgb(255,255,204);color:rgb(34,34,34);background-repeat:initial initial">tfiala@google.com</span></a> |</td><td nowrap style="border-top-style:solid;border-top-color:rgb(238,178,17);border-top-width:2px"><font color="#1155cc"> <a>650-943-3180</a></font></td></tr></tbody></table><br></div>
</div>