Skip to content

Commit

Permalink
Merge pull request #1442 from ivanimanishi/testFixes
Browse files Browse the repository at this point in the history
IECoreGL Test Fixes and updates to ie/options
  • Loading branch information
ivanimanishi authored Nov 7, 2024
2 parents 6ac8fc2 + 5c259f3 commit 446d2e7
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 66 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ Build
- Added `PYBIND11_INCLUDE_PATH` option.
- Added `VDB_PYTHON_PATH` to USD tests.
- Added `INSTALL_CREATE_SYMLINKS`, which allows you to disable the creation of version symlinks at the end of the install.
- Added `USG_SHIMLIB_PATH` which may be necessary to run nuke tests.

- CI :
- IECoreHoudini tests updated to pass on newer environments.
- IECoreGL tests updated with relaxed precisions for image comparisons.

10.5.10.0 (relative to 10.5.9.5)
=========
Expand Down
8 changes: 8 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,13 @@ o.Add(
"",
)

o.Add(
"USG_SHIMLIB_PATH",
"The path to the FnUsdShim to use for Nuke. This may be necessary to run the tests.",
"",
)


# OpenGL options

try :
Expand Down Expand Up @@ -2589,6 +2596,7 @@ nukeTestEnv["ENV"]["NUKE_PATH"] = "plugins/nuke"
nukeTestEnv["ENV"]["IECORE_OP_PATHS"] = "test/IECoreNuke/ops:test/IECore/ops"
# prepend OIIO LIB PATH to library path to support custom OIIO with specific dependencies
nukeTestEnv["ENV"][libraryPathEnvVar] = "{}:{}".format( nukeTestEnv.subst( "$OIIO_LIB_PATH" ), nukeTestEnv["ENV"][libraryPathEnvVar] )
nukeTestEnv["ENV"]["USG_SHIMLIB_PATH"] = nukeTestEnv["USG_SHIMLIB_PATH"]

if doConfigure :

