diff options
author | Fabiano FidĂȘncio <fabiano@fidencio.org> | 2012-02-03 02:10:03 -0200 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2012-02-14 14:53:44 +0200 |
commit | 1e8e2f9ee082ea0fb0e71736ba6d2578dea05e70 (patch) | |
tree | 99c508b51b3e3305ee50b1f5ce5c5f442897cf05 /server/tests/regression_test.py | |
parent | aebe837d3ae58f7bbd48bcb010680c1b95f8dc6a (diff) | |
download | spice-1e8e2f9ee082ea0fb0e71736ba6d2578dea05e70.tar.gz spice-1e8e2f9ee082ea0fb0e71736ba6d2578dea05e70.tar.xz spice-1e8e2f9ee082ea0fb0e71736ba6d2578dea05e70.zip |
Adding support to automated tests
As suggested by Alon, a simple automated test to try to find
regressions in Spice code.
To use this, compile Spice with --enable-automated-tests and
run test_display_streaming passing --automated-tests as parameter.
Diffstat (limited to 'server/tests/regression_test.py')
-rwxr-xr-x | server/tests/regression_test.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/server/tests/regression_test.py b/server/tests/regression_test.py new file mode 100755 index 00000000..e53bf878 --- /dev/null +++ b/server/tests/regression_test.py @@ -0,0 +1,25 @@ +#!/usr/bin/python +from subprocess import PIPE, Popen +import Image +import ImageChops + + +def snappy(): + cmd = "snappy -h localhost -p 5912 -o output.ppm" + p = Popen(cmd, shell=True) + p.wait() + +def verify(): + base = Image.open("base_test.ppm") + output = Image.open("output.ppm") + return ImageChops.difference(base, output).getbbox() + +if __name__ == "__main__": + snappy() + diff = verify() + + if diff is None: + print("\033[1;32mSUCCESS: No regressions were found!\033[1;m") + else: + print("\033[1;31mFAIL: Regressions were found!\n\033[1;m" + "\033[1;31m Please, take a look in your code and go fix it!\033[1;m") |