Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Minimal test harness for iOS #13029

Merged
merged 6 commits into from
Oct 10, 2019
Merged

Minimal test harness for iOS #13029

merged 6 commits into from
Oct 10, 2019

Conversation

dnfield
Copy link
Contributor

@dnfield dnfield commented Oct 9, 2019

To run:

autoninja -C out/ios_debug_sim_unopt FlutterTests
open -a Simulator.app
xcrun simctl install booted out/ios_debug_sim_unopt/FlutterTests.app

Then use either Console.app or xcrun simctl spawn booted log stream, launch the app, and look at the log output.

It would probably be nicer to bootstrap this from XCTest instead.

Known issues:

  • springboard reruns the test when it exits currently, so you get all your logs twice.
  • not clear how to capture the exit code, and we're not obviously printing it anywhere that I can see.

@dnfield dnfield requested review from chinmaygarde and gw280 October 9, 2019 17:54
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

template("ios_app") {
Copy link
Contributor

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?

Copy link
Member

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)

Copy link
Contributor Author

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.

<key>CFBundleName</key>
<string>FlutterTests</string>
<key>CFBundleVersion</key>
<string>1.0</string>
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

@@ -2,9 +2,22 @@
// 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 "flutter/fml/logging.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Unnecessary include of logging.h

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

EXPECT_EQ(1, 1);
}

TEST(SmokeTest, Fail) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This requires a different harness.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.


deps = [
":flutter_tests_fixtures",
"$flutter_root/runtime:libdart",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can stop using flutter_root now. If you still want to use it though, please use it consistently in rules (the next dep does not use the variable here).

# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

template("ios_app") {
Copy link
Member

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)

int main(int argc, char** argv) {
#ifdef OS_IOS
asl_log_descriptor(NULL, NULL, ASL_LEVEL_NOTICE, STDOUT_FILENO,
Copy link
Member

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

@dnfield dnfield merged commit 0622b05 into flutter:master Oct 10, 2019
@dnfield dnfield deleted the ios_test branch October 10, 2019 04:16
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 10, 2019
engine-flutter-autoroll added a commit to flutter/flutter that referenced this pull request Oct 10, 2019
[email protected]:flutter/engine.git/compare/ed1557f82dd4...f237896

git log ed1557f..f237896 --no-merges --oneline
2019-10-10 [email protected] Roll src/third_party/dart cc3e22f724..48e93d3d3b (8 commits)
2019-10-10 [email protected] Roll fuchsia/sdk/core/mac-amd64 from pczjK... to xd5Jj... (flutter/engine#13055)
2019-10-10 [email protected] Minimal test harness for iOS (flutter/engine#13029)


If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
Inconnu08 pushed a commit to Inconnu08/flutter that referenced this pull request Nov 26, 2019
[email protected]:flutter/engine.git/compare/ed1557f82dd4...f237896

git log ed1557f..f237896 --no-merges --oneline
2019-10-10 [email protected] Roll src/third_party/dart cc3e22f724..48e93d3d3b (8 commits)
2019-10-10 [email protected] Roll fuchsia/sdk/core/mac-amd64 from pczjK... to xd5Jj... (flutter/engine#13055)
2019-10-10 [email protected] Minimal test harness for iOS (flutter/engine#13029)


If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected] on the revert to ensure that a human
is aware of the problem.

To report a problem with the AutoRoller itself, please file a bug:
https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+/master/autoroll/README.md
gaaclarke added a commit to gaaclarke/engine that referenced this pull request May 27, 2020
gaaclarke added a commit to gaaclarke/engine that referenced this pull request May 27, 2020
gaaclarke added a commit to gaaclarke/engine that referenced this pull request May 27, 2020
gaaclarke added a commit that referenced this pull request May 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants