-
Notifications
You must be signed in to change notification settings - Fork 6k
Minimal test harness for iOS #13029
Minimal test harness for iOS #13029
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Copyright 2013 The Flutter Authors. All rights reserved. | ||
| # Use of this source code is governed by a BSD-style license that can be | ||
| # found in the LICENSE file. | ||
|
|
||
| template("ios_app") { | ||
| assert(is_ios) | ||
|
|
||
| copy("${target_name}__info_plist") { | ||
| sources = [ invoker.info_plist ] | ||
| outputs = [ "$root_out_dir/${target_name}.app/Info.plist" ] | ||
| } | ||
| executable("$target_name") { | ||
| forward_variables_from(invoker, "*") | ||
| output_name = "${target_name}.app/$target_name" | ||
|
|
||
| deps += [ | ||
| ":${target_name}__info_plist", | ||
| ] | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| <plist version="1.0"> | ||
| <dict> | ||
| <key>CFBundleDevelopmentRegion</key> | ||
| <string>en</string> | ||
| <key>CFBundleExecutable</key> | ||
| <string>FlutterTests</string> | ||
| <key>CFBundleIdentifier</key> | ||
| <string>io.flutter.FlutterTests</string> | ||
| <key>CFBundleInfoDictionaryVersion</key> | ||
| <string>6.0</string> | ||
| <key>CFBundleName</key> | ||
| <string>FlutterTests</string> | ||
| <key>CFBundleVersion</key> | ||
| <string>1.0</string> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we need to worry about the fact that these version strings are hardcoded?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the case of witing a unit testing app, no. For a real app, we'd probably want better handling of the plist in general. |
||
| <key>CFBundleShortVersionString</key> | ||
| <string>1.0</string> | ||
| </dict> | ||
| </plist> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #import <Foundation/Foundation.h> | ||
|
|
||
| #include "flutter/testing/testing.h" | ||
|
|
||
| namespace flutter_tests { | ||
|
|
||
| TEST(SmokeTest, Success) { | ||
| EXPECT_EQ(1, 1); | ||
| } | ||
|
|
||
| TEST(SmokeTest, Fail) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This requires a different harness.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right now this test isn't run and nothing is tested. I wanted to see if we could somehow get the exit code from this or what log scraping might make sense for CI. |
||
| EXPECT_EQ(1, 2); | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,21 @@ | |
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #include "flutter/fml/build_config.h" | ||
| #include "gtest/gtest.h" | ||
|
|
||
| #ifdef OS_IOS | ||
| #include <asl.h> | ||
| #endif // OS_IOS | ||
|
|
||
| int main(int argc, char** argv) { | ||
| #ifdef OS_IOS | ||
| asl_log_descriptor(NULL, NULL, ASL_LEVEL_NOTICE, STDOUT_FILENO, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this harness, both can be ASL_LEVEL_ERR. I don't think notices are shown by default.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In a local test they were, but I'll just make them both err. |
||
| ASL_LOG_DESCRIPTOR_WRITE); | ||
| asl_log_descriptor(NULL, NULL, ASL_LEVEL_ERR, STDERR_FILENO, | ||
| ASL_LOG_DESCRIPTOR_WRITE); | ||
| #endif // OS_IOS | ||
|
|
||
| ::testing::InitGoogleTest(&argc, argv); | ||
| return RUN_ALL_TESTS(); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add an
if (is_ios)here and assert if we're not ios and trying to use this template?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. You can also just say
assert(is_ios)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
assert(is_ios)is fine, but we can't do what I think @gw280 is asking - we need to use this template from iOS.