Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patrol drive --devices all infinity loop, stdbuf: command not found #487

Closed
Kiruel opened this issue Oct 20, 2022 · 13 comments
Closed

patrol drive --devices all infinity loop, stdbuf: command not found #487

Kiruel opened this issue Oct 20, 2022 · 13 comments
Labels
bug Something isn't working package: patrol_cli Related to the patrol_cli package platform: ios iOS is affected

Comments

@Kiruel
Copy link
Contributor

Kiruel commented Oct 20, 2022

Using: patrol drive --device=all

Got a infinity loop on:

Forwarding ports...

Full logs:

patrol drive --device=all --flavor dev
✓ Forwarded ports (21ms)
✓ Installed server (1.8s)
✓ Installed instrumentation (1.3s)
iproxy: /bin/sh: stdbuf: command not found
iproxy: 
⠙ Forwarding ports... (3.3s)pl.leancode.automatorserver.ServerLoop:
⠦ Forwarding ports... (84.5s)

Got an error on iOS too maybe related:

➜  patrol devices
ONEPLUS (MY_ID_ANDROID)
iPhone (MY_ID_IOS)
➜ patrol drive -d MY_ID_IOS --flavor dev
Error: Device MY_ID_IOS is not attached

Works fine on MY_ID_ANDROID.

@bartekpacia
Copy link
Contributor

Hi @Kiruel, thanks for creating the issue!

Looks like the stdbuf program is not present on your machine. stdbuf is used by patrol_cli internally to facilitate port forwarding with iproxy.

You can install stdbuf (together with other GNU coreutils) it with Homebrew like this:

$ brew install coreutils

Let me know if this helps!

@bartekpacia bartekpacia added bug Something isn't working package: patrol_cli Related to the patrol_cli package labels Oct 20, 2022
@bartekpacia
Copy link
Contributor

Checking if stdbuf is present should be done by patrol doctor. Related issue #173.

@bartekpacia bartekpacia changed the title patrol --devices=all infinity loop patrol drive --devices all infinity loop, stdbuf: command not found Oct 20, 2022
@bartekpacia bartekpacia added the platform: ios iOS is affected label Oct 20, 2022
@Kiruel
Copy link
Contributor Author

Kiruel commented Oct 21, 2022

Using patrol doctor:

➜ patrol doctor 
artifact path: /USER/ME/.cache/patrol (default)
➜  

Nothing more than that.

After installing:

➜ brew install coreutils
➜ whereis stdbuf
stdbuf: /opt/homebrew/bin/stdbuf /opt/homebrew/share/man/man1/stdbuf.1

Got the same result:

➜  patrol drive -d MY_ID --flavor dev
Error: Device MY_ID is not attached

For the log of --devices=all:

➜  patrol drive --device=all --flavor dev                       
✓ Forwarded ports (22ms)
✓ Installed server (2.5s)
✓ Installed instrumentation (1.6s)
⠹ Forwarding ports... (0.2s)iproxy: stdbuf: failed to run command ‘iproxy’: No such file or directory
iproxy: 
⠧ Forwarding ports... (3.8s)pl.leancode.automatorserver.ServerLoop:

Something different from the first log, I just try to install iproxybut it is not present in brew manager.

@bartekpacia
Copy link
Contributor

Ah, you also need to install iproxy. It's provided by this formula.

Sorry for the problems. I'll improve patrol doctor to be more friendly and useful :)

@Kiruel
Copy link
Contributor Author

Kiruel commented Oct 27, 2022

Still not work with iOS, even with iproxy installed:

➜  patrol drive -d MY_IOS_ID_DEVICE --flavor dev -v    
Verbose mode enabled. More logs will be printed.
Error: Device MY_IOS_ID_DEVICE is not attached
#0      throwToolExit (package:patrol_cli/src/common/tool_exit.dart:5:3)
#1      DeviceFinder.findDevicesToUse (package:patrol_cli/src/features/devices/device_finder.dart:97:9)
#2      DeviceFinder.find (package:patrol_cli/src/features/devices/device_finder.dart:44:12)
<asynchronous suspension>
#3      DriveCommand.parseInput (package:patrol_cli/src/features/drive/drive_command.dart:169:29)
<asynchronous suspension>
#4      StagedCommand.run (package:patrol_cli/src/common/staged_command.dart:21:20)
<asynchronous suspension>
#5      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
<asynchronous suspension>
#6      PatrolCommandRunner.runCommand (package:patrol_cli/src/command_runner.dart:232:18)
<asynchronous suspension>
#7      PatrolCommandRunner.run (package:patrol_cli/src/command_runner.dart:183:18)
<asynchronous suspension>
#8      patrolCommandRunner (package:patrol_cli/src/command_runner.dart:45:14)
<asynchronous suspension>
#9      main (file:///Users/MY_USER/.pub-cache/hosted/pub.dartlang.org/patrol_cli-0.7.3+1/bin/main.dart:6:20)
<asynchronous suspension>