Expand Down
46 changes: 21 additions & 25 deletions config/ie/options
Original file line number Diff line number Diff line change
Expand Up @@ -366,31 +366,18 @@ VDB_INCLUDE_PATH = os.path.join(
VDB_LIB_PATH = os.path.join(
"/software", "apps", "OpenVDB", vdbVersion, platform, compiler, compilerVersion, "lib"
)
if LooseVersion(vdbVersion) < LooseVersion("10") and targetApp:
VDB_PYTHON_PATH = os.path.join(
"/software",
"apps",
"OpenVDB",
vdbVersion,
platform,
compiler,
compilerVersion,
"python",
"lib",
"python" + pythonVersion,
)

else:
VDB_PYTHON_PATH = os.path.join(
"/software",
"apps",
"OpenVDB",
vdbVersion,
platform,
compiler,
compilerVersion,
"python",
)
VDB_PYTHON_PATH = os.path.join(
"/software",
"apps",
"OpenVDB",
vdbVersion,
platform,
compiler,
compilerVersion,
"python",
"lib",
"python" + pythonVersion,
)


PYBIND11_INCLUDE_PATH = os.path.join(
Expand Down Expand Up @@ -513,6 +500,15 @@ if targetApp == "nuke":
nukeReg = IEEnv.registry["apps"]["nuke"][nukeVersion][platform]
NUKE_ROOT = nukeReg["location"]
NUKE_LICENSE_FILE = nukeReg["wrapperEnvVars"]["foundry_LICENSE"]
USG_SHIMLIB_PATH = os.path.join(
"/software",
"apps",
"FnUsdShim",
nukeReg["compatibilityVersion"],
platform,
compiler,
compilerVersion,
)
INSTALL_NUKELIB_NAME = os.path.join(appPrefix, "lib", "$IECORE_NAME{}".format(ieCoreLibSuffix))
INSTALL_NUKEPYTHON_DIR = os.path.join(appPrefix, "python")
INSTALL_NUKEICON_DIR = os.path.join(appPrefix, "icons")
Expand Down
16 changes: 8 additions & 8 deletions test/IECoreGL/Camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def testPositioning( self ) :
i = IECore.Reader.create( os.path.join( os.path.dirname( __file__ ), "output", "testCamera.tif" ) ).read()
dimensions = i.dataWindow.size() + imath.V2i( 1 )
midpoint = dimensions.x * dimensions.y//2 + dimensions.x//2
self.assertEqual( i["G"][midpoint], 0 )
self.assertAlmostEqual( i["G"][midpoint], 0, 6 )

# render a plane at z = 0 with the camera moved back a touch to see it
r = IECoreGL.Renderer()
Expand All @@ -87,7 +87,7 @@ def testPositioning( self ) :
i = IECore.Reader.create( os.path.join( os.path.dirname( __file__ ), "output", "testCamera.tif" ) ).read()
dimensions = i.dataWindow.size() + imath.V2i( 1 )
midpoint = dimensions.x * dimensions.y//2 + dimensions.x//2
self.assertEqual( i["A"][midpoint], 1 )
self.assertAlmostEqual( i["A"][midpoint], 1, 6 )

def testXYOrientation( self ) :

Expand All @@ -113,15 +113,15 @@ def testXYOrientation( self ) :
i = IECore.Reader.create( os.path.join( os.path.dirname( __file__ ), "output", "testCamera.tif" ) ).read()
dimensions = i.dataWindow.size() + imath.V2i( 1 )
index = dimensions.x * dimensions.y//2 + dimensions.x - 1
self.assertEqual( i["A"][index], 1 )
self.assertAlmostEqual( i["A"][index], 1, 6 )
self.assertAlmostEqual( i["R"][index], 1, 6 )
self.assertEqual( i["G"][index], 0 )
self.assertEqual( i["B"][index], 0 )
self.assertAlmostEqual( i["G"][index], 0, 6 )
self.assertAlmostEqual( i["B"][index], 0, 6 )
index = dimensions.x//2
self.assertEqual( i["A"][index], 1 )
self.assertEqual( i["R"][index], 0 )
self.assertAlmostEqual( i["A"][index], 1, 6 )
self.assertAlmostEqual( i["R"][index], 0, 6 )
self.assertAlmostEqual( i["G"][index], 1, 6 )
self.assertEqual( i["B"][index], 0 )
self.assertAlmostEqual( i["B"][index], 0, 6 )

def setUp( self ) :

Expand Down
18 changes: 9 additions & 9 deletions test/IECoreGL/ImmediateRenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,20 @@ def test( self ) :
i = IECore.Reader.create( outputFileName ).read()
dimensions = i.dataWindow.size() + imath.V2i( 1 )
index = int(dimensions.x * 0.5)
self.assertEqual( i["A"][index], 1 )
self.assertAlmostEqual( i["A"][index], 1, 6 )
self.assertAlmostEqual( i["R"][index], 1, 6 )
self.assertAlmostEqual( i["G"][index], 1, 6 )
self.assertEqual( i["B"][index], 0 )
self.assertAlmostEqual( i["B"][index], 0, 6 )
index = dimensions.x * int(dimensions.y * 0.5) + int(dimensions.x * 0.5)
self.assertEqual( i["A"][index], 1 )
self.assertEqual( i["R"][index], 0 )
self.assertEqual( i["G"][index], 0 )
self.assertAlmostEqual( i["A"][index], 1, 6 )
self.assertAlmostEqual( i["R"][index], 0, 6 )
self.assertAlmostEqual( i["G"][index], 0, 6 )
self.assertAlmostEqual( i["B"][index], 1, 6 )
index = 0
self.assertEqual( i["A"][index], 0 )
self.assertEqual( i["R"][index], 0 )
self.assertEqual( i["G"][index], 0 )
self.assertEqual( i["B"][index], 0 )
self.assertAlmostEqual( i["A"][index], 0, 6 )
self.assertAlmostEqual( i["R"][index], 0, 6 )
self.assertAlmostEqual( i["G"][index], 0, 6 )
self.assertAlmostEqual( i["B"][index], 0, 6 )

def setUp( self ) :

Expand Down
24 changes: 12 additions & 12 deletions test/IECoreGL/MeshPrimitiveTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,22 +158,22 @@ def testUniformCs( self ) :
dimensions = image.dataWindow.size() + imath.V2i( 1 )
index = dimensions.x * int(dimensions.y * 0.75) + int(dimensions.x * 0.25)
self.assertAlmostEqual( image["R"][index], 1, 6 )
self.assertEqual( image["G"][index], 0 )
self.assertEqual( image["B"][index], 0 )
self.assertAlmostEqual( image["G"][index], 0, 6 )
self.assertAlmostEqual( image["B"][index], 0, 6 )

index = dimensions.x * int(dimensions.y * 0.75) + int(dimensions.x * 0.75)
self.assertEqual( image["R"][index], 0 )
self.assertAlmostEqual( image["R"][index], 0, 6 )
self.assertAlmostEqual( image["G"][index], 1, 6 )
self.assertEqual( image["B"][index], 0 )
self.assertAlmostEqual( image["B"][index], 0, 6 )

index = dimensions.x * int(dimensions.y * 0.25) + int(dimensions.x * 0.75)
self.assertAlmostEqual( image["R"][index], 1, 6 )
self.assertAlmostEqual( image["G"][index], 1, 6 )
self.assertAlmostEqual( image["B"][index], 1, 6 )

index = dimensions.x * int(dimensions.y * 0.25) + int(dimensions.x * 0.25)
self.assertEqual( image["R"][index], 0 )
self.assertEqual( image["G"][index], 0 )
self.assertAlmostEqual( image["R"][index], 0, 6 )
self.assertAlmostEqual( image["G"][index], 0, 6 )
self.assertAlmostEqual( image["B"][index], 1, 6 )

def testBound( self ) :
Expand All @@ -192,10 +192,10 @@ def testFaceNormals( self ) :
#include "IECoreGL/FragmentShader.h"
IECOREGL_FRAGMENTSHADER_IN vec3 fragmentN;
void main()
{
gl_FragColor = vec4( fragmentN, 1.0 );
}
void main()
{
gl_FragColor = vec4( fragmentN, 1.0 );
}
"""

r = IECoreGL.Renderer()
Expand Down Expand Up @@ -224,8 +224,8 @@ def testFaceNormals( self ) :
image = IECore.Reader.create( self.outputFileName ).read()
dimensions = image.dataWindow.size() + imath.V2i( 1 )
index = dimensions.x * dimensions.y//2 + dimensions.x//2
self.assertEqual( image["R"][index], 0 )
self.assertEqual( image["G"][index], 0 )
self.assertAlmostEqual( image["R"][index], 0, 6 )
self.assertAlmostEqual( image["G"][index], 0, 6 )
self.assertAlmostEqual( image["B"][index], 1, 6 )

def testIndexedUV( self ) :
Expand Down
22 changes: 11 additions & 11 deletions test/IECoreGL/Renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,17 +282,17 @@ def testStackBug( self ) :
index = dimensions.x * int(dimensions.y * 0.5) + int(dimensions.x * 0.5)
self.assertAlmostEqual( i["R"][index], 1, 6 )
self.assertAlmostEqual( i["G"][index], 1, 6 )
self.assertEqual( i["B"][index], 0 )
self.assertAlmostEqual( i["B"][index], 0, 6 )

index = dimensions.x * int(dimensions.y * 0.5)
self.assertAlmostEqual( i["R"][index], 1, 6 )
self.assertEqual( i["G"][index], 0 )
self.assertEqual( i["B"][index], 0 )
self.assertAlmostEqual( i["G"][index], 0, 6 )
self.assertAlmostEqual( i["B"][index], 0, 6 )

index = dimensions.x * int(dimensions.y * 0.5) + int(dimensions.x * 1) - 1
self.assertAlmostEqual( i["R"][index], 1, 6 )
self.assertEqual( i["G"][index], 0 )
self.assertEqual( i["B"][index], 0 )
self.assertAlmostEqual( i["G"][index], 0, 6 )
self.assertAlmostEqual( i["B"][index], 0, 6 )

def testPrimVars( self ) :

Expand Down Expand Up @@ -345,18 +345,18 @@ def testPrimVars( self ) :
i = IECore.Reader.create( os.path.join( os.path.dirname( __file__ ), "output", "testPrimVars.tif" ) ).read()
dimensions = i.dataWindow.size() + imath.V2i( 1 )
index = dimensions.x * int(dimensions.y * 0.5)
self.assertEqual( i["R"][index], 0 )
self.assertAlmostEqual( i["R"][index], 0, 6 )
self.assertAlmostEqual( i["G"][index], 1, 6 )
self.assertEqual( i["B"][index], 0 )
self.assertAlmostEqual( i["B"][index], 0, 6 )

index = dimensions.x * int(dimensions.y * 0.5) + int(dimensions.x * 0.5)
self.assertAlmostEqual( i["R"][index], 1, 6 )
self.assertEqual( i["G"][index], 0 )
self.assertEqual( i["B"][index], 0 )
self.assertAlmostEqual( i["G"][index], 0, 6 )
self.assertAlmostEqual( i["B"][index], 0, 6 )

index = dimensions.x * int(dimensions.y * 0.5) + int(dimensions.x * 1) - 1
self.assertEqual( i["R"][index], 0 )
self.assertEqual( i["G"][index], 0 )
self.assertAlmostEqual( i["R"][index], 0, 6 )
self.assertAlmostEqual( i["G"][index], 0, 6 )
self.assertAlmostEqual( i["B"][index], 1, 6 )

## \todo Make this assert something
Expand Down
3 changes: 2 additions & 1 deletion test/IECoreGL/ShadingTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -825,10 +825,11 @@ def testVertexCsDoesntAffectWireframe( self ) :
# wireframe is green, and vertex Cs is black,
# so there should be no contribution from
# wireframe or solid shading in the red channel.
self.assertEqual( sum( image["R"] ), 0 )
self.assertAlmostEqual( sum( image["R"] ), 0, 4 )
# black vertex colour should have no effect on
# green wireframe, so we should have some wireframe
# contribution in the green channel.
self.assertNotAlmostEqual( sum( image["G"] ), 0, 4 )
self.assertTrue( sum( image["G"] ) > 0 )

def testUniformFloatArrayParameters( self ) :
Expand Down

0 comments on commit 446d2e7

Please sign in to comment.