Commit Graph

105 Commits (05935d09124db6834ed7262b94de7558b6738590)

Author SHA1 Message Date
Oz Linden 18af6e397e merge changes for storm-1590 2011-09-09 12:43:07 -04:00
Logan Dethrow 5a03453b2c Corrected license information in llsingleton_test.cpp. 2011-09-08 11:03:21 -04:00
Nat Goodspeed 3d295fbf27 Automated merge with http://hg.secondlife.com/viewer-development 2011-09-07 18:14:40 -04:00
Nat Goodspeed b4a1d339fc STORM-1541: Add LLInstanceTracker tests for active-iterator asserts.
The recent class-static LLInstanceTracker::instance_iter and key_iter
reference count is intended to guard against deleting an instance of an
LLInstanceTracker subclass during iteration. Add tests for that functionality.
2011-09-07 17:29:08 -04:00
Logan Dethrow b8fddce34d Merge. Fixed issue with LLProxy code related to changes to the LLSocket interface. 2011-09-07 16:40:40 -04:00
Logan Dethrow 9a1e8d78fe Merge 2011-09-01 17:06:15 -04:00
Logan Dethrow 342005cd92 Clarified the reason for adding the deleteSingleton method to LLSingleton. Added a simple unit test to verify the functionality of the deleteSingleton method. 2011-09-01 17:05:22 -04:00
Richard Nelson 2154bccdc4 Automated merge with http://hg.secondlife.com/viewer-development 2011-08-31 11:51:38 -07:00
Nat Goodspeed bf906ac926 Re-add 3 llinstancetracker tests disabled by changeset 1ead63777bf6.
Fix LLInstanceTracker::key_iter constructor param; accepting
InstanceMap::iterator by non-const reference relied on Microsoft extension
that accepts non-const reference to an rvalue. Given typical iterator
implementation, simply accept by value instead, which makes gcc happy too.
2011-08-24 09:08:42 -04:00
Richard Linden 7ff36a724d better unit test for nested brackets in string replacement 2011-08-19 16:45:39 -07:00
Richard Linden 93645cf55c fix for not properly handling nested brackets in
string replacement, e.g. [[FOO]]
2011-08-19 16:41:53 -07:00
Richard Nelson 5c8f22c640 fix for gcc 2011-07-27 15:34:58 -07:00
Richard Nelson 75d2382dc3 fixed build 2011-07-26 18:54:07 -07:00
Richard Nelson 6b3a7480a1 merge 2011-07-26 15:47:53 -07:00
Richard Nelson df82fbffa2 removed last vestiges of llinstancetracerscopedguard 2011-07-26 14:35:54 -07:00
Nat Goodspeed 25ababd7a6 More FormatMessage compile errors, try again to fix 2011-07-19 10:40:02 -04:00
Nat Goodspeed 5379467ccb Fix copy/paste error in swiped FormatMessage() example code. 2011-07-19 10:18:12 -04:00
Nat Goodspeed 677609b722 Per Josh's comments in http://codereview.lindenlab.com/6510035/
Instead of low-level open(O_CREAT | O_EXCL) loop on all platforms, use
GetTempFileName() on Windows and mkstemp() elsewhere.
Don't append a final newline to NamedTempFile: use caller's data literally.
Tweak a couple comments.
2011-07-19 09:05:54 -04:00
Nat Goodspeed 790032d231 Use raw-string syntax for other Windows pathnames inserted to Python. 2011-07-16 22:24:31 -04:00
Nat Goodspeed 81dc440128 Use raw-string syntax for Python string containing Windows pathname.
Consider this pathname for llsdserialize_test.cpp:
C:\nats\indra\llcommon\tests\llsdserialize_test.cpp
Embed that in a Python string literal:
'C:\nats\indra\llcommon\tests\llsdserialize_test.cpp'
and you get a string containing:
C:
ats\indra\llcommon	ests\llsdserialize_test.cpp
where the \n became a newline and the \t became a tab character.
Hopefully Python raw-string syntax r'C:\etc\etc' works better.
2011-07-16 10:20:41 -04:00
Nat Goodspeed 2b509383cc Use C++ __FILE__ rather than Python __file__ to find indra work area.
In this case, the Python code in question is being written from a C++ string
literal to a temp script file in a platform-dependent temp directory -- so the
Python __file__ value tells you nothing about the location of the repository
checkout. Embedding __FILE__ from the containing C++ source file works better.
2011-07-15 22:32:06 -04:00
Nat Goodspeed 15c36ee9b3 If we're going to need indra.base.llsd, have to munge sys.path.
And at that point, the Python logic needed to bring in the llsd module is big
enough to warrant capturing it in a separate string variable common to
multiple tests.
2011-07-15 17:20:27 -04:00
Nat Goodspeed e41c4c90f0 Not all TC agents have llbase.llsd, fall back to indra.base.llsd 2011-07-15 16:01:43 -04:00
Nat Goodspeed fee07bb597 Try again to pacify VS fatal warning. 2011-07-15 14:24:37 -04:00
Nat Goodspeed 4b21954729 Muzzle VS warning 2011-07-15 14:02:45 -04:00
Nat Goodspeed 7341e01ce2 Add test to verify Python-to-C++ LLSD notation sequence.
Verify that an LLSD::String containing newlines works; verify that newlines
between items are accepted.
2011-07-15 12:42:49 -04:00
Nat Goodspeed c33cf379f2 Add test to verify C++-to-Python LLSD notation sequence.
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-15 11:53:05 -04:00
Nat Goodspeed e3b5d9fc5c Change NamedTempScript to NamedTempFile; allow streaming to it.
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-15 10:48:46 -04:00
Nat Goodspeed 1f58cd688f Pacify Linux gcc more thoroughly. 2011-07-14 20:20:35 -04:00
Nat Goodspeed 9f66409b88 #include correct headers for Windows _open() et al.
Also mollify Linux build, which gets alarmed when you implicitly ignore
write()'s return value. Ignore it explicitly.
2011-07-14 19:39:32 -04:00
Nat Goodspeed 5f37ec3c71 Avoid Boost.Filesystem: Boost package improperly built on Windows?
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-14 19:07:13 -04:00
Nat Goodspeed 8ca0f872f2 wstring_to_utf8str() accepts LLWString rather than std::wstring. 2011-07-14 17:12:02 -04:00
Nat Goodspeed 624c3f1a8e Use Linden wstring-to-string conversion, not boost::filesystem's.
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-14 16:24:31 -04:00
Nat Goodspeed 24508cc924 Attempt to fix minor build errors on Windows. 2011-07-14 15:27:36 -04:00
Nat Goodspeed 4c465f496f Eliminate use of PATH_MAX, which is bogus anyway. 2011-07-14 15:08:25 -04:00
Nat Goodspeed 0ab0efc327 Work around broken Windows command-line processing.
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-14 14:00:12 -04:00
Nat Goodspeed ec780a733f Still trying to fix Windows header-file-order problem. 2011-07-13 19:41:23 -04:00
Nat Goodspeed beea7cdc2d Attempt to fix confusing header-file-order problems on Windows. 2011-07-13 19:03:28 -04:00
Nat Goodspeed 0f66566620 Introduce support for C++ integration tests running Python scripts.
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-07-13 17:36:59 -04:00
Oz Linden b5c834c6fd merge changes for STORM-1051 2011-04-05 07:23:43 -04:00
Merov Linden ae1435e8ee Autobuild: fix for Mac build using XCode 2011-02-17 21:13:48 -08:00
Nat Goodspeed dad558250f Add test to call map-style functions with full map/array params.
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-09 23:28:10 -05:00
Nat Goodspeed a4d0a29c49 For test purposes, capture at registration each function's Vars*.
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-07 11:53:58 -05:00
Nat Goodspeed 1a1563bb15 Untested support for passing array to map-registered function.
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-06 21:32:25 -05:00
Nat Goodspeed f4f3791a5f Add test verifying passing LLSD() to const char* parameter.
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-06 11:57:19 -05:00
Nat Goodspeed e51ccdac0e Introduce zipmap() function and use it in place of frequent loops.
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-05 23:31:11 -05:00
Nat Goodspeed 934e8c3976 Make array-funcs success test exercise args-array-too-long case too.
Streamline a bit more redundancy from the code in that test.
2011-02-05 22:49:53 -05:00
Nat Goodspeed 54b1db2f65 Consolidate paramsa, paramsb, et al., into ["a"], ["b"] arrays.
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-05 22:29:43 -05:00
Nat Goodspeed 230d22ceb2 Fix Vars::cp dangling-pointer problem.
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-05 11:30:52 -05:00
Nat Goodspeed 950cac24cc Add successful calls to array-style functions. 2011-02-05 11:11:20 -05:00