Skip to content

Commit

Permalink
[tests] In test wrapper scripts if -debug is gdb or lldb, add separat…
Browse files Browse the repository at this point in the history
…or before corerun and args (dotnet#60416)

* [tests] If -debug is LLDB, add separator before corerun and args

   For runtime test shell scripts, if a debugger is specified with `-debug=/usr/bin/lddb` or the like, add a separator so that `lldb` doesn't try to interpret `-p` as a PID argument.

   Also update mono workflow doc

* Also support gdb as the debugger
  • Loading branch information
lambdageek authored Oct 20, 2021
1 parent bab9826 commit 72bcf2f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
14 changes: 3 additions & 11 deletions docs/workflow/testing/mono/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,12 @@ make run-tests-coreclr-all
To debug a single test with `lldb`:

1. Run the test at least once normally (or manually run the `mono.proj` `PatchCoreClrCoreRoot` target)
2. Edit the `.sh` file for the test and change the line
```
LAUNCHER="$_DebuggerFullPath "$CORE_ROOT/corerun" -p "System.Reflection.Metadata.MetadataUpdater.IsSupported=false" ${__DotEnvArg}"
```
to add `--` after the debugger full path
```
LAUNCHER="$_DebuggerFullPath -- "$CORE_ROOT/corerun" -p "System.Reflection.Metadata.MetadataUpdater.IsSupported=false" ${__DotEnvArg}"
```
3. Run the shell script for the test case manually:
2. Run the shell script for the test case manually:
```
bash ./artifacts/tests/coreclr/OSX.x64.Release/JIT/opt/InstructionCombining/DivToMul/DivToMul.sh -coreroot=`pwd`/artifacts/tests/coreclr/OSX.x64.Release/Tests/Core_Root -debug=/usr/bin/lldb
```
4. In LLDB add the debug symbols for mono: `add-dsym <CORE_ROOT>/libcoreclr.dylib.dwarf`
5. Run/debug the test
3. In LLDB add the debug symbols for mono: `add-dsym <CORE_ROOT>/libcoreclr.dylib.dwarf`
4. Run/debug the test

### WebAssembly:
Build the runtime tests for WebAssembly
Expand Down
11 changes: 10 additions & 1 deletion src/tests/Common/CLRTest.Execute.Bash.targets
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,20 @@ $__Command msbuild $CORE_ROOT/wasm-test-runner/WasmTestRunner.proj /p:NetCoreApp
<![CDATA[
$(BashLinkerTestLaunchCmds)
_DebuggerArgsSeparator=
if [[ "$_DebuggerFullPath" == *lldb* ]];
then
_DebuggerArgsSeparator=--
elif [[ "$_DebuggerFullPath" == *gdb* ]]
then
_DebuggerArgsSeparator=--args
fi
if [ ! -z "$CLRCustomTestLauncher" ];
then
LAUNCHER="$CLRCustomTestLauncher $PWD/"
else
LAUNCHER="$_DebuggerFullPath $(CLRTestRunFile)"
LAUNCHER="$_DebuggerFullPath $_DebuggerArgsSeparator $(CLRTestRunFile)"
fi
$(BashIlrtTestLaunchCmds)
Expand Down

0 comments on commit 72bcf2f

Please sign in to comment.