dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.19k stars 4.72k forks source link

[wasm] Missing support for building native libraries as part of tests #64127

Open radical opened 2 years ago

radical commented 2 years ago

[wasm] New interop DisabledRuntimeMarshalling* tests failing

Build, and Log:

Interop/DisabledRuntimeMarshalling/DisabledRuntimeMarshalling_NativeAssemblyDisabled/DisabledRuntimeMarshalling_NativeAssemblyDisabled.sh 
...
      System.DllNotFoundException: DisabledRuntimeMarshallingNative
         at DisabledRuntimeMarshalling.PInvokeAssemblyMarshallingDisabled.DelegatesFromExternalAssembly.StructWithDefaultNonBlittableFields_DoesNotMarshal()
         at Program.<Main>$(String[] args)
      Expected: 100
      Actual: 101
...
DisabledRuntimeMarshalling_Disabled_NativeTypeInAssembly/DisabledRuntimeMarshalling_Disabled_NativeTypeInAssembly.sh
DisabledRuntimeMarshalling_Disabled_NativeTypeInAssembly_ro/DisabledRuntimeMarshalling_Disabled_NativeTypeInAssembly_ro.sh [FAIL]
DisabledRuntimeMarshalling_Disabled_NativeAssemblyEnabled/DisabledRuntimeMarshalling_Disabled_NativeAssemblyEnabled.sh
DisabledRuntimeMarshalling_Disabled_NativeAssemblyDisabled/DisabledRuntimeMarshalling_Disabled_NativeAssemblyDisabled.sh

The test was added in https://github.com/dotnet/runtime/pull/63320

ghost commented 2 years ago

Tagging subscribers to 'arch-wasm': @lewing See info in area-owners.md if you want to be subscribed.

Issue Details
[Build](https://dev.azure.com/dnceng/public/_build/results?buildId=1565521&view=logs&jobId=190ad6c8-5950-568c-cadd-f2dfb7d5a79f&j=190ad6c8-5950-568c-cadd-f2dfb7d5a79f&t=c0f6fdc1-ac5d-583c-8ae1-a18de0846552), and [Log](https://helixre8s23ayyeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-64109-merge-1850cf60227a479486/Interop/1/console.70960392.log?sv=2019-07-07&se=2022-02-10T21%3A18%3A38Z&sr=c&sp=rl&sig=NS951kHrX8XCHaaF3K64ArmrFR5s0EWf%2FGpavAE3YzA%3D): ``` ... System.DllNotFoundException: DisabledRuntimeMarshallingNative at DisabledRuntimeMarshalling.PInvokeAssemblyMarshallingDisabled.DelegatesFromExternalAssembly.StructWithDefaultNonBlittableFields_DoesNotMarshal() at Program.
$(String[] args) Expected: 100 Actual: 101 ... ``` The test was added in https://github.com/dotnet/runtime/pull/63320
Author: radical
Assignees: -
Labels: `arch-wasm`, `blocking-clean-ci`
Milestone: -
jkoritzinsky commented 2 years ago

This test fails for the same reason on Wasm as many of the other interop tests: We don’t have the test build configured to support native library building or references for any of the “mobile” platforms or wasm.

danmoseley commented 2 years ago

test was disabled, so removing 'blocking-clean-ci'

radical commented 2 years ago

update: I got the native code to compile for the runtime tests. Now, these need to be linked in to each of the test assemblies, which will need relinking dotnet.wasm, adding to the build time.

radical commented 2 years ago

I'm able to relink now, with some changes to WasmTestRunner.proj, which fails with:

/workspaces/runtime/artifacts/tests/coreclr/Browser.wasm.Release/Tests/Core_Root/build/WasmApp.Native.targets(286,5):
error : Parameter types of pinvoke callback method 'System.Boolean CheckStructWithShortAndBoolManaged(DisabledRuntimeMarshallingNative+StructWithShortAndBool, System.Int16, System.Boolean)' needs to be blittable. 
[/workspaces/runtime/artifacts/tests/coreclr/Browser.wasm.Release/Tests/Core_Root/wasm-test-runner/WasmTestRunner.proj]
lewing commented 1 year ago

@radical what is the status of this one?

radical commented 1 year ago

@radical what is the status of this one?

This is incomplete, and won't be finished for 8.0 .

fanyang-mono commented 1 year ago

This prevented a newly added test for nested struct with PInvoke from running with wasm. Furthermore, this issue appears to extend to all PInvoke tests on the WASM platform, serving as a significant obstacle in the comprehensive testing of PInvoke functionality for WASM.

lewing commented 8 months ago

@jeffschwMSFT @steveisok thoughts on where this should land?

steveisok commented 8 months ago

@jeffschwMSFT @steveisok thoughts on where this should land?

On balance, I think it should stay on your team. My reasoning is that the test infra is so specialized, you'll have to be involved regardless.