Skip to content

Commit

Permalink
Merge pull request #1398 from danieldresser-ie/cancelTimings
Browse files Browse the repository at this point in the history
IECoreScene tests : Tighten up a couple test timings
  • Loading branch information
johnhaddon authored Nov 28, 2023
2 parents b985d9f + d6b435a commit 6233650
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1929,7 +1929,7 @@ def backgroundRun():
startTime = time.time()
thread.start()

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

Expand Down
3 changes: 3 additions & 0 deletions src/IECoreScene/MeshAlgoTriangulate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ MeshPrimitivePtr MeshAlgo::triangulate(
throw InvalidArgumentException( "MeshAlgo::triangulate : Mesh with invalid primitive variables" );
}

// arePrimitiveVariablesValid is expensive enough that we should check the canceller after running it.
Canceller::check( canceller );

// already triangulated
if ( mesh->maxVerticesPerFace() == 3 )
{
Expand Down
4 changes: 2 additions & 2 deletions test/IECoreScene/MeshAlgoTriangulateTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,13 +295,13 @@ def backgroundRun():
startTime = time.time()
thread.start()

time.sleep( 0.1 )
time.sleep( 0.01 )
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.1 seconds is a minimal performance bar
# that it terminates with 0.2 seconds is a minimal performance bar
self.assertLess( time.time() - startTime, 0.2 )
self.assertTrue( cancelled[0] )

Expand Down
2 changes: 1 addition & 1 deletion test/IECoreScene/PrimitiveTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def backgroundRun():
startTime = time.time()
thread.start()

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

Expand Down

0 comments on commit 6233650

Please sign in to comment.