Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions contrib/IECoreAlembic/test/IECoreAlembic/AlembicSceneTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1899,7 +1899,6 @@ def testPointsVaryingInterpolation( self ) :
IECoreScene.PrimitiveVariable.Interpolation.Vertex,
)

@unittest.skipIf( ( IECore.TestUtil.inMacCI() or IECore.TestUtil.inWindowsCI() ), "Mac and Windows CI are too slow for reliable timing" )
def testCancel ( self ) :

strip = IECoreScene.MeshPrimitive.createPlane( imath.Box2f( imath.V2f( 0 ), imath.V2f( 100000, 1 ) ), imath.V2i( 100000, 1 ) )
Expand All @@ -1916,25 +1915,10 @@ def testCancel ( self ) :
readRoot = IECoreScene.SceneInterface.create( fileName, IECore.IndexedIO.OpenMode.Read )

canceller = IECore.Canceller()
cancelled = [False]

def backgroundRun():
try:
readRoot.child( "sphere" ).readObject( 0.0, canceller )
except IECore.Cancelled:
cancelled[0] = True

thread = threading.Thread(target=backgroundRun, args=())

startTime = time.time()
thread.start()

time.sleep( 0.01 )
canceller.cancel()
thread.join()

self.assertLess( time.time() - startTime, 0.1 if IECore.isDebug() else 0.06 )
self.assertTrue( cancelled[0] )
with self.assertRaisesRegex( IECore.Cancelled, "" ):
readRoot.child( "sphere" ).readObject( 0.0, canceller )

def testIndexedCurveUVs( self ) :

Expand Down
20 changes: 2 additions & 18 deletions contrib/IECoreUSD/test/IECoreUSD/USDSceneTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2673,7 +2673,6 @@ def testInstancedSkinning( self ) :

self.assertEqual( len( unskinnedHashes ), 1 )

@unittest.skipIf( ( IECore.TestUtil.inMacCI() or IECore.TestUtil.inWindowsCI() ), "Mac and Windows CI are too slow for reliable timing" )
def testCancel ( self ) :

strip = IECoreScene.MeshPrimitive.createPlane( imath.Box2f( imath.V2f( 0 ), imath.V2f( 100000, 1 ) ), imath.V2i( 100000, 1 ) )
Expand All @@ -2690,25 +2689,10 @@ def testCancel ( self ) :
readRoot = IECoreScene.SceneInterface.create( fileName, IECore.IndexedIO.OpenMode.Read )

canceller = IECore.Canceller()
cancelled = [False]

def backgroundRun():
try:
readRoot.child( "sphere" ).readObject( 0.0, canceller )
except IECore.Cancelled:
cancelled[0] = True

thread = threading.Thread(target=backgroundRun, args=())

startTime = time.time()
thread.start()

time.sleep( 0.01 )
canceller.cancel()
thread.join()

self.assertLess( time.time() - startTime, 0.03 )
self.assertTrue( cancelled[0] )
with self.assertRaisesRegex( IECore.Cancelled, "" ):
readRoot.child( "sphere" ).readObject( 0.0, canceller )

def testCustomAttributes( self ) :

Expand Down
25 changes: 3 additions & 22 deletions test/IECoreScene/MeshAlgoDistributePointsTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,37 +419,18 @@ def testZeroAreaPolygons( self ):
p = IECoreScene.MeshAlgo.distributePoints( mesh = m, density = 1 )
self.assertEqual( len( p["P"].data ), 0 )

@unittest.skipIf( ( IECore.TestUtil.inMacCI() or IECore.TestUtil.inWindowsCI() ), "Mac and Windows CI are too slow for reliable timing" )
def testCancel( self ) :
# Initializing the points distribution is slow and not cancellable
# Pre-initialize it so it doesn't mess with our timing
IECore.PointDistribution.defaultInstance()

canceller = IECore.Canceller()
cancelled = [False]
canceller.cancel()

m = IECore.Reader.create( os.path.join( "test", "IECore", "data", "cobFiles", "pCubeShape1.cob" ) ).read()

def backgroundRun():
try:
p = IECoreScene.MeshAlgo.distributePoints( mesh = m, density = 10000000, offset = imath.V2f( 0.0001, 0.0001 ), canceller = canceller )
except IECore.Cancelled:
cancelled[0] = True

thread = threading.Thread(target=backgroundRun, args=())

startTime = time.time()
thread.start()

time.sleep( 0.1 )
canceller.cancel()
thread.join()

# This test should actually produce a time extremely close to the sleep duration ( within
# 0.003 seconds whether the sleep duration is 0.01 seconds or 100 seconds ), but checking
# that it terminates with 0.1 seconds is a minimal performance bar
self.assertLess( time.time() - startTime, 0.2 )
self.assertTrue( cancelled[0] )
with self.assertRaisesRegex( IECore.Cancelled, "" ):
p = IECoreScene.MeshAlgo.distributePoints( mesh = m, density = 10000000, offset = imath.V2f( 0.0001, 0.0001 ), canceller = canceller )

