Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix paths to test binaries #112

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

matlo607
Copy link
Contributor

I could not execute the unit tests on Linux after a build with the package manager conan.
I got various errors as below :

Could not find executable /home/vagrant/.conan/data/qpid-proton/0.17.0/murex/testing/build/0a97a1801350fba2ff4f9c864097f04752c8d5c5/build-dir/proton-c/bindings/cpp/codec_test
...
The following tests passed:
        python-test
        cpp-example-container

11% tests passed, 17 tests failed out of 19

Total Test time (real) =  38.84 sec

The following tests FAILED:
          2 - cpp-codec_test (Not Run)
          3 - cpp-thread_safe_test (Not Run)
          4 - cpp-interop_test (Not Run)
          5 - cpp-message_test (Not Run)
          6 - cpp-scalar_test (Not Run)
          7 - cpp-value_test (Not Run)
          8 - cpp-container_test (Not Run)
          9 - cpp-url_test (Not Run)
         10 - c-object-tests (Not Run)
         11 - c-message-tests (Not Run)
         12 - c-engine-tests (Not Run)
         13 - c-parse-url-tests (Not Run)
         14 - c-refcount-tests (Not Run)
         15 - c-reactor-tests (Not Run)
         16 - c-event-tests (Not Run)
         17 - c-data-tests (Not Run)
         18 - c-condition-tests (Not Run)
Errors while running CTest

To reproduce the initial problem, please feel free to use this conan recipe :

PROJECT(conan-qpid-proton)
cmake_minimum_required(VERSION 2.8)
include(${CMAKE_CURRENT_SOURCE_DIR}/../conanbuildinfo.cmake)
CONAN_BASIC_SETUP()

macro(use_cxx11)
    if(CMAKE_VERSION VERSION_LESS "3.1")
        if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
            set (CMAKE_CXX_FLAGS "--std=gnu++11 ${CMAKE_CXX_FLAGS}")
        endif()
    else()
        set(CMAKE_CXX_STANDARD 11)
    endif()
endmacro(use_cxx11)

if(CXX_14)
    MESSAGE("Activating CXX_STANDARD 14")
    set(CMAKE_CXX_STANDARD 14)
else()
    MESSAGE("Not activating CXX_STANDARD 14")
    MESSAGE("Activating CXX_STANDARD 11")
    use_cxx11()
endif()

include("CMakeListsOriginal.cmake")
#!/usr/bin/env python

import os
import shutil
from conans import ConanFile, CMake

def _defs_to_string(defs):
    return " ".join(['-D{0}="{1}"'.format(k, v) for k, v in defs.items()])

class QpidProtonConan(ConanFile):
    name = 'qpid-proton'
    version = '0.17.0'
    license = "https://github.com/apache/qpid-proton/blob/master/LICENSE"
    settings = "os", "compiler", "build_type", "arch"
    options = {
        "PIC": [True, False],
        "shared": [True, False],
        "include_pdbs": [True, False],
        "tests": [True, False],
        "std": ['c++98', 'c++11']
    }
    default_options = "PIC=True", "shared=True", "include_pdbs=False", "tests=False", "std=c++11"
    sources = "https://github.com/apache/qpid-proton.git"
    source_dir = "qpid-proton"
    generators = "cmake"
    exports_sources = "CMakeLists.txt"

    def source(self):
        self.run("git clone %s" % (self.sources))
        self.run("cd %s && git checkout tags/%s" % (self.source_dir, self.version))
        os.rename(os.path.join(self.source_dir, 'CMakeLists.txt'), os.path.join(self.source_dir, 'CMakeListsOriginal.cmake'))
        shutil.move('CMakeLists.txt', self.source_dir)

    def requirements(self):
        self.requires("OpenSSL/1.0.2l@conan/stable")

    def build(self):
        cmake = CMake(self.settings)
        cmake.definitions['CMAKE_C_FLAGS'] = '-D_REENTRANT'
        cmake.definitions['CMAKE_CXX_FLAGS'] = '-D_REENTRANT -std=%s' % (self.options.std)
        cmake.definitions['CMAKE_SHARED_LINKER_FLAGS'] = '-ldl'
        cmake.definitions['CMAKE_INSTALL_PREFIX'] = '%s' % (self.package_folder)
        #cmake.definitions['CMAKE_VERBOSE_MAKEFILE:BOOL'] = 'ON'

        python_home = os.environ['PYTHONHOME']

        cmake_defs = dict()
        cmake_defs['ENABLE_VALGRIND'] = 'OFF'
        # proton-j was removed in version 0.17.0 and '-DBUILD_JAVA' becomes obsolete
        cmake_defs['BUILD_JAVA'] = 'OFF'
        cmake_defs['BUILD_PERL'] = 'OFF'
        cmake_defs['BUILD_PHP'] = 'OFF'
        cmake_defs['BUILD_PYTHON'] = 'ON'
        cmake_defs['BUILD_RUBY'] = 'OFF'
        cmake_defs['SASL_IMPL'] = 'none'
        cmake_defs['PYTHON_EXECUTABLE'] = '%s/bin/python' % (python_home)
        cmake_defs['PYTHON_INCLUDE_DIR'] = '%s/include/python2.7' % (python_home)
        cmake_defs['PYTHON_LIBRARY'] = '%s/lib/libpython2.7.so' % (python_home)

        self.output.info("Configuring: cmake %s %s" % (cmake.command_line, _defs_to_string(cmake_defs)))

        old_ld_library_path = os.environ['LD_LIBRARY_PATH']
        ld_library_path = os.path.join(python_home, 'lib') + os.pathsep + old_ld_library_path
        old_path = os.environ['PATH']
        path = os.path.join(python_home, 'bin') + os.pathsep + old_path
        self.output.info("PYTHONHOME=%s" % (python_home))
        self.output.info("LD_LIBRARY_PATH=%s" % (ld_library_path))
        self.output.info("PATH=%s" % (path))
        os.environ['PATH'] = path
        os.environ['LD_LIBRARY_PATH'] = ld_library_path
        os.environ['PYTHONHOME'] = python_home

        cmake.configure(self, args=None, defs=cmake_defs, \
                source_dir=os.path.join('..', self.source_dir), build_dir='build-dir')
        cmake.build(self, args=None, build_dir='build-dir', target='install')

        if self.options.tests:
            # exclude java tests as we are not interested in proton-j
            self.run("cd build-dir && ctest -VV -E proton-java")

    def package(self):
        pass

    def package_info(self):
        self.cpp_info.includedirs = ['include']
        self.cpp_info.libdirs = ['lib64']
        self.cpp_info.resdir = ['share']
        self.cpp_info.libs = [
            'qpid-proton-core',
            'qpid-proton-cpp',
            'qpid-proton-proactor',
            'qpid-proton'
        ]

@astitcher
Copy link
Member

@matlo607 Sorry this change looks good, but it makes the regular CI build fail because now it can't find the same binaries!

So Look at the Travis output above and try to figure out a change that will work in all cases.

@matlo607 matlo607 force-pushed the fix-path-test-binaries branch 4 times, most recently from ada1027 to bc4b72a Compare July 25, 2017 16:10
@matlo607
Copy link
Contributor Author

@astitcher
Please could you give me some hints to fix the build on Windows ?
I don't have a clue and a Windows machine too.

@astitcher
Copy link
Member

@matlo607 I think this may be fixed with change b172262. If you have a chance can you check and close this PR if it is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants