You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kp...@apache.org on 2021/09/29 20:52:16 UTC

[qpid-interop-test] branch main updated: Changed location of installed python files to me more standard, also added entry point in /usr/local/bin.

This is an automated email from the ASF dual-hosted git repository.

kpvdr pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-interop-test.git


The following commit(s) were added to refs/heads/main by this push:
     new 60ab8dc  Changed location of installed python files to me more standard, also added entry point in /usr/local/bin.
60ab8dc is described below

commit 60ab8dc59f668794e046a7fee7cbfacff5b7517a
Author: Kim van der Riet <ki...@apache.org>
AuthorDate: Wed Sep 29 16:51:57 2021 -0400

    Changed location of installed python files to me more standard, also added entry point in /usr/local/bin.
---
 CMakeLists.txt                             |  13 ++-
 NOTICE                                     |   2 +-
 QUICKSTART.md                              | 138 ++++++++---------------------
 README.md                                  |  13 ++-
 bin/amqp_complex_types_test                |   3 -
 bin/amqp_large_content_test                |   3 -
 bin/amqp_types_test                        |   3 -
 bin/jms_hdrs_props_test                    |   3 -
 bin/jms_messages_test                      |   3 -
 bin/qpid-interop-test.in                   |  84 ++++++++++++++++++
 config.sh.in                               |  25 ------
 src/python/qpid_interop_test/qit_common.py |   5 +-
 src/python/qpid_interop_test/qit_shim.py   |  21 ++---
 13 files changed, 143 insertions(+), 173 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index faa4769..ae4a1e0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -113,14 +113,11 @@ if(NOT "${retcode}" STREQUAL "0")
     message(FATAL_ERROR "Data code file generation for .Net failed: ${retcode}")
 endif()
 
-configure_file(config.sh.in config.sh @ONLY)
+configure_file(bin/qpid-interop-test.in bin/qpid-interop-test @ONLY)
 
 install (DIRECTORY src/python/qpid_interop_test
-         DESTINATION ${CMAKE_INSTALL_PREFIX}
+         DESTINATION ${CMAKE_INSTALL_PREFIX}/lib
          PATTERN ".gitignore" EXCLUDE)
-install (DIRECTORY bin
-         DESTINATION ${CMAKE_INSTALL_PREFIX}
-         FILE_PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ
-         PATTERN ".gitignore" EXCLUDE)
-install(FILES build/config.sh
-        DESTINATION ${CMAKE_INSTALL_PREFIX}/libexec/qpid_interop_test/)
+install(FILES build/bin/qpid-interop-test
+        DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/
+        PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_READ WORLD_EXECUTE)
diff --git a/NOTICE b/NOTICE
index b4c1091..8155002 100644
--- a/NOTICE
+++ b/NOTICE
@@ -1,5 +1,5 @@
 Apache Qpid Interop Test
-Copyright 2015-2020 The Apache Software Foundation
+Copyright 2015-2021 The Apache Software Foundation
 
 This product includes software developed at
 The Apache Software Foundation (http://www.apache.org/).
diff --git a/QUICKSTART.md b/QUICKSTART.md
index 95e9e18..bcbd86e 100644
--- a/QUICKSTART.md
+++ b/QUICKSTART.md
@@ -34,78 +34,79 @@ The following tools are needed to build qpid-interop-test:
 
  * git
  * gcc-c++
- * Python 2.7.x
- * Python 3.x
+ * python3-devel
+ * make
  * cmake
- * Java JDK
- * Maven
- * JSON cpp
+ * java-11-openjdk-devel
+ * maven
+ * jsoncpp-devel
+
+These may be found on relatively recent distributions such as:
+
+ * Fedora
+ * Ubuntu
+ * RHEL 8+
 
 The following Qpid components must be installed *before* you build and install
 qpid-interop-test:
 
- * Qpid Proton C++ development
- * Qpid Python
- * Python2 Qpid Proton
- * Python3 Qpid Proton
+ * qpid-proton-cpp-devel
+ * python3-qpid-proton
 
 The following are not required, but if installed and present, will be tested:
 
- * Rhea (a JavaScript client, also requires npm and nodejs)
- * AMQP.Net Lite (requires mono)
- 
+ * Rhea https://github.com/amqp/rhea.git (a JavaScript AMQP client, also requires nodejs-devel)
+ * dotnet-sdk-5.0
+
 In addition, if you wish to run the tests against a broker on the build machine,
 it will be necessary to have a running broker. One of the following may be
 installed and started against which to run the interop tests as a local broker:
- 
+
  * Artemis Java broker
- * ActiveMQ Java broker
- * Qpid C++ broker
  * Qpid Dispatch router (which may be used as a single node, or as part of a
- routed configuration)
+ routed configuration) qpid-dispatch-router
 
 Any AMQP 1.0 broker should work. Tests can also be run against a
 remote broker provided the broker IP address is known.
 
 These pre-requisites can be installed using the standard system package manager
