From 5b3c1f973585a73be5e8e11f57fa7a0843bb203d Mon Sep 17 00:00:00 2001 From: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Date: Wed, 19 Aug 2020 17:38:39 -0700 Subject: [PATCH] [pigeon] Updated documentation in run_tests.sh and turned the ios unit tests back on. (#191) --- .../ios/Runner.xcodeproj/project.pbxproj | 17 +---- packages/pigeon/run_tests.sh | 69 ++++++++++++++++++- 2 files changed, 69 insertions(+), 17 deletions(-) diff --git a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner.xcodeproj/project.pbxproj b/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner.xcodeproj/project.pbxproj index f285dc9180..20ab37a48e 100644 --- a/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner.xcodeproj/project.pbxproj +++ b/packages/pigeon/platform_tests/ios_unit_tests/ios/Runner.xcodeproj/project.pbxproj @@ -11,10 +11,6 @@ 0D50127523FF75B100CD5B95 /* RunnerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 0D50127423FF75B100CD5B95 /* RunnerTests.m */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -39,8 +35,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -56,13 +50,11 @@ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -83,8 +75,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -103,9 +93,7 @@ 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( - 3B80C3931E831B6300D905FE /* App.framework */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEBA1CF902C7004384FC /* Flutter.framework */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 9740EEB31CF90195004384FC /* Generated.xcconfig */, @@ -271,7 +259,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; @@ -408,7 +396,6 @@ }; 249021D3217E4FDB00AE95B9 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -482,7 +469,6 @@ }; 97C147031CF9000F007C117D /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; @@ -538,7 +524,6 @@ }; 97C147041CF9000F007C117D /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_NONNULL = YES; diff --git a/packages/pigeon/run_tests.sh b/packages/pigeon/run_tests.sh index 8058d80556..2b3ee4f467 100755 --- a/packages/pigeon/run_tests.sh +++ b/packages/pigeon/run_tests.sh @@ -1,10 +1,28 @@ +############################################################################### +# run_tests.sh +# +# This runs all the different types of tests for pigeon. It should be run from +# the directory that contains the script. +############################################################################### + # exit when any command fails set -e +############################################################################### +# Variables +############################################################################### flutter=$(which flutter) flutter_bin=$(dirname $flutter) framework_path="$flutter_bin/cache/artifacts/engine/ios/" +############################################################################### +# Functions +############################################################################### + +# test_pigeon_ios() +# +# Compiles the pigeon file to a temp directory and attempts to compile the code +# and runs the dart analyzer on the generated dart code. test_pigeon_ios() { temp_dir=$(mktemp -d -t pigeon) @@ -30,6 +48,9 @@ test_pigeon_ios() { rm -rf $temp_dir } +# test_pigeon_android() +# +# Compiles the pigeon file to a temp directory and attempts to compile the code. test_pigeon_android() { temp_dir=$(mktemp -d -t pigeon) @@ -48,7 +69,22 @@ test_pigeon_android() { rm -rf $temp_dir } +############################################################################### +# Dart unit tests +############################################################################### +pub get pub run test test/ + +############################################################################### +# Compilation tests (Code is generated and compiled) +############################################################################### +# Make sure the artifacts are present. +flutter precache +# Make sure flutter dependencies are available. +pushd $PWD +cd e2e_tests/test_objc/ +flutter pub get +popd test_pigeon_android ./pigeons/voidflutter.dart test_pigeon_android ./pigeons/voidhost.dart test_pigeon_android ./pigeons/host2flutter.dart @@ -64,6 +100,9 @@ test_pigeon_ios ./pigeons/void_arg_host.dart test_pigeon_ios ./pigeons/void_arg_flutter.dart test_pigeon_ios ./pigeons/list.dart +############################################################################### +# Mock handler flutter tests. +############################################################################### pushd $PWD pub run pigeon \ --input pigeons/message.dart \ @@ -73,6 +112,31 @@ cd mock_handler_tester flutter test popd +############################################################################### +# iOS unit tests on generated code. +############################################################################### +pub run pigeon \ + --input pigeons/message.dart \ + --dart_out /dev/null \ + --objc_header_out platform_tests/ios_unit_tests/ios/Runner/messages.h \ + --objc_source_out platform_tests/ios_unit_tests/ios/Runner/messages.m +clang-format -i platform_tests/ios_unit_tests/ios/Runner/messages.h +clang-format -i platform_tests/ios_unit_tests/ios/Runner/messages.m +pushd $PWD +cd platform_tests/ios_unit_tests +flutter build ios +cd ios +xcodebuild \ + -workspace Runner.xcworkspace \ + -scheme RunnerTests \ + -sdk iphonesimulator \ + -destination 'platform=iOS Simulator,name=iPhone 8' \ + test +popd + +############################################################################### +# End-to-end (e2e) integration tests. +############################################################################### DARTLE_H="e2e_tests/test_objc/ios/Runner/dartle.h" DARTLE_M="e2e_tests/test_objc/ios/Runner/dartle.m" DARTLE_DART="e2e_tests/test_objc/lib/dartle.dart" @@ -97,5 +161,8 @@ xcodebuild \ test | xcpretty popd +############################################################################### +# Run the formatter on generated code. +############################################################################### cd ../.. -pub global activate flutter_plugin_tools && pub global run flutter_plugin_tools format \ No newline at end of file +pub global activate flutter_plugin_tools && pub global run flutter_plugin_tools format