Commit Graph

50 Commits (f729cfc33f258781c5fd85a3d8773bf6149d12db)

Author SHA1 Message Date
Bennett Goble f729cfc33f SL-15742: Convert build scripts to Python 3
This changeset makes it possible to build the Second Life viewer using
Python 3. It is designed to be used with an equivalent Autobuild branch
so that a developer can compile without needing Python 2 on their
machine.

Breaking change: Python 2 support ending

Rather than supporting two versions of Python, including one that was
discontinued at the beginning of the year, this branch focuses on
pouring future effort into Python 3 only. As a result, scripts do not
need to be backwards compatible. This means that build environments,
be they on personal computers and on build agents, need to have a
compatible interpreter.

Notes

- SLVersionChecker will still use Python 2 on macOS
- Fixed the message template url used by template_verifier.py
2021-12-10 14:42:49 -08:00
Nat Goodspeed 2902f23a41 DRTVWR-476: Remove special llcorehttp test memory manager.
NickyD discovered that the substitute default allocator used for llcorehttp
tests was returning badly-aligned storage, which caused access violations on
alignment-sensitive data such as std::atomic. Thanks Nicky!!

Moreover, the llcorehttp test assertions regarding memory usage, well-
intentioned though they are, have been causing us trouble for years. Many have
already been disabled.

The problem is that use of test_allocator.h affected *everything* defined with
that header file's declarations visible. That inevitably included specific
functions in other subsystems. Those functions then (unintentionally) consumed
the special allocator, throwing off the memory tracking and making certain
memory-related assertions consistently fail.

This is a particular, observable bad effect of One Definition Rule violations.
Within a given program, C++ allows multiple definitions for the same entity,
but requires that all such definitions be the same. Partial visibility of the
global operator new() and operator delete() overrides meant that some
definitions of certain entities used the default global allocator, some used
llcorehttp's. There may have been other, more subtle bad effects of these ODR
violations.

If one wanted to reimplement verification of the memory consumption of
llcorehttp classes:

* Each llcorehttp class (for which memory tracking was desired) should declare
  class-specific operator new() and operator delete() methods. Naturally,
  these would all consume a central llcorehttp-specific allocator, but that
  allocator should *not* be named global operator new().
* Presumably that would require runtime indirection to allow using the default
  allocator in production while substituting the special allocator for tests.
* Recording and verifying the memory consumption in each test should be
  performed in the test-object constructor and destructor, rather than being
  sprinkled throughout the test<n>() methods.
* With that mechanism in place, the test object should provide methods to
  adjust (or entirely disable) memory verification for a particular test.
* The test object should also provide a "yes, we're still consuming llcorehttp
  memory" method to be used for spot checks in the middle of tests -- instead
  of sprinkling in explicit comparisons as before.
* In fact, the llcorehttp test object in each test_*.hpp file should be
  derived from a central llcorehttp test-object base class providing those
  methods.
