Skip to content

Triage tests regressing by building managed tests on OSX #36404

Closed

Description

@sdmaclea

The following test started regressing (currently in the `dev/infrastructure branch) as a result of the #36253 change to start building all managed test assemblies on OSX.

They will be disabled (in the `dev/infrastructure branch) as part of #36351

<!-- Fixed by #36482
-->
<ExcludeList Include="$(XunitTestBinBase)/readytorun/tests/mainv**/*"/>
<ExcludeList Include="$(XunitTestBinBase)/Interop/COM/ComWrappers/GlobalInstance/GlobalInstanceMarshallingTests/*"/>
<ExcludeList Include="$(XunitTestBinBase)/Interop/COM/ComWrappers/GlobalInstance/GlobalInstanceTrackerSupportTests/*"/>
<ExcludeList Include="$(XunitTestBinBase)/Interop/COM/NativeClients/DefaultInterfaces/*"/>
<ExcludeList Include="$(XunitTestBinBase)/Interop/COM/NativeClients/Dispatch/*"/>
<ExcludeList Include="$(XunitTestBinBase)/Interop/COM/NativeClients/Events/*"/>
<ExcludeList Include="$(XunitTestBinBase)/Interop/COM/NativeClients/Licensing/*"/>
<ExcludeList Include="$(XunitTestBinBase)/Interop/COM/NativeClients/Primitives/*"/>
<ExcludeList Include="$(XunitTestBinBase)/Interop/COM/NETClients/ConsumeNETServer/ConsumeNETServer/*"/>
<!-- Regressions apparently caused by building all tests on OSX/Linux
        Oddly these pass when the helix payload is downloaded and the test is run locally
-->
<ExcludeList Include="$(XunitTestBinBase)/Interop/IJW/CopyConstructorMarshaler/CopyConstructorMarshaler/*"/>
<ExcludeList Include="$(XunitTestBinBase)/Interop/IJW/FixupCallsHostWhenLoaded/*"/>
<ExcludeList Include="$(XunitTestBinBase)/Interop/IJW/LoadIjwFromModuleHandle/LoadIjwFromModuleHandle/*"/>
<ExcludeList Include="$(XunitTestBinBase)/Interop/IJW/ManagedCallingNative/ManagedCallingNative/*"/>
<ExcludeList Include="$(XunitTestBinBase)/Interop/IJW/NativeCallingManaged/NativeCallingManaged/*"/>
<ExcludeList Include="$(XunitTestBinBase)/Interop/IJW/NativeVarargs/NativeVarargsTest/*"/>

Could someone take a look?
/cc @jkoritzinsky @sbomer @AaronRobinsonMSFT