-(yum, dnf, apt-get etc.) OR built from source and installed.
+(dnf, apt-get etc.) OR built from source and installed.
 
 These are the install steps:
 
 1. Install prerequisites, from packages or source
-2. Install or download / build AMQP brokers to test against
-3. Build qpid-interop-test
-4. Run the tests
+2. Build qpid-interop-test
+3. Run the tests
 
 ## 2. Install prerequisites
 
 If installing prerequisites from packages, the following are some suggestions
 
-### 2.1 RHEL7
+### 2.1 RHEL8
 
 From a clean install:
 
 ````
-yum install cmake maven java-1.8.0-openjdk-devel perl-XML-XPath
+dnf install cmake maven java-1.11.0-openjdk-devel
 ````
 
 Some packages will need to be downloaded from [EPEL](https://fedoraproject.org/wiki/EPEL).
 To set up the EPEL repo in yum:
 
 ````
-wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
-yum install epel-release-latest-7.noarch.rpm
+wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
+yum install epel-release-latest-8.noarch.rpm
 ````
 
 then install the following packages:
 
 ````
-yum -y install jsoncpp-devel nodejs-rhea qpid-proton-cpp-devel python-qpid-proton qpid-proton-cpp-devel python2-qpid-proton
+dnf -y install jsoncpp-devel nodejs-rhea qpid-proton-cpp-devel python-qpid-proton qpid-proton-cpp-devel python2-qpid-proton
 ````
 
-Note that RHEL6 is not supported because it uses Python 2.6.x, and the test code uses features of Python 2.7.x.
+Note that RHEL6 and 7 are not supported because they standardize Python 2.7.x.
 
-### 2.2 Fedora 28
+### 2.2 Fedora 34
 
 All packages are available directly from the Fedora repositories:
 
@@ -113,7 +114,7 @@ All packages are available directly from the Fedora repositories:
 dnf -y install gcc-c++ cmake maven java-1.8.0-openjdk-devel perl-XML-XPath jsoncpp-devel nodejs-rhea qpid-proton-cpp-devel python-qpid-proton qpid-proton-cpp-devel python2-qpid-proton python3-qpid-proton
 ````
 
-### 2.3 CentOS7 Docker image
+### 2.3 CentOS8 Docker image
 
 Docker images come with only the bare essentials, so there is more to install than a standard bare-metal install:
 
@@ -138,82 +139,13 @@ yum -y install mono-devel python34-devel jsoncpp-devel nodejs-rhea qpid-proton-c
 Note that at the time of release, there is no python3-qpid-proton package available for CentOS7, but this should be available soon. Tests should be run with
 the --exclude-shim ProtonPython3 flag to avoid errors.
 
-### 2.4 Fedora 28 Docker image
+### 2.4 Fedora 34 Docker image
 
 ````
 dnf -y install vim unzip wget procps-ng git gcc-c++ make cmake maven swig java-1.8.0-openjdk-devel perl-XML-XPath python-devel mono-devel python3-devel jsoncpp-devel nodejs-rhea python-qpid-proton qpid-proton-cpp-devel python2-qpid-proton python3-qpid-proton
 ````
 
-## 3. Obtaining a broker
-
-Qpid-interop-test requires a running broker to be available. This
-may be on localhost as a local install or build, or on another machine, in which case its
-IP addresss must be known. Some local broker install options are:
-
-### 3.1 ActiveMQ 5
-
-Download from [Apache](http://activemq.apache.org/download.html).
-
-Make the following changes to the `activemq.xml` config file: For XML element
-`broker.transportConnectors.transportConnector@name="amqp"` add the attribute
-`wireFormat.allowNonSaslConnections=true`. ie:
-
-````
-<transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=1048576000&amp;wireFormat.allowNonSaslConnections=true"/>
-````
-
-### 3.2 Artemis
-
-Download from [Apache](https://activemq.apache.org/artemis/download.html).
-
-### 3.3 Qpid cpp broker
-
-    yum -y install qpid-cpp-server # CentOS7/RHEL
-
-or
-
-    dnf -y install qpid-cpp-server # Fedora 28
-
-and set the configuration file in /etc/qpid/qpidd.conf as follows:
-
-````
-auth=no
-queue-patterns=qit
-````
-
-The broker may be started via service, but if running in a Docker container, this may not work. In this case, start the broker directly:
-
-    /sbin/qpidd -d
-
-and can be stopped with
-
-    /sbin/qpidd -q
-
-### 3.4 Qpid Dispatch Router
-
-    yum install qpid-dispatch-router
-
-and add the following to the config file in /etc/qpid-dispatch/qdrouterd.conf:
-
-````
-listener {
-    host: ::1
-    port: amqp
-    authenticatePeer: no
-    saslMechanisms: ANONYMOUS
-}
-
-````
-
-The broker may be started via service, but if running in a Docker container, this may not work. In this case, start the broker directly:
-
-    /sbin/qdrouterd -d
-
-and can be stopped with
-
-    pkill qdrouterd # Needs procps-ng package installed in Docker containers
-
-## 4. Install qpid-interop-test
+## 3. Build and install qpid-interop-test
 
 Qpid-interop-test may be installed locally (preferred for local builds) or to the system
 (which requires root privileges). For a local install, use the `-DCMAKE_INSTALL_PREFIX`
@@ -249,9 +181,9 @@ If you are a developer working on changes to qpid-interop-test itself, the
 source repository can be cloned from git as follows:
 
     git clone https://gitbox.apache.org/repos/asf/qpid-interop-test.git
-    
+
 or
-    
+
     git clone https://github.com/apache/qpid-interop-test.git
 
 
@@ -259,7 +191,7 @@ or
 
 ### 5.1 Set the environment
 
-The config.sh script is in the qpid-interop-test build directory: 
+The config.sh script is in the qpid-interop-test build directory:
 
 ````
 source build/config.sh
@@ -360,7 +292,7 @@ not defined or `Amqp.Net.dll` was not found in the path.
 ### 6.2 Rhea JavaScript Client
 
 The following packages need to be installed:
- 
+
  * nodejs
  * npm
 
diff --git a/README.md b/README.md
index c9eb0fe..cea430f 100644
--- a/README.md
+++ b/README.md
@@ -51,16 +51,16 @@ directory. The very short version of this is as follows:
 1. Write a pair of client programs using the client API under test. The first
 is a sender which reads the following from the command-line:
 
-    `<broker address> <amqp type> <JSON string: test values> ...`
-    
+    `sender <broker address> <amqp type> <JSON string: test values> ...`
+
     and is responsible for sending messages containing the test values each in a
     single message in the appropriate AMQP type format.
-    
+
     The second client program is a receiver, and must read the following from the
     command-line
-    
-    `<broker address> <amqp type> <JSON string: num messages>`
-    
+
+    `receiver <broker address> <amqp type> <JSON string: num messages>`
+
     and is responsible for receiving <num messages> messages from the broker and
     printing the bodies of the received messages appropriately decoded for type
     <amqp type>. The printed output will be a JSON string containing the identical
@@ -75,4 +75,3 @@ in step 1 above.
 3. Add an instance of your new shim class to `SHIM_MAP` keyed against its name.
 
 That's it!
-
diff --git a/bin/amqp_complex_types_test b/bin/amqp_complex_types_test
deleted file mode 100755
index 2c35a7e..0000000
--- a/bin/amqp_complex_types_test
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/bash
-
-python3 -m qpid_interop_test.amqp_complex_types_test $@
diff --git a/bin/amqp_large_content_test b/bin/amqp_large_content_test
deleted file mode 100755
index 9eae769..0000000
--- a/bin/amqp_large_content_test
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/bash
-
-python3 -m qpid_interop_test.amqp_large_content_test $@
diff --git a/bin/amqp_types_test b/bin/amqp_types_test
deleted file mode 100755
index 1a9ca41..0000000
--- a/bin/amqp_types_test
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/bash
-
-python3 -m qpid_interop_test.amqp_types_test $@
diff --git a/bin/jms_hdrs_props_test b/bin/jms_hdrs_props_test
deleted file mode 100755
index ca0a7c1..0000000
--- a/bin/jms_hdrs_props_test
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/bash
-
-python3 -m qpid_interop_test.jms_hdrs_props_test $@
diff --git a/bin/jms_messages_test b/bin/jms_messages_test
deleted file mode 100755
index 73afbe7..0000000
--- a/bin/jms_messages_test
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/bash
-
-python3 -m qpid_interop_test.jms_messages_test $@
diff --git a/bin/qpid-interop-test.in b/bin/qpid-interop-test.in
new file mode 100755
index 0000000..8c32789
--- /dev/null
+++ b/bin/qpid-interop-test.in
@@ -0,0 +1,84 @@
+#! /usr/bin/env python3
+
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+
+# NOTE: THIS FILE IS GENERATED, DO NOT EDIT DIRECTLY.
+
+""" Qpid Interop Test entry point """
+
+import os
+import subprocess
+import sys
+
+TEST_NAME_LIST = ['amqp_types_test',
+                  'amqp_complex_types_test',
+                  'amqp_large_content_test',
+                  'jms_messages_test',
+                  'jms_hdrs_props_test']
+
+class TestOptions:
+    """ Test options for QIT entry point """
+    def __init__(self):
+        if len(sys.argv) == 1:
+            print('ERROR: No test name.\n')
+            TestOptions._usage(sys.argv[0])
+            sys.exit(1)
+        test_name = sys.argv[1]
+        if test_name in ['-h', '--help', 'help']:
+            self._usage(sys.argv[0])
+            sys.exit()
+        if test_name not in TEST_NAME_LIST and test_name != 'all':
+            print('ERROR: Invalid test name.\n')
+            TestOptions._usage(sys.argv[0])
+            sys.exit(1)
+        self.test_list = TEST_NAME_LIST if test_name == 'all' else [test_name]
+        self.test_opts = sys.argv[2:] if len(sys.argv) > 2 else None
+
+    @staticmethod
+    def _usage(argv0):
+        prog_name = argv0.split('/')[-1]
+        print(f'{prog_name} --help:  Print help')
+        print(f'{prog_name} test-name [test-options]')
+        print(f'    test-name:             One of {TEST_NAME_LIST},')
+        print( '                           or "all" to run all tests sequentially.')
+        print( '    test-options:          Optional arguments for test.')
+        print(f'{prog_name} test-name --help: Help for test-name')
+
+if __name__ == "__main__":
+    # Set the environment so proton and QIT can be found
+    os.environ['PYTHONPATH'] = ('@PROTON_INSTALL_DIR@/lib64/proton/bindings/python:'
+                                '@CMAKE_INSTALL_PREFIX@/lib:'
+                                '@CMAKE_INSTALL_PREFIX@/libexec/qpid_interop_test/shims/qpid-proton-python')
+    os.environ['LD_LIBRARY_PATH'] = '@PROTON_INSTALL_DIR@/lib64:%s'%(os.getenv('LD_LIBRARY_PATH'))
+    os.environ['CMAKE_INSTALL_PREFIX'] = '@CMAKE_INSTALL_PREFIX@'
+
+    # Process test options
+    TEST_OPTIONS = TestOptions()
+
+    # Run the test(s)
+    for this_test_name in TEST_OPTIONS.test_list:
+        if len(TEST_OPTIONS.test_list) > 1:
+            print(f'=== {this_test_name} ===')
+        subprocess_args = ['python3', '-m', f'qpid_interop_test.{this_test_name}']
+        if TEST_OPTIONS.test_opts is not None:
+            subprocess_args.extend(TEST_OPTIONS.test_opts)
+        try:
+            subprocess.run(subprocess_args, check=True)
+        except subprocess.CalledProcessError as err:
+            cmd = ' '.join(err.cmd)
+            print(f'"{cmd}" returned exit-code {err.returncode}')
+        if len(TEST_OPTIONS.test_list) > 1:
+            print()
diff --git a/config.sh.in b/config.sh.in
deleted file mode 100644
index 0fbe426..0000000
--- a/config.sh.in
+++ /dev/null
@@ -1,25 +0,0 @@
-#! /bin/bash
-
-#  Licensed to the Apache Software Foundation (ASF) under one or more
-#  contributor license agreements.  See the NOTICE file distributed with
-#  this work for additional information regarding copyright ownership.
-#  The ASF licenses this file to You under the Apache License, Version 2.0
-#  (the "License"); you may not use this file except in compliance with
-#  the License.  You may obtain a copy of the License at
-#
-#  http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-
-
-# Source this file to set up environment variables for the Qpid interop tests.
-
-export PYTHON3PATH=@PROTON_INSTALL_DIR@/lib64/proton/bindings/python:@CMAKE_INSTALL_PREFIX@:@CMAKE_INSTALL_PREFIX@/libexec/qpid_interop_test/shims/qpid-proton-python
-export PYTHONPATH=${PYTHON3PATH}
-
-export LD_LIBRARY_PATH=@PROTON_INSTALL_DIR@/lib64:${LD_LIBRARY_PATH}
-export PATH=@PROTON_INSTALL_DIR@/bin:@CMAKE_INSTALL_PREFIX@/bin:${PATH}
diff --git a/src/python/qpid_interop_test/qit_common.py b/src/python/qpid_interop_test/qit_common.py
index 724f508..88e25b0 100644
--- a/src/python/qpid_interop_test/qit_common.py
+++ b/src/python/qpid_interop_test/qit_common.py
@@ -36,8 +36,9 @@ QPID_JMS_SHIM_VER = '0.3.0-SNAPSHOT'
 
 # Find shim directory
 PREFIX_LIST = [os.path.join(os.sep, 'usr', 'local')]
-if 'PYTHONPATH' in os.environ:
-    PREFIX_LIST.extend(os.getenv('PYTHONPATH').split(':'))
+if 'CMAKE_INSTALL_PREFIX' in os.environ:
+    PREFIX_LIST.append(os.getenv('CMAKE_INSTALL_PREFIX'))
+QIT_SHIM_HOME = None
 for prefix in PREFIX_LIST:
     if os.path.exists(os.path.join(prefix, 'libexec', 'qpid_interop_test')):
         QIT_SHIM_HOME = os.path.join(prefix, 'libexec', 'qpid_interop_test', 'shims')
diff --git a/src/python/qpid_interop_test/qit_shim.py b/src/python/qpid_interop_test/qit_shim.py
index 2404754..b53acb4 100644
--- a/src/python/qpid_interop_test/qit_shim.py
+++ b/src/python/qpid_interop_test/qit_shim.py
@@ -32,13 +32,10 @@ from qpid_interop_test.qit_errors import InteropTestTimeout
 
 class ShimProcess(subprocess.Popen):
     """Abstract parent class for Sender and Receiver shim process"""
-    def __init__(self, params, python3_flag, proc_name):
+    def __init__(self, params, proc_name):
         self.proc_name = proc_name
         self.killed_flag = False
         self.env = copy.deepcopy(os.environ)
-        if python3_flag:
-            if 'PYTHON3PATH' in self.env:
-                self.env['PYTHONPATH'] = self.env['PYTHON3PATH']
         super().__init__(params, stdout=subprocess.PIPE, stderr=subprocess.PIPE, preexec_fn=os.setsid, env=self.env)
 
     def wait_for_completion(self, timeout):
@@ -84,15 +81,15 @@ class ShimProcess(subprocess.Popen):
 
 class Sender(ShimProcess):
     """Sender shim process"""
-    def __init__(self, params, python3_flag, proc_name='Sender'):
-        #print('\n>>>SNDR>>> %s python3_flag=%s' % (params, python3_flag))
-        super().__init__(params, python3_flag, proc_name)
+    def __init__(self, params, proc_name='Sender'):
+        #print('\n>>>SNDR>>> %s' % params)
+        super().__init__(params, proc_name)
 
 class Receiver(ShimProcess):
     """Receiver shim process"""
-    def __init__(self, params, python3_flag, proc_name='Receiver'):
-        #print('\n>>>RCVR>>> %s python3_flag=%s' % (params, python3_flag))
-        super().__init__(params, python3_flag, proc_name)
+    def __init__(self, params, proc_name='Receiver'):
+        #print('\n>>>RCVR>>> %s' % params)
+        super().__init__(params, proc_name)
 
 class Shim:
     """Abstract shim class, parent of all shims."""
@@ -110,14 +107,14 @@ class Shim:
         args = []
         args.extend(self.send_params)
         args.extend([broker_addr, queue_name, test_key, json_test_str])
-        return Sender(args, 'Python3' in self.NAME)
+        return Sender(args)
 
     def create_receiver(self, broker_addr, queue_name, test_key, json_test_str):
         """Create a new receiver instance"""
         args = []
         args.extend(self.receive_params)
         args.extend([broker_addr, queue_name, test_key, json_test_str])
-        return Receiver(args, 'Python3' in self.NAME)
+        return Receiver(args)
 
 
 class ProtonPython3Shim(Shim):

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