Commit Graph

71 Commits (9fdca96f8bd2211a99fe88e57b70cbecefa20b6d)

Author SHA1 Message Date
Ansariel 9fdca96f8b Re-enable compiler warnings C4244 and C4396 except for lltracerecording.h and llunittype.h for now 2024-07-08 20:27:14 +02:00
Ansariel b42f9d836b Re-enable a lot of compiler warnings for MSVC and address the C4267 "possible loss of precision" warnings 2024-06-01 15:49:26 +02:00
Andrey Lihatskiy 1b68f71348 #824 Process source files in bulk: replace tabs with spaces, convert CRLF to LF, and trim trailing whitespaces as needed 2024-04-29 07:56:09 +03:00
Nat Goodspeed c7546ea65e SL-18837: Make llsdserialize_test debug output conditional.
Move hexdump() and hexmix() stream formatters to new hexdump.h for potential
use by other tests.

In toPythonUsing() helper function, add a temp file to receive Python script
debug output, and direct debug output to that file. On test failure, dump the
contents of that file to the log.

Give NamedTempFile::peep() an optional target std::ostream; refactor
implementation as peep_via() that accepts a callable to process each text
line. Add operator<<() to stream the contents of a NamedTempFile object to
ostream -- but don't use that with LL_DEBUGS(), as it flattens the file
contents into a single log line. Instead add peep_log(), which streams each
individual text line to LL_DEBUGS().
2023-09-08 14:14:09 -04:00
Nat Goodspeed a45c9f68c3 SL-18837: Add debugging output to llsdserialize_test.cpp. 2023-09-08 08:58:32 -04:00
Nat Goodspeed 95aa00f742 SL-18837: Fix minor merge glitch. 2023-09-07 13:40:46 -04:00
Nat Goodspeed b8e6777439 SL-18837: Merge branch 'main' into actions 2023-09-07 11:15:56 -04:00
Nat Goodspeed c4366378b6 SL-18837: Ditch Boost.Phoenix implicit lambda syntax.
It's cool to be able to write 'arg1 << "stuff" << var ...;' for a lambda
accepting a std::ostream reference, but cascading compile errors mean it's no
longer worth trying to make that work -- given actual C++ lambdas.

Also clean up a lingering BOOST_FOREACH() and a boost::bind() while at it.
2023-06-06 10:04:26 -04:00
Nat Goodspeed 6516c9d07d SL-18837: NamedTempFile back to std::function, use boost::phoenix <<
It seems the problem addressed by aab769e wasn't some synergy between
Boost.Phoenix and Boost.Function, but rather the lack of a Phoenix header file
introducing operator<<().
2023-06-06 07:44:42 -04:00
Nat Goodspeed 7efe727f26 DRTVWR-558: Merge branch 'main' of secondlife/viewer into actions 2023-05-19 10:43:14 -04:00
Andrey Lihatskiy 971e851157 SL-19647 OSX buildfix 2023-05-04 16:44:23 +03:00
Andrey Lihatskiy 5c5dd99b38 Merge remote-tracking branch 'origin/zap-LLSDArray' into DRTVWR-582-maint-U
# Conflicts:
#	indra/llcommon/tests/llsdserialize_test.cpp
2023-05-04 16:08:41 +03:00
Nat Goodspeed e7c5b9fb0f SL-19647: Eliminate LLSDArray entirely.
Newer C++ compilers have different semantics around LLSDArray's special copy
constructor, which was essential to proper LLSD nesting. In short, we can no
longer trust LLSDArray to behave correctly. Now that we have variadic
functions, get rid of LLSDArray and replace every reference with llsd::array().
2023-05-03 17:38:30 -04:00
Nat Goodspeed 6cb6385bc7 SL-18330: Tweaks for Visual Studio builds 2023-03-01 16:37:55 -05:00
Nat Goodspeed 590e158cf3 SL-18330: Adapt LLSDSerialize and tests to llssize max_bytes params. 2022-12-06 16:30:35 -05:00
Nat Goodspeed 761d8337fb SL-18330: Test Python llsd.parse() both from bytes and from stream. 2022-12-02 17:14:31 -05:00
Nat Goodspeed 2f557cd7fa SL-18330: Fix new C++ <-> Python LLSD compatibility tests.
When sending multiple LEAP packets in the same file (for testing convenience),
use a length prefix instead of delimiting with '\n'. Now that we allow a
serialization format that includes an LLSD format header (e.g.
"<?llsd/binary?>"), '\n' is part of the packet content. But in fact, testing
binary LLSD means we can't pick any delimiter guaranteed not to appear in the
packet content.

