]> git.cworth.org Git - apitrace-tests/blobdiff - cli/cli-trim-unused-shaders.script
cli: Use python differ. Fix failures.
[apitrace-tests] / cli / cli-trim-unused-shaders.script
index 2fb53df62111e33fbb8b4690102e4b4123ca3068..8d461b071876e3a6897ae7c52dbcabed0deea6e6 100644 (file)
@@ -12,8 +12,97 @@ apitrace trim --auto --calls=10,47,50,71,87,88 glxsimple.trace
 
 # Verify that we actually trimmed what we wanted to
 
-apitrace diff --diff=diff glxsimple.trace glxsimple-trim.trace
-expect "12,40d11\n< glCreateShader(GL_VERTEX_SHADER) = 7\n< glShaderSource(7, 1, &\"void main()\n< {\n<         gl_Position = ftransform();\n< }\n< \", NULL)\n< glCompileShader(7)\n< glCreateShader(GL_FRAGMENT_SHADER) = 8\n< glShaderSource(8, 1, &\"#version 120\n< uniform vec4 color;\n< void main()\n< {\n<         gl_FragColor = color;\n< }\n< \", NULL)\n< glCompileShader(8)\n< glCreateProgram() = 9\n< glAttachShader(9, 7)\n< glAttachShader(9, 8)\n< glLinkProgram(9)\n< glUseProgram(9)\n< glGetUniformLocation(9, \"color\") = 0\n< glUniform4f(0, 0, 1, 0, 1)\n< glBegin(GL_QUADS)\n< glVertex2f(0, 0)\n< glVertex2f(64, 0)\n< glVertex2f(64, 64)\n< glVertex2f(0, 64)\n< glEnd()\n42,43d12\n< glXSwapBuffers(0x236a280, 41943041)\n< \n"
+apitrace diff --diff=python glxsimple.trace glxsimple-trim.trace
+expect r"""  glXChooseVisual(37134976, 0, (GLX_RGBA, GLX_RED_SIZE, GLX_RED_SIZE, GLX_GREEN_SIZE, GLX_RED_SIZE, GLX_BLUE_SIZE, GLX_RED_SIZE, GLX_ALPHA_SIZE, GLX_RED_SIZE, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, GLX_RED_SIZE, GLX_X_VISUAL_TYPE, GLX_DIRECT_COLOR, 0)) = ([37179128, 34, 0, 24, 5, 16711680, 65280, 255, 256, 8])
+  glXCreateContext(37134976, ([37179128, 34, 0, 24, 5, 16711680, 65280, 255, 256, 8]), 0, True) = 37241648
+  glXMakeCurrent(37134976, 41943041, 37241648) = True
+  glViewport(0, 0, 64, 64)
+  glMatrixMode(GL_PROJECTION)
+  glLoadIdentity()
+  glOrtho(0.0, 64.0, 64.0, 0.0, 0.0, 1.0)
+  glMatrixMode(GL_MODELVIEW)
+  glClearColor(0.0, 0.0, 1.0, 1.0)
+  glClear((GL_COLOR_BUFFER_BIT))
+  glXSwapBuffers(37134976, 41943041)
+- glCreateShader(GL_VERTEX_SHADER) = 7
+- glShaderSource(7, 1, ('void main()\n{\n        gl_Position = ftransform();\n}\n'), 0)
+- glCompileShader(7)
+- glCreateShader(GL_FRAGMENT_SHADER) = 8
+- glShaderSource(8, 1, ('#version 120\nuniform vec4 color;\nvoid main()\n{\n        gl_FragColor = color;\n}\n'), 0)
+- glCompileShader(8)
+- glCreateProgram() = 9
+- glAttachShader(9, 7)
+- glAttachShader(9, 8)
+- glLinkProgram(9)
+- glUseProgram(9)
+- glGetUniformLocation(9, color) = 0
+- glUniform4f(0, 0.0, 1.0, 0.0, 1.0)
+- glBegin(GL_QUADS)
+- glVertex2f(0.0, 0.0)
+- glVertex2f(64.0, 0.0)
+- glVertex2f(64.0, 64.0)
+- glVertex2f(0.0, 64.0)
+- glEnd()
+  glUseProgram(0)
+- glXSwapBuffers(37134976, 41943041)
+  glGenTextures(1, (1))
+  glBindTexture(GL_TEXTURE_2D, 1)
+  glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, blob(3))
+  glEnable(GL_TEXTURE_2D)
+  glBegin(GL_QUADS)
+  glTexCoord2f(0.0, 0.0)
+  glVertex2f(0.0, 0.0)
+  glTexCoord2f(1.0, 0.0)
+  glVertex2f(64.0, 0.0)
+  glTexCoord2f(1.0, 1.0)
+  glVertex2f(64.0, 64.0)
+  glTexCoord2f(0.0, 1.0)
+  glVertex2f(0.0, 64.0)
+  glEnd()
+  glDisable(GL_TEXTURE_2D)
+  glXSwapBuffers(37134976, 41943041)
+  glClearColor(1.0, 0.0, 0.0, 1.0)
+  glClear((GL_COLOR_BUFFER_BIT))
+  glXSwapBuffers(37134976, 41943041)
+  glCreateShader(GL_VERTEX_SHADER) = 10
+  glShaderSource(10, 1, ('void main()\n{\n        gl_Position = ftransform();\n}\n'), 0)
+  glCompileShader(10)
+  glCreateShader(GL_FRAGMENT_SHADER) = 11
+  glShaderSource(11, 1, ('#version 120\nuniform vec4 color;\nvoid main()\n{\n        gl_FragColor = color;\n}\n'), 0)
+  glCompileShader(11)
+  glCreateProgram() = 12
+  glAttachShader(12, 10)
+  glAttachShader(12, 11)
+  glLinkProgram(12)
+  glUseProgram(12)
+  glGetUniformLocation(12, color) = 0
+  glUniform4f(0, 1.0, 0.0, 1.0, 1.0)
+  glBegin(GL_QUADS)
+  glVertex2f(0.0, 0.0)
+  glVertex2f(64.0, 0.0)
+  glVertex2f(64.0, 64.0)
+  glVertex2f(0.0, 64.0)
+  glEnd()
+  glUseProgram(0)
+  glXSwapBuffers(37134976, 41943041)
+  glGenTextures(1, (2))
+  glBindTexture(GL_TEXTURE_2D, 2)
+  glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, blob(3))
+  glEnable(GL_TEXTURE_2D)
+  glBegin(GL_QUADS)
+  glTexCoord2f(0.0, 0.0)
+  glVertex2f(0.0, 0.0)
+  glTexCoord2f(1.0, 0.0)
+  glVertex2f(64.0, 0.0)
+  glTexCoord2f(1.0, 1.0)
+  glVertex2f(64.0, 64.0)
+  glTexCoord2f(0.0, 1.0)
+  glVertex2f(0.0, 64.0)
+  glEnd()
+  glDisable(GL_TEXTURE_2D)
+  glXSwapBuffers(37134976, 41943041)
+  glXDestroyContext(37134976, 37241648)
+"""
 
 # Generate output images for all frames in the trimmed trace
 