2020-03-25 18:44:04 -04:00
andreykproductengine 344a3a040f Teamcity W64 build freeze. 2019-02-15 22:05:44 +02:00
andreykproductengine eb1c3c5cbb Fix for teamcity W64 build freeze. 2019-02-08 22:22:06 +02:00
Nat Goodspeed 1e49cd9b00 DRTVWR-418: Disable more needlessly fragile memory consumption tests. 2017-09-20 17:11:06 -04:00
Nat Goodspeed 2368c44a8e DRTVWR-418: Disable another fragile llcorehttp memory-usage check. 2017-08-15 16:31:17 -04:00
Nat Goodspeed a0c1842595 DRTVWR-418: Fix syntax for previous test skip. 2017-02-13 16:53:18 -05:00
Nat Goodspeed a971909a34 DRTVWR-418: Reluctantly skip llcorehttp 503-with-retry test on W64. 2017-02-13 16:07:38 -05:00
Nat Goodspeed f4ecfd9cb9 MAINT-5232: Disable unrealistic failing checks on GetMemTotal(). 2016-09-27 10:41:24 -04:00
Nat Goodspeed acbee7ffab MAINT-5232: Give up on running mem test twice: doesn't work 2016-09-27 10:36:14 -04:00
Nat Goodspeed 1a34afb1cc MAINT-5232: Try workaround for dubious llcorehttp mem usage test. 2016-09-23 06:16:46 -07:00
Oz Linden 9be58e915a merge with 4.0.3-release 2016-04-04 15:53:09 -04:00
Oz Linden c8726aba30 remove execute permission from many files that should not have it 2015-11-10 09:48:56 -05:00
Rider Linden 6ff0bff8f0 Another fix for unit tests. Missed on Windows. 2015-10-15 11:42:43 -07:00
Rider Linden b30e408a42 MAINT-5732: Update unit tests 2015-10-15 11:03:13 -07:00
Rider Linden 7ff38e34ea Update the unit tests to use the new pointer type. 2015-07-08 12:44:57 -07:00
Monty Brandenberg 6d405e2d01 Convert one more unit test over to improved waiting scheme to avoid build failures. 2013-10-04 18:24:59 -04:00
Monty Brandenberg 6f5790da38 Merge. Pull in viewer-release after 3.6.7 release. 2013-10-04 15:36:52 -04:00
Monty Brandenberg eff651cffc SH-4312 Configuration data between viewer and llcorehttp is clumsy.
Much improved.  Unified the global and class options into a single
option list.  Implemented static and dynamic setting paths as much
as possible.  Dynamic path does require packet/RPC but otherwise
there's near unification.  Dynamic modes can't get values back yet
due to the response/notifier scheme but this doesn't bother me.
Flatten global and class options into simpler struct-like entities.
Setter/getter available on these when needed (external APIs) but code
can otherwise fiddle directly when it knows what to do.  Much duplicated
options/state removed from HttpPolicy.  Comments cleaned up.  Threads
better described and consistently mentioned in API docs.  Integration
test extended for 503 responses with Reply-After headers.
2013-07-12 15:00:24 -04:00
Monty Brandenberg 8a83408185 MAINT-2302 Tests frequently fail on Windows builds.
I'm calling this the more correct fix.  The httprequest tests
actually talk to an HTTP server running in the Python test
scaffold script.  Under severe CPU competition, it may not
get the cycles needed to start up and make progress.  So this
modifies the test to spin a little faster and dwell waiting
on the server for a longer period.  Hope this will be
adequate to make the tests reliable.
2013-05-14 11:52:12 -04:00
Monty Brandenberg 73f474d886 Merge. Refresh from /lindenlab/viewer-cat prior to pushing. 2013-05-13 18:34:54 -04:00
Monty Brandenberg 81ffd3fcca Whinge reduction effort on the unit tests. Python 2.7 SocketServer
library has new exception-throwing behavior when a client disconnects
unannounced.  Generally ignore exceptions as a result as we don't
care about the server side.  On HTTP trace-mode tests, spin a little
faster and longer to give libcurl time to emit all the junk it wants
to send us.  Should reduce 'reasonable time' failures on tests <12>
and <13>.
2013-05-13 18:32:03 -04:00
simon ee2fce8790 Merge downstream code and viewer-beta 2013-05-09 14:10:45 -07:00
Monty Brandenberg f5e8457e4e BUG-2295/MAINT-2624 unexpected crash around Content-Range: header processing
Not certain what the source of the short data is with one resident but I'm
going to make these problems retryable as they are transport-related.  Lift
the retry detection into a method that should be reusable by others interested
in determining what is retryable.  Trace output handling on the libcurl debug
callback was attrocious.  Some unsafe length handling on my part was protected
by a second layer of defense.  Made that correct and more useful by logging
actual data sizes during trace.
2013-05-06 12:12:05 -04:00
Monty Brandenberg f9850aa5d2 BUG-2295/MAINT-2624 [FIXED] Crash in HttpOpRequest::stageFromActive w/ Content-Range
Don't rely on a response body being present should a
Content-Range header be parsed.  Unit tests captured
the original crash and confirm the fix.
2013-04-29 17:09:13 -04:00
Monty Brandenberg 4eef1c8a2e SH-4106 Significantly upgrade the HttpHeaders interface for SSB.
Header container moves from a vector of raw lines to a vector
of string pairs representing name/value pairs in headers.  For
incoming headers, we normalize the name to lowercase and trim
it.  Values are only left-trimmed.  Outgoing headers are left
as-is.  Simple find() method for the common case, forward and
reverse iterators for those few who need to do it themselves.
The HTTP status line (e.g. 'HTTP/1.1 200 Ok') is no longer treated
as a header to be returned to caller.  Unit tests, as usual,
were a bear but they absolutely ensured outgoing HTTP header
conformance after the change.  Grunt work paid off.