Using a length prefix also lets us pass a specific max_bytes to the subject
C++ LLSD parser.

Make llleap_test.cpp use new freestanding Python llsd package when available.
Update Python-side LEAP protocol code to work directly with encoded bytes
stream, avoiding bytes<->str encoding and decoding, which breaks binary LLSD.

Make LLSDSerialize::deserialize() recognize LLSD format header case-
insensitively. Python emits and checks for "llsd/binary", while LLSDSerialize
emits and checks for "LLSD/Binary". Once any of the headers is recognized,
pass corrected max_bytes to the specific parser.

Make deserialize() more careful about the no-header case: preserve '\n' in
content. Introduce debugging code (disabled) because it's a little tricky to
recreate.

Revert LLLeap child process stdout parser from LLSDSerialize::deserialize() to
the specific LLSDNotationParser(), as at present: the generic parser fails one
of LLLeap's integration tests for reasons that remain mysterious.
2022-12-02 15:17:56 -05:00
Nat Goodspeed b180e4de23 SL-18330: WIP: Send LLLeap to child as binary LLSD; generic parser.
Since parsing binary LLSD is faster than parsing notation LLSD, send data from
the viewer to the LEAP plugin child process's stdin in binary instead of
notation.

Similarly, instead of parsing the child process's stdout using specifically a
notation parser, use the generic LLSDSerialize::deserialize() LLSD parser.

Add more LLSDSerialize Python compatibility tests.
2022-11-29 14:03:02 -05:00
Nat Goodspeed 42e0787446 SL-18330: LLSDSerialize::deserialize() w/o hdr uses XML or notation
Absent a header from LLSDSerialize::serialize(), make deserialize()
distinguish between XML or notation by recognizing an initial '<'.
2022-11-23 17:15:15 -05:00
Nat Goodspeed abe62c23d7 SL-18330: Make LLSDSerialize::deserialize() default to notation.
LLSDSerialize::serialize() emits a header string, e.g. "<? llsd/notation ?>"
for notation format. Until now, LLSDSerialize::deserialize() has required that
header to properly decode the input stream.

But none of LLSDBinaryFormatter, LLSDXMLFormatter or LLSDNotationFormatter
emit that header themselves. Nor do any of the Python llsd.format_binary(),
format_xml() or format_notation() functions. Until now, you could not use
LLSD::deserialize() to parse an arbitrary-format LLSD stream serialized by
anything but LLSDSerialize::serialize().

Change LLSDSerialize::deserialize() so that if no header is recognized,
instead of failing, it attempts to parse as notation. Add tests to exercise
this case.

The tricky part about this processing is that deserialize() necessarily reads
some number of bytes from the input stream first, to try to recognize the
header. If it fails to do so, it must prepend the bytes it has already read to
the rest of the input stream since they're probably the beginning of the
serialized data.

