Skip to content

Commit

Permalink
Add macOS-x64 testing (#1177)
Browse files Browse the repository at this point in the history
* Add macOS-x64 testing

This PR adds PR tests on macOS-x64
  • Loading branch information
WardenGnaw authored Jul 22, 2021
1 parent 7ee545f commit 86bf7c9
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 9 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ jobs:
which gdb
echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope
# TODO: Try to make core dumps work
# Related CoreDump Tests: https://github.com/microsoft/MIEngine/issues/1170
# echo 1 | sudo tee /proc/sys/kernel/core_uses_pid
# ulimit -S -c unlimited
# sudo sysctl -w kernel.core_pattern=${{ github.workspace }}/core.%e
Expand Down Expand Up @@ -150,4 +151,19 @@ jobs:
run: dotnet build ${{ github.workspace }}/src/MIDebugEngine-Unix.sln

- run: |
${{ github.workspace }}/PublishOpenDebugAD7.sh -c Debug -o ${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/extension/debugAdapters
${{ github.workspace }}/PublishOpenDebugAD7.sh -c Debug -o ${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/extension/debugAdapters
cp ${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/CppTests/TestConfigurations/config_lldb.xml ${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/CppTests/config.xml
- name: Download LLDB-MI
run: |
${{ github.workspace }}/tools/DownloadLldbMI.sh ${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/extension/debugAdapters
- run: |
dotnet test ${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/CppTests/CppTests.dll --logger "trx;LogFileName=${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/CppTests/results.trx"
- name: 'Upload Test Results'
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: osx_x64_results
path: ${{ github.workspace }}/bin/DebugAdapterProtocolTests/Debug/CppTests/results.trx
2 changes: 1 addition & 1 deletion src/OpenDebugAD7/AD7DebugSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ private void SetCommonMISettings(Dictionary<string, JToken> args)
else
{
// If lldb and there is no miDebuggerPath, set it.
bool hasMiDebuggerPath = args.ContainsKey("miDebuggerPath");
bool hasMiDebuggerPath = args.ContainsKey("miDebuggerPath") && !string.IsNullOrEmpty(args["miDebuggerPath"].ToString());
if (miMode == "lldb" && !hasMiDebuggerPath)
{
args["miDebuggerPath"] = MILaunchOptions.GetLLDBMIPath();
Expand Down
22 changes: 22 additions & 0 deletions test/CppTests/TestConfigurations/config_lldb.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8" ?>
<TestMachineConfiguration>
<TestConfigurations>
<TestConfiguration
Compiler="Clang"
DebuggeeArchitecture="x64"
Debugger="Lldb" />
</TestConfigurations>
<Compilers>
<Compiler
Name="Clang"
Type="ClangPlusPlus"
Path="/usr/bin/clang++" />
</Compilers>
<Debuggers>
<!-- By not specifying the Path, LLDB that ships with the extension will be used. -->
<Debugger
Name="Lldb"
Type="Lldb"
MIMode="lldb" />
</Debuggers>
</TestMachineConfiguration>
6 changes: 4 additions & 2 deletions test/CppTests/Tests/BreakpointTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,10 @@ public void FunctionBreakpointsBasic(ITestSettings settings)
[Theory]
[DependsOnTest(nameof(CompileKitchenSinkForBreakpointTests))]
[RequiresTestSettings]
// TODO: Re-enable for Gdb_Gnu
[UnsupportedDebugger(SupportedDebugger.Gdb_Gnu | SupportedDebugger.Gdb_Cygwin | SupportedDebugger.Gdb_MinGW, SupportedArchitecture.x64 | SupportedArchitecture.x86)]
// TODO: https://github.com/microsoft/MIEngine/issues/1170
// - gdb_gnu
// - lldb
[UnsupportedDebugger(SupportedDebugger.Lldb | SupportedDebugger.Gdb_Gnu | SupportedDebugger.Gdb_Cygwin | SupportedDebugger.Gdb_MinGW, SupportedArchitecture.x64 | SupportedArchitecture.x86)]
public void RunModeBreakpoints(ITestSettings settings)
{
this.TestPurpose("Tests setting breakpoints while in run mode");
Expand Down
9 changes: 6 additions & 3 deletions test/CppTests/Tests/CoreDumpTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public CoreDumpTests(ITestOutputHelper outputHelper) : base(outputHelper)
[Theory]
[RequiresTestSettings]
[SupportedPlatform(SupportedPlatform.Linux, SupportedArchitecture.x64 | SupportedArchitecture.x86)]
// TODO: Re-enable for Gdb_Gnu
// TODO: https://github.com/microsoft/MIEngine/issues/1170
// - gdb_gnu
[UnsupportedDebugger(SupportedDebugger.Gdb_Gnu, SupportedArchitecture.x64 | SupportedArchitecture.x86)]
public void CoreDumpBasic(ITestSettings settings)
{
Expand All @@ -68,7 +69,8 @@ public void CoreDumpBasic(ITestSettings settings)
[Theory]
[RequiresTestSettings]
[SupportedPlatform(SupportedPlatform.Linux, SupportedArchitecture.x64 | SupportedArchitecture.x86)]
// TODO: Re-enable for Gdb_Gnu
// TODO: https://github.com/microsoft/MIEngine/issues/1170
// - gdb_gnu
[UnsupportedDebugger(SupportedDebugger.Gdb_Gnu, SupportedArchitecture.x64 | SupportedArchitecture.x86)]
public void CoreDumpBasicMismatchedSourceAndSymbols(ITestSettings settings)
{
Expand All @@ -88,7 +90,8 @@ public void CoreDumpBasicMismatchedSourceAndSymbols(ITestSettings settings)
[Theory]
[RequiresTestSettings]
[SupportedPlatform(SupportedPlatform.Linux, SupportedArchitecture.x64 | SupportedArchitecture.x86)]
// TODO: Re-enable for Gdb_Gnu
// TODO: https://github.com/microsoft/MIEngine/issues/1170
// - gdb_gnu
[UnsupportedDebugger(SupportedDebugger.Gdb_Gnu, SupportedArchitecture.x64 | SupportedArchitecture.x86)]
public void CoreDumpVerifyActions(ITestSettings settings)
{
Expand Down
6 changes: 6 additions & 0 deletions test/CppTests/Tests/ExpressionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ public void DataTipBasic(ITestSettings settings)

[Theory]
[DependsOnTest(nameof(CompileKitchenSinkForExpressionTests))]
// TODO: https://github.com/microsoft/MIEngine/issues/1170
// - lldb
[UnsupportedDebugger(SupportedDebugger.Lldb, SupportedArchitecture.x64 | SupportedArchitecture.x86)]
[RequiresTestSettings]
public void CallStackBasic(ITestSettings settings)
{
Expand Down Expand Up @@ -328,6 +331,9 @@ public void EvaluateOnFrames(ITestSettings settings)

[Theory]
[DependsOnTest(nameof(CompileKitchenSinkForExpressionTests))]
// TODO: https://github.com/microsoft/MIEngine/issues/1170
// - lldb
[UnsupportedDebugger(SupportedDebugger.Lldb, SupportedArchitecture.x64 | SupportedArchitecture.x86)]
[RequiresTestSettings]
public void EvaluateInvalidExpression(ITestSettings settings)
{
Expand Down
8 changes: 6 additions & 2 deletions test/CppTests/Tests/SharedLibTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ public void CompileSharedLibDebuggee(ITestSettings settings)

[Theory]
[DependsOnTest(nameof(CompileSharedLibDebuggee))]
[UnsupportedDebugger(SupportedDebugger.VsDbg, SupportedArchitecture.x86 | SupportedArchitecture.x64)]
// TODO: https://github.com/microsoft/MIEngine/issues/1170
// - lldb
[UnsupportedDebugger(SupportedDebugger.VsDbg | SupportedDebugger.Lldb, SupportedArchitecture.x86 | SupportedArchitecture.x64)]
[RequiresTestSettings]
public void SharedLibBasic(ITestSettings settings)
{
Expand All @@ -66,7 +68,9 @@ public void SharedLibBasic(ITestSettings settings)
}

[Theory]
[UnsupportedDebugger(SupportedDebugger.VsDbg, SupportedArchitecture.x86 | SupportedArchitecture.x64)]
// TODO: https://github.com/microsoft/MIEngine/issues/1170
// - lldb
[UnsupportedDebugger(SupportedDebugger.VsDbg | SupportedDebugger.Lldb, SupportedArchitecture.x86 | SupportedArchitecture.x64)]
[RequiresTestSettings]
public void SharedLibMismatchSourceAndSymbols(ITestSettings settings)
{
Expand Down
44 changes: 44 additions & 0 deletions tools/DownloadLldbMI.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#! /bin/bash
lldbMIDownloadLink="https://download.visualstudio.microsoft.com/download/pr/173e6ced-0717-401d-87fc-169ca3424c72/f1228fd847c140b7f9839612f497bb7a/lldb-mi-10.0.0.zip"
toolsDirectory=$(dirname "$0")

# Go to root project folder
pushd "$toolsDirectory/.." > /dev/null 2>&1 || exit 1

if [ -z "$1" ] || [ "$1" == "-h" ]; then
echo "Please pass in output folder of publish"
echo "Example: $0 $(pwd)/bin/DebugAdapterProtocolTests/Debug/extension/debugAdapters"
exit 1
fi

if [ ! -f "$1/OpenDebugAD7" ]; then
echo "Please build MIDebugEngine-Unix.sln and run PublishOpenDebugAD7.sh before running DownloadLldbMI.sh"
popd || exit
exit 1
fi

# Download the latest version of lldb-ui that vscode-cpptools uses.
if ! `curl $lldbMIDownloadLink --output ./lldb-mi-10.0.0.zip > /dev/null 2>&1` ; then
echo "Failed to download lldb-mi."
exit 1
fi

unzip -o ./lldb-mi-10.0.0.zip > /dev/null 2>&1

if [ ! -f ./debugAdapters/lldb-mi/bin/lldb-mi ]; then
echo "Failed to unzip."
fi

# Ensure we can run it or we will get permission denied.
if ! `sudo chmod 755 ./debugAdapters/lldb-mi/bin/lldb-mi` ; then
echo "Failed to change permissions for lldb-mi."
exit 1
fi

# place lldb-mi folder in output's debugAdapters folder
mv ./debugAdapters/lldb-mi $1/../.

# Clean up unused zip
rm ./lldb-mi-10.0.0.zip

popd > /dev/null 2>&1 || exit

0 comments on commit 86bf7c9

Please sign in to comment.