summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/tests/env.py.in
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/cpp/src/tests/env.py.in')
-rw-r--r--qpid/cpp/src/tests/env.py.in100
1 files changed, 100 insertions, 0 deletions
diff --git a/qpid/cpp/src/tests/env.py.in b/qpid/cpp/src/tests/env.py.in
new file mode 100644
index 0000000000..d76e17f573
--- /dev/null
+++ b/qpid/cpp/src/tests/env.py.in
@@ -0,0 +1,100 @@
+#
+# 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.
+#
+
+from __future__ import print_function
+
+from plano import *
+
+def _export(name, value):
+ globals()[name] = value
+
+ if value is not None:
+ ENV[name] = value
+
+def _export_module(name, path):
+ _export(name, None)
+
+ if exists(path):
+ _export(name, path)
+
+# Variables substituted by cmake
+
+_export("BUILD_DIR", normalize_path("@CMAKE_BINARY_DIR@"))
+_export("SOURCE_DIR", normalize_path("@CMAKE_SOURCE_DIR@"))
+_export("SASLPASSWD2", normalize_path("@SASLPASSWD2_EXECUTABLE@"))
+_export("PYTHON", normalize_path("@PYTHON_EXECUTABLE@"))
+_export("VALGRIND", None)
+
+if "@ENABLE_VALGRIND@" == "ON":
+ _export("VALGRIND", normalize_path("@VALGRIND_EXECUTABLE@"))
+
+# Python path
+
+_python_path = [
+ join(BUILD_DIR, "src", "tests"),
+ join(BUILD_DIR, "bindings", "qpid", "python"),
+ join(BUILD_DIR, "management", "python", "lib"),
+]
+
+if "PYTHONPATH" in ENV:
+ _python_path.extend(ENV["PYTHONPATH"].split(PATH_VAR_SEP))
+
+ENV["PYTHONPATH"] = PATH_VAR_SEP.join(_python_path)
+
+# Path
+
+_path = [
+ join(BUILD_DIR, "src"),
+ join(BUILD_DIR, "src", "RelWithDebInfo"),
+ join(BUILD_DIR, "src", "tests"),
+ join(BUILD_DIR, "src", "tests", "RelWithDebInfo"),
+ join(BUILD_DIR, "management", "python", "bin"),
+]
+
+if "PATH" in ENV:
+ _path.extend(ENV["PATH"].split(PATH_VAR_SEP))
+
+ENV["PATH"] = PATH_VAR_SEP.join(_path)
+
+# Modules
+
+_export_module("HA_LIB", join(BUILD_DIR, "src", "ha.so"))
+_export_module("XML_LIB", join(BUILD_DIR, "src", "xml.so"))
+_export_module("AMQP_LIB", join(BUILD_DIR, "src", "amqp.so"))
+_export_module("TEST_STORE_LIB", join(BUILD_DIR, "src", "tests", "test_store.so"))
+_export_module("STORE_LIB", join(BUILD_DIR, "src", "linearstore.so"))
+
+if STORE_LIB is None:
+ _export_module("STORE_LIB", join(BUILD_DIR, "src", "legacystore.so"))
+
+# Summarize
+
+print("PWD: {}".format(current_dir()))
+print("SOURCE_DIR: {}".format(SOURCE_DIR))
+print("BUILD_DIR: {}".format(BUILD_DIR))
+
+print("PATH:")
+
+for item in _path:
+ print(" {}".format(item))
+
+print("PYTHONPATH:")
+
+for item in _python_path:
+ print(" {}".format(item))