Skip to content

Commit c7625b1

Browse files
authored
Split up test browser.test_glbook to separate cases. (#25588)
Split up test browser.test_glbook to separate cases. I am seeing some flakiness in this test, so splitting the test up in separate parts to see which part specifically is flaking.
1 parent 245a15d commit c7625b1

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

test/test_browser.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,10 +1788,21 @@ def test_glgears_deriv(self):
17881788
assert 'gl-matrix' not in read_file('test.html'), 'Should not include glMatrix when not needed'
17891789

17901790
@requires_graphics_hardware
1791-
def test_glbook(self):
1791+
@parameterized({
1792+
'Hello_Triangle': ('CH02_HelloTriangle.o', [], []),
1793+
'Simple_VertexShader': ('CH08_SimpleVertexShader.o', [], []),
1794+
'Simple_Texture2D': ('CH09_SimpleTexture2D.o', [], []),
1795+
'Simple_TextureCubemap': ('CH09_TextureCubemap.o', [], []),
1796+
'TextureWrap': ('CH09_TextureWrap.o', [], []),
1797+
'MultiTexture': ('CH10_MultiTexture.o', ['Chapter_10/MultiTexture/basemap.tga', 'Chapter_10/MultiTexture/lightmap.tga'], []),
1798+
# run this individual test with optimizations and closure for more coverage
1799+
'ParticleSystem': ('CH13_ParticleSystem.o', ['Chapter_13/ParticleSystem/smoke.tga'], ['-O2']),
1800+
})
1801+
def test_glbook(self, program, images, cflags):
17921802
self.cflags.append('-Wno-int-conversion')
17931803
self.cflags.append('-Wno-pointer-sign')
1794-
programs = self.get_library('third_party/glbook', [
1804+
1805+
libs = self.get_library('third_party/glbook', [
17951806
'Chapter_2/Hello_Triangle/CH02_HelloTriangle.o',
17961807
'Chapter_8/Simple_VertexShader/CH08_SimpleVertexShader.o',
17971808
'Chapter_9/Simple_Texture2D/CH09_SimpleTexture2D.o',
@@ -1804,19 +1815,13 @@ def test_glbook(self):
18041815
def book_path(path):
18051816
return test_file('third_party/glbook', path)
18061817

1807-
for program in programs:
1808-
print(program)
1809-
basename = os.path.basename(program)
1810-
args = ['-lGL', '-lEGL', '-lX11']
1811-
if basename == 'CH10_MultiTexture.o':
1812-
shutil.copy(book_path('Chapter_10/MultiTexture/basemap.tga'), '.')
1813-
shutil.copy(book_path('Chapter_10/MultiTexture/lightmap.tga'), '.')
1814-
args += ['--preload-file', 'basemap.tga', '--preload-file', 'lightmap.tga']
1815-
elif basename == 'CH13_ParticleSystem.o':
1816-
shutil.copy(book_path('Chapter_13/ParticleSystem/smoke.tga'), '.')
1817-
args += ['--preload-file', 'smoke.tga', '-O2'] # test optimizations and closure here as well for more coverage
1818-
1819-
self.reftest(program, book_path(basename.replace('.o', '.png')), cflags=args)
1818+
cflags += ['-lGL', '-lEGL', '-lX11']
1819+
for image in images:
1820+
cflags += ['--preload-file', f'{book_path(image)}@{os.path.basename(image)}']
1821+
1822+
lib = [l for l in libs if program in os.path.basename(l)][0]
1823+
1824+
self.reftest(lib, book_path(program.replace('.o', '.png')), cflags=cflags)
18201825

18211826
@requires_graphics_hardware
18221827
@parameterized({

0 commit comments

Comments
 (0)