@@ -23,4 +112,9 @@ apitrace dump-images --call-nos=no -o ./glxsimple-out/ glxsimple-trim.trace
 # Compare output to reference images
 
 apitrace diff-images -v ./glxsimple-ref ./glxsimple-out
-expect "Comparing ./glxsimple-ref/0000000000.png and ./glxsimple-out/0000000000.png ... MATCH\nComparing ./glxsimple-ref/0000000001.png and ./glxsimple-out/0000000001.png ... MATCH\nComparing ./glxsimple-ref/0000000002.png and ./glxsimple-out/0000000002.png ... MATCH\nComparing ./glxsimple-ref/0000000003.png and ./glxsimple-out/0000000003.png ... MATCH\nComparing ./glxsimple-ref/0000000004.png and ./glxsimple-out/0000000004.png ... MATCH\n"
+expect r"""Comparing ./glxsimple-ref/0000000000.png and ./glxsimple-out/0000000000.png ... MATCH
+Comparing ./glxsimple-ref/0000000001.png and ./glxsimple-out/0000000001.png ... MATCH
+Comparing ./glxsimple-ref/0000000002.png and ./glxsimple-out/0000000002.png ... MATCH
+Comparing ./glxsimple-ref/0000000003.png and ./glxsimple-out/0000000003.png ... MATCH
+Comparing ./glxsimple-ref/0000000004.png and ./glxsimple-out/0000000004.png ... MATCH
+"""