Activity

  1. added
    untriaged
    on May 13, 2020
  2. AaronRobinsonMSFT commented on May 13, 2020

    @AaronRobinsonMSFT
    Member

    @sdmaclea All of the tests under Interop/ require native assets that are only built on Windows.

  3. sdmaclea commented on May 13, 2020

    @sdmaclea
    ContributorAuthor

    So the native assets are supposed to be built on the target during the run-test-job.
    Are these not hooked up properly so that they are being built during build-tests skipnative?

  4. AaronRobinsonMSFT commented on May 14, 2020

    @AaronRobinsonMSFT
    Member

    They should be hooked up to build via the build-tests, but won't get built with build-tests skipnative. The native assets would build with build-tests skipmanaged. Some of those assets come from the same place as CoreRun, others come from the native project output path.

  5. sdmaclea commented on May 14, 2020

    @sdmaclea
    ContributorAuthor

    So that shouldn't be the issue. AFAIK, the native assets are being built the same.

    I am taking a look at Interop/IJW/NativeCallingManaged/NativeCallingManaged/* now

  6. sdmaclea commented on May 14, 2020

    @sdmaclea
    ContributorAuthor

    So this is what I see in the payload for the test as sent to helix.

     ls -la
    total 5188
    drwxr-xr-x 1 stmaclea 1049089       0 May 13 20:50 ./
    drwxr-xr-x 1 stmaclea 1049089       0 May 13 20:50 ../
    -rwxr-xr-x 1 stmaclea 1049089   36864 May 13 20:50 IjwNativeCallingManagedDll.dll*
    -rw-r--r-- 1 stmaclea 1049089     964 May 13 20:50 IjwNativeCallingManagedDll.exp
    -rw-r--r-- 1 stmaclea 1049089    2062 May 13 20:50 IjwNativeCallingManagedDll.lib
    -rw-r--r-- 1 stmaclea 1049089  536576 May 13 20:50 IjwNativeCallingManagedDll.pdb
    -rwxr-xr-x 1 stmaclea 1049089  375808 May 13 20:50 mscoree.dll*
    -rw-r--r-- 1 stmaclea 1049089    1167 May 13 20:50 mscoree.exp
    -rw-r--r-- 1 stmaclea 1049089    2188 May 13 20:50 mscoree.lib
    -rw-r--r-- 1 stmaclea 1049089 4272128 May 13 20:50 mscoree.pdb
    -rw-r--r-- 1 stmaclea 1049089   10456 May 13 20:50 NativeCallingManaged.cmd
    -rwxr-xr-x 1 stmaclea 1049089    6144 May 13 20:50 NativeCallingManaged.dll*
    -rwxr-xr-x 1 stmaclea 1049089    8856 May 13 20:50 NativeCallingManaged.sh*
    -rwxr-xr-x 1 stmaclea 1049089   35840 May 13 20:50 TestLibrary.dll*
    
  7. sdmaclea commented on May 14, 2020

    @sdmaclea
    ContributorAuthor
       Interop\IJW\NativeCallingManaged\NativeCallingManaged\NativeCallingManaged.cmd [FAIL]
          Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'IjwNativeCallingManagedDll, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
          File name: 'IjwNativeCallingManagedDll, Culture=neutral, PublicKeyToken=null'
             at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
             at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
             at System.Reflection.Assembly.Load(String assemblyString)
             at IjwHelper.LoadIjwAssembly(String name) in /Users/runner/runners/2.168.2/work/1/s/src/coreclr/tests/src/Interop/IJW/IjwHelper.cs:line 20
             at NativeCallingManaged.NativeCallingManaged.Main(String[] args) in /Users/runner/runners/2.168.2/work/1/s/src/coreclr/tests/src/Interop/IJW/NativeCallingManaged/NativeCallingManaged.cs:line 23
          
          Return code:      1
          Raw output file:      C:\h\w\97700803\w\B4A8097E\e\Interop\IJW\Reports\Interop.IJW\NativeCallingManaged\NativeCallingManaged\NativeCallingManaged.output.txt
          Raw output:
          BEGIN EXECUTION
           "C:\h\w\97700803\p/corerun.exe" NativeCallingManaged.dll 
          Expected: 100
          Actual: -532462766
          END EXECUTION - FAILED
          FAILED
          Test Harness Exitcode is : 1
          To run the test:
          > set CORE_ROOT=C:\h\w\97700803\p
          > C:\h\w\97700803\w\B4A8097E\e\Interop\IJW\NativeCallingManaged\NativeCallingManaged\NativeCallingManaged.cmd
          Expected: True
          Actual:   False
          Stack Trace:
            F:\workspace\_work\1\s\artifacts\tests\coreclr\Windows_NT.x64.Checked\TestWrappers\Interop.IJW\Interop.IJW.XUnitWrapper.cs(528,0): at Interop_IJW._NativeCallingManaged_NativeCallingManaged_NativeCallingManaged_._NativeCallingManaged_NativeCallingManaged_NativeCallingManaged_cmd()
          Output:
            Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'IjwNativeCallingManagedDll, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
            File name: 'IjwNativeCallingManagedDll, Culture=neutral, PublicKeyToken=null'
               at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
               at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
               at System.Reflection.Assembly.Load(String assemblyString)
               at IjwHelper.LoadIjwAssembly(String name) in /Users/runner/runners/2.168.2/work/1/s/src/coreclr/tests/src/Interop/IJW/IjwHelper.cs:line 20
               at NativeCallingManaged.NativeCallingManaged.Main(String[] args) in /Users/runner/runners/2.168.2/work/1/s/src/coreclr/tests/src/Interop/IJW/NativeCallingManaged/NativeCallingManaged.cs:line 23
            
            Return code:      1
            Raw output file:      C:\h\w\97700803\w\B4A8097E\e\Interop\IJW\Reports\Interop.IJW\NativeCallingManaged\NativeCallingManaged\NativeCallingManaged.output.txt
            Raw output:
            BEGIN EXECUTION
             "C:\h\w\97700803\p/corerun.exe" NativeCallingManaged.dll 
            Expected: 100
            Actual: -532462766
            END EXECUTION - FAILED
            FAILED
            Test Harness Exitcode is : 1
            To run the test:
            > set CORE_ROOT=C:\h\w\97700803\p
            > C:\h\w\97700803\w\B4A8097E\e\Interop\IJW\NativeCallingManaged\NativeCallingManaged\NativeCallingManaged.cmd
    
  8. sdmaclea commented on May 14, 2020

    @sdmaclea
    ContributorAuthor

    It seems to be failing while trying to load the IjwNativeCallingManagedDll.dll assembly, which seems to be present.

  9. AaronRobinsonMSFT commented on May 14, 2020

    @AaronRobinsonMSFT
    Member

    Where can I get the binaries from that run?

  10. sdmaclea commented on May 14, 2020

    @sdmaclea
    ContributorAuthor

    Aaron and I worked on this a bit longer.

    The tests downloaded from Helix work on my local machine. Aaron had similar experience with the tests on his machine with his own CORE_ROOT.

    We did see that the cmd files do not match what we told MSBUILD to create. The directory separator has been replaced everywhere \ -> /. It is not clear why this is happening.

    It is not clear why this works running locally, but not when run with helix.

    /cc @trylek @jashook

    Thanks @AaronRobinsonMSFT

  11. self-assigned this
    on May 14, 2020
  12. removed
    untriaged
    on May 14, 2020
  13. sdmaclea commented on May 14, 2020

    @sdmaclea
    ContributorAuthor

    The typical usage of the directory separator is

    REM Local CoreShim requested - see MSBuild property 'CLRTestScriptLocalCoreShim'
    ECHO Copying '%CORE_ROOT%\CoreShim.dll'...
    COPY /y %CORE_ROOT%\CoreShim.dll .

    But since we are generating in MSBUILD, my working guess is that % is a MSBuild special character and needs to be escaped. Similar to the complaint in

    src/runtest.proj:    <!-- NOTE! semicolons must be escaped with %3B boooo -->
    
        <!-- Write the file -->
        <WriteLinesToFile
          File="$(OutputPath)\$(MSBuildProjectName).cmd"
          Lines="$(_CLRTestExecutionScriptText)"
          Overwrite="true" />

    Needs to become

        <!-- Write the file -->
        <WriteLinesToFile
          File="$(OutputPath)\$(MSBuildProjectName).cmd"
          Lines="$([MSBuild]::Escape($(_CLRTestExecutionScriptText)))"
          Overwrite="true" />

    See https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-escape-special-characters-in-msbuild?view=vs-2019

    I'll try this in a separate PR.

    Edit

    I am thinking $([MSBuild]::Escape($(_CLRTestExecutionScriptText))) won't work. We need some content treated specially.

    The correct way to go seems to properly escape the special characters.

    The % characters need to be escaped to %25. https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild-special-characters?view=vs-2019

  14. sdmaclea commented on May 14, 2020

    @sdmaclea
    ContributorAuthor

    OK escaping the % didn't work.

    @natemcmaster noted a similar issue with backslash on Linux. dotnet/msbuild#4018 (comment)

    Perhaps escaping the backslash would work.

    @ericstj Also commented about the lack of scalability of WriteLinesToFile. Perhaps that is part of our problem with MSBuild slowness. dotnet/msbuild#4018 (comment)

    I think we need to stop using MSBuild as a templating engine.

  15. sdmaclea commented on May 16, 2020

    @sdmaclea
    ContributorAuthor

    #36482 switches to building the script files on the correct target.

    That fixed most of the issues in the top post.

    Strangely the 6 IJW tests fail on helix, but pass when downloaded and run on my local machine.

        Interop\IJW\NativeVarargs\NativeVarargsTest\NativeVarargsTest.cmd [FAIL]
          
          Return code:      1
          Raw output file:      C:\h\w\BE210A03\w\BF4E0A89\e\Interop\IJW\Reports\Interop.IJW\NativeVarargs\NativeVarargsTest\NativeVarargsTest.output.txt
          Raw output:
          BEGIN EXECUTION
           "C:\h\w\BE210A03\p\corerun.exe" NativeVarargsTest.dll 
          System.IO.FileNotFoundException: Could not load file or assembly 'IjwNativeVarargs, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
          File name: 'IjwNativeVarargs, Culture=neutral, PublicKeyToken=null'
             at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
             at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
             at System.Reflection.Assembly.Load(String assemblyString)
             at IjwHelper.LoadIjwAssembly(String name) in /Users/runner/runners/2.168.2/work/1/s/src/coreclr/tests/src/Interop/IJW/IjwHelper.cs:line 20
             at NativeVarargsTest.NativeVarargsTest.Main(String[] args) in /Users/runner/runners/2.168.2/work/1/s/src/coreclr/tests/src/Interop/IJW/NativeVarargs/NativeVarargsTest.cs:line 52
          Expected: 100
          Actual: 101
          END EXECUTION - FAILED
          FAILED
          Test Harness Exitcode is : 1
          To run the test:
          > set CORE_ROOT=C:\h\w\BE210A03\p
          > C:\h\w\BE210A03\w\BF4E0A89\e\Interop\IJW\NativeVarargs\NativeVarargsTest\NativeVarargsTest.cmd
          Expected: True
          Actual:   False
          Stack Trace:
            F:\workspace\_work\1\s\artifacts\tests\coreclr\Windows_NT.x86.Checked\TestWrappers\Interop.IJW\Interop.IJW.XUnitWrapper.cs(625,0): at Interop_IJW._NativeVarargs_NativeVarargsTest_NativeVarargsTest_._NativeVarargs_NativeVarargsTest_NativeVarargsTest_cmd()
          Output:
            
            Return code:      1
            Raw output file:      C:\h\w\BE210A03\w\BF4E0A89\e\Interop\IJW\Reports\Interop.IJW\NativeVarargs\NativeVarargsTest\NativeVarargsTest.output.txt
            Raw output:
            BEGIN EXECUTION
             "C:\h\w\BE210A03\p\corerun.exe" NativeVarargsTest.dll 
            System.IO.FileNotFoundException: Could not load file or assembly 'IjwNativeVarargs, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
            File name: 'IjwNativeVarargs, Culture=neutral, PublicKeyToken=null'
               at System.Reflection.RuntimeAssembly.InternalLoad(ObjectHandleOnStack assemblyName, ObjectHandleOnStack requestingAssembly, StackCrawlMarkHandle stackMark, Boolean throwOnFileNotFound, ObjectHandleOnStack assemblyLoadContext, ObjectHandleOnStack retAssembly)
               at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, RuntimeAssembly requestingAssembly, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, AssemblyLoadContext assemblyLoadContext)
               at System.Reflection.Assembly.Load(String assemblyString)
               at IjwHelper.LoadIjwAssembly(String name) in /Users/runner/runners/2.168.2/work/1/s/src/coreclr/tests/src/Interop/IJW/IjwHelper.cs:line 20
               at NativeVarargsTest.NativeVarargsTest.Main(String[] args) in /Users/runner/runners/2.168.2/work/1/s/src/coreclr/tests/src/Interop/IJW/NativeVarargs/NativeVarargsTest.cs:line 52
            Expected: 100
            Actual: 101
            END EXECUTION - FAILED
            FAILED
            Test Harness Exitcode is : 1
            To run the test:
            > set CORE_ROOT=C:\h\w\BE210A03\p
            > C:\h\w\BE210A03\w\BF4E0A89\e\Interop\IJW\NativeVarargs\NativeVarargsTest\NativeVarargsTest.cmd
    
  16. jkoritzinsky commented on May 16, 2020

    @jkoritzinsky
    Member

    My guess is that some of the debug vc++ runtime dlls aren't copied over correctly.

  17. sdmaclea commented on May 16, 2020

    @sdmaclea
    ContributorAuthor

    But why would building managed DLLs on OSX affect that?
    Native binaries are built and copied from WIndows like before. I assume IJW managed C++ is treated as native because it is built using CMake. (That is what I saw in my tree)

  18. removed their assignment
    on May 16, 2020
  19. jkoritzinsky commented on May 16, 2020

    @jkoritzinsky
    Member

    We do some extra copying of some other files. It's possible that they aren't being copied.

  20. jkoritzinsky commented on May 18, 2020

    @jkoritzinsky
    Member

    I was correct. The current way that we copy the debug CRT won't work if we're on OSX. We currently use the None item group to copy it when we build on Windows. This needs to be updated to work in the new workflow.

    <ItemGroup
    Condition="'$(TargetsWindows)' == 'true' And ('$(Configuration)' == 'Debug' Or '$(Configuration)' == 'Checked') And '$(CopyDebugCRTDllsToOutputDirectory)' == 'true'" >
    <None Include="$(VCToolsRedistDir)onecore/debug_nonredist/$(TargetArchitecture)/Microsoft.VC*.DebugCRT/vcruntime*d.dll" Link="%(Filename)%(Extension)" CopyToOutputDirectory="Always" />
    <None Include="$(VCToolsRedistDir)onecore/debug_nonredist/$(TargetArchitecture)/Microsoft.VC*.DebugCRT/msvcp*d.dll" Link="%(Filename)%(Extension)" CopyToOutputDirectory="Always" />
    <None Include="$(ExtensionSdkDir)/Microsoft.UniversalCRT.Debug/$(UCRTVersion)/Redist/Debug/$(TargetArchitecture)/ucrtbased.dll" CopyToOutputDirectory="Always" />
    </ItemGroup>

  21. self-assigned this
    on May 20, 2020
  22. ghost locked as resolved and limited conversation to collaborators on Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-Infrastructure-coreclr

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions