{
LogFuncEntry();
- {
- lock_guard lock(m_mutex);
-
- m_processStatus = Paused;
- m_state_cv.notify_all();
- }
-
// call repaint() at function exit
std::unique_ptr<void, std::function<void(void*)> >
on_exit(this, [&](void *)
break;
}
default:
- return;
+ break;
+ }
+
+ {
+ lock_guard lock(m_mutex);
+
+ m_processStatus = Paused;
+ m_state_cv.notify_all();
}
}
{
unique_lock lock(m_mutex);
- // TODO move this out here
+ // TODO move this out here
// deactivate debugger on process exit (deffered, can't call this in callback)
if(!exited && m_processStatus == Exited)
{
case IDebugger::AsyncResult::Eof:
{
+ if (dynamic_cast<FileLineReader*>(line_reader) != nullptr)
+ break;
+
static const auto ErrorMsg =
tty::bold + tty::brown + literal("EOF") + tty::reset + literal("\n");
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">\r
+\r
+ <PropertyGroup>\r
+ <OutputType>Exe</OutputType>\r
+ <TargetFramework>netcoreapp3.1</TargetFramework>\r
+ </PropertyGroup>\r
+\r
+</Project>\r
--- /dev/null
+using System;\r
+\r
+namespace CLITestBreakpoint\r
+{\r
+ class Program\r
+ {\r
+ static void Main(string[] args)\r
+ {\r
+ Console.WriteLine("Hello World!"); // BREAK1\r
+ }\r
+ }\r
+}\r
--- /dev/null
+set just-my-code 1
+b Program.cs:9
+r
+s
+bt
+c
+
--- /dev/null
+set just-my-code 1
+b Program.cs:9
+ Breakpoint 1 at Program.cs:9 --pending, warning: No executable code of the debugger's target code type is associated with this line.
+r
+\^running
+breakpoint modified, Breakpoint 1 at .*CLITestBreakpoint/Program.cs:9
+stopped, reason: breakpoint 1 hit, thread id: .*, stopped threads: all, times= 1, frame=\{CLITestBreakpoint\.Program\.Main\(\) at .*CLITestBreakpoint/Program.cs:9\}
+s
+\^running
+Hello World!
+stopped, reason: end stepping range, thread id: .*, stopped threads: all, frame=\{CLITestBreakpoint\.Program\.Main\(\) at .*CLITestBreakpoint/Program.cs:10\}
+bt
+#0 CLITestBreakpoint\.Program\.Main\(\) at .*CLITestBreakpoint/Program.cs:10
+c
+\^running
+stopped, reason: exited, exit-code: 0
+\^exit
--- /dev/null
+#!/bin/bash
+
+NETCOREDBG=$1
+TEST_NAME=$2
+ASSEMB_PATH=$3
+FILE_COMMANDS=$4
+
+file_log=$(mktemp)
+file_test="$TEST_NAME/log_test.txt"
+
+$NETCOREDBG --interpreter=cli -ex "source $FILE_COMMANDS" -- dotnet "$ASSEMB_PATH" 2>&1 | tee "$file_log"
+
+echo ""
+echo "CLI LOG INTERPRET START"
+
+skip_line()
+{
+ local line=$1
+
+ if [[ -z "$line" ]] ||
+ [[ "$line" == "library loaded:"* ]] ||
+ [[ "$line" == "no symbols loaded, base address:"* ]] ||
+ [[ "$line" == "symbols loaded, base address:"* ]] ||
+ [[ "$line" == "thread created, id:"* ]] ;
+ then
+ echo "1"
+ else
+ echo "0"
+ fi
+}
+
+# Remove ^M ('\r') from each line in file, if have it ("sdb shell" usually add this one).
+mv "$file_log" "$file_log"2
+sed -e 's/\r//g' "$file_log"2 > "$file_log"
+rm -f "$file_log"2
+
+log_current_line=1
+test_current_line=1
+log_line_count=$(awk 'END{print NR}' "$file_log")
+log_line_count=$((log_line_count+1))
+test_line_count=$(awk 'END{print NR}' "$file_test")
+test_line_count=$((test_line_count+1))
+
+while [[ "$log_current_line" -lt "$log_line_count" ]] && [[ "$test_current_line" -lt "$test_line_count" ]]
+do
+ log_line=$(sed "$log_current_line"'q;d' "$file_log")
+ log_current_line=$((log_current_line+1))
+
+ test_line=$(sed "$test_current_line"'q;d' "$file_test")
+ test_current_line=$((test_current_line+1))
+
+ while [[ $(skip_line "$log_line") -eq "1" ]] && [[ "$log_current_line" -lt "$log_line_count" ]]
+ do
+ log_line=$(sed "$log_current_line"'q;d' "$file_log")
+ log_current_line=$((log_current_line+1))
+ done
+
+ echo "TEST"
+ echo " log line =""$log_line" | cat -v
+ echo " test regex =""$test_line" | cat -v
+
+ # Note, "test_line" provide regex that have '\^' first symbol instead of '^'.
+ if [[ "$log_line" == "^exit" ]] && [[ "$test_line" == "\^exit" ]]
+ then
+ echo "OK"
+ rm -f "$file_log"
+ exit 0
+ fi
+
+ # Note, we don't include in test log file '^' (start string marker) and '$' (end string marker), but add them in comparation directly.
+ if [[ "$log_line" =~ ^$test_line$ ]]
+ then
+ echo "OK"
+ else
+ echo "FAIL"
+ rm -f "$file_log"
+ exit 1
+ fi
+
+done
+
+echo "FAIL"
+rm -f "$file_log"
+exit 1
+
}
ALL_TEST_NAMES=(
+ "CLITestBreakpoint"
"MIExampleTest"
"MITestBreakpoint"
"MITestExpression"
SOURCE_FILES="${SOURCE_FILES}${file};"
done
- PROTO="mi"
- if [[ $TEST_NAME == VSCode* ]] ;
+ # Check, that test shell run in terminal (returns 0 (succeeds), if the descriptors are hooked up to a terminal).
+ test -t 0 -a -t 1 -a -t 2
+ # Skip CLI tests on MacOS (kernel "Darwin") in jenkins.
+ if [[ "$?" != "0" ]] && [[ $TEST_NAME == CLI* ]] && [[ "$(uname)" == "Darwin" ]] ;
then
- PROTO="vscode"
+ continue
+ fi
+
+ if [[ $TEST_NAME == CLI* ]] ;
+ then
+ ./run_cli_test.sh "$NETCOREDBG" "$TEST_NAME" "$TEST_NAME/bin/Debug/netcoreapp3.1/$TEST_NAME.dll" "$TEST_NAME/commands.txt"
+ else
+ PROTO="mi"
+ if [[ $TEST_NAME == VSCode* ]] ;
+ then
+ PROTO="vscode"
+ fi
+
+ test_timeout $TIMEOUT dotnet run --project TestRunner -- \
+ --local $NETCOREDBG \
+ --proto $PROTO \
+ --test $TEST_NAME \
+ --sources "$SOURCE_FILES" \
+ --assembly $TEST_NAME/bin/Debug/netcoreapp3.1/$TEST_NAME.dll \
+ "${LOGOPTS[@]}"
fi
- test_timeout $TIMEOUT dotnet run --project TestRunner -- \
- --local $NETCOREDBG \
- --proto $PROTO \
- --test $TEST_NAME \
- --sources "$SOURCE_FILES" \
- --assembly $TEST_NAME/bin/Debug/netcoreapp3.1/$TEST_NAME.dll \
- "${LOGOPTS[@]}"
res=$?
}
ALL_TEST_NAMES=(
+ "CLITestBreakpoint"
"MIExampleTest"
"MITestBreakpoint"
"MITestExpression"
HOSTTESTDIR=$SCRIPTDIR/$TEST_NAME
SOURCE_FILES=$(find $HOSTTESTDIR \! -path "$HOSTTESTDIR/obj/*" -type f -name "*.cs" -printf '%p;')
- if [[ $TEST_NAME == VSCode* ]] ;
+ RC="0"
+
+ if [[ $TEST_NAME == CLI* ]] ;
+ then
+
+ $SDB push $SCRIPTDIR/$TEST_PROJ_NAME/commands.txt $REMOTETESTDIR
+ $SDB root on
+ ./run_cli_test.sh "$SDB shell $NETCOREDBG" "$TEST_NAME" "$REMOTETESTDIR/$TEST_NAME.dll" "$REMOTETESTDIR/commands.txt"
+ let RC=$?
+ $SDB root off
+
+ elif [[ $TEST_NAME == VSCode* ]] ;
then
PROTO="vscode"
--test $TEST_NAME \
--sources $SOURCE_FILES \
--assembly $REMOTETESTDIR/$TEST_PROJ_NAME.dll
+ let RC=$?
else
PROTO="mi"
--test $TEST_NAME \
--sources "$SOURCE_FILES" \
--assembly $REMOTETESTDIR/$TEST_PROJ_NAME.dll
+ let RC=$?
fi
- if [ "$?" -ne "0" ]; then
+ if [ "$RC" -ne "0" ]; then
test_fail=$(($test_fail + 1))
test_list="$test_list$TEST_NAME ... failed\n"
test_xml+="<testcase name=\"$TEST_NAME\"><failure></failure></testcase>"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MITestBreakpointUpdate", "MITestBreakpointUpdate\MITestBreakpointUpdate.csproj", "{440BEDAD-6094-4FCA-A941-E44300A378C9}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CLITestBreakpoint", "CLITestBreakpoint\CLITestBreakpoint.csproj", "{3F7823C7-880F-4CD3-931B-86B0F4F05423}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
{440BEDAD-6094-4FCA-A941-E44300A378C9}.Release|x64.Build.0 = Release|Any CPU
{440BEDAD-6094-4FCA-A941-E44300A378C9}.Release|x86.ActiveCfg = Release|Any CPU
{440BEDAD-6094-4FCA-A941-E44300A378C9}.Release|x86.Build.0 = Release|Any CPU
+ {3F7823C7-880F-4CD3-931B-86B0F4F05423}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {3F7823C7-880F-4CD3-931B-86B0F4F05423}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {3F7823C7-880F-4CD3-931B-86B0F4F05423}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {3F7823C7-880F-4CD3-931B-86B0F4F05423}.Debug|x64.Build.0 = Debug|Any CPU
+ {3F7823C7-880F-4CD3-931B-86B0F4F05423}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {3F7823C7-880F-4CD3-931B-86B0F4F05423}.Debug|x86.Build.0 = Debug|Any CPU
+ {3F7823C7-880F-4CD3-931B-86B0F4F05423}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {3F7823C7-880F-4CD3-931B-86B0F4F05423}.Release|Any CPU.Build.0 = Release|Any CPU
+ {3F7823C7-880F-4CD3-931B-86B0F4F05423}.Release|x64.ActiveCfg = Release|Any CPU
+ {3F7823C7-880F-4CD3-931B-86B0F4F05423}.Release|x64.Build.0 = Release|Any CPU
+ {3F7823C7-880F-4CD3-931B-86B0F4F05423}.Release|x86.ActiveCfg = Release|Any CPU
+ {3F7823C7-880F-4CD3-931B-86B0F4F05423}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal