Commit Graph

783 Commits

Author SHA1 Message Date
Jacques Lucke 48bd6e7102 Tests: use guarded allocator in tests
This helps finding memory leaks in tests.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D8631
2020-08-19 18:18:20 +02:00
Sybren A. Stüvel ac41215f07 Tests: fix Alembic export test on Windows
Convert all `subprocess.run()` arguments to string, to prevent breaking
"does this argument need quoting" checks on Windows.
2020-08-17 20:08:01 +02:00
Sybren A. Stüvel a95f863596 Fix T75936: Alembic, allow exporting of invisible objects
Add a new depsgraph builder class that includes invisible objects and
use that in the Alembic exporter.

Alembic supports three options for visibility, "visible", "inherited",
and "hidden". This means that parents can be hidden and still have
visible children (contrary to USD, where invisibility is used to prune
an entire scene graph subtree). Because of this, the visibility is
stored on the transform node, as that represents the Object in Blender
and thus keeps the Alembic file as close to Blender's own structure as
possible.

Reviewed By: Sergey

Differential Revision: https://developer.blender.org/D8595
2020-08-17 17:56:05 +02:00
Sybren A. Stüvel 04ae290024 Cleanup: Alembic, rename test in CMake for consistency
Rename test `alembic_tests` to `alembic_export_tests`, so that its name
is consistent with the Python file containing the tests,
`alembic_export_tests.py`.

No functional changes.
2020-08-17 17:56:05 +02:00
Sybren A. Stüvel 449ccb7b30 Fix typo: missing `f` string prefix in Alembic export test 2020-08-17 15:16:20 +02:00
Sybren A. Stüvel 6b6de5beba Cleanup: Alembic tests, add note explaining how the export tests work
No functional changes.
2020-08-17 14:07:45 +02:00
Sybren A. Stüvel ad459302ce Cleanup: rename `alembic_tests.py` to `alembic_tests_export.py`
Rename `alembic_tests.py` to `alembic_tests_export.py`, as this makes it
clearer what is being tested.

No functional changes.
2020-08-17 14:07:45 +02:00
Sybren A. Stüvel 4a2ff0fef8 Tests: Better error reporting in `AbstractAlembicTest`
Instead of checking for the length of a list, just handle the error that
occurs when the length is incorrect.

No functional changes to any actual test.
2020-08-17 14:07:45 +02:00
Sybren A. Stüvel 38752944f8 Fix formatting bug in `AbstractAlembicTest` class
Replace `formatstring, value` with the correct `formatstring % value`.

No functional changes to any actual tests.
2020-08-17 14:07:45 +02:00
Brecht Van Lommel 53d203dea8 Tests: move remaining gtests into their own module folders
And make them part of the blender_test runner. The one exception is blenlib
performance tests, which we don't want to run by default. They remain in their
own executable.

Differential Revision: https://developer.blender.org/D8498
2020-08-10 18:14:00 +02:00
Sergey Sharybin 2c5c39d53c Merge branch 'blender-v2.90-release' 2020-08-05 13:00:15 +02:00
Sergey Sharybin 02ccc37144 Correct recent fix for Cycles motion blur test
Need to only compare directory name, not the whole path.
2020-08-05 12:59:28 +02:00
Julian Eisel fc9f7e3e51 Merge branch 'blender-v2.90-release' 2020-08-05 12:19:28 +02:00
Brecht Van Lommel ec9ab00fcb Fix failing USD test on macOS after becoming part of blender test runner 2020-08-05 12:15:17 +02:00
Brecht Van Lommel de53178b26 Fix T78777: Cycles motion blur test differences between AVX/AVX2
This appears to be slight precision differences in the Embree implementation,
simply increase the diff threshold a little for these motion blur tests.
2020-08-05 11:45:31 +02:00
Campbell Barton 6119f3cad1 Cleanup: spelling (initialized) 2020-08-01 13:57:27 +10:00
Campbell Barton 901ee66ea1 Cleanup: use term init instead of initialize/initialise
The abbreviation 'init' is brief, unambiguous and already used
in thousands of places, also initialize is often accidentally
written with British spelling.
2020-08-01 13:51:05 +10:00
Brecht Van Lommel 81caec8c60 Fix blender_test runner build on the buildbot on Linux and macOS
Add our own copy of the gtest discovery scripts from CMake a few reasons:
* Use the very latest version which supports PRE_TEST for Windows
* Fix usage of [] symbols in file paths that fail with the zsh shell
* Disable asan leak checker when discovering tests