@Kiruel
Copy link
Contributor Author

Kiruel commented Oct 27, 2022

Btw I'm on:
Apple M1 Max
macOS Monterey

@bartekpacia
Copy link
Contributor

Okay, this is strange. Very sorry for the problems!

Could you do flutter devices and patrol devices one after another and post output here?

@Kiruel
Copy link
Contributor Author

Kiruel commented Oct 28, 2022

No problem :) happy to help on it.
The logs:

➜  flutter devices
4 connected devices:

ONEPLUS A5010 (mobile)     • ID_ANDROID                • android-arm64  • Android 10 (API 29)
iPhone de ME (mobile)      • ID_IOS • ios              • iOS 16.1 20B79
macOS (desktop)            • macos                     • darwin-arm64   • macOS 12.5.1 21G83 darwin-arm
Chrome (web)               • chrome                    • web-javascript • Google Chrome 106.0.5249.119

• Error: ME's Apple Watch needs to connect to determine its availability. Check the connection between the device and its companion iPhone, and the connection between the iPhone and Xcode. Both devices may also need to be restarted and unlocked. (code 1)
➜  patrol devices
ONEPLUS A5010 (ID_ANDROID)
iPhone de ME (ID_IOS)

@bartekpacia
Copy link
Contributor

bartekpacia commented Oct 28, 2022

Oh boi, I know!

When running tests on iOS, you have to use the device's name instead of its ID. So you should do:

$ patrol drive -d 'iPhone de ME' --flavor dev -v   

instead of:

$ patrol drive -d $ID_IOS --flavor dev -v   

Let me know if this helped.

So sorry about this 🤦🏻 I'll fix this to let users use both the device name and the device ID.

@Kiruel
Copy link
Contributor Author

Kiruel commented Nov 2, 2022

Maybe this is why the --device=all not work as-well, but you find the problem ! :)

I find another issue but probably not related to this one:

➜  patrol --version
patrol_cli v0.7.4+1
➜  patrol drive -d "iPhone de Etienne" --flavor dev -v
Verbose mode enabled. More logs will be printed.
Forwarding ports...
Forwarded ports
Using artifact ios-0.7.4+1
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild test -project AutomatorServer.xcodeproj -scheme AutomatorServer -sdk iphoneos -destination "platform=iOS,name=iPhone de Etienne"
User defaults from command line:
IDEPackageSupportUseBuiltinSCM = YES
Build settings from command line:
SDKROOT = iphoneos16.0
Resolve Package Graph
Fetching from https://github.com/apple/swift-nio-ssl.git (cached)
Fetching from https://github.com/apple/swift-atomics.git (cached)
Fetching from https://github.com/apple/swift-protobuf.git (cached)
Fetching from https://github.com/apple/swift-log.git (cached)
Fetching from https://github.com/apple/swift-nio-transport-services.git (cached)
Fetching from https://github.com/grpc/grpc-swift.git (cached)
Fetching from https://github.com/apple/swift-nio.git (cached)
Fetching from https://github.com/apple/swift-nio-http2.git (cached)
Fetching from https://github.com/apple/swift-nio-extras.git (cached)
Cloning local copy of package ‘swift-nio-ssl’
Checking out 2.22.1 of package ‘swift-nio-ssl’
Cloning local copy of package ‘grpc-swift’
Checking out 1.10.0 of package ‘grpc-swift’
Cloning local copy of package ‘swift-nio-extras’
Checking out 1.14.0 of package ‘swift-nio-extras’
Cloning local copy of package ‘swift-protobuf’
Checking out 1.20.1 of package ‘swift-protobuf’
Cloning local copy of package ‘swift-nio-http2’
Checking out 1.22.1 of package ‘swift-nio-http2’
Cloning local copy of package ‘swift-nio-transport-services’
Checking out 1.13.1 of package ‘swift-nio-transport-services’
Cloning local copy of package ‘swift-log’
Checking out 1.4.4 of package ‘swift-log’
Cloning local copy of package ‘swift-nio’
Checking out 2.41.1 of package ‘swift-nio’
Cloning local copy of package ‘swift-atomics’
Checking out 1.0.2 of package ‘swift-atomics’
Resolved source packages:
SwiftProtobuf: https://github.com/apple/swift-protobuf.git @ 1.20.1
swift-nio-http2: https://github.com/apple/swift-nio-http2.git @ 1.22.1
swift-atomics: https://github.com/apple/swift-atomics.git @ 1.0.2
swift-nio-ssl: https://github.com/apple/swift-nio-ssl.git @ 2.22.1
grpc-swift: https://github.com/grpc/grpc-swift.git @ 1.10.0
swift-nio-transport-services: https://github.com/apple/swift-nio-transport-services.git @ 1.13.1
swift-nio-extras: https://github.com/apple/swift-nio-extras.git @ 1.14.0
swift-nio: https://github.com/apple/swift-nio.git @ 2.41.1
swift-log: https://github.com/apple/swift-log.git @ 1.4.4
Prepare packages
2022-11-02 17:10:23.810 xcodebuild[52102:27332340] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x122f84650: name:Docs.docc path:group:Docs.docc> Failed to load container at path: /Users/etiennetheodore/Library/Developer/Xcode/DerivedData/AutomatorServer-fomtdpvbkcvkliantsawynmkhfhp/SourcePackages/checkouts/swift-protobuf/Sources/protoc-gen-swift/Docs.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder".}

