From 1445ce2809511d2af2ef0f80685a16385c3fff71 Mon Sep 17 00:00:00 2001 From: Thomas Van Lenten Date: Fri, 20 May 2016 11:06:43 -0400 Subject: Make the CocoaPods integration tests more robust - Env solution doesn't seem to always work, use template pod files and copy them in place instead. - Flush the pods cache before and after runs. - Make pod install verbose to have the info incase something goes wrong. --- .../Tests/CocoaPods/OSXCocoaPodsTester/Podfile | 12 ---------- .../CocoaPods/OSXCocoaPodsTester/Podfile-framework | 10 +++++++++ .../CocoaPods/OSXCocoaPodsTester/Podfile-static | 8 +++++++ .../Tests/CocoaPods/iOSCocoaPodsTester/Podfile | 12 ---------- .../CocoaPods/iOSCocoaPodsTester/Podfile-framework | 10 +++++++++ .../CocoaPods/iOSCocoaPodsTester/Podfile-static | 8 +++++++ objectivec/Tests/CocoaPods/run_tests.sh | 26 +++++++++++++++------- 7 files changed, 54 insertions(+), 32 deletions(-) delete mode 100644 objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile create mode 100644 objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-framework create mode 100644 objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-static delete mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile create mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-framework create mode 100644 objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-static diff --git a/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile b/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile deleted file mode 100644 index 956e8148..00000000 --- a/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile +++ /dev/null @@ -1,12 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :osx, '10.9' - -install! 'cocoapods', :deterministic_uuids => false - -if ENV['USE_FRAMEWORKS'] == 'YES' then - use_frameworks! -end - -target 'OSXCocoaPodsTester' do - pod 'Protobuf', :path => '../../../..' -end diff --git a/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-framework b/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-framework new file mode 100644 index 00000000..27eeafc9 --- /dev/null +++ b/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-framework @@ -0,0 +1,10 @@ +source 'https://github.com/CocoaPods/Specs.git' +platform :osx, '10.9' + +install! 'cocoapods', :deterministic_uuids => false + +use_frameworks! + +target 'OSXCocoaPodsTester' do + pod 'Protobuf', :path => '../../../..' +end diff --git a/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-static b/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-static new file mode 100644 index 00000000..5dfc8de5 --- /dev/null +++ b/objectivec/Tests/CocoaPods/OSXCocoaPodsTester/Podfile-static @@ -0,0 +1,8 @@ +source 'https://github.com/CocoaPods/Specs.git' +platform :osx, '10.9' + +install! 'cocoapods', :deterministic_uuids => false + +target 'OSXCocoaPodsTester' do + pod 'Protobuf', :path => '../../../..' +end diff --git a/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile b/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile deleted file mode 100644 index cc353f16..00000000 --- a/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile +++ /dev/null @@ -1,12 +0,0 @@ -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '8.0' - -install! 'cocoapods', :deterministic_uuids => false - -if ENV['USE_FRAMEWORKS'] == 'YES' then - use_frameworks! -end - -target 'iOSCocoaPodsTester' do - pod 'Protobuf', :path => '../../../..' -end diff --git a/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-framework b/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-framework new file mode 100644 index 00000000..913a289b --- /dev/null +++ b/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-framework @@ -0,0 +1,10 @@ +source 'https://github.com/CocoaPods/Specs.git' +platform :ios, '8.0' + +install! 'cocoapods', :deterministic_uuids => false + +use_frameworks! + +target 'iOSCocoaPodsTester' do + pod 'Protobuf', :path => '../../../..' +end diff --git a/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-static b/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-static new file mode 100644 index 00000000..e9b3c235 --- /dev/null +++ b/objectivec/Tests/CocoaPods/iOSCocoaPodsTester/Podfile-static @@ -0,0 +1,8 @@ +source 'https://github.com/CocoaPods/Specs.git' +platform :ios, '8.0' + +install! 'cocoapods', :deterministic_uuids => false + +target 'iOSCocoaPodsTester' do + pod 'Protobuf', :path => '../../../..' +end diff --git a/objectivec/Tests/CocoaPods/run_tests.sh b/objectivec/Tests/CocoaPods/run_tests.sh index 20eed96c..edf0fe81 100755 --- a/objectivec/Tests/CocoaPods/run_tests.sh +++ b/objectivec/Tests/CocoaPods/run_tests.sh @@ -31,7 +31,7 @@ OPTIONS: EOF } -TEST_MODES=( "yes" "no" ) +TEST_MODES=( "static" "framework" ) TEST_NAMES=( "iOSCocoaPodsTester" "OSXCocoaPodsTester" ) while [[ $# != 0 ]]; do case "${1}" in @@ -40,10 +40,10 @@ while [[ $# != 0 ]]; do exit 0 ;; --skip-static ) - TEST_MODES=(${TEST_MODES[@]/no}) + TEST_MODES=(${TEST_MODES[@]/static}) ;; --skip-framework ) - TEST_MODES=(${TEST_MODES[@]/yes}) + TEST_MODES=(${TEST_MODES[@]/framework}) ;; --skip-ios ) TEST_NAMES=(${TEST_NAMES[@]/iOSCocoaPodsTester}) @@ -93,24 +93,34 @@ cleanup() { # incase something does hiccup. xcodebuild -workspace "${TEST_NAME}.xcworkspace" -scheme "${TEST_NAME}" clean > /dev/null || true pod deintegrate > /dev/null || true - # Delete the files left after pod deintegrate + # Flush the cache so nothing is left behind. + pod cache clean --all || true + # Delete the files left after pod deintegrate. rm -f Podfile.lock || true rm -rf "${TEST_NAME}.xcworkspace" || true git checkout -- "${TEST_NAME}.xcodeproj" || true + # Remove the Podfile that was put in place. + rm -f Podfile || true } do_test() { local TEST_NAME="$1" - local USE_FRAMEWORKS_VALUE="$2" + local TEST_MODE="$2" - header "${TEST_NAME}" - USE_FRAMEWORKS: "${USE_FRAMEWORKS_VALUE}" + header "${TEST_NAME}" - Mode: "${TEST_MODE}" cd "${ScriptDir}/${TEST_NAME}" # Hook in cleanup for any failures. trap "cleanup ${TEST_NAME}" EXIT - # Invoke pod and then xcodebuild, but catch the results so we can cleanup. - USE_FRAMEWORKS="${USE_FRAMEWORKS_VALUE}" pod install + # Ensure nothing is cached by pods to start with that could throw things off. + pod cache clean --all + + # Put the right Podfile in place. + cp -f "Podfile-${TEST_MODE}" "Podfile" + + # Do the work! + pod install --verbose xcodebuild -workspace "${TEST_NAME}.xcworkspace" -scheme "${TEST_NAME}" build # Clear the hook and manually run cleanup. -- cgit v1.2.3