Glean tests report pass when returning a code 127 (library not found),
this is obviously false, since the tests didn't run they could not
pass.

Signed-off-by: Dylan Baker <[email protected]>
---
 framework/tests/gleantest_tests.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/framework/tests/gleantest_tests.py 
b/framework/tests/gleantest_tests.py
index ba2c3a5..cee48b9 100644
--- a/framework/tests/gleantest_tests.py
+++ b/framework/tests/gleantest_tests.py
@@ -21,6 +21,10 @@
 
 """ Tests for the glean class. Requires Nose """
 
+from __future__ import print_function
+import os
+from nose.plugins.skip import SkipTest
+from framework.core import Environment
 from framework.gleantest import GleanTest
 
 
@@ -41,3 +45,24 @@ def test_globalParams_assignment():
     GleanTest.globalParams = ['--quick']
     test2 = GleanTest('basic')
     assert test1.command == test2.command
+
+
+def test_bad_returncode():
+    """ If glean doesn't return zero it should be a fail
+
+    Currently clean returns 127 if piglit can't find it's libs (LD_LIBRARY_PATH
+    isn't set properly), and then marks such tests as pass, when they obviously
+    are not.
+
+    """
+    if not os.path.exists('bin'):
+        raise SkipTest("This test requires a working, built version of piglit")
+
+    # Clearing the environment should remove the piglit/lib from
+    # LD_LIBRARY_PATH
+    os.environ = {}
+
+    test = GleanTest('basic')
+    result = test.run(Environment())
+    print("result: {result}\nreturncode: {returncode}".format(**result))
+    assert result['result'] == 'fail', "Result should have been fail"
-- 
1.9.0

_______________________________________________
Piglit mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to