3

I have a C++ library that I want to include into my iOS application. It has unit tests. If I put it simply, it's something like:

#include <cstdio>
int main()
{
   printf("Test result\n");
}

Is it possible to run such an application that uses only stdin/stdout on an arm64 based iOS device to make sure that all compiles and works correctly?

I can do it on a real android device with adb push/adb shell, so I wonder, is it possible to do the same on iOS based devices?

Adrian Mole
  • 49,934
  • 160
  • 51
  • 83
user1244932
  • 7,352
  • 5
  • 46
  • 103
  • 2
    _is it possible to run such application that uses only stdin/stdout on arm64 based device to make sure that all compile and work correctly?_ Yes, Raspberry Pi is ARM64 and runs Linux. – Thomas Sablik May 30 '20 at 15:02
  • Based on my experience with developing for embedded control devices in safety-related environment: Compile and run your tests on the developing system. You want to test *the source code*, not the compiler, at least if you're not the compiler developer. – the busybee May 30 '20 at 16:05
  • 3
    why wouldn't it be possible ? create an Objective-C project (not Swift) and put your code in main without calling `UIApplicationMain` – blld Jun 02 '20 at 02:50
  • @blld It is not solve problem. `cmake+make` can build just fine console application, without any objective-c, but how I deploy/run/collect stdout/stderr/exit code of such application from script? But deploying and running by hands all 100 units tests and analyze result for every change is not fun. – user1244932 Jun 02 '20 at 15:38

1 Answers1

0

It's not completely clear what are you trying to archive. But let me guess:

  1. There is a third-party library you don't have control over.
  2. There're tests in this library. The tests are a separate console app.
  3. And you're looking for a way to run this app in some kind of shell on iOS that can run an arbitrary executables. And you can't because of all the security.

But if you have the source code of unit tests, then with some small changes you can compile them as a library, not as an executable. And call them from a "shell" you can write yourself - a small host app the sole purpose of which is to call these tests (and probably send their results via any kind of connection that suits you).

More on this you can read here

Yes, this host app will have a GUI, but I don't really understand why do you against it... if you really are.

Also these may be helpfull:
debug bridge for iPhone / shell command prompt
ADB equivalent for iOS device

x00
  • 13,643
  • 3
  • 16
  • 40