[From xunit/xunit] Structs passed via [MemberData(...)] may be corrupted on Ubuntu
I found this issue at https://github.com/xunit/xunit/issues/1069 and it looks like it might be of interest to people here.
Original text
When running xUnit tests on the .Net CLI using the public Travis CI servers (running Ubuntu), data held within a simple struct containing four float fields is corrupted when passed to theory using the [MemberData(...)] attribute. When running the same tests on a local Windows machine, or via AppVeyor (Windows CI) all tests pass as expected.
Example struct,
public struct Vector
{
public float X;
public float Y;
public float Z;
public float W;
public Vector(float x, float y, float z, float w)
{
W = w;
X = x;
Y = y;
Z = z;
}
}
Usage,
public static object[][] ArrayVectorData = new[] { new object[] { new Vector(1, 2, 3, 4) } };
[Theory]
[MemberData(nameof(ArrayVectorData))]
public void Vector_ViaArrayMemberData(Vector vector)
{
Assert.Equal(1, vector.X);
Assert.Equal(2, vector.Y);
Assert.Equal(3, vector.Z);
Assert.Equal(4, vector.W);
}
On Windows: Test passes. On Travis CI: Expected: 3, Actual: -2.511178E-26
I've created a simple repro at, Andy-Wilkinson/BugRepro-VectorTests The corresponding CI logs show Travis CI failing (log) and AppVeyor passing (log)
/cc @Andy-Wilkinson, @onovotny
@jamesqo, @Andy-Wilkinson, I have tried to repro the issue using the simple repro on my Ubuntu 14.04, building it using the latest CLI tools available here: https://dotnetcli.blob.core.windows.net/dotnet/Sdk/rel-1.0.0/dotnet-dev-ubuntu-x64.latest.tar.gz I cannot repro the issue, the app completes successfuly.
@jamesqo do you have a repro for this using a recent/latest build that can be used for investigation?
@gkhanna79 No, I don't own an Ubuntu machine; I opened entirely on behalf of the original owner of the issue at xunit/xunit.
Thanks for the comments @gkhanna79 . Unfortunately I'm not much of an expert with Linux - it was only something I spotted when trying to run some Travis CI builds (the logs from the build are here ).
This is using the 1.0.0-preview2-003121 version of the SDK by the look of it. I will have a look to see if I can force Travis to update before the build.
I've managed to get Travis CI to update to the latest version of the dotnet SDK (1.0.0-rc4-004771) and the tests run without error now (build logs here ).
@jamesqo - Thanks for submitting this issue with the coreclr repo. You can close this issue as fixed now.