2022-11-02 17:10:23.823 xcodebuild[52102:27332340] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x122dc8560: name:Docs.docc path:group:Docs.docc> Failed to load container at path: /Users/etiennetheodore/Library/Developer/Xcode/DerivedData/AutomatorServer-fomtdpvbkcvkliantsawynmkhfhp/SourcePackages/checkouts/grpc-swift/Sources/protoc-gen-grpc-swift/Docs.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder".}

2022-11-02 17:10:23.832 xcodebuild[52102:27332340] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x116a0d430: name:Docs.docc path:group:Docs.docc> Failed to load container at path: /Users/etiennetheodore/Library/Developer/Xcode/DerivedData/AutomatorServer-fomtdpvbkcvkliantsawynmkhfhp/SourcePackages/checkouts/grpc-swift/Sources/GRPC/Docs.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder".}

2022-11-02 17:10:23.846 xcodebuild[52102:27332340] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x124cae950: name:Documentation.docc path:group:Documentation.docc> Failed to load container at path: /Users/etiennetheodore/Library/Developer/Xcode/DerivedData/AutomatorServer-fomtdpvbkcvkliantsawynmkhfhp/SourcePackages/checkouts/swift-log/Sources/Logging/Documentation.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Documentation.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Documentation.docc" as a "Swift Package Folder" because it is already open as a "Folder".}

2022-11-02 17:10:23.855 xcodebuild[52102:27332340] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x122fddf20: name:Docs.docc path:group:Docs.docc> Failed to load container at path: /Users/etiennetheodore/Library/Developer/Xcode/DerivedData/AutomatorServer-fomtdpvbkcvkliantsawynmkhfhp/SourcePackages/checkouts/swift-nio-ssl/Sources/NIOSSL/Docs.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder".}

2022-11-02 17:10:23.858 xcodebuild[52102:27332340] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x122ff7a20: name:Docs.docc path:group:Docs.docc> Failed to load container at path: /Users/etiennetheodore/Library/Developer/Xcode/DerivedData/AutomatorServer-fomtdpvbkcvkliantsawynmkhfhp/SourcePackages/checkouts/swift-nio-transport-services/Sources/NIOTransportServices/Docs.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder".}

2022-11-02 17:10:23.901 xcodebuild[52102:27332340] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x116a568c0: name:Docs.docc path:group:Docs.docc> Failed to load container at path: /Users/etiennetheodore/Library/Developer/Xcode/DerivedData/AutomatorServer-fomtdpvbkcvkliantsawynmkhfhp/SourcePackages/checkouts/swift-nio-extras/Sources/NIOSOCKS/Docs.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder".}

2022-11-02 17:10:23.902 xcodebuild[52102:27332340] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x122e0e760: name:Docs.docc path:group:Docs.docc> Failed to load container at path: /Users/etiennetheodore/Library/Developer/Xcode/DerivedData/AutomatorServer-fomtdpvbkcvkliantsawynmkhfhp/SourcePackages/checkouts/swift-nio-extras/Sources/NIOHTTPCompression/Docs.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder".}