To support this use case, introduce cat_streambuf, a std::streambuf subclass
that (virtually) concatenates other std::streambuf instances. When read by a
std::istream, the sequence of underlying std::streambufs appears to the
consumer as a single continuous stream.
2022-11-22 16:21:44 -05:00
Signal Linden 8d7cde22c3 Replace llbase with llsd module 2022-10-11 15:10:04 -07:00
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 066fb5dafc DRTVWR-476: Default LLSDNotationFormatter now OPTIONS_PRETTY_BINARY.
LLSDNotationFormatter (also LLSDNotationStreamer that uses it, plus
operator<<(std::ostream&, const LLSD&) that uses LLSDNotationStreamer) is most
useful for displaying LLSD to a human, e.g. for logging. Having the default
dump raw binary bytes into the log file is not only suboptimal, it can
truncate the output if one of those bytes is '\0'. (This is a problem with the
logging subsystem, but that's a story for another day.)

Use OPTIONS_PRETTY_BINARY wherever there is a default LLSDFormatter
::EFormatterOptions argument.

Also, allow setting LLSDFormatter subclass boolalpha(), realFormat() and
format(options) using optional constructor arguments. Naturally, each subclass
that supports this must accept and forward these constructor arguments to its
LLSDFormatter base class constructor.

Fix a couple bugs in LLSDNotationFormatter::format_impl() for an LLSD::Binary
value with OPTIONS_PRETTY_BINARY:
- The code unconditionally emitted a b(len) type prefix followed by either raw
  binary or hex, depending on the option flag. OPTIONS_PRETTY_BINARY caused it
  to emit "0x" before the hex representation of the data. This is wrong in
  that it can't be read back by either the C++ or the Python LLSD parser.
  Correct OPTIONS_PRETTY_BINARY formatting consists of b16"hex digits" rather
  than b(len)"raw bytes".
- Although the code did set hex mode, it didn't set either the field width or
  the fill character, so that a byte value less than 16 would emit a single
  digit rather than two.

Instead of having one LLSDFormatter::format() method with an optional options
argument, declare two overloads. The format() overload without options passes
the mOptions data member to the overload accepting options.

Refactor the LLSDFormatter family, hoisting the recursive format_impl() method
(accepting level) to a pure virtual method at LLSDFormatter base-class level.
Most subclasses therefore need not override either base-class format() method,
only format_impl(). In fact the short format() overload isn't even virtual.

Consistently use LLSDFormatter::EFormatterOptions enum as the options
parameter wherever such options are accepted.
2020-05-13 16:37:12 -04:00
Nat Goodspeed c4096f670c SL-10153: Review and rationalize fetching paths from environment.
Use LLStringUtil::getenv() or getoptenv() whenever we fetch a string that will
be used as a pathname.

Use LLFile::tmpdir() instead of getenv("TEMP").

As an added extra-special bonus, finally clean up $TMP/llcontrol-test-zzzzzz
directories that have been accumulating every time we run a local build!
2018-12-14 15:38:13 -05:00
Andrey Kleshchev 9411bd1cef MAINT-2338 Unit tests 2018-05-22 12:58:52 +00:00
Nat Goodspeed ae0b3149ba DRTVWR-418: Fix a round of compile errors surfaced by -std=c++11.
These are mostly things that were in fact erroneous, but accepted by older
compilers.

This changeset has not yet been built with Visual Studio 2013 or Linux gcc,
even with -std=c++11.

This changeset has not been built *without* -std=c++11. It should be used in
conjunction with a corresponding change to LL_BUILD_DARWIN_BASE_SWITCHES in
viewer-build-variables/variables.

This is a work in progress. We do not assert that this changeset completes the
work needed to turn on -std=c++11, even on the Mac.
2017-02-23 16:49:49 -05:00
Glenn Glazer 9e93d24b20 MAINT=6585: fix llsdserialize_test 2016-07-20 15:57:53 -07:00
Oz Linden c8726aba30 remove execute permission from many files that should not have it 2015-11-10 09:48:56 -05:00
Nat Goodspeed 3b7d3cb1ea For one use case, boost::bind() better than boost::phoenix::bind().
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-16 15:17:24 -05:00
Nat Goodspeed eae38f7d57 Eliminate use of boost::lambda with boost::function (Trac #10864).
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-12 13:46:41 -08:00
Richard Linden a77f424945 BUILDFIX: fix for crashes in unit tests on mac and linux 2013-08-23 13:41:51 -07:00
Richard Linden 3413a57a90 BUILDFIX: accidental checkin of infinite loop in llsdserialize test 2013-08-22 16:57:51 -07:00
Richard Linden b1419bfbf0 BUILDFIX: attempted fix for crash on exit in llsdserialize test 2013-08-22 16:56:14 -07:00
Richard Linden cc31b4ae79 SH-4399 FIX: Interesting: Texture console MB Bound 0/384 and texture queue bounces once per second
SH-4346 FIX: Interesting: some integer Statistics are displayed as floating point after crossing region boundary
made llerrs/infos/etc properly variadic wrt tags
LL_INFOS("A", "B", "C") works, for example
fixed unit tests
remove llsimplestat
2013-08-12 20:05:16 -07:00
Graham Madarasz fd447189c5 Merge 3.5.1 into Materials 2013-04-25 21:00:16 -07:00
Graham Madarasz bf6182daa8 Update Mac and Windows breakpad builds to latest 2013-03-29 07:50:08 -07:00
Oz Linden fd96fe41a6 remove use of system llbase module in integration tests; always use the one from this tree 2013-03-01 11:41:33 -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 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
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 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