LLTextureFetch was also given a second options structure
for texture fetches.  Same as the original but with header return
to caller requested.  Baked textures should use this, the other
20,000 texture fetch requests should continue to use the original.
2013-04-15 16:55:35 +00:00
Graham Madarasz bf6182daa8 Update Mac and Windows breakpad builds to latest 2013-03-29 07:50:08 -07:00
Monty Brandenberg 81b9e29a1f DRTVWR-209 Merge of viewer-development with SH-3316 drano-http code.
Cmake files not merged correctly and had to be done by hand.  New memory
allocation made some memory usage tests in the llcorehttp integration
tests no longer valid.  Would like to work on LLLog sometime and get
it to be consistent.  Special flags needed for windows build of example
program.
2012-09-07 18:55:04 -04:00
Monty Brandenberg 8d3e5f3959 SH-3241 Validate header correctness, SH-3243 more unit tests
Define expectations for headers for GET, POST, PUT requests.
Document those in the interface, test those with integration tests.
Verify that header overrides work as expected.
2012-07-16 17:35:44 -04:00
Monty Brandenberg d238341afa SH-3189 Remove/improve naive data structures
When releasing HTTP waiters, avoid unnecessary sort activity.
For Content-Type in responses, let libcurl do the work and removed
my parsing of headers.  Drop Content-Encoding as libcurl will deal
with that.  If anyone is interested, they can parse.
2012-07-16 11:53:04 -04:00
Monty Brandenberg 5eb5dc6b27 SH-3241 validate that request headers are correct
First round of integration tests.  Added a request header 'reflector'
to the web server to sent the client's headers back with a 'X-Reflect-'
prefix.  Use boost::regex to check various headers.  Run a test on
a simple GET and a byte-ranged GET a la texture fetch.
2012-07-13 18:24:49 -04:00
Monty Brandenberg 7010459f04 SH-3240 Capture Content-Type and Content-Encoding headers.
HttpResponse object now has two strings for these content headers.
Either or both may be empty.  Tidied up the cross-platform string
code and got more defensive about the length of a header line.
Integration test for the new response object.
2012-07-11 15:53:57 -04:00
Monty Brandenberg bc72acbfd2 SH-3244 Syscall avoidance in HttpRequest::update() method
Well, achieved that by doing work in bulk when needed.  But
turned into some additional things.  Change timebase from
mS to uS as, well, things are headed that way.  Implement
an HttpReplyQueue::fetchAll method (advertised one, hadn't
implemented it).
2012-07-10 18:50:21 -04:00
Monty Brandenberg 398d78a773 Rework the 'sleep' logic in the test HTTP server so that the
30-second hang doesn't break subsequent tests.  Did this by
introducing threads into the HTTP server as I can't find the magic
to detect that my client has gone away.
2012-07-09 13:28:50 -04:00
Monty Brandenberg e8b0088d1a SH-3184/SH-3221 More work on cleanup with better unit test work and more aggressive shutdown of a thread.
Some additional work let me enable a memory check for the clean shutdown case and
generally do a better job on other interfaces.  Request queue waiters now awake
on shutdown and don't sleep once the queue is turned off.  Much better semantically
for how this will be used.
2012-06-26 12:28:58 -04:00
Monty Brandenberg e172ec84fa SH-3184/SH-3221 Improve cleanup, destructor, thread termination, etc. logic in library.
With this commit, the cleanup paths should be production quality.  Unit tests have been
expanded to include cases requiring thread termination and cleanup by the worker thread.
Special operation/request added to support the unit tests.  Thread interface expanded
to include a very aggressive cancel() method that does not do cleanup but prevents the
thread from accessing objects that will be destroyed.
2012-06-23 23:33:50 -04:00
Monty Brandenberg ed55eec8e3 Always another platform build fix. Mac this time. 2012-06-22 12:44:54 -04:00
Monty Brandenberg ed5db30654 Preparing for better shutdown/cleanup logic. 2012-06-21 21:32:33 -04:00
Monty Brandenberg a066bc1994 SH-3181 More interface options for API. Also includes returned headers.
Only thing interesting in this changeset is the discovery that a sleep
in the fake HTTP server ties up tests.  Need to thread that or fail on
client disconnect or something to speed that up and make it usable for
bigger test scenarios.  But good enough for now...
2012-06-20 18:43:28 -04:00
Monty Brandenberg f0353abe76 Implement timeout and retry count options for requests.
Pretty straightforward.  Still don't like how I'm managing
the options block.  Struct?  Accessors?  Can't decide.  But
the options now speed up the unit test runs even as I add
tests.
2012-06-19 15:43:29 -04:00
Monty Brandenberg b08125a587 LLMutex recursive lock, global & per-request tracing, simple GET request, LLProxy support, HttpOptions starting to work, HTTP resource waiting fixed.
Non-LLThread-based threads need to do some registration or LLMutex locks taken out in these
threads will not work as expected (SH-3154).  We'll get a better solution later, this fixes
some things for now.  Tracing of operations now supported.  Global and per-request (via
HttpOptions) tracing levels of [0..3].  The 2 and 3 levels use libcurl's VERBOSE mode
combined with CURLOPT_DEBUGFUNCTION to stream high levels of detail into the log.  *Very*
laggy but useful.  Simple GET request supported (no Range: header).  Really just a
degenrate case of a ranged get but supplied an API anyway.  Global option to use the
LLProxy interface to setup CURL handles for either socks5 or http proxy usage.  This
isn't really the most encapsulated way to do this but a better solution will have to
come later.  The wantHeaders and tracing options are now supported in HttpOptions giving
per-request controls.  Big refactoring of the HTTP resource waiter in lltexturefetch.
What I was doing before wasn't correct.  Instead, I'm implementing the resource wait
after the Semaphore model (though not using system semaphores).  So instead of having
a sequence like:  SEND_HTTP_REQ -> WAIT_HTTP_RESOURCE -> SEND_HTTP_REQ, we now
do WAIT_HTTP_RESOURCE -> WAIT_HTTP_RESOURCE2 (actual wait) -> SEND_HTTP_REQ.  Works
well but the prioritized filling of the corehttp library needs some performance
work later.
2012-06-14 16:31:48 -04:00
Monty Brandenberg 7adeb39237 HTTP Proxy, PUT & POST, unit tests and refactoring.
Implemented/modified PUT & POST to not used chunked encoding for the request.
Made the unit test much happier and probably a better thing for the pipeline.
Have a cheesy static & dynamic proxy capability using both local options and
a way to wire into LLProxy in llmessages.  Not a clean thing but it will get
the proxy path working with both socks5 & http proxies.  Refactoring to get
rid of unneeded library handler and unified an HttpStatus return for all
requests.  Big batch of code removed as a result of that and more is possible
as well as some syscall avoidance with a bit more work.  Boosted the unit
tests for simple PUT & POST test which revealed the test harness does *not*
like chunked encoding so we'll avoid it for now (and don't really need it
in any of our schemes).
2012-06-12 17:42:33 -04:00
Monty Brandenberg 75242eab8f Bring in the testrunner/http server scaffold for better integration testing.
This brings in a copy of llmessage's llsdmessage testing server.  We run
a mocked HTTP service to handle requests and the integration tests run
against it by picking up the LL_TEST_PORT environment variable when running.
Add some checks and output to produce useful info when run in the wrong
environment and when bad status is received.  Later will add a dead port
as well so we can test that rather than use 'localhost:2'.
2012-06-11 19:06:52 -04:00
Monty Brandenberg f4a59854c5 Unit test fixups. Mac/Linux detect memory leak due to llwarns, try/catch cleanup.
Our logging holds on to a changing bit of memory between operations and the memory
leak detection I'm using senses this and complains.  So, for now, disable the
final memory check on Mac & Linux, leave it active on Windows.  Solve this for
real some other day.  Add try/catch blocks to do cleanup in unit tests that go
wrong so that we don't get a cascade of assertion failures when subsequent tests
find singletons still alive.
2012-06-11 12:24:54 -04:00
Monty Brandenberg 28a04400b4 Implemented HTTP retry for requests. Went in rather easily which
surprised me.  Added a retry queue similar to ready queue to the
policy object which is sorted by retry time.  Currently do five
retries (after the initial try) delayed by .25, .5, 1, 2 and 5
seconds.  Removed the retry logic from the lltexturefetch module.
Upped the waiting time in the unit test for the retries.  People
won't like this but tough, need tests.
2012-06-08 20:21:54 -04:00
Monty Brandenberg b8edacd0bb Major steps towards implementing the policy component.
Identified and reacted to the priority inversion problem we
have in texturefetch.  Includes the introduction of a priority_queue
for the requests that are ready.  Start some parameterization in
anticipation of having policy_class everywhere.  Removed _assert.h
which isn't really needed in indra codebase.  Implemented async
setPriority request (which I hope I can get rid of eventually along
with all priorities in this library).  Converted to using unsigned
int for priority rather than float.  Implemented POST and did
groundwork for PUT.
2012-06-01 14:07:34 -04:00
Monty Brandenberg 30d72b041f Added correct libcurl initialization to the unit tests which makes Windows builds reliable.
It's the right thing to do and introduced a scoped version for convenience in tests.
2012-05-09 10:23:02 -04:00
Monty Brandenberg 7a9acdc68a Try to get some more correct curl init into the unit testing. 2012-05-09 07:06:15 -07:00
Monty Brandenberg 74d59e7128 Build llcorehttp as part of a viewer dependency with unit tests. This required
boost::thread and the easiest path to that was to go with the 1.48 Boost release
in the 3P tree (eliminating a fork for a modified 1.45 packaging).  One unit test,
the most important one, is failing in test_httprequest but that can be attended
to later.  This test issues a GET to http://localhost:2/ and that is hitting the
wire but the libcurl plumbing isn't delivering the failure, only the eventual
timeout.  An unexpected change in behavior.
2012-05-07 15:16:31 -04:00
Monty Brandenberg 5611cb6d47 Okay, imported the core-http library and got it compiling suspiciously easily.
The unit/integration tests don't work yet as I'm still battling cmake/autobuild
as usual but first milestone passed.
2012-04-23 16:19:39 -04:00