Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

migrate more pxrUsdMayaGL tests from plugin/pxr/... to test/... #761

Merged

Conversation

mattyjams
Copy link
Contributor

These commits move a whole bunch more interactive tests previously in the plugin/pxr/... area over to the project-level test/... area.

All of the tests were "sanitized" to remove usage of the pxrUsd plugin and the pxrUsdProxyShape and pxrUsdReferenceAssembly nodes. They are now all authored in terms of the mayaUsdPlugin and mayaUsdProxyShape.

I realized that I forgot to do this sanitization in #741, so I'll put up a separate PR that cleans up testProxyShapeDrawLighting and testProxyShapeDrawPurpose.

One thing to note about testProxyShapeDrawColorAccuracy and testProxyShapeDrawVisibility: These tests previously took advantage of the feature with pxrUsdProxyShape to set variants directly on the proxy shape. This doesn't exist on mayaUsdProxyShape, since the expectation is that you would make those selections directly in USD through UFE. For those two, I added a new "wrapper" USD file that makes the shadingVariant selection and pointed the proxies at those instead of the originals.

Sorry this ended up being fairly large, but it's mostly just file moves. Each test was migrated in its own commit. There were touch-ups to the Python test scripts, and then probably the bulk of the actual diffs are in the Maya scenes where I had to replace pxrUsdProxyShape with mayaUsdProxyShape.

…s testProxyShapeRendererSceneMessages

Usage of Pixar's USD reference assembly and proxy shape were removed in favor
of using just mayaUsdProxyShape nodes.
…. to test/lib/mayaUsd/render/pxrUsdMayaGL/...
…est/lib/mayaUsd/render/pxrUsdMayaGL/...

Note that because making variant set selections from Maya is not supported
until later versions of UFE (i.e. not in Maya 2019), the proxy shape was set to
reference a USD file that makes the shading variant set selection.
…/lib/mayaUsd/render/pxrUsdMayaGL/...

Note that because making variant set selections from Maya is not supported
until later versions of UFE (i.e. not in Maya 2019), the proxy shapes were set
to reference USD files that makes the shading variant set selections.
Comment on lines -50 to -58
def _LoadAssemblies(self):
loadStartTime = cmds.timerX()

UsdMaya.LoadReferenceAssemblies()

loadElapsedTime = cmds.timerX(startTime=loadStartTime)

Tf.Status("Load Elapsed Time: %f" % loadElapsedTime)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No assemblies anymore, so assembly-related code was removed.

@classmethod
def setUpClass(cls):
# The test USD data is authored Z-up, so make sure Maya is configured
# that way too.
cmds.upAxis(axis='z')

cmds.loadPlugin('pxrUsd')
cmds.loadPlugin('mayaUsdPlugin')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still explicitly load mayaUsdPlugin here because the Maya scene doesn't have a requires line for it, and because we use mayaUSDExport() and mayaUSDImport() below.

@@ -15,10 +15,6 @@
# limitations under the License.
#

from future.utils import iteritems
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dropped this from all of the tests to remove this dependency.

Comment on lines -53 to +50
for profileScopeName, elapsedTime in iteritems(cls._profileScopeMetrics):
for profileScopeName in cls._profileScopeMetrics.keys():
elapsedTime = cls._profileScopeMetrics[profileScopeName]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty straightforward tweak to remove iteritems.

Comment on lines -62 to +60
statsOutput = '\n'.join(statsOutputLines)
perfStatsFilePath = '%s/perfStats.raw' % cls._testDir
statsOutput = os.linesep.join(statsOutputLines)
perfStatsFilePath = os.path.join(cls._testDir, 'perfStats.raw')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few other tweaks like these to make sure all platforms are supported.

Comment on lines -87 to -102
def testUsdChangeProcessingAssembly(self):
"""
Tests that authoring on a USD stage that is referenced by an assembly
node (in "Collapsed" representation with a proxy shape underneath)
invokes drawing refreshes in Maya correctly.
"""
self._testName = 'UsdChangeProcessingTest_Assembly'

mayaSceneFile = '%s.ma' % self._testName
mayaSceneFullPath = os.path.abspath(mayaSceneFile)
cmds.file(mayaSceneFullPath, open=True, force=True)

UsdMaya.LoadReferenceAssemblies()

assemblyDagPathName = '|UsdChangeProcessingTest|Primitive'
self._RunTest(assemblyDagPathName)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assembly case was removed, so everything was collapsed from _RunTest() into testUsdChangeProcessingProxy().

Comment on lines -20 to -42
# Maya 2017 and later use PyQt5/PySide2 while Maya 2016 and earlier use
# PyQt4/PySide. We test whether we're running in Maya 2017+ by trying to import
# PySide2, which should only be available there. If that succeeds, we import
# the rest of the modules from PySide2. Otherwise, we assume we're in 2016 or
# earlier and we import everything from PySide.
try:
import PySide2
usePySide2 = True
except ImportError:
usePySide2 = False

if usePySide2:
from PySide2 import QtCore
from PySide2.QtTest import QTest
from PySide2.QtWidgets import QWidget

