summaryrefslogtreecommitdiff
path: root/indra/llcommon/tests
AgeCommit message (Collapse)Author
2011-07-15Add test to verify Python-to-C++ LLSD notation sequence.Nat Goodspeed
Verify that an LLSD::String containing newlines works; verify that newlines between items are accepted.
2011-07-15Add test to verify C++-to-Python LLSD notation sequence.Nat Goodspeed
Write a sequence of LLSDSerialize::toNotation() calls separated by newlines to a data file, then read lines and parse using llbase.llsd.parse(). Verify that this produces expected data even when one item is a string containing newlines. Generalize python() helper function to allow using any of the NamedTempFile constructor forms. Allow specifying expected Python rc (default 0) and use this to verify an intentional sys.exit(17). This is better than previous sys.exit(0) test because when, at one point, NamedTempFile failed to write file data, running Python on an empty script file still terminates with rc 0. A nonzero rc verifies that we've written the file, that Python is running it and that we're retrieving its rc.
2011-07-15Change NamedTempScript to NamedTempFile; allow streaming to it.Nat Goodspeed
The only thing about NamedTempScript that was specific to script files was the hardcoded ".py" extension. Renaming it to NamedTempFile with an explicit extension argument addresses that. Allow constructing NamedTempFile with either a std::string, as before, or an expression of the form (lambda::_1 << some << stuff). If Linden's Boost package included the Boost.Iostreams lib, we could even stream such an expression directly to an ostream constructed around the fd. But oh well.
2011-07-14Pacify Linux gcc more thoroughly.Nat Goodspeed
2011-07-14#include correct headers for Windows _open() et al.Nat Goodspeed
Also mollify Linux build, which gets alarmed when you implicitly ignore write()'s return value. Ignore it explicitly.
2011-07-14Avoid Boost.Filesystem: Boost package improperly built on Windows?Nat Goodspeed
Seems Linden's Boost package and the viewer build might use different settings of the /Zc:wchar_t switch. Anyway, this implementation using open(O_CREAT | O_EXCL) should be more robust. I'm surprised Boost.Filesystem doesn't seem to offer "create a unique file"; all I found was "generate a random filename fairly likely to be unique."
2011-07-14wstring_to_utf8str() accepts LLWString rather than std::wstring.Nat Goodspeed
2011-07-14Use Linden wstring-to-string conversion, not boost::filesystem's.Nat Goodspeed
On Windows, calling boost::filesystem::path::string() implicitly requests code conversion between std::wstring (the boost::filesystem::path::string_type selected on Windows) and std::string. At least for integration-test program, that produces link errors. Use Linden's wstring_to_utf8str() instead.
2011-07-14Attempt to fix minor build errors on Windows.Nat Goodspeed
2011-07-14Eliminate use of PATH_MAX, which is bogus anyway.Nat Goodspeed
2011-07-14Work around broken Windows command-line processing.Nat Goodspeed
It's wonderful that the Python interpreter will accept a whole multi-line script as a composite -c argument... but because Windows command-line processing is fundamentally flawed, we simply can't count on it for Windows. Instead, accept script text, write a temporary script file in a system- dependent temp directory, ask Python to run that script and delete the file. Also, on Windows, use _spawnl(), much simpler than adding bizarre Windows wait logic to LLProcessLauncher. Use LLProcessLauncher only on Mac & Linux, with waitpid() to capture rc.
2011-07-13Still trying to fix Windows header-file-order problem.Nat Goodspeed
2011-07-13Attempt to fix confusing header-file-order problems on Windows.Nat Goodspeed
2011-07-13Introduce support for C++ integration tests running Python scripts.Nat Goodspeed
This is in its infancy; tested on Mac; needs to be ironed out on Windows and Linux. Goal is to test at least some cross-language LLSD serialization.
2011-04-05merge changes for STORM-1051Oz Linden
2011-02-17Autobuild: fix for Mac build using XCodeMerov Linden
2011-02-09Add test to call map-style functions with full map/array params.Nat Goodspeed
Test also passes overlong arrays and maps with extraneous keys; in all cases we expect the same set of values to be passed to the registered functions.
2011-02-07For test purposes, capture at registration each function's Vars*.Nat Goodspeed
We'd introduced FunctionsTriple to associate a pair of registered function names with the Vars* on which those functions should operate. But with more different tests coming up, it became clear that restating the Vars* every time a given function name appeared in any such context was redundant. Instead, extended addf() to accept and store the relevant Vars* for each registered function, be it the global Vars for the free functions and static methods or the stack Vars for the non-static methods. Added varsfor() function to retrieve and validate the Vars* for a given function name. Eliminated array_funcs() function, restating aggregates of names to test as LLSD collections. Where before these were coerced into a separate LLSD map with ["a"] and ["b"] keys, that map can now be part of the original structure.
2011-02-06Untested support for passing array to map-registered function.Nat Goodspeed
An array-registered function has no param names, so you can only pass an array: a map would be meaningless. Initial implementation of map-registered functions assumed that since you CAN pass a map, you MUST pass a map. But in fact it's meaningful to pass an array as well -- for whatever reason -- and easy to implement, so there you are. Tests to follow.
2011-02-06Add test verifying passing LLSD() to const char* parameter.Nat Goodspeed
LLSDParam<const char*> is coded to pass NULL for an isUndefined() LLSD value, so event-based caller can choose whether to pass NULL, "" or whatever string value to such a parameter. Ensure this behavior.
2011-02-05Introduce zipmap() function and use it in place of frequent loops.Nat Goodspeed
One operation we often use is to take an LLSD array of param names, a corresponding LLSD array of values, and create from them a name=value LLSD map. Instead of doing that "by hand" every time, use a function.
2011-02-05Make array-funcs success test exercise args-array-too-long case too.Nat Goodspeed
Streamline a bit more redundancy from the code in that test.
2011-02-05Consolidate paramsa, paramsb, et al., into ["a"], ["b"] arrays.Nat Goodspeed
Following the C++ convention of having two distinct somethigna, somethingb names, initially we introduced paramsa, paramsb LLSD arrays, following that convention all the way down the line. This led to two distinct loops every time we wanted to walk both arrays, since we didn't want to assume that they were both the same size. But leveraging the fact that distinct LLSD arrays stored in the same LLSD container can in fact be of different lengths, refactored all the pairs of vars into top-level LLSD maps keyed by ["a"] and ["b"]. That lets us perform nested loops rather than duplicating the logic, making test code much less messy.
2011-02-05Fix Vars::cp dangling-pointer problem.Nat Goodspeed
Naively storing a const char* param in a const char* data member ignores the fact that once the caller's done, the string data referenced by that pointer will probably be freed. Store the referenced string in a std::string instead.
2011-02-05Add successful calls to array-style functions.Nat Goodspeed
2011-02-04fix linking to llqtwebkit.Alain Linden
2011-02-04Change FunctionsTriple refs to pointers to facilitate passing.Nat Goodspeed
A certain popular-but-dumb compiler seems to think that initializing a std::vector from a pair of iterators requires assignment. A struct containing a reference cannot be assigned. Pointers get us past this issue.
2011-02-04Move FunctionsTriple data to function returning vector<same>.Nat Goodspeed
We want to break out a couple different test methods that both need the same data. While we could define a std::vector<FunctionsTriple> in the lleventdispatcher_data class and initialize it using a classic {} initializer as in array_funcs(), using a separate function puts it closer to the tests consuming that data, and helps reduce clutter in the central data class. Either way, it's cool that BOOST_FOREACH() handles the gory details of iterating over a std::vector vs. a classic-C array.
2011-02-03BOOST_FOREACH(LLSD) helpers more readable with 'using namespace'.Nat Goodspeed
2011-02-03Introduce BOOST_FOREACH() helpers for LLSD in llsdutil.h.Nat Goodspeed
You can't directly write: BOOST_FOREACH(LLSD item, someLLSDarray) { ... } because LLSD has two distinct iteration mechanisms, one for arrays and one for maps, neither using the standard [const_]iterator typedefs or begin()/end() methods. But with these helpers, you can write: BOOST_FOREACH(LLSD item, llsd::inArray(someLLSDarray)) { ... } or BOOST_FOREACH(const llsd::MapEntry& pair, llsd::inMap(someLLSDmap)) { ... } These are in namespace llsd instead of being (e.g.) llsd_inMap because with a namespace at least your .cpp file can have a local 'using': using namespace llsd; BOOST_FOREACH(LLSD item, inArray(someLLSDarray)) { ... } It's namespace llsd rather than LLSD because LLSD can't be both a namespace and a class name.
2011-02-03Add test to call array-style functions with too-short array.Nat Goodspeed
Also, finally got sick of hand-writing the official iterator-loop idiom and dragged in BOOST_FOREACH(). Because LLSD has two completely different iteration styles, added inArray and inMap helper classes to be able to write: BOOST_FOREACH(LLSD item, inArray(someArray)) { ... }
2011-02-02Add test to call no-args functions using (map | array)-style callsNat Goodspeed
2011-02-02Add test to exercise map/array args mismatch validation.Nat Goodspeed
2011-02-02First few LLEventDispatcher call cases: try_call(), call CallablesNat Goodspeed
2011-02-01Replace ad-hoc test functions/methods with systematic enumeration.Nat Goodspeed
Previous tests involved a small handful of functions with only a couple different parameter types. Now we exhaustively invoke every registration case, plus every metadata query case. Call cases still pending.
2011-01-31HACK just to get the build to work. FIX THIS TEST!Alain Linden
2011-01-28Extend LLEventAPI to directly call other functions & methods.Nat Goodspeed
Until now, LLEventAPI has only been able to register functions specifically accepting(const LLSD&). Typically you add a wrapper method to your LLEventAPI subclass, register that, have it extract desired params from the incoming LLSD and then call the actual function of interest. With help from Alain, added new LLEventAPI::add() methods capable of registering functions/methods with arbitrary parameter signatures. The code uses boost::fusion magic to implicitly match incoming LLSD arguments to the function's formal parameter list, bypassing the need for an explicit helper method. New add() methods caused an ambiguity with a previous convenience overload. Removed that overload and fixed the one existing usage. Replaced LLEventDispatcher::get() with try_call() -- it's no longer easy to return a Callable for caller to call directly. But the one known use of that feature simply used it to avoid fatal LL_ERRS on unknown function-name string, hence the try_call() approach actually addresses that case more directly. Added indra/common/lleventdispatcher_test.cpp to exercise new functionality.
2010-08-24standardizing test suite names as class name under testAaron Terrell (Enus)
2010-08-13Change license from GPL to LGPL (version 2.1)Oz Linden
2010-06-07Automated merge with ssh://hg.lindenlab.com/dessie/viewer-releaseMark Palange (Mani)
2010-06-04Fix a long-suffering logging unit test failure, re-enable the test.Tofu Linden
This makes logs look less scary on Linux, in-line with other platforms.
2010-06-02EXT-3780 FIX Fixed CPU MHz to be MHz on all platforms.palange@pdp47.lindenlab.com
2010-06-01Added eol-at-eofMark Palange (Mani)
2010-06-01EXT-3780 FIX Added llprocessor regression testMark Palange (Mani)
2010-02-06EXT-5055 LLInstanceTracker promotes some dangerous patterns - detect themTofu Linden
2009-12-03Skip logging test that fails on Linux, no idea whyNat Goodspeed
2009-11-12DEV-42747 - lltreeiterators_test.cpp broken on Windowsrichard
reviewed by Nat
2009-11-10Enhance LLInstanceTracker variants to be more uniform.Nat Goodspeed
For both the (so far unused) generic KEY form and the KEY = T* form, provide key_iter, beginKeys(), endKeys(). Change instance_iter so that when dereferenced, it gives you a T& rather than a T*, to be more harmonious with a typical STL container. (You parameterize LLInstanceTracker with T, not with T*.) Fix existing usage in llfasttimer.cpp and lltimer.cpp to agree. For the KEY = T* specialization, add T* getInstance(T*) so client isn't forced to know which variant was used. Add unit tests for uniformity of public operations on both variants.
2009-10-20Automated merge with ssh://hg.lindenlab.com/viewer/viewer-2-0/Nat Goodspeed
2009-10-20Don't include linden_common.h in lldate.h, or any other .h files.Nat Goodspeed
Migrate to the .cpp files where it's needed.