microsoft/MIEngine

Instructions for running tests on Linux do not work

gareth-rees opened this issue · 4 comments

How do I run the MIEngine test cases on Linux?

  • I started with README.md which says I need to read the developer guide:

    * [Developer Guide](https://github.com/Microsoft/MIEngine/wiki/Building-Testing-and-Debugging)

  • The linked developer guide does not exist, however I found a "Testing OpenDebugAD7" page in the Wiki which has instructions for running OpenDebugAD7 tests on Linux.

  • The instructions have five steps.

  • (0) "Make sure you have built the solution. See Building MIEngine for VSCode."

    MIEngine$ dotnet build src/MIDebugEngine-Unix.sln
    Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET
    ...
    Build succeeded.
    MIEngine$ ./PublishOpenDebugAD7.sh -c Debug
    ##[command] dotnet build /home/grees/github.com/MIEngine/src/MIDebugEngine-Unix.sln -c Debug
    ...
    Build succeeded.
    ...
    ##[command] dotnet publish /home/grees/github.com/MIEngine/src/OpenDebugAD7/OpenDebugAD7.csproj -c Debug -r linux-x64 --self-contained
    ...
    ##[command] cp /home/grees/github.com/MIEngine/bin/Debug/Microsoft.MIDebugEngine.dll /home/grees/github.com/MIEngine/bin/Debug/vscode/linux-x64/publish/.
    ##[command] cp /home/grees/github.com/MIEngine/bin/Debug/Microsoft.MICore.dll /home/grees/github.com/MIEngine/bin/Debug/vscode/linux-x64/publish/.
    
  • (1) "Make sure you have g++ and gdb installed."

    MIEngine$ g++ --version | head -1
    g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
    MIEngine$ gdb --version | head -1
    GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1
    
  • (2) "You will want to use config_gdb.xml as a template for your config_gdb.xml." The link mistakenly goes to config_lldb.xml, and I assume this should be "for your config.xml"

  • (3) "You will want to create config.xml at <MIEngine_Root>/bin/DebugAdapterProtocolTests/Debug/CppTests"

    MIEngine$ cp test/CppTests/TestConfigurations/config_gdb.xml bin/DebugAdapterProtocolTests/Debug/CppTests/config.xml 
    
  • (4) "Then you should be able to run dotnet test <MIEngine_Root>/bin/DebugAdapterProtocolTests/Debug/CppTests/CppTests.dll"

    MIEngine$ dotnet test bin/DebugAdapterProtocolTests/Debug/CppTests/CppTests.dll
    Microsoft (R) Test Execution Command Line Tool Version 17.0.0
    Copyright (c) Microsoft Corporation.  All rights reserved.
    
    Starting test execution, please wait...
    A total of 1 test files matched the specified pattern.
    [xUnit.net 00:00:00.99]     CppTests.Tests.AutoCompleteTests.TestAutoComplete(settings: Gpp/x64/Gdb) [FAIL]
      Failed CppTests.Tests.AutoCompleteTests.TestAutoComplete(settings: Gpp/x64/Gdb) [5 ms]
      Error Message:
       Debug Adapter Path /home/grees/github.com/MIEngine/bin/DebugAdapterProtocolTests/Debug/extension/debugAdapters/OpenDebugAD7 does not exist.
    ...
    Failed!  - Failed:    50, Passed:    14, Skipped:     1, Total:    65, Duration: 24 s - /home/grees/github.com/MIEngine/bin/DebugAdapterProtocolTests/Debug/CppTests/CppTests.dll (net5.0)
    

(I've trimmed many lines of output from these commands, but I can provide the full details if it will help.)

I suggest that the instructions for running tests on Linux should be brought up to date.

@gareth-rees Thanks for letting us know!

One mistake is that when you build you will need to publish in an area that the test suite knows.

E.g. <MIEngine_Root>/bin/DebugAdapterProtocolTests/Debug/extension/debugAdapter

instead of /home/grees/github.com/MIEngine/bin/Debug/vscode/linux-x64/publish/

One mistake is that when you build you will need to publish in an area that the test suite knows.

Thank you for updating the wiki, I can now run the tests. But note that the publish destination needs to end with .../debugAdapters (with a s), not .../debugAdapter.

MIEngine$ ./PublishOpenDebugAD7.sh -c Debug -o bin/DebugAdapterProtocolTests/Debug/extension/debugAdapters
...
Build succeeded.
...
MIEngine$ dotnet test bin/DebugAdapterProtocolTests/Debug/CppTests/CppTests.dll
...
Failed!  - Failed:     2, Passed:    62, Skipped:     1, Total:    65, Duration: 4 m 59 s - /home/grees/github.com/MIEngine/bin/DebugAdapterProtocolTests/Debug/CppTests/CppTests.dll (net5.0)

You might also want to edit point 2 under "Linux" where it says, "as a template for your config_gdb.xml" -- I think this needs to be "config.xml".

Updated.

@gareth-rees Thank for pointing out the issues in our documentation.

Updated Wiki looks good to me and I can follow the instructions and run the test cases. Thanks for fixing the docs!