@unittest.skipIf( True, "Not running slow perf tests by default" )
def testPerformance( self ) :
Expand Down
29 changes: 5 additions & 24 deletions test/IECoreScene/MeshAlgoFaceAreaTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,36 +128,17 @@ def testTwoFaces( self ) :
self.assertEqual( textureAreas[0], 6 )
self.assertEqual( textureAreas[1], 1 )

@unittest.skipIf( ( IECore.TestUtil.inMacCI() or IECore.TestUtil.inWindowsCI() ), "Mac and Windows CI are too slow for reliable timing" )
def testCancel( self ) :
canceller = IECore.Canceller()
cancelled = [False]
canceller.cancel()

# Basic large mesh
strip = IECoreScene.MeshPrimitive.createPlane( imath.Box2f( imath.V2f( 0 ), imath.V2f( 1000000, 1 ) ), imath.V2i( 1000000, 1 ) )

def backgroundRun( texture ):
try:
if texture:
IECoreScene.MeshAlgo.calculateFaceTextureArea( strip, "uv", "P", canceller )
else:
IECoreScene.MeshAlgo.calculateFaceArea( strip, "P", canceller )
except IECore.Cancelled:
cancelled[0] = True

for texture in [ False, True ]:
cancelled[0] = False
thread = threading.Thread(target=backgroundRun, args=(texture,))

startTime = time.time()
thread.start()

time.sleep( 0.01 )
canceller.cancel()
thread.join()

self.assertLess( time.time() - startTime, 0.03 )
self.assertTrue( cancelled[0] )
with self.assertRaisesRegex( IECore.Cancelled, "" ):
IECoreScene.MeshAlgo.calculateFaceTextureArea( strip, "uv", "P", canceller )
with self.assertRaisesRegex( IECore.Cancelled, "" ):
IECoreScene.MeshAlgo.calculateFaceArea( strip, "P", canceller )

if __name__ == "__main__":
unittest.main()
28 changes: 4 additions & 24 deletions test/IECoreScene/MeshAlgoNormalsTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def testFaceVaryingOnSphere( self ):
# averaging in the nearby cone faces that have similar normals and pushing the normal
# towards the axis.
zComp = -0.8660255

planeComp = ( 1 - zComp * zComp ) ** 0.5
angles = [ 2 * math.pi * ( i + 0.5 ) / divs for i in range( divs ) ]
self.assertVectorListsAlmostEqual( list( n.data )[0:3 * divs:3], [ imath.V3f( planeComp * math.cos( a ), planeComp * math.sin( a ), zComp ) for a in angles ], absError = 1e-3 if divs == 10000 else 1e-5 )
Expand Down Expand Up @@ -394,33 +394,13 @@ def testPerformance( self ) :
elapsed = time.time() - startTime
print( "Time for 1000000 face sphere with extreme verts, thresholded faceVarying: ", elapsed )

@unittest.skipIf( ( IECore.TestUtil.inMacCI() or IECore.TestUtil.inWindowsCI() ), "Mac and Windows CI are too slow for reliable timing" )
def testCancel( self ) :
canceller = IECore.Canceller()
cancelled = [False]

strip = IECoreScene.MeshPrimitive.createPlane( imath.Box2f( imath.V2f( 0 ), imath.V2f( 3000000, 1 ) ), imath.V2i( 3000000, 1 ) )
def backgroundRun():

try:
IECoreScene.MeshAlgo.calculateVertexNormals( strip, IECoreScene.MeshAlgo.NormalWeighting.Equal, canceller = canceller )
except IECore.Cancelled:
cancelled[0] = True

thread = threading.Thread(target=backgroundRun, args=())

startTime = time.time()
thread.start()

time.sleep( 0.05 )
canceller.cancel()
thread.join()

# This test should actually produce a time extremely close to the sleep duration ( within
# 0.003 seconds whether the sleep duration is 0.01 seconds or 100 seconds ), but checking
# that it terminates with 0.1 seconds is a minimal performance bar
self.assertLess( time.time() - startTime, 0.15 )
self.assertTrue( cancelled[0] )
strip = IECoreScene.MeshPrimitive.createPlane( imath.Box2f( imath.V2f( 0 ), imath.V2f( 3000, 1 ) ), imath.V2i( 3000, 1 ) )
with self.assertRaisesRegex( IECore.Cancelled, "" ):
IECoreScene.MeshAlgo.calculateVertexNormals( strip, IECoreScene.MeshAlgo.NormalWeighting.Equal, canceller = canceller )

if __name__ == "__main__":
unittest.main()
42 changes: 9 additions & 33 deletions test/IECoreScene/MeshAlgoTangentsTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,43 +348,19 @@ def testComputeTangentsFromPrimitiveCentroid( self ):
self.assertArrayEqual( tRes, tangent.data )
self.assertArrayEqual( btRes, biTangent.data )

@unittest.skipIf( ( IECore.TestUtil.inMacCI() or IECore.TestUtil.inWindowsCI() ), "Mac and Windows CI are too slow for reliable timing" )
def testCancel( self ) :
canceller = IECore.Canceller()
canceller.cancel()

