From 0c0f98ad2be3a222a472d67014040cfa0b09fe81 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Tue, 11 Jun 2019 09:05:22 -0300 Subject: [PATCH 01/18] Add GTest example Signed-off-by: Uilian Ries --- .travis.yml | 6 ++ README.md | 6 ++ appveyor.yml | 4 + libraries/gtest/encryption/CMakeLists.txt | 17 ++++ libraries/gtest/encryption/README.md | 25 ++++++ libraries/gtest/encryption/build.bat | 11 +++ libraries/gtest/encryption/build.sh | 14 +++ libraries/gtest/encryption/conanfile.py | 34 ++++++++ libraries/gtest/encryption/encrypter.cpp | 86 +++++++++++++++++++ libraries/gtest/encryption/encrypter.h | 9 ++ .../encryption/test_package/CMakeLists.txt | 16 ++++ .../encryption/test_package/conanfile.py | 22 +++++ .../test_package/encryption_test.cpp | 51 +++++++++++ 13 files changed, 301 insertions(+) create mode 100644 libraries/gtest/encryption/CMakeLists.txt create mode 100644 libraries/gtest/encryption/README.md create mode 100755 libraries/gtest/encryption/build.bat create mode 100755 libraries/gtest/encryption/build.sh create mode 100644 libraries/gtest/encryption/conanfile.py create mode 100644 libraries/gtest/encryption/encrypter.cpp create mode 100644 libraries/gtest/encryption/encrypter.h create mode 100644 libraries/gtest/encryption/test_package/CMakeLists.txt create mode 100644 libraries/gtest/encryption/test_package/conanfile.py create mode 100644 libraries/gtest/encryption/test_package/encryption_test.cpp diff --git a/.travis.yml b/.travis.yml index 6db14584..81569dc1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,6 +37,9 @@ matrix: - name: Using Facebook Folly with Conan <<: *linux env: FOLDER=libraries/folly/basic + - name: GTest encryption example + <<: *linux + env: FOLDER=libraries/gtest/encryption - name: CMake reuse exported targets multiconfig <<: *linux env: FOLDER=features/cmake/find_package/exported_targets_multiconfig @@ -67,6 +70,9 @@ matrix: - name: Using Facebook Folly with Conan <<: *osx env: FOLDER=libraries/folly/basic + - name: GTest encryption example + <<: *osx + env: FOLDER=libraries/gtest/encryption - name: CMake reuse exported targets multiconfig <<: *osx env: FOLDER=features/cmake/find_package/exported_targets_multiconfig diff --git a/README.md b/README.md index f7ed600e..ed4d167d 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,12 @@ Demonstrate how to use Folly to validate an URI using Futures, FBString, Executo Blog Post: https://blog.conan.io/2018/12/03/Using-Facebook-Folly-with-Conan.html +#### [Using package flow with GTest](libraries/gtest/encryption) + +Demonstrate how to use GTest to test a project with CMake using package development flow + +Documentation: https://docs.conan.io/en/latest/developing_packages/package_dev_flow.html + #### [Exporting targets with CMake and reuse with find_package()](features/cmake/find_package/exported_targets_multiconfig) Use CMake to declare, export and install the targets of some libraries and using Conan to reuse them with diff --git a/appveyor.yml b/appveyor.yml index 0b0c5042..1c3c9af0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -36,6 +36,10 @@ environment: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 CMAKE_GENERATOR: "Visual Studio 15 2017 Win64" PROJECT_DIR: libraries/folly/basic + # GTest encryption example + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + CMAKE_GENERATOR: "Visual Studio 15 2017 Win64" + PROJECT_DIR: libraries/gtest/encryption # Using Conan with find_package and exported targets - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 CMAKE_GENERATOR: "Visual Studio 15 2017 Win64" diff --git a/libraries/gtest/encryption/CMakeLists.txt b/libraries/gtest/encryption/CMakeLists.txt new file mode 100644 index 00000000..6613bc4a --- /dev/null +++ b/libraries/gtest/encryption/CMakeLists.txt @@ -0,0 +1,17 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +PROJECT(encrypter CXX) + +# Initialize Conan ############################################################# +INCLUDE(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +CONAN_BASIC_SETUP() + +# Create Encrypter library ##################################################### +ADD_LIBRARY(${CMAKE_PROJECT_NAME} encrypter.cpp) +TARGET_LINK_LIBRARIES(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) + +# Install Encrypter library #################################################### +install(TARGETS ${CMAKE_PROJECT_NAME} + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +install(FILES encrypter.h DESTINATION include) \ No newline at end of file diff --git a/libraries/gtest/encryption/README.md b/libraries/gtest/encryption/README.md new file mode 100644 index 00000000..e2094ca4 --- /dev/null +++ b/libraries/gtest/encryption/README.md @@ -0,0 +1,25 @@ +# Conan GTest Example + +## Getting Started + +* Download conan client from [Conan.io](https://conan.io). + +* Run the following command. + +```bash +conan create . user/channel +``` + +The above command will export, build and test a conan package for a custom encryption library. + +## Synopsis + +[Conan.io](https://conan.io) example for [gtest](https://github.com/google/googletest/) project. + +The project is using OpenSSL to build an encryption library, and using Google test to ensure that the library is built correctly. +The Google test library is required in the **test_package/conanfile.py**. + +A different approach would be running the test at the end of the **build()** method in the root conanfile.py and require gtest library as a **build_require**, +so it would be only downloaded when the encryption library has to be built from sources. + +With that approach, the **test_package** project could just run an example using/linking with the encryption library. diff --git a/libraries/gtest/encryption/build.bat b/libraries/gtest/encryption/build.bat new file mode 100755 index 00000000..051451fd --- /dev/null +++ b/libraries/gtest/encryption/build.bat @@ -0,0 +1,11 @@ +@ECHO ON + +RMDIR /Q /S build source package + +conan source . --source-folder source +conan install . --install-folder build +conan build . --source-folder source --build-folder build +conan package . --source-folder source --build-folder build --package-folder package +conan export-pkg . conan/testing --package-folder package + +conan test test_package conan-gtest-example/0.1.0@conan/testing diff --git a/libraries/gtest/encryption/build.sh b/libraries/gtest/encryption/build.sh new file mode 100755 index 00000000..8b93d764 --- /dev/null +++ b/libraries/gtest/encryption/build.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e +set -x + +rm -rf build source package + +conan source . --source-folder source +conan install . --install-folder build +conan build . --source-folder source --build-folder build +conan package . --source-folder source --build-folder build --package-folder package +conan export-pkg . conan/testing --package-folder package + +conan test test_package conan-gtest-example/0.1.0@conan/testing diff --git a/libraries/gtest/encryption/conanfile.py b/libraries/gtest/encryption/conanfile.py new file mode 100644 index 00000000..e3d1ccb4 --- /dev/null +++ b/libraries/gtest/encryption/conanfile.py @@ -0,0 +1,34 @@ +from conans import ConanFile +from conans import CMake + + +class ConanGTestExample(ConanFile): + """Build Conan GTest Example""" + name = "conan-gtest-example" + version = "0.1.0" + url = "https://github.com/conan-io/examples" + author = "lasote" + license = "MIT" + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + exports = "*" + description = "Google Test example of use for conan.io" + requires = "OpenSSL/1.0.2r@conan/stable" + options = {"shared": [True, False]} + default_options = {"shared": False} + + def _configure_cmake(self): + cmake = CMake(self) + cmake.configure() + return cmake + + def build(self): + cmake = self._configure_cmake() + cmake.build() + + def package(self): + cmake = self._configure_cmake() + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["encrypter"] diff --git a/libraries/gtest/encryption/encrypter.cpp b/libraries/gtest/encryption/encrypter.cpp new file mode 100644 index 00000000..f53c060d --- /dev/null +++ b/libraries/gtest/encryption/encrypter.cpp @@ -0,0 +1,86 @@ +// SOURCE CODE FROM https://wiki.openssl.org/index.php/EVP_Symmetric_Encryption_and_Decryption +// applink.c => https://www.openssl.org/docs/faq.html +#if _MSC_VER + #include "openssl/applink.c" +#endif +#include "encrypter.h" + +int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key, unsigned char *iv, unsigned char *ciphertext){ + EVP_CIPHER_CTX *ctx; + + int len; + + int ciphertext_len; + + /* Create and initialise the context */ + if(!(ctx = EVP_CIPHER_CTX_new())) handleErrors(); + + /* Initialise the encryption operation. IMPORTANT - ensure you use a key + * and IV size appropriate for your cipher + * In this example we are using 256 bit AES (i.e. a 256 bit key). The + * IV size for *most* modes is the same as the block size. For AES this + * is 128 bits */ + if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv)) + handleErrors(); + + /* Provide the message to be encrypted, and obtain the encrypted output. + * EVP_EncryptUpdate can be called multiple times if necessary + */ + if(1 != EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, plaintext_len)) + handleErrors(); + ciphertext_len = len; + + /* Finalise the encryption. Further ciphertext bytes may be written at + * this stage. + */ + if(1 != EVP_EncryptFinal_ex(ctx, ciphertext + len, &len)) handleErrors(); + ciphertext_len += len; + + /* Clean up */ + EVP_CIPHER_CTX_free(ctx); + + return ciphertext_len; +} + + +int decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key, unsigned char *iv, unsigned char *plaintext){ + EVP_CIPHER_CTX *ctx; + + int len; + + int plaintext_len; + + /* Create and initialise the context */ + if(!(ctx = EVP_CIPHER_CTX_new())) handleErrors(); + + /* Initialise the decryption operation. IMPORTANT - ensure you use a key + * and IV size appropriate for your cipher + * In this example we are using 256 bit AES (i.e. a 256 bit key). The + * IV size for *most* modes is the same as the block size. For AES this + * is 128 bits */ + if(1 != EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv)) + handleErrors(); + + /* Provide the message to be decrypted, and obtain the plaintext output. + * EVP_DecryptUpdate can be called multiple times if necessary + */ + if(1 != EVP_DecryptUpdate(ctx, plaintext, &len, ciphertext, ciphertext_len)) + handleErrors(); + plaintext_len = len; + + /* Finalise the decryption. Further plaintext bytes may be written at + * this stage. + */ + if(1 != EVP_DecryptFinal_ex(ctx, plaintext + len, &len)) handleErrors(); + plaintext_len += len; + + /* Clean up */ + EVP_CIPHER_CTX_free(ctx); + + return plaintext_len; +} + +void handleErrors(void){ + ERR_print_errors_fp(stderr); + abort(); +} \ No newline at end of file diff --git a/libraries/gtest/encryption/encrypter.h b/libraries/gtest/encryption/encrypter.h new file mode 100644 index 00000000..1a730269 --- /dev/null +++ b/libraries/gtest/encryption/encrypter.h @@ -0,0 +1,9 @@ +#include +#include +#include +#include + +int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key, unsigned char *iv, unsigned char *ciphertext); +int decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key, unsigned char *iv, unsigned char *plaintext); +void handleErrors(void); + diff --git a/libraries/gtest/encryption/test_package/CMakeLists.txt b/libraries/gtest/encryption/test_package/CMakeLists.txt new file mode 100644 index 00000000..9e6fdf68 --- /dev/null +++ b/libraries/gtest/encryption/test_package/CMakeLists.txt @@ -0,0 +1,16 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +PROJECT(encryption-test CXX) + +# Initialize Conan ############################################################# +INCLUDE(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +CONAN_BASIC_SETUP() + +# Create application test ###################################################### +ADD_EXECUTABLE(${PROJECT_NAME} encryption_test.cpp) +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${CONAN_LIBS}) + +# Include Encryptor test ####################################################### +ENABLE_TESTING() +ADD_TEST(NAME encryption + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin + COMMAND ${PROJECT_NAME}) diff --git a/libraries/gtest/encryption/test_package/conanfile.py b/libraries/gtest/encryption/test_package/conanfile.py new file mode 100644 index 00000000..824647e3 --- /dev/null +++ b/libraries/gtest/encryption/test_package/conanfile.py @@ -0,0 +1,22 @@ +from conans import ConanFile +from conans import CMake + + +class TestConanGTestExample(ConanFile): + settings = "os", "compiler", "arch", "build_type" + generators = "cmake" + requires = "gtest/1.8.1@bincrafters/stable" + default_options = {"gtest:shared": True} + + def _configure_cmake(self): + cmake = CMake(self) + cmake.configure() + return cmake + + def build(self): + cmake = self._configure_cmake() + cmake.build() + + def test(self): + cmake = self._configure_cmake() + cmake.test() diff --git a/libraries/gtest/encryption/test_package/encryption_test.cpp b/libraries/gtest/encryption/test_package/encryption_test.cpp new file mode 100644 index 00000000..9214b49a --- /dev/null +++ b/libraries/gtest/encryption/test_package/encryption_test.cpp @@ -0,0 +1,51 @@ +// SOURCE CODE FROM https://wiki.openssl.org/index.php/EVP_Symmetric_Encryption_and_Decryption + +#include +#include "encrypter.h" + +TEST(TestingEncryption, cipher) { + + /* A 256 bit key */ + unsigned char *key = (unsigned char *)"01234567890123456789012345678901"; + + /* A 128 bit IV */ + unsigned char *iv = (unsigned char *)"01234567890123456"; + + /* Message to be encrypted */ + unsigned char *plaintext = (unsigned char *) "The quick brown fox jumps over the lazy dog"; + unsigned char ciphertext[128]; + + /* Buffer for the decrypted text */ + unsigned char decryptedtext[128]; + + int decryptedtext_len, ciphertext_len; + + /* Initialise the library */ + ERR_load_crypto_strings(); + OpenSSL_add_all_algorithms(); + OPENSSL_config(NULL); + + /* Encrypt the plaintext */ + ciphertext_len = encrypt (plaintext, strlen ((char *)plaintext), key, iv, ciphertext); + + /* Do something useful with the ciphertext here */ + printf("Ciphertext is:\n"); + BIO_dump_fp (stdout, (const char *)ciphertext, ciphertext_len); + + /* Decrypt the ciphertext */ + decryptedtext_len = decrypt(ciphertext, ciphertext_len, key, iv, decryptedtext); + + decryptedtext[decryptedtext_len] = '\0'; + + /* Show the decrypted text */ + printf("Decrypted text is:\n"); + printf("%s\n", decryptedtext); + + // The decoded data is the same that we encode + ASSERT_STREQ((const char*) decryptedtext, (const char*) plaintext); + + /* Clean up */ + EVP_cleanup(); + ERR_free_strings(); +} + From 00dfee14b197f1720fa570a6b956bffb2b53fdae Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Wed, 15 Apr 2020 15:47:24 -0300 Subject: [PATCH 02/18] Update GTest package Signed-off-by: Uilian Ries --- libraries/gtest/encryption/conanfile.py | 2 +- libraries/gtest/encryption/test_package/conanfile.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/gtest/encryption/conanfile.py b/libraries/gtest/encryption/conanfile.py index e3d1ccb4..3ad0ba92 100644 --- a/libraries/gtest/encryption/conanfile.py +++ b/libraries/gtest/encryption/conanfile.py @@ -13,7 +13,7 @@ class ConanGTestExample(ConanFile): generators = "cmake" exports = "*" description = "Google Test example of use for conan.io" - requires = "OpenSSL/1.0.2r@conan/stable" + requires = "openssl/1.1.1e" options = {"shared": [True, False]} default_options = {"shared": False} diff --git a/libraries/gtest/encryption/test_package/conanfile.py b/libraries/gtest/encryption/test_package/conanfile.py index 824647e3..8d36dd4b 100644 --- a/libraries/gtest/encryption/test_package/conanfile.py +++ b/libraries/gtest/encryption/test_package/conanfile.py @@ -5,7 +5,7 @@ class TestConanGTestExample(ConanFile): settings = "os", "compiler", "arch", "build_type" generators = "cmake" - requires = "gtest/1.8.1@bincrafters/stable" + requires = "gtest/1.10.0" default_options = {"gtest:shared": True} def _configure_cmake(self): From 5a3bd9fa447935de8a4ac59302fa86eed3fa2a43 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Wed, 15 Apr 2020 17:17:34 -0300 Subject: [PATCH 03/18] Apply C++11 for GTest Signed-off-by: Uilian Ries --- README.md | 6 +++++ libraries/gtest/encryption/README.md | 25 ------------------- .../encryption/test_package/CMakeLists.txt | 3 ++- 3 files changed, 8 insertions(+), 26 deletions(-) delete mode 100644 libraries/gtest/encryption/README.md diff --git a/README.md b/README.md index e772e374..9a1c9ca5 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,12 @@ Demonstrate how to use Folly to validate an URI using Futures, FBString, Executo Blog Post: https://blog.conan.io/2018/12/03/Using-Facebook-Folly-with-Conan.html +### [Testing package with GTest](libraries/gtest/encryption) + +Demonstrate how to use GTest with your test package. + +Docs: https://docs.conan.io/en/latest/integrations/ci/appveyor.html#building-and-testing-your-project + ### [An introduction to Dear ImGui and how to use with Conan](libraries/dear-imgui/basic) Demonstrate how to use Dear ImGui with Conan to add a GUI to an OpenGL3 application. diff --git a/libraries/gtest/encryption/README.md b/libraries/gtest/encryption/README.md deleted file mode 100644 index e2094ca4..00000000 --- a/libraries/gtest/encryption/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Conan GTest Example - -## Getting Started - -* Download conan client from [Conan.io](https://conan.io). - -* Run the following command. - -```bash -conan create . user/channel -``` - -The above command will export, build and test a conan package for a custom encryption library. - -## Synopsis - -[Conan.io](https://conan.io) example for [gtest](https://github.com/google/googletest/) project. - -The project is using OpenSSL to build an encryption library, and using Google test to ensure that the library is built correctly. -The Google test library is required in the **test_package/conanfile.py**. - -A different approach would be running the test at the end of the **build()** method in the root conanfile.py and require gtest library as a **build_require**, -so it would be only downloaded when the encryption library has to be built from sources. - -With that approach, the **test_package** project could just run an example using/linking with the encryption library. diff --git a/libraries/gtest/encryption/test_package/CMakeLists.txt b/libraries/gtest/encryption/test_package/CMakeLists.txt index 9e6fdf68..a933f7cd 100644 --- a/libraries/gtest/encryption/test_package/CMakeLists.txt +++ b/libraries/gtest/encryption/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11) PROJECT(encryption-test CXX) # Initialize Conan ############################################################# @@ -8,6 +8,7 @@ CONAN_BASIC_SETUP() # Create application test ###################################################### ADD_EXECUTABLE(${PROJECT_NAME} encryption_test.cpp) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${CONAN_LIBS}) +SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) # Include Encryptor test ####################################################### ENABLE_TESTING() From 8d4c4973efcee0d00e3aef1c25a87546fe77c3b5 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Wed, 22 Apr 2020 17:24:22 -0300 Subject: [PATCH 04/18] Fix Windows build Signed-off-by: Uilian Ries --- libraries/gtest/encryption/encrypter.cpp | 3 --- libraries/gtest/encryption/encrypter.h | 1 + libraries/gtest/encryption/test_package/conanfile.py | 8 +++++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libraries/gtest/encryption/encrypter.cpp b/libraries/gtest/encryption/encrypter.cpp index f53c060d..db735616 100644 --- a/libraries/gtest/encryption/encrypter.cpp +++ b/libraries/gtest/encryption/encrypter.cpp @@ -1,8 +1,5 @@ // SOURCE CODE FROM https://wiki.openssl.org/index.php/EVP_Symmetric_Encryption_and_Decryption // applink.c => https://www.openssl.org/docs/faq.html -#if _MSC_VER - #include "openssl/applink.c" -#endif #include "encrypter.h" int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key, unsigned char *iv, unsigned char *ciphertext){ diff --git a/libraries/gtest/encryption/encrypter.h b/libraries/gtest/encryption/encrypter.h index 1a730269..6b53f186 100644 --- a/libraries/gtest/encryption/encrypter.h +++ b/libraries/gtest/encryption/encrypter.h @@ -3,6 +3,7 @@ #include #include + int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key, unsigned char *iv, unsigned char *ciphertext); int decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key, unsigned char *iv, unsigned char *plaintext); void handleErrors(void); diff --git a/libraries/gtest/encryption/test_package/conanfile.py b/libraries/gtest/encryption/test_package/conanfile.py index 8d36dd4b..e28d5e08 100644 --- a/libraries/gtest/encryption/test_package/conanfile.py +++ b/libraries/gtest/encryption/test_package/conanfile.py @@ -1,5 +1,5 @@ from conans import ConanFile -from conans import CMake +from conans import CMake, RunEnvironment, tools class TestConanGTestExample(ConanFile): @@ -18,5 +18,7 @@ def build(self): cmake.build() def test(self): - cmake = self._configure_cmake() - cmake.test() + env_build = RunEnvironment(self) + with tools.environment_append(env_build.vars): + cmake = self._configure_cmake() + cmake.test() From 585ad883cb9a57c9f7f23ccec5b764595e09fa0a Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Mon, 27 Apr 2020 15:26:38 -0300 Subject: [PATCH 05/18] Force debug mode for gtest Signed-off-by: Uilian Ries --- features/integrate_build_system/build.py | 0 features/makefiles/build.sh | 0 libraries/gtest/encryption/build.sh | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 features/integrate_build_system/build.py mode change 100644 => 100755 features/makefiles/build.sh diff --git a/features/integrate_build_system/build.py b/features/integrate_build_system/build.py old mode 100644 new mode 100755 diff --git a/features/makefiles/build.sh b/features/makefiles/build.sh old mode 100644 new mode 100755 diff --git a/libraries/gtest/encryption/build.sh b/libraries/gtest/encryption/build.sh index 8b93d764..517caeb0 100755 --- a/libraries/gtest/encryption/build.sh +++ b/libraries/gtest/encryption/build.sh @@ -6,9 +6,9 @@ set -x rm -rf build source package conan source . --source-folder source -conan install . --install-folder build +conan install . --install-folder build -s build_type=Debug conan build . --source-folder source --build-folder build conan package . --source-folder source --build-folder build --package-folder package conan export-pkg . conan/testing --package-folder package -conan test test_package conan-gtest-example/0.1.0@conan/testing +conan test test_package conan-gtest-example/0.1.0@conan/testing -s build_type=Debug From f0624c26f6debe59b69ddfd81d7cf700e647d874 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Mon, 27 Apr 2020 15:36:13 -0300 Subject: [PATCH 06/18] Force mac os version Signed-off-by: Uilian Ries --- libraries/gtest/encryption/build.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/libraries/gtest/encryption/build.sh b/libraries/gtest/encryption/build.sh index 517caeb0..3da4a47e 100755 --- a/libraries/gtest/encryption/build.sh +++ b/libraries/gtest/encryption/build.sh @@ -5,10 +5,20 @@ set -x rm -rf build source package -conan source . --source-folder source -conan install . --install-folder build -s build_type=Debug -conan build . --source-folder source --build-folder build -conan package . --source-folder source --build-folder build --package-folder package -conan export-pkg . conan/testing --package-folder package +elif [[ "$OSTYPE" == "darwin"* ]]; then + conan source . --source-folder source + conan install . --install-folder build -s build_type=Debug --build missing -s os.version=10.13 + conan build . --source-folder source --build-folder build + conan package . --source-folder source --build-folder build --package-folder package + conan export-pkg . conan/testing --package-folder package -conan test test_package conan-gtest-example/0.1.0@conan/testing -s build_type=Debug + conan test test_package conan-gtest-example/0.1.0@conan/testing -s build_type=Debug --build missing -s os.version=10.13 +else + conan source . --source-folder source + conan install . --install-folder build -s build_type=Debug + conan build . --source-folder source --build-folder build + conan package . --source-folder source --build-folder build --package-folder package + conan export-pkg . conan/testing --package-folder package + + conan test test_package conan-gtest-example/0.1.0@conan/testing -s build_type=Debug +fi From 62dad9e3d7725a83cf1644584635679890e2813d Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Mon, 27 Apr 2020 15:48:12 -0300 Subject: [PATCH 07/18] Force mac os version Signed-off-by: Uilian Ries --- libraries/gtest/encryption/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/gtest/encryption/build.sh b/libraries/gtest/encryption/build.sh index 3da4a47e..bdcad9c6 100755 --- a/libraries/gtest/encryption/build.sh +++ b/libraries/gtest/encryption/build.sh @@ -5,7 +5,7 @@ set -x rm -rf build source package -elif [[ "$OSTYPE" == "darwin"* ]]; then +if [[ "$OSTYPE" == "darwin"* ]]; then conan source . --source-folder source conan install . --install-folder build -s build_type=Debug --build missing -s os.version=10.13 conan build . --source-folder source --build-folder build From 9c975d477a2f2d69c23bafa9eefcbbd870609dc1 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Mon, 27 Apr 2020 16:03:08 -0300 Subject: [PATCH 08/18] Force mac os version 2 Signed-off-by: Uilian Ries --- libraries/gtest/encryption/build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/gtest/encryption/build.sh b/libraries/gtest/encryption/build.sh index bdcad9c6..37e26e3e 100755 --- a/libraries/gtest/encryption/build.sh +++ b/libraries/gtest/encryption/build.sh @@ -15,10 +15,10 @@ if [[ "$OSTYPE" == "darwin"* ]]; then conan test test_package conan-gtest-example/0.1.0@conan/testing -s build_type=Debug --build missing -s os.version=10.13 else conan source . --source-folder source - conan install . --install-folder build -s build_type=Debug + conan install . --install-folder build -s build_type=Debug --build missing conan build . --source-folder source --build-folder build conan package . --source-folder source --build-folder build --package-folder package conan export-pkg . conan/testing --package-folder package - conan test test_package conan-gtest-example/0.1.0@conan/testing -s build_type=Debug + conan test test_package conan-gtest-example/0.1.0@conan/testing -s build_type=Debug --build missing fi From 7ba41b63c5e7b224be839477cbc81ac6a4594792 Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Mon, 27 Apr 2020 17:13:01 -0300 Subject: [PATCH 09/18] Apply @sse4 patch Signed-off-by: Uilian Ries --- features/multi_config/conanfile.py | 22 +++++++++---------- features/multi_config/hello.cpp | 2 +- .../multi_config/test_package/conanfile.py | 2 ++ libraries/protobuf/serialization/build.sh | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/features/multi_config/conanfile.py b/features/multi_config/conanfile.py index a955e6b7..d2e5a8d9 100644 --- a/features/multi_config/conanfile.py +++ b/features/multi_config/conanfile.py @@ -28,22 +28,22 @@ def configure(self): def build(self): # Alternative 1: Use always default runtime (MD/MDd) - cmake_release = CMake(self, build_type="Debug") + cmake_debug = CMake(self, build_type="Debug") # Alternative 2: if you want to keep MD-MDd/MT-MTd configuration (uncomment section in CMakeLists.txt) - # cmake_release.defintions["CONAN_LINK_RUNTIME_MULTI"] = cmake_release.definitions["CONAN_LINK_RUNTIME"] - # cmake_release.definitions["CONAN_LINK_RUNTIME"] = False - cmake_release.configure() - cmake_release.build() + # cmake_debug.defintions["CONAN_LINK_RUNTIME_MULTI"] = cmake_debug.definitions["CONAN_LINK_RUNTIME"] + # cmake_debug.definitions["CONAN_LINK_RUNTIME"] = False + cmake_debug.configure(build_folder="Debug") + cmake_debug.build() if self.settings.os != "Windows": - print_strings(self, "lib/libhello_d.a", "DEBUG") + print_strings(self, "Debug/lib/libhello_d.a", "DEBUG") - cmake_debug = CMake(self, build_type="Release") + cmake_release = CMake(self, build_type="Release") # Alternative 2: if you want to keep MD-MDd/MT-MTd configuration (uncomment section in CMakeLists.txt) - # cmake_debug.defintions["CONAN_LINK_RUNTIME_MULTI"] = cmake_release.definitions["CONAN_LINK_RUNTIME"] - # cmake_debug.definitions["CONAN_LINK_RUNTIME"] = False - cmake_debug.configure() - cmake_debug.build() + # cmake_release.defintions["CONAN_LINK_RUNTIME_MULTI"] = cmake_release.definitions["CONAN_LINK_RUNTIME"] + # cmake_release.definitions["CONAN_LINK_RUNTIME"] = False + cmake_release.configure() + cmake_release.build() if self.settings.os != "Windows": print_strings(self, "lib/libhello.a", "RELEASE") diff --git a/features/multi_config/hello.cpp b/features/multi_config/hello.cpp index ac130ab6..8eb399fd 100644 --- a/features/multi_config/hello.cpp +++ b/features/multi_config/hello.cpp @@ -2,7 +2,7 @@ #include "hello.h" void hello(){ - #if !defined NDEBUG + #if !defined(NDEBUG) std::cout << "Hello World Debug!" << std::endl; #else std::cout << "Hello World Release!" << std::endl; diff --git a/features/multi_config/test_package/conanfile.py b/features/multi_config/test_package/conanfile.py index 025e3bcf..5ff12cbb 100644 --- a/features/multi_config/test_package/conanfile.py +++ b/features/multi_config/test_package/conanfile.py @@ -15,5 +15,7 @@ def build(self): def test(self): os.chdir("bin") output = StringIO() + if self.settings.build_type != 'Release': + return self.run(".%sexample" % os.sep, run_environment=True, output=output) assert ("Hello World {}!".format(str(self.settings.build_type)) in output.getvalue()), output.getvalue() diff --git a/libraries/protobuf/serialization/build.sh b/libraries/protobuf/serialization/build.sh index c4b20ab5..91e64408 100755 --- a/libraries/protobuf/serialization/build.sh +++ b/libraries/protobuf/serialization/build.sh @@ -7,7 +7,7 @@ rm -rf build mkdir build pushd build -conan install .. +conan install .. --build missing cmake .. -DCMAKE_BUILD_TYPE=Release cmake --build . From 4a190f091680e74c32b7815d4fc73a17756f114a Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Mon, 27 Apr 2020 19:45:57 -0300 Subject: [PATCH 10/18] Revert "Apply @sse4 patch" This reverts commit 7ba41b63c5e7b224be839477cbc81ac6a4594792. --- features/multi_config/conanfile.py | 22 +++++++++---------- features/multi_config/hello.cpp | 2 +- .../multi_config/test_package/conanfile.py | 2 -- libraries/protobuf/serialization/build.sh | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/features/multi_config/conanfile.py b/features/multi_config/conanfile.py index d2e5a8d9..a955e6b7 100644 --- a/features/multi_config/conanfile.py +++ b/features/multi_config/conanfile.py @@ -28,23 +28,23 @@ def configure(self): def build(self): # Alternative 1: Use always default runtime (MD/MDd) - cmake_debug = CMake(self, build_type="Debug") - # Alternative 2: if you want to keep MD-MDd/MT-MTd configuration (uncomment section in CMakeLists.txt) - # cmake_debug.defintions["CONAN_LINK_RUNTIME_MULTI"] = cmake_debug.definitions["CONAN_LINK_RUNTIME"] - # cmake_debug.definitions["CONAN_LINK_RUNTIME"] = False - cmake_debug.configure(build_folder="Debug") - cmake_debug.build() - - if self.settings.os != "Windows": - print_strings(self, "Debug/lib/libhello_d.a", "DEBUG") - - cmake_release = CMake(self, build_type="Release") + cmake_release = CMake(self, build_type="Debug") # Alternative 2: if you want to keep MD-MDd/MT-MTd configuration (uncomment section in CMakeLists.txt) # cmake_release.defintions["CONAN_LINK_RUNTIME_MULTI"] = cmake_release.definitions["CONAN_LINK_RUNTIME"] # cmake_release.definitions["CONAN_LINK_RUNTIME"] = False cmake_release.configure() cmake_release.build() + if self.settings.os != "Windows": + print_strings(self, "lib/libhello_d.a", "DEBUG") + + cmake_debug = CMake(self, build_type="Release") + # Alternative 2: if you want to keep MD-MDd/MT-MTd configuration (uncomment section in CMakeLists.txt) + # cmake_debug.defintions["CONAN_LINK_RUNTIME_MULTI"] = cmake_release.definitions["CONAN_LINK_RUNTIME"] + # cmake_debug.definitions["CONAN_LINK_RUNTIME"] = False + cmake_debug.configure() + cmake_debug.build() + if self.settings.os != "Windows": print_strings(self, "lib/libhello.a", "RELEASE") diff --git a/features/multi_config/hello.cpp b/features/multi_config/hello.cpp index 8eb399fd..ac130ab6 100644 --- a/features/multi_config/hello.cpp +++ b/features/multi_config/hello.cpp @@ -2,7 +2,7 @@ #include "hello.h" void hello(){ - #if !defined(NDEBUG) + #if !defined NDEBUG std::cout << "Hello World Debug!" << std::endl; #else std::cout << "Hello World Release!" << std::endl; diff --git a/features/multi_config/test_package/conanfile.py b/features/multi_config/test_package/conanfile.py index 5ff12cbb..025e3bcf 100644 --- a/features/multi_config/test_package/conanfile.py +++ b/features/multi_config/test_package/conanfile.py @@ -15,7 +15,5 @@ def build(self): def test(self): os.chdir("bin") output = StringIO() - if self.settings.build_type != 'Release': - return self.run(".%sexample" % os.sep, run_environment=True, output=output) assert ("Hello World {}!".format(str(self.settings.build_type)) in output.getvalue()), output.getvalue() diff --git a/libraries/protobuf/serialization/build.sh b/libraries/protobuf/serialization/build.sh index 91e64408..c4b20ab5 100755 --- a/libraries/protobuf/serialization/build.sh +++ b/libraries/protobuf/serialization/build.sh @@ -7,7 +7,7 @@ rm -rf build mkdir build pushd build -conan install .. --build missing +conan install .. cmake .. -DCMAKE_BUILD_TYPE=Release cmake --build . From d2774700ea65dc808315900afadc652a28909c3a Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Mon, 27 Apr 2020 19:47:19 -0300 Subject: [PATCH 11/18] Build only GTest Signed-off-by: Uilian Ries --- .ci/run.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.ci/run.py b/.ci/run.py index bcb756e1..d440c5e4 100644 --- a/.ci/run.py +++ b/.ci/run.py @@ -29,7 +29,7 @@ def is_appveyor(): def appveyor_image(): return os.getenv("APPVEYOR_BUILD_WORKER_IMAGE","") - + @contextmanager def chdir(dir_path): @@ -100,8 +100,10 @@ def get_build_list(): build = [it for it in files if "build.py" in it] if not build: build = [it for it in files if os.path.basename(it) == script] - + if build: + if "gtest" not in root: + continue builds.append(os.path.join(root, build[0])) dirs[:] = [] continue @@ -189,18 +191,18 @@ def run_scripts(scripts): with chdir(os.path.dirname(script)): print_build(script) build_script = [sys.executable, abspath] if abspath.endswith(".py") else abspath - + # Need to initialize the cache with default files if they are not already there try: subprocess.call(['conan', 'install', 'foobar/foobar@conan/stable'], env=env, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) except: pass - + with ensure_python_environment_preserved(): with ensure_cache_preserved(): result = subprocess.call(build_script, env=env) - + results[script] = result if result != 0 and FAIL_FAST: break From c104b3a4bf2f6a3f0abb64dc915c3718bac7f1da Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Mon, 27 Apr 2020 21:59:59 -0300 Subject: [PATCH 12/18] Disable Linux on CI Signed-off-by: Uilian Ries --- .travis.yml | 43 +------------------------------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/.travis.yml b/.travis.yml index 55b61216..05e59454 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,47 +6,6 @@ jobs: fast_finish: true include: - - stage: Linux - Conan develop - name: Python 3.5 - python: 3.5 - env: TOXENV=py35-conandev - dist: xenial - - name: Python 3.8 - python: 3.8 - env: TOXENV=py38-conandev - dist: xenial - - # All Linux first, check versions - - stage: Linux - Conan Current - name: Python 3.5 - python: 3.5 - env: TOXENV=py35-conancurrent - dist: xenial - - name: Python 3.8 - python: 3.8 - env: TOXENV=py38-conancurrent - dist: xenial - - - stage: Linux - Conan 1.23 - name: Python 3.5 - python: 3.5 - env: TOXENV=py35-conan123 - dist: xenial - - name: Python 3.8 - python: 3.8 - env: TOXENV=py38-conan123 - dist: xenial - - - stage: Linux - Conan 1.22 - name: Python 3.5 - python: 3.5 - env: TOXENV=py35-conan122 - dist: xenial - - name: Python 3.8 - python: 3.8 - env: TOXENV=py38-conan122 - dist: xenial - # Macos is slow, only if everything has passed - stage: Macos - All Conan versions name: Conan develop - Python 3.8 @@ -67,7 +26,7 @@ jobs: before_install: - ./.ci/travis/before_install.sh - + install: - | if [[ "$(uname -s)" == 'Darwin' ]]; then From 1036136cb7d9d4a27744bb47272ca2b89067faaa Mon Sep 17 00:00:00 2001 From: SSE4 Date: Tue, 28 Apr 2020 19:46:39 +0700 Subject: [PATCH 13/18] - improve error messages Signed-off-by: SSE4 --- .gitignore | 3 +++ libraries/gtest/encryption/build.sh | 4 ++-- libraries/gtest/encryption/encrypter.cpp | 22 ++++++++++++---------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 13918373..8f881759 100644 --- a/.gitignore +++ b/.gitignore @@ -53,3 +53,6 @@ libraries/poco/md5/build/* .pydevproject .settings/* .ropeproject/* + +.tox +.python-version diff --git a/libraries/gtest/encryption/build.sh b/libraries/gtest/encryption/build.sh index 37e26e3e..f7099562 100755 --- a/libraries/gtest/encryption/build.sh +++ b/libraries/gtest/encryption/build.sh @@ -10,7 +10,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then conan install . --install-folder build -s build_type=Debug --build missing -s os.version=10.13 conan build . --source-folder source --build-folder build conan package . --source-folder source --build-folder build --package-folder package - conan export-pkg . conan/testing --package-folder package + conan export-pkg . conan/testing --package-folder package --force conan test test_package conan-gtest-example/0.1.0@conan/testing -s build_type=Debug --build missing -s os.version=10.13 else @@ -18,7 +18,7 @@ else conan install . --install-folder build -s build_type=Debug --build missing conan build . --source-folder source --build-folder build conan package . --source-folder source --build-folder build --package-folder package - conan export-pkg . conan/testing --package-folder package + conan export-pkg . conan/testing --package-folder package --force conan test test_package conan-gtest-example/0.1.0@conan/testing -s build_type=Debug --build missing fi diff --git a/libraries/gtest/encryption/encrypter.cpp b/libraries/gtest/encryption/encrypter.cpp index db735616..0ee79ce7 100644 --- a/libraries/gtest/encryption/encrypter.cpp +++ b/libraries/gtest/encryption/encrypter.cpp @@ -10,7 +10,7 @@ int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key, uns int ciphertext_len; /* Create and initialise the context */ - if(!(ctx = EVP_CIPHER_CTX_new())) handleErrors(); + if(!(ctx = EVP_CIPHER_CTX_new())) handleErrors("(encrypt) EVP_CIPHER_CTX_new"); /* Initialise the encryption operation. IMPORTANT - ensure you use a key * and IV size appropriate for your cipher @@ -18,19 +18,19 @@ int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key, uns * IV size for *most* modes is the same as the block size. For AES this * is 128 bits */ if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv)) - handleErrors(); + handleErrors("(encrypt) EVP_EncryptInit_ex"); /* Provide the message to be encrypted, and obtain the encrypted output. * EVP_EncryptUpdate can be called multiple times if necessary */ if(1 != EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, plaintext_len)) - handleErrors(); + handleErrors("(encrypt) EVP_EncryptUpdate"); ciphertext_len = len; /* Finalise the encryption. Further ciphertext bytes may be written at * this stage. */ - if(1 != EVP_EncryptFinal_ex(ctx, ciphertext + len, &len)) handleErrors(); + if(1 != EVP_EncryptFinal_ex(ctx, ciphertext + len, &len)) handleErrors("(encrypt) EVP_EncryptFinal_ex"); ciphertext_len += len; /* Clean up */ @@ -48,7 +48,7 @@ int decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key, u int plaintext_len; /* Create and initialise the context */ - if(!(ctx = EVP_CIPHER_CTX_new())) handleErrors(); + if(!(ctx = EVP_CIPHER_CTX_new())) handleErrors("(decrypt) EVP_CIPHER_CTX_new"); /* Initialise the decryption operation. IMPORTANT - ensure you use a key * and IV size appropriate for your cipher @@ -56,19 +56,19 @@ int decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key, u * IV size for *most* modes is the same as the block size. For AES this * is 128 bits */ if(1 != EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv)) - handleErrors(); + handleErrors("(decrypt) EVP_DecryptInitEx"); /* Provide the message to be decrypted, and obtain the plaintext output. * EVP_DecryptUpdate can be called multiple times if necessary */ if(1 != EVP_DecryptUpdate(ctx, plaintext, &len, ciphertext, ciphertext_len)) - handleErrors(); + handleErrors("(decrypt) EVP_DecryptUpdate"); plaintext_len = len; /* Finalise the decryption. Further plaintext bytes may be written at * this stage. */ - if(1 != EVP_DecryptFinal_ex(ctx, plaintext + len, &len)) handleErrors(); + if(1 != EVP_DecryptFinal_ex(ctx, plaintext + len, &len)) handleErrors("(decrypt) EVP_DecryptFinal_ex"); plaintext_len += len; /* Clean up */ @@ -77,7 +77,9 @@ int decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key, u return plaintext_len; } -void handleErrors(void){ +void handleErrors(const char * message){ + fprintf(stderr, "%s\n", message); ERR_print_errors_fp(stderr); + fflush(stderr); abort(); -} \ No newline at end of file +} From d5a6bec70f83e968205b12f1005495e6162b5bc6 Mon Sep 17 00:00:00 2001 From: SSE4 Date: Tue, 28 Apr 2020 19:48:18 +0700 Subject: [PATCH 14/18] - forget to commit file Signed-off-by: SSE4 --- libraries/gtest/encryption/encrypter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/gtest/encryption/encrypter.h b/libraries/gtest/encryption/encrypter.h index 6b53f186..468e6775 100644 --- a/libraries/gtest/encryption/encrypter.h +++ b/libraries/gtest/encryption/encrypter.h @@ -6,5 +6,5 @@ int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *key, unsigned char *iv, unsigned char *ciphertext); int decrypt(unsigned char *ciphertext, int ciphertext_len, unsigned char *key, unsigned char *iv, unsigned char *plaintext); -void handleErrors(void); +void handleErrors(const char *); From 44917d1e39019c8346e8948546a5e1f08d9db261 Mon Sep 17 00:00:00 2001 From: SSE4 Date: Tue, 28 Apr 2020 20:09:08 +0700 Subject: [PATCH 15/18] - get the test output Signed-off-by: SSE4 --- libraries/gtest/encryption/test_package/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libraries/gtest/encryption/test_package/conanfile.py b/libraries/gtest/encryption/test_package/conanfile.py index e28d5e08..6710e1aa 100644 --- a/libraries/gtest/encryption/test_package/conanfile.py +++ b/libraries/gtest/encryption/test_package/conanfile.py @@ -18,7 +18,8 @@ def build(self): cmake.build() def test(self): + os.environ["CTEST_OUTPUT_ON_FAILURE"] = "1" env_build = RunEnvironment(self) with tools.environment_append(env_build.vars): cmake = self._configure_cmake() - cmake.test() + cmake.test(output_on_failure=True) From 7ae03824733146581b859a1a436adfc6385a21c7 Mon Sep 17 00:00:00 2001 From: SSE4 Date: Tue, 28 Apr 2020 20:28:37 +0700 Subject: [PATCH 16/18] Update conanfile.py --- libraries/gtest/encryption/test_package/conanfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/gtest/encryption/test_package/conanfile.py b/libraries/gtest/encryption/test_package/conanfile.py index 6710e1aa..678f9279 100644 --- a/libraries/gtest/encryption/test_package/conanfile.py +++ b/libraries/gtest/encryption/test_package/conanfile.py @@ -1,6 +1,6 @@ from conans import ConanFile from conans import CMake, RunEnvironment, tools - +import os class TestConanGTestExample(ConanFile): settings = "os", "compiler", "arch", "build_type" From f5c836d38f706155d7c032966331d5362818487f Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Tue, 12 May 2020 17:32:41 -0300 Subject: [PATCH 17/18] Update test package for gtest Signed-off-by: Uilian Ries --- libraries/gtest/encryption/test_package/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/gtest/encryption/test_package/CMakeLists.txt b/libraries/gtest/encryption/test_package/CMakeLists.txt index a933f7cd..a7fc725e 100644 --- a/libraries/gtest/encryption/test_package/CMakeLists.txt +++ b/libraries/gtest/encryption/test_package/CMakeLists.txt @@ -9,6 +9,7 @@ CONAN_BASIC_SETUP() ADD_EXECUTABLE(${PROJECT_NAME} encryption_test.cpp) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${CONAN_LIBS}) SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY ENVIRONMENT "DYLD_LIBRARY_PATH=${GTest_LIB_DIRS}") # Include Encryptor test ####################################################### ENABLE_TESTING() From dbe36413fc7e3978863e4383530e9ea6ce453bdd Mon Sep 17 00:00:00 2001 From: Uilian Ries Date: Wed, 20 May 2020 11:28:29 -0300 Subject: [PATCH 18/18] Update libraries/gtest/encryption/test_package/CMakeLists.txt --- libraries/gtest/encryption/test_package/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/gtest/encryption/test_package/CMakeLists.txt b/libraries/gtest/encryption/test_package/CMakeLists.txt index a7fc725e..52fe9bca 100644 --- a/libraries/gtest/encryption/test_package/CMakeLists.txt +++ b/libraries/gtest/encryption/test_package/CMakeLists.txt @@ -9,7 +9,7 @@ CONAN_BASIC_SETUP() ADD_EXECUTABLE(${PROJECT_NAME} encryption_test.cpp) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${CONAN_LIBS}) SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY ENVIRONMENT "DYLD_LIBRARY_PATH=${GTest_LIB_DIRS}") +SET_PROPERTY(TARGET ${PROJECT_NAME} PROPERTY ENVIRONMENT "DYLD_LIBRARY_PATH=${CONAN_LIB_DIRS_GTEST}") # Include Encryptor test ####################################################### ENABLE_TESTING()