This means Windows also no longer requires the very latest CMake 3.18.
2020-07-31 14:41:13 +02:00
Brecht Van Lommel 5628aaeee1 Fix build of blender_test runner on macOS 2020-07-31 14:15:42 +02:00
Sergey Sharybin db24e289b2 Merge branch 'blender-v2.90-release' 2020-07-31 11:53:22 +02:00
Sergey Sharybin de21ddf821 BLI: Initial implementation of generic session UUID API
Covers basics like generation of new UUID.

Also contains code needed to use the SessionUUID as a key in the Map.
2020-07-31 11:24:03 +02:00
Ray Molenkamp 44928a2a8f Fix: Blender_test not working on windows.
This bumps the minimum requirement for cmake from 3.10 to 3.18 on windows
if `WITH_GTESTS` is enabled.

Reviewed By: sergey brecht sybren campbellbarton

Differential Revision: https://developer.blender.org/D8405
2020-07-30 13:18:05 -06:00
Germano Cavalcante 2181028292 Merge branch 'blender-v2.90-release' 2020-07-29 19:19:25 -03:00
Brecht Van Lommel 81ce8481b2 Fix failing PLY test, update hash because metadata changed 2020-07-29 19:49:53 +02:00
Jacques Lucke 814ca40c63 Merge branch 'blender-v2.90-release' 2020-07-28 16:37:01 +02:00
Jacques Lucke b274d18aec Cleanup: correct usage of extern-C blocks in various places
This removes extern-C blocks around other includes and adds
such blocks for some headers that need them.
2020-07-28 16:33:43 +02:00
Sybren A. Stüvel e8869d9c71 Merge remote-tracking branch 'origin/blender-v2.90-release' 2020-07-27 19:02:44 +02:00
Sybren A. Stüvel 2584a2a4e7 Fix USD unit test on buildbot
The buildbot uses a separate `CMAKE_INSTALL_PREFIX`. This means that
the unit test could not find its USD JSON files in the build directory.
Using `${CMAKE_INSTALL_PREFIX}` instead of `$<TARGET_FILE_DIR:blender>`
solved this.
2020-07-27 19:02:22 +02:00
Ray Molenkamp 729da8bfac CTest: Fix blender_test not working on windows.
MSVC does need the wholearchive flag but it was not set,
so no tests were actually linked into the binary.

Reviewed By: sybren

Differential Revision: https://developer.blender.org/D8404
2020-07-27 10:55:34 -06:00
Jacques Lucke 6cecdf2ade Functions: move tests closer to code 2020-07-26 12:19:11 +02:00
Jacques Lucke f495b583be Merge branch 'blender-v2.90-release' 2020-07-24 12:40:20 +02:00
Jacques Lucke 236ca8fbe8 Allocator: make leak detection work with static variables
When definining static variables that own memory, you should
use the "construct on first use" idiom. Otherwise, you'll get
a warning when Blender exits.

More details are provided in D8354.

Differential Revision: https://developer.blender.org/D8354
2020-07-24 12:26:11 +02:00
Jacques Lucke 149bb0c26d Cleanup: unify naming between different spans 2020-07-23 18:07:44 +02:00
Jacques Lucke c8b24af1b2 BLI: move some tests into blenlib/tests
Reviewers: sybren

Differential Revision: https://developer.blender.org/D8315
2020-07-23 15:23:55 +02:00
Hans Goudey 4aa2a5481c Bevel: Refactor "Vertex Only" to an enum
This matches the change that was done to the bevel modifier so that the
interface for the modifier, the active tool, and the operator are consistent.

 This commit extends the refactor to the bmesh implementation too, so
that the parameters in the implementation don't stray too far from what
is exposed.

Tests are adjusted and still pass.
2020-07-21 16:32:00 -04:00
Alexander Gavrilov f8cc01595d Drivers: add lerp and clamp functions to namespace.
Implementation of lerp without a function requires repeating one of
the arguments, which is not ideal. To avoid that, add a new function
to the driver namespace. In addition, provide a function for clamping
between 0 and 1 to support easy clamped lerp, and a smoothstep function
from GLSL that is somewhat related.

The function implementations are added to a new bl_math module.
As an aside, add the round function and two-argument log to the
pylike expression subset.

Differential Revision: https://developer.blender.org/D8205
2020-07-21 19:01:50 +03:00
Jacques Lucke 579b180053 BLI: add Vector/Array.fill methods 2020-07-20 13:02:10 +02:00
Jacques Lucke 8cbbdedaf4 Refactor: Update integer type usage
This updates the usage of integer types in code I wrote according to our new style guides.

Major changes:
* Use signed instead of unsigned integers in many places.
* C++ containers in blenlib use `int64_t` for size and indices now (instead of `uint`).
* Hash values for C++ containers are 64 bit wide now (instead of 32 bit).