from shiboken2 import wrapInstance
else:
from PySide import QtCore
from PySide.QtTest import QTest
from PySide.QtGui import QWidget

from shiboken import wrapInstance
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed all the support for PySide, dropping Maya 2016 and earlier.

The pxrUsdReferenceAssembly workflow never really supported significant
authoring on the root prim that is referenced by the assembly. This means that
for the purposes of the testProxyShapeLiveSurface test, the existing authoring
that attempts to translate the root prim is actually being ignored when the USD
is referenced by a USD reference assembly or proxy shape. The test was authored
taking that into account.

However, that is only the case when using Pixar's batch renderer. This issue
has been fixed when using UFE and the Viewport 2.0 render delegate. In that
case, using the same Maya scene and USD, the referenced geometry ends up being
transformed correctly, but differently as compared to the Pixar batch renderer.

To keep the test results consistent (and correct) between the Pixar batch
renderer and the VP2.0 render delegate, we simply remove the root prim
xformOps.

(Internal change: 2094559)
@mattyjams
Copy link
Contributor Author

One small addition here with 17f789a. The Pixar batch renderer actually represents the USD in the testProxyShapeLiveSurface test in the wrong location since the Pixar workflows never really supported directly referencing a root prim with a transformation on it. That test assumes the transformation is being ignored, so I just removed it from the USD. This ensures that it matches the VP2.0 render delegate, which does support this correctly.

mattyjams added a commit to mattyjams/maya-usd that referenced this pull request Sep 5, 2020
…s.zip

This removes usage of future.utils.iteritems from the usdMaya and translators
tests to make it easier to test for currently released versions of Maya and
Python 2. testUsdImportXforms required some additional surgery to remove the
use of builtins.zip which may also not be available in certain installs of
Python 2.

Outside of this commit, there are three remaining pxrUsdMayaGL tests that still
use future.utils.iteritems, but those are addressed in PR Autodesk#761 which migrates
those tests from plugin/pxr/... to test/...

Combining the changes here with those in Autodesk#761 removes all usage of the future
Python module, so the instructions on how to install it were removed from
build.md.
@kxl-adsk kxl-adsk merged commit 089c7e1 into Autodesk:dev Sep 9, 2020
@mattyjams mattyjams deleted the pr/continued_pxrUsdMayaGL_test_migration branch September 9, 2020 01:17
@@ -14,6 +14,7 @@ set(TEST_SCRIPT_FILES
testProxyShapeDuplicatePerformance.py
testProxyShapeLiveSurface.py
testProxyShapeRendererSceneMessages.py
testProxyShapeSelectionPerformance.py
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mattyjams

As a FYI, I noticed that both testProxyShapeLiveSurface and testProxyShapeSelectionPerformance fail on my Windows after syncing to the latest dev changes.

@kxl-adsk I believe you mentioned the same failure on your side. I don't think I notice these failures when I originally reviewed this PR but they show up now.

Requires more investigation.

98% tests passed, 2 tests failed out of 127

Label Time Summary:
interactive          = 847.06 sec*proc (14 tests)
pxrUsdMayaGL         = 847.06 sec*proc (14 tests)
translators          = 643.22 sec*proc (52 tests)
ufe                  = 264.30 sec*proc (21 tests)
usdPreviewSurface    =  20.88 sec*proc (2 tests)

Total Test time (real) = 212.37 sec

The following tests FAILED:
         15 - testProxyShapeLiveSurface (Failed)
         17 - testProxyShapeSelectionPerformance (Failed)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, sorry about that @HamedSabri-adsk. They've been passing for me on Linux. I briefly had access to a Windows machine before we left the studio, but I've since lost that. :/

Do you have any logs handy from failed runs of either of those tests? And I assume all of the other pxrUsdMayaGL tests are passing?

Just a wild guess without any more detail for the moment, but the one thing common to these two tests and absent from all the others is the shenanigans they pull dealing with PySide2 and shiboken2 so that they can emulate clicking in the viewports. Maybe there's something there that's problematic on Windows?

Let me know what I can do to help get to the bottom of that!

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed I saw these when validating your change @mattyjams and before merging. I was confused because @HamedSabri-adsk run the tests and they were passing. The explanation I found is that we can be using builds of Maya with asserts enabled. When we do, these tests will cause Maya to assert when the application is exiting. This then causes the test to fail. You won't get it with the official build of Maya.

The assert seems to be complaining that there are still some shared GL widgets alive when we are releasing resources.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the extra info @kxl-adsk. Makes sense then why I might not be seeing those failed asserts.

I took a wild stab at addressing this in #777, so we can continue the investigation there.

mattyjams added a commit to mattyjams/maya-usd that referenced this pull request Sep 16, 2020
…performance tests

This is an attempt to drop all handles the testProxyShapeLiveSurface and
testProxyShapeSelectionPerformance tests are holding to UI and viewport
elements in hopes that their resources can be fully freed when Maya exits.
This was raised as an issue in PR Autodesk#761 with debug builds of Maya that assert
when resources are not freed at exit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unit test Related to unit tests (both python or c++)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants