From 63b95fd4aae4ea1a720005d85d1be6d4b219c784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg-Christian=20B=C3=B6hme?= Date: Sun, 18 Mar 2018 18:30:54 +0100 Subject: [PATCH] Fix ClassLoader and SharedLibrary test for android (#2209) --- Foundation/testsuite/CMakeLists.txt | 2 +- Foundation/testsuite/src/ClassLoaderTest.cpp | 3 --- Foundation/testsuite/src/SharedLibraryTest.cpp | 3 --- cmake/ExecuteOnAndroid.cmake | 2 +- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/Foundation/testsuite/CMakeLists.txt b/Foundation/testsuite/CMakeLists.txt index 1204c786e..be03f0592 100644 --- a/Foundation/testsuite/CMakeLists.txt +++ b/Foundation/testsuite/CMakeLists.txt @@ -27,7 +27,7 @@ POCO_SOURCES_AUTO_PLAT( TEST_SRCS WINCE add_executable( ${TESTUNIT} ${TEST_SRCS} ) if(ANDROID) add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} - COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} "-DTEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/data;${CMAKE_BINARY_DIR}/bin/TestApp" -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/${TESTUNIT} -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) + COMMAND ${CMAKE_COMMAND} -DANDROID_NDK=${ANDROID_NDK} "-DTEST_FILES=${CMAKE_CURRENT_SOURCE_DIR}/data;${CMAKE_BINARY_DIR}/bin/TestApp;${CMAKE_BINARY_DIR}/bin/TestLibrary.so" -DLIBRARY_DIR=${CMAKE_BINARY_DIR}/lib -DUNITTEST=${CMAKE_BINARY_DIR}/bin/${TESTUNIT} -DTEST_PARAMETER=-all -P ${CMAKE_SOURCE_DIR}/cmake/ExecuteOnAndroid.cmake) else() add_test(NAME ${LIBNAME} WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${TESTUNIT} -all) set_tests_properties(${LIBNAME} PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=.") # The SharedLibaryTest has to look for shared libraries in the working directory diff --git a/Foundation/testsuite/src/ClassLoaderTest.cpp b/Foundation/testsuite/src/ClassLoaderTest.cpp index f374faec4..6ea707fbe 100644 --- a/Foundation/testsuite/src/ClassLoaderTest.cpp +++ b/Foundation/testsuite/src/ClassLoaderTest.cpp @@ -204,12 +204,9 @@ CppUnit::Test* ClassLoaderTest::suite() { CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("ClassLoaderTest"); -#if (POCO_OS != POCO_OS_ANDROID) - // FIXME exclude from android build temporarly to fix the bug. See issue https://github.com/pocoproject/poco/issues/2209 CppUnit_addTest(pSuite, ClassLoaderTest, testClassLoader1); CppUnit_addTest(pSuite, ClassLoaderTest, testClassLoader2); CppUnit_addTest(pSuite, ClassLoaderTest, testClassLoader3); -#endif return pSuite; } diff --git a/Foundation/testsuite/src/SharedLibraryTest.cpp b/Foundation/testsuite/src/SharedLibraryTest.cpp index e63e10c51..41cf4696b 100644 --- a/Foundation/testsuite/src/SharedLibraryTest.cpp +++ b/Foundation/testsuite/src/SharedLibraryTest.cpp @@ -141,12 +141,9 @@ CppUnit::Test* SharedLibraryTest::suite() { CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("SharedLibraryTest"); -#if (POCO_OS != POCO_OS_ANDROID) - // FIXME exclude from android build temporarly to fix the bug. See issue https://github.com/pocoproject/poco/issues/2209 CppUnit_addTest(pSuite, SharedLibraryTest, testSharedLibrary1); CppUnit_addTest(pSuite, SharedLibraryTest, testSharedLibrary2); CppUnit_addTest(pSuite, SharedLibraryTest, testSharedLibrary3); -#endif return pSuite; } diff --git a/cmake/ExecuteOnAndroid.cmake b/cmake/ExecuteOnAndroid.cmake index e944c23a6..eec652a7e 100644 --- a/cmake/ExecuteOnAndroid.cmake +++ b/cmake/ExecuteOnAndroid.cmake @@ -12,7 +12,7 @@ message(STATUS "Push ${UNITTEST} to android ...") execute_process(COMMAND ${ANDROID_NDK}/../platform-tools/adb push ${UNITTEST} /data/local/tmp/ OUTPUT_QUIET) message(STATUS "Execute ${UNITTEST_FILENAME} ${TEST_PARAMETER} on android ...") execute_process( - COMMAND ${ANDROID_NDK}/../platform-tools/adb shell "cd /data/local/tmp;su root sh -c 'LD_LIBRARY_PATH=/data/local/tmp/lib TMPDIR=/data/local/tmp HOME=/data/local/tmp ./${UNITTEST_FILENAME} ${TEST_PARAMETER};echo exit code $?'" + COMMAND ${ANDROID_NDK}/../platform-tools/adb shell "cd /data/local/tmp;su root sh -c 'LD_LIBRARY_PATH=/data/local/tmp:/data/local/tmp/lib:/data/local/tmp/data TMPDIR=/data/local/tmp HOME=/data/local/tmp ./${UNITTEST_FILENAME} ${TEST_PARAMETER};echo exit code $?'" RESULT_VARIABLE _RESULT OUTPUT_VARIABLE _OUT ERROR_VARIABLE _ERR