summaryrefslogtreecommitdiff
path: root/indra/llcommon/tests
AgeCommit message (Collapse)Author
2016-08-29MAINT-5011: Fix abbreviateFile() test to run under .../indra/ path.Nat Goodspeed
This particular test relied on there being exactly one instance of the string "indra" in the source file's __FILE__ path -- which is usually true, but not if the developer clones the viewer source repo under a parent directory whose path itself contains "indra". Fix to handle any number of occurrences.
2016-08-17MAINT-5011: Use LLTHROW() instead of plain BOOST_THROW_EXCEPTION().Nat Goodspeed
A level of preprocessor indirection lets us later change the implementation if desired.
2016-08-17MAINT-5011: Add llexception_test.cpp with tests (and conclusions).Nat Goodspeed
llexception_test.cpp is an unusual test source in that it need not be verified on every build, so its invocation in indra/llcommon/CMakeLists.txt is commented out with that remark. Its purpose is to help a developer decide what base class(es) to use for LLException, how to throw and how to catch. Our current conclusions are written up as comments in llexception_test.cpp. Added CRASH_ON_UNHANDLED_EXCEPTION() and LOG_UNHANDLED_EXCEPTION() macros to llexception.h -- macros to log __FILE__, __LINE__ and __PRETTY_FUNCTION__ of the catch site. These invoke functions in llexception.cpp so we don't need to #include llerror.h for every possible catch site.
2016-07-21MAINT=6585: remove extraneous path manipulation from llleap_testGlenn Glazer
2016-07-21MAINT=6585: fix llleap_test to use llbase not indra.baseGlenn Glazer
2016-07-20MAINT=6585: fix llsdserialize_testGlenn Glazer
2016-07-19MAINT-5011: Introduce LLException base class for viewer exceptions.Nat Goodspeed
This also introduces LLContinueError for exceptions which should interrupt some part of viewer processing (e.g. the current coroutine) but should attempt to let the viewer session proceed. Derive all existing viewer exception classes from LLException rather than from std::runtime_error or std::logic_error. Use BOOST_THROW_EXCEPTION() rather than plain 'throw' to enrich the thrown exception with source file, line number and containing function.
2016-04-04merge with 4.0.3-releaseOz Linden
2016-03-17MergeRider Linden
2016-03-16merge changes for DRTVWR-417Oz Linden
2015-12-18MAINT-5976: Fix bug in LLCoros::set_consuming() mechanism.Nat Goodspeed
The original implementation of set_consuming() involved a bool* pointing to a local bool in VoidListener::operator()()'s stack frame. postAndSuspend() would set that bool (through the pointer) as soon as it returned from suspension. The trouble with that is that LLEventMailDrop potentially calls its new listener (fulfilling the future) immediately in the listen_impl() override -- in other words, way up at the top of postAndSuspend(), well before the code that sets the relevant bool. Instead, make the adapter formerly known as VoidListener bind the coroutine's get_consuming() value at adapter construction time (before listening on the LLEventPump), so that its operator()() has the coroutine's correct get_consuming() value to return. Eliminating the bool* makes the code both simpler AND more correct! This change makes that adapter very specific to coroutine usage. Rename it FutureListener and migrate it from lleventcoros.h into the .cpp file. Nobody else was using it anyway. Make corresponding changes to postAndSuspend2() and its WaitForEventOnHelper class -- whose name no longer corresponds to the function as it used to. Rename that one FutureListener2. The new FutureListener functionality, common to both these adapters, makes it useful to derive FutureListener2 from FutureListener. Introduce llmake(), a generic function to deduce template type arguments from function parameter types. This allows us to remove the voidlistener() and wfeoh() helper functions. Hiding VoidListener broke one of the lleventcoro_test.cpp tests. But that test was sort of a lame recap of an earlier implementation of postAndSuspend(), based on LLEventPump events. Recast that test to illustrate how to use a coroutine future to suspend a coroutine for something other than an LLEventPump. But that rubbed my nose in the fact that we MUST wrap future's context switching with proper management of the current coroutine. Introduce LLCoros::Future<T>, which wraps boost::dcoroutines::future<T>. Use LLCoros::Future<T> in postAndSuspend() and postAndSuspend2().
2015-12-16MAINT-5976: Introduce LLCoros::set_consuming(bool).Nat Goodspeed
set_consuming(true) tells each postAndSuspend() call to consume the event for which it is suspending.
2015-11-18WOLF-300: Try using a smaller data volume for LLLeap tests on Windows.Nat Goodspeed
2015-11-10remove execute permission from many files that should not have itOz Linden
2015-09-18Tweek to naming postEventAndSuspend -> postAndSuspendRider Linden
2015-09-18Set consistent terminology for yield/wait -> suspend for coroutines.Rider Linden
2015-07-10MAINT-5351: Finish cleaning up messy merge from backing out backoutNat Goodspeed
2015-07-10Automated merge with file:///Users/nat/linden/maint-4952-v-t-uNat Goodspeed
2015-07-10Merge restore of more selfless changesNat Goodspeed
2015-07-10Backed out changeset bab1000e1b2d: restore 'selfless' changesNat Goodspeed
2015-07-10Merge restore of selfless changesNat Goodspeed
2015-07-10Backed out changeset 6e1fa9518747: reapply 'selfless' changesNat Goodspeed
2015-07-07MergeRider Linden
2015-07-07Backout selfles merge 738255dbbfd679d9e615baab3398e5e345bbb3c5Rider Linden
2015-07-07Apply reverse patchRider Linden
2015-07-07Backed out selfless mergeRider Linden
2015-07-07Automated merge with ssh://bitbucket.org/nat_linden/viewer-selflessNat Goodspeed
2015-07-06Force Boost use of TR1 for result_of in testsRider Linden
2015-07-06Force Boost result_of to use TR1 for tests.Rider Linden
2015-07-02MAINT-5357: Introduce and populate llcoro:: namespace.Nat Goodspeed
To date, the coroutine helper functions in lleventcoro.h have been in the global namespace. Migrate them into llcoro namespace, and fix references. Specifically, LLVoidListener => llcoro::VoidListener, and voidlistener(), postAndWait(), both waitForEventOn(), postAndWait2(), errorException() and errorLog() have been moved into llcoro. Also migrate new LLCoros::get_self() and Suspending to llcoro:: namespace. While at it, I realized that -- having converted several lleventcoro.h functions from templates (for arbitrary 'self' parameter type) to ordinary functions, having moved them from lleventcoro.h to lleventcoro.cpp, we can now migrate their helpers from lleventcoro.h to lleventcoro.cpp as well. This eliminates the need for the LLEventDetail namespace; the relevant helpers are now in an anonymous namespace in the .cpp file: listenerNameForCoro(), storeToLLSDPath(), WaitForEventOnHelper and wfeoh().
2015-07-01MAINT-5351: Reorganize lleventcoro_test.cpp to be more readable.Nat Goodspeed
Each test<n>() method invokes a function from earlier in the source. It's much better if each of those functions immediately precedes the test that invokes it.
2015-07-01MAINT-5351: Remove 'self' parameter from coroutine functions.Nat Goodspeed
lleventcoro_test.cpp runs clean (as modified for new API), and all the rest builds clean, but the resulting viewer is as yet untested.
2015-06-30MAINT-5232: Add tests for new LLSingleton dependency functionality.Nat Goodspeed
2015-05-29MAINT-5232: Make LLPounceable noncopyable.Nat Goodspeed
Changing the queue-of-callables implementation to boost::signals2::signal, which is noncopyable, means that LLPounceable itself should be noncopyable.
2015-05-29MAINT-5232: Per Vir review, use Boost.Signals2 for LLPounceable.Nat Goodspeed
Vir points out that "queue of callables" is pretty much exactly what a signal does. Add unit tests to verify chronological order, also queue reset when fired.
2015-05-22MAINT-5232: Add LLPounceable template for delayed registrations.Nat Goodspeed
LLMuteList, an LLSingleton, overrides its getInstance() method to intercept control every time a consumer wants LLMuteList. This "polling" is to notice when gMessageSystem becomes non-NULL, and register a couple callbacks on it. Unfortunately there are a couple ways to request the LLMuteList instance without specifically calling the subclass getInstance(), which would bypass that logic. Moreover, the polling feels a bit dubious to start with. LLPounceable<T*> presents an idiom in which you can callWhenReady(callable) on the LLPounceable instance. If the T* is already non-NULL, it calls the callable immediately; otherwise it enqueues it for when the T* is set non-NULL. (This lets you "pounce" on the T* as soon as it becomes available, hence the name.) So if gMessageSystem were an LLPounceable<LLMessageSystem*>, LLMuteList's constructor could simply call gMessageSystem.callWhenReady() and relax: the callbacks would be registered either on LLMuteList construction or LLMessageSystem initialization, whichever comes later. LLPounceable comes with its very own set of unit tests. However, as of this commit it is not yet used in actual viewer code.
2015-05-22MAINT-5232: Clean up some dubious LLSingleton methods.Nat Goodspeed
Remove evil getIfExists() method, used by no one. Remove evil destroyed() method, used in exactly three places -- one of which is a test. Replace with equally evil instanceExists() method, which is used EVERYWHERE -- sigh.
2015-01-12Experimentally try full-size LLLeap stream test on Windows.Nat Goodspeed
The new toolchain may (!) have fixed a longstanding bug in LLLeap / APR when we try to pump large volumes of data through a Windows named pipe using APR nonblocking I/O. This used to fail pretty consistently because the APR nonblocking write call would sometimes spuriously return "would block" when in fact the data buffer was completely written; the caller would later retry, which of course would duplicate some of the data in the pipe. Preliminary experiments with VS 2013 suggest this may have been resolved. This changeset is to propagate the experiment to a wider range of Windows systems; we may need to revert it if in fact the bug persists.
2014-12-23fix dos line endingsOz Linden
2014-12-22Investigative check-in to see if system clock() function can be used to time ↵callum_linden
ms_sleep() calls and adjust expectations accordingly
2014-12-16For one use case, boost::bind() better than boost::phoenix::bind().Nat Goodspeed
We use boost::phoenix::placeholders::arg1 to imply a whole lambda expression, replacing boost::lambda. But to bind a plain function in a more straightforward way, seems classic boost::bind() works while boost::phoenix::bind() does not.
2014-12-16Isolate #pragma clang to __clang__ compilations.Nat Goodspeed
It's very irritating that Visual Studio produces a warning for unrecognized #pragmas, which we then merrily turn into an error -- #pragma is inherently compiler-specific!
2014-12-12Eliminate use of boost::lambda with boost::function (Trac #10864).Nat Goodspeed
https://svn.boost.org/trac/boost/ticket/10864 I've used boost::lambda with boost::function in a number of creative ways over the years. But the clang 6 shipped with Xcode 6 seems to have somehow broken lambda + function in Boost 1.57. boost::phoenix is a partial workaround. Sadly, lambda's comma-operator overload doesn't seem to be supported, necessitating a couple ugly workarounds. With real lambdas now supported by current compilers, I'm sure the Boost community has little incentive to repair the lambda + function problem. Presumably we'll be able to use such features ourselves Real Soon Now...
2014-12-11Disambiguate a few ensure() calls.Nat Goodspeed
These were of the form ensure(std::string, something convertible to bool). Not sure what the ambiguity was, but ensure(std::string, bool(something)) works better.
2014-11-14remove skip from llframetimer_test now that it is fixedOz Linden
2014-11-14merge up to tip of viewer-tools-updateOz Linden
2014-11-14rewrite an llframetimer test to be less sensitive to extended ms_sleep callsOz Linden
2014-11-14Skip LLFrameTimer test<3>, which fails with Xcode 6.x builds.Nat Goodspeed
Hopefully this is temporary until we figure out the real problem!
2014-10-23Bring in new TUT library build. Clean up ensure_equals() overloads.Nat Goodspeed
The new TUT library build eliminates the ambiguity about ensure_equals(const char*, ...) versus ensure_equals(const std::string&, ...). Now it's all based on const std::string&. Remove pointless const char* overloads and ambiguous forwarding templates. With clang in Xcode 6, any new datatypes we intend to use with ensure_equals() must have operator<<(std::ostream&, datatype) declared BEFORE lltut.h #includes tut.hpp. Reorder code in certain test source files to guarantee that visibility.
2014-10-22Remove unit test case that relied on undefined order of evaluationOz Linden
in: 'cout << a() << b()' the order of evaluation of a() and b() is undefined.