2022-11-02 17:10:23.903 xcodebuild[52102:27332340] [MT] IDEFileReferenceDebug: [Load] <IDESwiftPackageCore.IDESwiftPackageSpecialFolderFileReference, 0x122e08c00: name:Docs.docc path:group:Docs.docc> Failed to load container at path: /Users/etiennetheodore/Library/Developer/Xcode/DerivedData/AutomatorServer-fomtdpvbkcvkliantsawynmkhfhp/SourcePackages/checkouts/swift-nio-extras/Sources/NIOExtras/Docs.docc, Error: Error Domain=com.apple.dt.IDEContainerErrorDomain Code=6 "Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder"." UserInfo={NSLocalizedDescription=Cannot open "Docs.docc" as a "Swift Package Folder" because it is already open as a "Folder".}

Computing target dependency graph and provisioning inputs
Create build description
Build description signature: 57275c4f6ff8667573ee87fbd6acccbc
Build description path: /Users/etiennetheodore/Library/Developer/Xcode/DerivedData/AutomatorServer-fomtdpvbkcvkliantsawynmkhfhp/Build/Intermediates.noindex/XCBuildData/57275c4f6ff8667573ee87fbd6acccbc-desc.xcbuild
note: Building targets in dependency order
/Users/etiennetheodore/.cache/patrol/ios-0.7.4+1/AutomatorServer.xcodeproj: error: No profiles for 'pl.leancode.AutomatorServerUITests.xctrunner' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'pl.leancode.AutomatorServerUITests.xctrunner'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'AutomatorServerUITests' from project 'AutomatorServer')
/Users/etiennetheodore/.cache/patrol/ios-0.7.4+1/AutomatorServer.xcodeproj: error: No profiles for 'pl.leancode.AutomatorServer' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'pl.leancode.AutomatorServer'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild. (in target 'AutomatorServer' from project 'AutomatorServer')
Test session results, code coverage, and logs:
/Users/etiennetheodore/Library/Developer/Xcode/DerivedData/AutomatorServer-fomtdpvbkcvkliantsawynmkhfhp/Logs/Test/Test-AutomatorServer-2022.11.02_17-10-23-+0100.xcresult
Testing failed:
No profiles for 'pl.leancode.AutomatorServerUITests.xctrunner' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'pl.leancode.AutomatorServerUITests.xctrunner'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
No profiles for 'pl.leancode.AutomatorServer' were found: Xcode couldn't find any iOS App Development provisioning profiles matching 'pl.leancode.AutomatorServer'. Automatic signing is disabled and unable to generate a profile. To enable automatic signing, pass -allowProvisioningUpdates to xcodebuild.
Testing cancelled because the build failed.

** TEST FAILED **
Unhandled exception:
Exception: Test failed. See logs above. Also, consider running with --verbose.
#0      IOSDriver._runServerOnDevice.<anonymous closure> (package:patrol_cli/src/features/drive/platform/ios_driver.dart:218:9)
#1      List.forEach (dart:core-patch/growable_array.dart:416:8)
#2      ProcessListeners.listenStdErr.<anonymous closure> (package:patrol_cli/src/common/extensions/process.dart:50:14)
#3      _RootZone.runUnaryGuarded (dart:async/zone.dart:1586:10)
#4      _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
#5      _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#6      _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
#7      _StreamController._add (dart:async/stream_controller.dart:648:7)
#8      _StreamController.add (dart:async/stream_controller.dart:596:5)
#9      _Socket._onData (dart:io-patch/socket_patch.dart:2324:41)
#10     _RootZone.runUnaryGuarded (dart:async/zone.dart:1586:10)
#11     _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
#12     _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
#13     _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:774:19)
#14     _StreamController._add (dart:async/stream_controller.dart:648:7)
#15     _StreamController.add (dart:async/stream_controller.dart:596:5)
#16     new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1849:33)
#17     _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1322:14)
#18     _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#19     _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
#20     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:122:13)
#21     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:193:5)

Should I need more config before running on iOS ?

@bartekpacia
Copy link
Contributor

Glad it works now :) Sorry again.

@bartekpacia
Copy link
Contributor

Should I need more config before running on iOS?

For physical iOS devices – unfortunately yes, you have to open the Xcode project at ~/.cache/patrol/ios-0.7.4+1 and set up signing. It's just a few clicks, but I admit, it's not perfect experience. We want to distribute prebuilt, resigned .app – this is tracked in #488.

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar problem, please file a new issue. Make sure to follow the template and provide all the information necessary to reproduce the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working package: patrol_cli Related to the patrol_cli package platform: ios iOS is affected
Projects
None yet
Development

No branches or pull requests

2 participants