python/tests: Speed up the tests by reusing the same pipe context.

This commit is contained in:
José Fonseca
2010-03-31 13:12:08 +01:00
parent fceee46022
commit aae63a7109
2 changed files with 6 additions and 4 deletions

View File

@@ -56,6 +56,7 @@ class TextureTest(TestCase):
def test(self): def test(self):
dev = self.dev dev = self.dev
ctx = self.ctx
target = self.target target = self.target
format = self.format format = self.format
@@ -103,8 +104,6 @@ class TextureTest(TestCase):
size = util_format_get_nblocksy(format, h) * stride size = util_format_get_nblocksy(format, h) * stride
src_raw = os.urandom(size) src_raw = os.urandom(size)
ctx = self.dev.context_create()
ctx.surface_write_raw(src_surface, 0, 0, w, h, src_raw, stride) ctx.surface_write_raw(src_surface, 0, 0, w, h, src_raw, stride)
ctx.surface_copy(dst_surface, 0, 0, ctx.surface_copy(dst_surface, 0, 0,
@@ -119,6 +118,7 @@ class TextureTest(TestCase):
def main(): def main():
dev = Device() dev = Device()
ctx = dev.context_create()
suite = TestSuite() suite = TestSuite()
targets = [ targets = [
@@ -178,6 +178,7 @@ def main():
while zslice < depth >> level: while zslice < depth >> level:
test = TextureTest( test = TextureTest(
dev = dev, dev = dev,
ctx = ctx,
target = target, target = target,
format = format, format = format,
width = size, width = size,

View File

@@ -59,6 +59,7 @@ class TextureTest(TestCase):
def test(self): def test(self):
dev = self.dev dev = self.dev
ctx = self.ctx
target = self.target target = self.target
format = self.format format = self.format
@@ -91,8 +92,6 @@ class TextureTest(TestCase):
in_raw = os.urandom(size) in_raw = os.urandom(size)
ctx = self.dev.context_create()
ctx.surface_write_raw(surface, 0, 0, surface.width, surface.height, in_raw, stride) ctx.surface_write_raw(surface, 0, 0, surface.width, surface.height, in_raw, stride)
out_raw = ctx.surface_read_raw(surface, 0, 0, surface.width, surface.height) out_raw = ctx.surface_read_raw(surface, 0, 0, surface.width, surface.height)
@@ -103,6 +102,7 @@ class TextureTest(TestCase):
def main(): def main():
dev = Device() dev = Device()
ctx = dev.context_create()
suite = TestSuite() suite = TestSuite()
targets = [ targets = [
@@ -162,6 +162,7 @@ def main():
while zslice < depth >> level: while zslice < depth >> level:
test = TextureTest( test = TextureTest(
dev = dev, dev = dev,
ctx = ctx,
target = target, target = target,
format = format, format = format,
width = size, width = size,