strip = IECoreScene.MeshPrimitive.createPlane( imath.Box2f( imath.V2f( 0 ), imath.V2f( 3000000, 1 ) ), imath.V2i( 3000000, 1 ) )
variant = 0
def backgroundRun():

try:
if variant == 0:
IECoreScene.MeshAlgo.calculateTangentsFromUV( strip, canceller = canceller )
elif variant == 1:
IECoreScene.MeshAlgo.calculateTangentsFromFirstEdge( strip, canceller = canceller )
elif variant == 2:
IECoreScene.MeshAlgo.calculateTangentsFromTwoEdges( strip, canceller = canceller )
elif variant == 3:
IECoreScene.MeshAlgo.calculateTangentsFromPrimitiveCentroid( strip, canceller = canceller )
except IECore.Cancelled:
cancelled[0] = True

for i in range( 4 ):
cancelled = [False]
variant = i
thread = threading.Thread(target=backgroundRun, args=())

startTime = time.time()
thread.start()

time.sleep( 0.1 )
canceller.cancel()
thread.join()

# This test should actually produce a time extremely close to the sleep duration ( within
# 0.003 seconds whether the sleep duration is 0.01 seconds or 100 seconds ), but checking
# that it terminates with 0.1 seconds is a minimal performance bar
self.assertLess( time.time() - startTime, 0.2 )
self.assertTrue( cancelled[0] )
with self.assertRaisesRegex( IECore.Cancelled, "" ):
IECoreScene.MeshAlgo.calculateTangentsFromUV( strip, canceller = canceller )
with self.assertRaisesRegex( IECore.Cancelled, "" ):
IECoreScene.MeshAlgo.calculateTangentsFromFirstEdge( strip, canceller = canceller )
with self.assertRaisesRegex( IECore.Cancelled, "" ):
IECoreScene.MeshAlgo.calculateTangentsFromTwoEdges( strip, canceller = canceller )
with self.assertRaisesRegex( IECore.Cancelled, "" ):
IECoreScene.MeshAlgo.calculateTangentsFromPrimitiveCentroid( strip, canceller = canceller )

if __name__ == "__main__":
unittest.main()
24 changes: 3 additions & 21 deletions test/IECoreScene/MeshAlgoTriangulateTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,34 +276,16 @@ def testPerformance( self ) :
elapsed = time.time() - startTime
print( "Time for 16000000 faces with heavy, unindexed, face-varying primvar", elapsed )

@unittest.skipIf( ( IECore.TestUtil.inMacCI() or IECore.TestUtil.inWindowsCI() ), "Mac and Windows CI are too slow for reliable timing" )
def testCancel( self ) :
canceller = IECore.Canceller()
cancelled = [False]

# Basic large mesh
strip = IECoreScene.MeshPrimitive.createPlane( imath.Box2f( imath.V2f( 0 ), imath.V2f( 3000000, 1 ) ), imath.V2i( 3000000, 1 ) )

def backgroundRun():
try:
IECoreScene.MeshAlgo.triangulate( strip, canceller )
except IECore.Cancelled:
cancelled[0] = True

thread = threading.Thread(target=backgroundRun, args=())

startTime = time.time()
thread.start()

time.sleep( 0.01 )
canceller = IECore.Canceller()
canceller.cancel()
thread.join()

# This test should actually produce a time extremely close to the sleep duration ( within
# 0.01 seconds whether the sleep duration is 0.01 seconds or 1 seconds ), but checking
# that it terminates with 0.2 seconds is a minimal performance bar
self.assertLess( time.time() - startTime, 0.2 )
self.assertTrue( cancelled[0] )
with self.assertRaisesRegex( IECore.Cancelled, "" ):
IECoreScene.MeshAlgo.triangulate( strip, canceller )

if __name__ == "__main__":
unittest.main()
21 changes: 3 additions & 18 deletions test/IECoreScene/PrimitiveTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ def testVariableIndexedView( self ) :

IECoreScene.testVariableIndexedView()

@unittest.skipIf( ( IECore.TestUtil.inMacCI() or IECore.TestUtil.inWindowsCI() ), "Mac and Windows CI are too slow for reliable timing" )
def testCancelLoading( self ) :

strip = IECoreScene.MeshPrimitive.createPlane( imath.Box2f( imath.V2f( 0 ), imath.V2f( 100000, 1 ) ), imath.V2i( 1000000, 1 ) )
Expand All @@ -189,25 +188,11 @@ def testCancelLoading( self ) :
loadIO = IECore.MemoryIndexedIO( saveIO.buffer(), IECore.IndexedIO.OpenMode.Read )

canceller = IECore.Canceller()
cancelled = [False]

def backgroundRun():
try:
IECore.Object.load( loadIO, "test", canceller )
except IECore.Cancelled:
cancelled[0] = True

thread = threading.Thread(target=backgroundRun, args=())

startTime = time.time()
thread.start()

time.sleep( 0.01 )
canceller.cancel()
thread.join()

self.assertLess( time.time() - startTime, 0.1 )
self.assertTrue( cancelled[0] )
with self.assertRaisesRegex( IECore.Cancelled, "" ):
IECore.Object.load( loadIO, "test", canceller )


if __name__ == "__main__":
unittest.main()
Loading