Commit Graph

22145 Commits (b9a03b95aafb07eb32a8f99a671f2216acce96d4)

Author SHA1 Message Date
Nat Goodspeed b9a03b95aa On Windows, introduce viewer Job Object and assign children to it.
The idea is that, with the right flag settings, this will cause the OS to
terminate remaining viewer child processes when the viewer terminates --
whether or not it terminates intentionally. Of course, if LLProcess's caller
specifies autokill=false, e.g. to run the viewer updater, that asserts that we
WANT the child to persist beyond the viewer session itself.
2012-01-22 09:16:11 -05:00
Nat Goodspeed e690373b05 Since lltrans.h moved to llui, fix linux_updater/CMakeLists.txt. 2012-01-21 19:46:46 -05:00
Nat Goodspeed 47d9475707 Convert LLProcess consumers from LLSD to LLProcess::Params block.
Using a Params block gives compile-time checking against attribute typos. One
might inadvertently set myLLSD["autofill"] = false and only discover it when
things behave strangely at runtime; but trying to set myParams.autofill will
produce a compile error.
However, it's excellent that the same LLProcess::create() method can accept
either LLProcess::Params or a properly-constructed LLSD block.
2012-01-21 11:45:15 -05:00
Nat Goodspeed 6e214960ce Define LLProcess::Params; accept create(const LLSDParamAdapter<Params>&).
This allows callers to pass either LLSD formatted as before -- which all
callers still do -- or an actual LLProcess::Params block.
2012-01-20 20:19:50 -05:00
Nat Goodspeed 50d0446dd9 Automated merge with http://hg.lindenlab.com/richard/viewer-initparam-llcommon 2012-01-20 19:08:00 -05:00
Nat Goodspeed f0dbb87833 Per Richard, replace LLProcessLauncher with LLProcess.
LLProcessLauncher had the somewhat fuzzy mandate of (1) accumulating
parameters with which to launch a child process and (2) sometimes tracking the
lifespan of the ensuing child process. But a valid LLProcessLauncher object
might or might not have ever been associated with an actual child process.
LLProcess specifically tracks a child process. In effect, it's a fairly thin
wrapper around a process HANDLE (on Windows) or pid_t (elsewhere), with
lifespan management thrown in. A static LLProcess::create() method launches a
new child; create() accepts an LLSD bundle with child parameters. So building
up a parameter bundle is deferred to LLSD rather than conflated with the
process management object.
Reconcile all known LLProcessLauncher consumers in the viewer code base,
notably the class unit tests.
2012-01-20 18:10:40 -05:00
Richard Linden 4287dcaacf moved LLSDParam to llcommon so that LLSD<->Param Block conversion are usable by everyone 2012-01-20 14:55:39 -08:00
Richard Linden 057da807ac removed LLXUIXML library
moved LLInitParam, and LLRegistry to llcommon
moved LLUIColor, LLTrans, and LLXUIParser to llui
reviewed by Nat
2012-01-20 13:51:46 -08:00
Nat Goodspeed 083a9e0927 To grow std::string by a char, use push_back() instead of append(). 2012-01-19 17:04:55 -05:00
Nat Goodspeed 6fddfab6dd Try to fix argument quoting on Windows.
Despite LLProcessLauncher's list-of-argument-strings API, on Windows it must
ram them all into a single command-line string anyway. This means that if
arguments contain spaces (or anything else that would confuse Windows command-
line parsing), the target process won't receive the intended arguments.
Introduce double quotes for any arguments not already double-quoted by caller.
2012-01-19 16:41:17 -05:00
Nat Goodspeed 1ed5bb3ada Make embedded Python scripts compatible with Python 2.5 *SIGH*
Apparently our TeamCity build machines are still not up to Python 2.6.
2012-01-18 10:56:13 -05:00
Nat Goodspeed ff4addd1b4 Add tests for implicit-kill-on-destroy, also orphan() method. 2012-01-18 01:10:52 -05:00
Nat Goodspeed 06f9dbd8db Introduce static LLProcessLauncher::isRunning(ll_pid_t) method.
typedef LLProcessLauncher::ll_pid_t to be HANDLE on Windows, pid_t elsewhere.
Then we can define getProcessID() returning ll_pid_t on all platforms,
retaining getProcessHandle() for hypothetical existing consumers... of which
there are none in practice.
This lets us define isRunning(ll_pid_t) to encapsulate the platform-specific
logic to actually check on a running child process, turning non-static
isRunning() into a fairly trivial wrapper.
2012-01-18 01:09:50 -05:00
Nat Goodspeed 4bfd84d3be Add tests for child-process args management and for kill() method. 2012-01-17 21:40:41 -05:00
Nat Goodspeed 2ae9f921f2 Refactor llprocesslauncher_test.cpp for better code reuse.
Instead of free python() and python_out() functions containing a local
temporary LLProcessLauncher instance, with a 'tweak' callback param to
"do stuff" to that inaccessible object, change to a PythonProcessLauncher
class that sets up a (public) LLProcessLauncher member, then allows you to
run() or run() and then readfile() the output. Now you can construct an
instance and tweak to your heart's content -- without funky callback syntax --
before running the script.
Move all such helpers from TUT fixture struct to namespace scope. While
fixture-struct methods can freely call one another, introducing a nested class
gets awkward: constructor must explicitly require and bind a fixture-struct
pointer or reference. Namespace scope solves this.
(Truthfully, I only put them in the fixture struct originally because I
thought it necessary for calling ensure() et al. But ensure() and friends are
free functions; need only qualify them with tut:: namespace.)
2012-01-17 20:44:26 -05:00
Nat Goodspeed 51b26cab9a Any proper RAII class must either handle copying or be noncopyable.
NamedTempFile makes no attempt to deal with copying, therefore make it
noncopyable.
2012-01-17 20:30:46 -05:00
Nat Goodspeed 74fbd31813 Add first couple of LLProcessLauncher tests.
Run INTEGRATION_TEST_llprocesslauncher using setpython.py so we can find the
Python interpreter of interest.
Introduce python() function to run a Python script specified using
NamedTempFile conventions.
Introduce a convention by which we can read output from a Python script using
only the limited pre-January-2012 LLProcessLauncher API. Introduce
python_out() function to leverage that convention.
Exercise a couple of LLProcessLauncher methods using all the above.
2012-01-17 19:03:17 -05:00
Nat Goodspeed c0731c1c05 Add log message if LLProcessLauncher child fails to execv().
On a Posix platform (vfork()/execv() implementation), if for any reason the
execv() failed (e.g. executable not on PATH), the viewer would never know, nor
the user: the vfork() child produced no output, and terminated with rc 0! Add
logging, make child terminate with nonzero rc.
Remove pointless addArgument(const char*) overload: this does nothing for you
that the compiler won't do implicitly.
In llupdateinstaller.cpp, remove pointless c_str() call in addArgument() arg:
we were starting with a std::string, then extracting its c_str(), only to
construct a whole new std::string from it!
2012-01-17 18:55:42 -05:00
Nat Goodspeed a01dd3549c Make NamedTempFile::peep() a public member for debugging unit tests. 2012-01-17 18:40:05 -05:00
Nat Goodspeed b6a08ad007 Extract APR and temp-fixture-file helper code to indra/test.
Specifically:
Introduce ManageAPR class in indra/test/manageapr.h. This is useful for a
simple test program without lots of static constructors.
Extract NamedTempFile from llsdserialize_test.cpp to indra/test/
namedtempfile.h. Refactor to use APR file operations rather than platform-
dependent APIs.
Use NamedTempFile for llprocesslauncher_test.cpp.
2012-01-13 12:41:54 -05:00
Nat Goodspeed 39a86eda8d Add LLStreamQueue::size() and tests to exercise it. 2012-01-12 12:19:27 -05:00
Nat Goodspeed 61b5f3143e Introduce LLStreamQueue to buffer nonblocking I/O.
Add unit tests to verify basic functionality.
2012-01-05 15:43:23 -05:00
Nat Goodspeed 97876f6118 Fix sleep(0.5) to sleep(1) -- truncation to int makes that dubious. 2011-12-23 17:38:34 -05:00
Nat Goodspeed 8008d540e5 Should we expect EOF on one pipe before we finish reading the other?
Defend test against the ambiguous answer to that question by not recording, or
testing for, EOF history events.
Enrich output for history-verification failures: display whole history array.
2011-12-23 16:45:05 -05:00
Nat Goodspeed 802d4465b3 Automated merge with ssh://hg.lindenlab.com/nat/viewer-leap 2011-12-23 16:11:46 -05:00
Nat Goodspeed cf7c6f93f2 Make pipe-management logic more robust.
Previous logic was vulnerable to the case in which both pipes reached EOF in
the same loop iteration. Now we use std::list instead of std::vector, allowing
us to iterate and delete with a single pass.
2011-12-23 15:23:03 -05:00
Nat Goodspeed 29273ffba6 Comment out lookup table used only by commented-out code.
Otherwise the unreferenced declaration causes a fatal warning.
2011-12-22 17:27:53 -05:00
Nat Goodspeed 6ccba88101 Never call apr_proc_wait() inside child_status_callback().
Quiet the temporary child_status_callback() output.
Add a bit of diagnostic info if apr_proc_wait() returns anything but
APR_CHILD_DONE.
2011-12-22 17:18:02 -05:00
Nat Goodspeed 39c3efbda3 Add child_status_callback() function and arrange to call periodically.
At least on OS X 10.7, a call to apr_proc_wait(APR_NOWAIT) in fact seems to
block the caller. So instead of polling apr_proc_wait(), use APR callback
mechanism (apr_proc_other_child_register() et al.) and poll that using
apr_proc_other_child_refresh_all().
Evidently this polls the underlying system waitpid(), but the internal call
seems to better support nonblocking. On arrival in the
child_status_callback(APR_OC_REASON_DEATH) call, though, apr_proc_wait()
produces ECHILD: the child process in question has already been reaped.
The OS-encoded wait() status does get passed to the callback, but then we have
to use OS-dependent macros to tease apart voluntary termination vs. killed by
signal... a bit of a hole in APR's abstraction layer.
Wrap ensure_equals() calls with a macro to explain which comparison failed.
2011-12-22 16:20:19 -05:00
Nat Goodspeed 25ef0cd223 Tweak llprocesslauncher_test.cpp to run properly on Windows.
Fix EOL issues: "\r\n" vs. "\n".
On Windows, requesting a read in nonblocking mode can produce EAGAIN instead
of EWOULDBLOCK.
2011-12-21 20:42:11 -05:00
Nat Goodspeed 2fd0bc8648 Change llprocesslauncher_test.cpp eyeballing to program verification.
That is, where before we just flung stuff to stdout with the expectation that
a human user would verify, replace with assertions in the test code itself.
Quiet previous noise on stdout.
Introduce a temp script file that produces output on both stdout and stderr,
with sleep() calls so we predictably have to wait for it. Track and then
verify the history of our interaction with the child process, noting
especially EWOULDBLOCK attempts.
2011-12-21 17:00:43 -05:00
Nat Goodspeed 7832d8eccb Fix llprocesslauncher_test.cpp to work on Windows. 2011-12-21 11:12:48 -05:00
Nat Goodspeed 14c09c3ce5 Add unit-test module for LLProcessLauncher.
As always with llcommon, this is expressed as an "integration test" to
sidestep a circular dependency: the llcommon build depends on its unit tests,
but all our unit tests depend on llcommon.
Initial test code is more for human verification than automated verification:
does APR's child-process management in fact support nonblocking operations?
2011-12-21 10:06:26 -05:00
Oz Linden b022ebf13c merge changes for storm-1734 2011-12-20 10:39:06 -05:00
Oz Linden 2667c6a80f merge changes for storm-653 and storm-1737 2011-12-20 09:20:36 -05:00
Oz Linden 540dc4b955 merge up to latest viewer-development 2011-12-20 09:19:21 -05:00
Oz Linden 8ca5050231 merge changes for vmrg-206 2011-12-19 16:42:53 -05:00
Oz Linden 4d7d582535 pull back release tags 2011-12-19 16:41:50 -05:00
Oz Linden 4c8d00d1d3 update build params for oz viewer-trial build 2011-12-19 15:25:39 -05:00
Oz Linden a336f1ee39 merge changes for storm-1737 2011-12-19 13:16:01 -05:00
Jonathan Yap 5226629883 STORM-1737 panel_edit_skin.xml uses confusing historical terminology 2011-12-18 10:29:05 -05:00
Jonathan Yap 399bd5643c STORM-653 As a user i would like to be able to see the available number of attachments and remaining free slots. 2011-12-17 13:27:20 -05:00
Leslie Linden 16b6a47247 EXP-1742 FIX -- Clicking IM notification or receiving multiple IM notifications in quick succession crashes to desktop
* Moved toast logic for mouse hover out of the draw call to avoid chain of callbacks that lead to reordering of the draw list while we are iterating over it.
2011-12-16 15:07:04 -08:00
Oz Linden c7a7976010 merge changes for storm-1729 2011-12-16 10:07:31 -05:00
Oz Linden 67fafa40ae merge snowstorm issues to latest viewer-development 2011-12-16 10:07:06 -05:00
Oz Linden b015ab4bd2 merge changes for vmrg-206 2011-12-16 09:39:55 -05:00
Oz Linden 94673473ed merge changes for storm-1653 2011-12-15 16:06:08 -05:00
Oz Linden 916c4a79e5 merge changes for storm-1731 2011-12-15 16:05:26 -05:00
Oz Linden c0f5b24b54 merge changes for storm-1723 2011-12-15 16:04:40 -05:00
Oz Linden 1b6ee87bc8 merge changes for storm-1733 2011-12-15 16:03:34 -05:00