I do hope that I broke no builds, but it is quite likely that some compiler reports
slightly different errors. Please let me know when there are any errors. If the fix
is small, feel free to commit it yourself.
I compiled successfully on linux with gcc and on windows.
2020-07-20 12:16:20 +02:00
Jacques Lucke 2679236047 Cleanup: avoid static initialization order issues when accessing CPPTypes
Instead of depending on static initialization order of globals use
static variables within functions. Those are initialized on first use.
This is every so slighly less efficient, but avoids a full class of problems.
2020-07-17 14:15:06 +02:00
Sybren A. Stüvel e7c1a32a78 Tests: disable ASAN when discovering tests
CMake, when it's configuring the project, runs the `blender_test` test
runner (if it exists from a previous build) to discover which tests it
contains. At this time none of the tests themselves are run, so it's not
that useful to run ASAN and have it break things when there are memory
leaks.

This commit disables ASAN by injecting `ASAN_OPTIONS="detect_leaks=0"` in
the environment variables.

It is not enough to use `set(ENV{ASAN_OPTIONS} "detect_leaks=0")` in
`tests/gtests/runner/CMakeLists.txt`, as it wouldn't be passed to the child
process.
2020-07-16 17:38:29 +02:00
Sybren A. Stüvel a138bf57c9 Tests: move tests from USD test directory into `io/common` and `io/usd`
This commit is a followup of {D7649}, and ports the USD tests to the new
testing approach. It moves test code from `tests/gtests/usd` into
`source/blender/io/common` and `source/blender/io/usd`, and adjusts the
use of namespaces to be consistent with the other tests.

I decided to put one test into `io/usd/tests`, instead of
`io/usd/intern`. The reason is that this test does not correspond with a
single file in that directory; instead, it tests Blender's integration
with the USD library itself.

There are two new CLI arguments for the Big Test Runner:

- `--test-assets-dir`, which points to the `lib/tests` directory in the
  SVN repository. This allows unit tests to find test assets.
- `--test-release-dir`, which points to `bin/{BLENDER_VERSION}` in the
  build directory. At the moment this is only used by the USD test.

The CLI arguments are automatically passed to the Big Test Runner when
using `ctest`. When manually running the tests, the arguments are only
required when there is a test run that needs them.

For more info about splitting some code into 'common', see
rB084c5d6c7e2cf8.

No functional changes to the tests themselves, only to the way they are
built & run.

Differential Revision: https://developer.blender.org/D8314

Reviewed by: brecht, mont29
2020-07-16 17:38:29 +02:00
Sybren A. Stüvel 56aa5b0d8c T73268: Link C/C++ unit tests into single executable
This commit introduces a new way to build unit tests. It is now possible
for each module to generate its own test library. The tests in these
libraries are then bundled into a single executable.

The test executable can be run with `ctest`. Even though the tests
reside in a single executable, they are still exposed as individual
tests to `ctest`, and thus can be selected via its `-R` argument.

Not yet ported tests still build & run as before.

The following rules apply:

- Test code should reside in the same directory as the code under test.
- Tests that target functionality in `somefile.{c,cc}` should reside in
  `somefile_test.cc`.
- The namespace for tests is the `tests` sub-namespace of the code under
  test. For example, tests for `blender::bke` should be in
  `blender::bke:tests`.
- The test files should be listed in the module's `CMakeLists.txt` in a
  `blender_add_test_lib()` call. See the `blenkernel` module for an
  example.

Reviewed By: brecht

Differential Revision: https://developer.blender.org/D7649
2020-07-16 12:58:49 +02:00
Jacques Lucke d897228682 BLI: move safe math functions to separate header 2020-07-16 11:28:31 +02:00
Jacques Lucke f6f93b5b12 BLI: add safe_divide, safe_modf and safe_logf
Those are defined exactly as their corresponding functions in Cycles.
2020-07-16 11:05:30 +02:00
Jacques Lucke 35bfe1702c BLI: add safe_powf function
The same function is also used by cycles.
2020-07-16 10:46:18 +02:00
Jacques Lucke e8b26a0501 Fix signed/unsigned comparison 2020-07-15 11:06:54 +02:00
Ray Molenkamp 70992ae270 Fix: Fix build error with MSVC in BLI_span_test
span.size() returns an uint, causing a signed/unsigned comparison
using 3u sidesteps the issue
2020-07-13 12:29:53 -06:00
Jacques Lucke a19584a471 BLI: fix constructor regression for Vector and Array
This was introduced in rB403384998a6bb5f428e15ced5.
2020-07-13 10:51:46 +02:00
Jacques Lucke c7eada103c Nodes: support implicit conversions and incorrectly linked sockets 2020-07-11 18:02:06 +02:00
Jacques Lucke 3edd2832b2 Functions: make generic types hashable 2020-07-10 12:57:28 +02:00