Automated testing on iOS

Jacob Carlborg doob at me.com
Wed Feb 12 19:04:28 UTC 2020


On 2020-02-08 20:54, Dan Olson wrote:

> Hi Jacob, nice progress on getting iOS support into ldc!  I peek at the
> forums every now and then. Your approach of using an xcode test was how
> I ran from the command line on an iOS device.  The idea to generate an
> Xcode project with test seems good to me.
> 
> I assume you know about setupEnvAndRunTests() in
> 
> https://github.com/smolt/ldc-iphone-dev/blob/master/unittester/unittest.d

No, I haven't seen that.

> Is that still needed to pass all druntime/phobos unittests?

The unit tests for druntime pass without that. For the manual tests, 
I've been using the binaries that are built using `ldc-build-runtime 
--testrunners`.

For automated testing I have an Xcode project which contains a single 
XCTest implemented in Objective-C. This is linked with `test_runner.o` 
and `libdruntime-ldc-unittest.a` which are generated by the above 
command. The test calls `rt_init`, then `runModuleUnitTests` and asserts 
that the return value of `runModuleUnitTests` is whatever it should be. 
Then it calls `rt_term`.

The unit tests for Phobos can be run in the same way. Currently not all 
of them pass. Most of the failures are in allocator and math related 
modules. I suspect the allocator tests that fail might be due to a 
different page size, but I'm not sure. For the math related tests I 
haven't investigated that yet.

I see that `setupEnvAndRunTests` changes the directory to the temp 
directory and then configures the FPU. I've modified the tests that 
write files (those that I have found so far) to write to the temp 
directory instead. Configuring the FPU might help with the math related 
tests. I'll take a look at that.

Thanks.

-- 
/Jacob Carlborg


More information about the digitalmars-d-ldc mailing list