qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [2/2] qpid-proton git commit: fNO-JIRA: [cpp] testme check program exists instead of using HAS_CPP11
Date Wed, 19 Sep 2018 01:00:06 GMT
fNO-JIRA: [cpp] testme check program exists instead of using HAS_CPP11

Using HAS_CPP11 won't work outside a build tree. Instead check for existence
of test executables to detect tests that are not built under c++03


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/96972871
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/96972871
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/96972871

Branch: refs/heads/master
Commit: 96972871c78ed9aabfca24e73e95b9e5f0f58c59
Parents: 32b9708
Author: Alan Conway <aconway@redhat.com>
Authored: Tue Sep 18 16:01:21 2018 -0400
Committer: Alan Conway <aconway@redhat.com>
Committed: Tue Sep 18 16:01:21 2018 -0400

----------------------------------------------------------------------
 cpp/examples/testme         | 29 ++++++++++++++++-------------
 tests/py/test_subprocess.py |  7 +++++++
 2 files changed, 23 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/96972871/cpp/examples/testme
----------------------------------------------------------------------
diff --git a/cpp/examples/testme b/cpp/examples/testme
index d4abc0a..5f30f23 100755
--- a/cpp/examples/testme
+++ b/cpp/examples/testme
@@ -21,7 +21,7 @@
 # Run the C++ examples and verify that they behave as expected.
 # Example executables must be in PATH
 
-import unittest, sys, shutil, os
+import unittest, sys, shutil, os, errno
 from test_subprocess import Popen, TestProcessError, check_output
 import test_subprocess
 from os.path import dirname
@@ -143,11 +143,13 @@ map{string(k1):int(42), symbol(k2):boolean(0)}
         self.assertTrue(len(out) > 0);
         self.assertEqual(["send"]*len(out), out)
 
-    @unittest.skipUnless(os.getenv('HAS_CPP11'), "not a  C++11 build")
     def test_scheduled_send(self):
-        out = check_output(["scheduled_send", "-a", Broker.addr+"scheduled_send", "-t", "0.1",
"-i", "0.001"]).split()
-        self.assertTrue(len(out) > 0);
-        self.assertEqual(["send"]*len(out), out)
+        try:
+            out = check_output(["scheduled_send", "-a", Broker.addr+"scheduled_send", "-t",
"0.1", "-i", "0.001"]).split()
+            self.assertTrue(len(out) > 0);
+            self.assertEqual(["send"]*len(out), out)
+        except OSError as e:
+            if e.errno != errno.ENOENT: raise
 
     def test_message_properties(self):
         expect="""using put/get: short=123 string=foo symbol=sym
@@ -161,15 +163,16 @@ expected conversion_error: "unexpected type, want: uint got: string"
 """
         self.assertMultiLineEqual(expect, check_output(["message_properties"]))
 
-    @unittest.skipUnless(os.getenv('HAS_CPP11'), "not a  C++11 build")
     def test_multithreaded_client(self):
-        got = check_output(["multithreaded_client", Broker.addr, "examples", "10"])
-        self.maxDiff = None
-        self.assertIn("10 messages sent and received", got);
-
-#    @unittest.skipUnless(os.getenv('HAS_CPP11'), "not a  C++11 build")
-    @unittest.skip("Test is unstable, will enable when fixed")
-    def test_multithreaded_client_flow_control(self):
+        try:
+            got = check_output(["multithreaded_client", Broker.addr, "examples", "10"])
+            self.maxDiff = None
+            self.assertIn("10 messages sent and received", got);
+        except OSError as e:
+            if e.errno != errno.ENOENT: raise
+
+    # Test is unstable, enable when fixed
+    def skip_test_multithreaded_client_flow_control(self):
         got = check_output(["multithreaded_client_flow_control", Broker.addr, "examples",
"10", "2"])
         self.maxDiff = None
         self.assertIn("20 messages sent and received", got);

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/96972871/tests/py/test_subprocess.py
----------------------------------------------------------------------
diff --git a/tests/py/test_subprocess.py b/tests/py/test_subprocess.py
index 512123f..4905107 100644
--- a/tests/py/test_subprocess.py
+++ b/tests/py/test_subprocess.py
@@ -23,6 +23,13 @@ import subprocess, re, os, tempfile
 
 from subprocess import PIPE
 
+def in_path(name):
+    """Look for name in the PATH""" 
+    for path in os.environ["PATH"].split(os.pathsep):
+        f = os.path.join(path, name)
+        if os.path.isfile(f) and os.access(f, os.X_OK):
+            return f
+
 class TestProcessError(Exception):
     def __init__(self, proc, what, output=None):
         self.output = output


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message