Fix up the tests to work in linux container too

This commit is contained in:
Ben Jackson 2020-11-21 16:42:26 +00:00
commit c769e8a479
7 changed files with 93 additions and 70 deletions

View file

@ -34,6 +34,7 @@ function! vimspector#internal#state#Reset() abort
catch /.*/
echohl WarningMsg
echom 'Exception while loading vimspector:' v:exception
echom 'From:' v:throwpoint
echom 'Vimspector unavailable: Requires Vim compiled with Python 3.6'
echohl None
return v:false

View file

@ -81,8 +81,8 @@ class StackTraceView( object ):
PENDING = 2
# FIXME: Make into a dict by id ?
_threads: list[ Thread ]
_line_to_thread = dict[ int, Thread ]
_threads: typing.List[ Thread ]
_line_to_thread = typing.Dict[ int, Thread ]
def __init__( self, session, win ):
self._logger = logging.getLogger( __name__ )
@ -264,25 +264,26 @@ class StackTraceView( object ):
else:
self._next_sign_id = 1
with ( utils.ModifiableScratchBuffer( self._buf ),
utils.RestoreCursorPosition() ):
utils.ClearBuffer( self._buf )
with utils.ModifiableScratchBuffer( self._buf ):
with utils.RestoreCursorPosition():
utils.ClearBuffer( self._buf )
for thread in self._threads:
icon = '+' if not thread.IsExpanded() else '-'
line = utils.AppendToBuffer(
self._buf,
f'{icon} Thread: {thread.thread["name"]} ({thread.State()})' )
for thread in self._threads:
icon = '+' if not thread.IsExpanded() else '-'
line = utils.AppendToBuffer(
self._buf,
f'{icon} Thread {thread.id}: {thread.thread["name"]} '
f'({thread.State()})' )
if self._current_thread == thread.id:
signs.PlaceSign( self._next_sign_id,
'VimspectorStackTrace',
'vimspectorCurrentThread',
self._buf.name,
line )
if self._current_thread == thread.id:
signs.PlaceSign( self._next_sign_id,
'VimspectorStackTrace',
'vimspectorCurrentThread',
self._buf.name,
line )
self._line_to_thread[ line ] = thread
self._DrawStackTrace( thread )
self._line_to_thread[ line ] = thread
self._DrawStackTrace( thread )
def _LoadStackTrace( self,
thread: Thread,

View file

@ -142,7 +142,7 @@ echo " * BASEDIR_CMD=$BASEDIR_CMD"
echo "%SETUP - Building test programs..."
set -e
pushd tests/testdata/cpp/simple
make all
make clean all
popd
set +e
echo "%DONE - built test programs"

View file

@ -695,6 +695,7 @@ endfunction
function! Test_Add_Line_BP_In_Other_File_While_Debugging()
call ThisTestIsFlaky()
let moo = 'moo.py'
let cow = 'cow.py'
lcd ../support/test/python/multiple_files

View file

@ -4,13 +4,19 @@ ENV DEBIAN_FRONTEND=noninteractive
ENV LC_ALL C.UTF-8
RUN apt-get update && \
apt install -y curl dirmngr apt-transport-https lsb-release ca-certificates \
software-properties-common && \
apt-get install -y curl \
dirmngr \
apt-transport-https \
lsb-release \
ca-certificates \
software-properties-common && \
curl -sL https://deb.nodesource.com/setup_12.x | bash - && \
add-apt-repository ppa:bartbes/love-stable -y && \
apt-get update && \
apt-get -y dist-upgrade && \
apt-get -y install python3-dev \
apt-get -y install gcc-8 \
g++-8 \
python3-dev \
python3-pip \
python3-venv \
ca-cacert \
@ -31,6 +37,9 @@ RUN apt-get update && \
RUN ln -fs /usr/share/zoneinfo/Europe/London /etc/localtime && \
dpkg-reconfigure --frontend noninteractive tzdata
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 1 \
--slave /usr/bin/g++ g++ /usr/bin/g++-8
## cleanup of files from setup
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

View file

@ -11,7 +11,7 @@ endfunction
function! s:StartDebugging()
exe 'edit ' . s:fn
call vimspector#SetLineBreakpoint( s:fn, 15 )
call vimspector#Launch()
call vimspector#LaunchWithSettings( #{ configuration: 'run-to-breakpoint' } )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( s:fn, 15, 1 )
endfunction
@ -32,8 +32,8 @@ function! Test_Multiple_Threads_Continue()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '- Thread: Thread #1 (paused)',
\ ' .*: threads!main@threads.cpp:' . string( thread_l )
\ '- Thread [0-9]\+: .* (paused)',
\ ' .*: .*@threads.cpp:' . string( thread_l )
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ 1,
@ -47,8 +47,8 @@ function! Test_Multiple_Threads_Continue()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '- Thread: Thread #1 (paused)',
\ ' .*: threads!main@threads.cpp:' . string( thread_l )
\ '- Thread [0-9]\+: .* (paused)',
\ ' .*: .*@threads.cpp:' . string( thread_l )
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ 1,
@ -58,7 +58,7 @@ function! Test_Multiple_Threads_Continue()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '+ Thread: Thread #2 (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ '$',
@ -72,8 +72,8 @@ function! Test_Multiple_Threads_Continue()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '- Thread: Thread #1 (paused)',
\ ' .*: threads!main@threads.cpp:' . string( thread_l )
\ '- Thread [0-9]\+: .* (paused)',
\ ' .*: .*@threads.cpp:' . string( thread_l )
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ 1,
@ -83,7 +83,7 @@ function! Test_Multiple_Threads_Continue()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '+ Thread: Thread #3 (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ '$',
@ -97,8 +97,8 @@ function! Test_Multiple_Threads_Continue()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '- Thread: Thread #1 (paused)',
\ ' .*: threads!main@threads.cpp:' . string( thread_l )
\ '- Thread [0-9]\+: .* (paused)',
\ ' .*: .*@threads.cpp:' . string( thread_l )
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ 1,
@ -108,7 +108,7 @@ function! Test_Multiple_Threads_Continue()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '+ Thread: Thread #4 (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ '$',
@ -123,8 +123,8 @@ function! Test_Multiple_Threads_Continue()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '- Thread: Thread #1 (paused)',
\ ' .*: threads!main@threads.cpp:' . string( thread_l )
\ '- Thread [0-9]\+: .* (paused)',
\ ' .*: .*@threads.cpp:' . string( thread_l )
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ 1,
@ -134,7 +134,7 @@ function! Test_Multiple_Threads_Continue()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '+ Thread: Thread #5 (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ '$',
@ -148,8 +148,8 @@ function! Test_Multiple_Threads_Continue()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '- Thread: Thread #1 (paused)',
\ ' .*: threads!main@threads.cpp:' . string( notify_l )
\ '- Thread [0-9]\+: .* (paused)',
\ ' .*: .*@threads.cpp:' . string( notify_l )
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ 1,
@ -159,7 +159,7 @@ function! Test_Multiple_Threads_Continue()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '+ Thread: Thread #6 (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ '$',
@ -174,7 +174,13 @@ endfunction
function! Test_Multiple_Threads_Step()
let thread_l = 67
let thread_n = thread_l + 1
if $VIMSPECTOR_MIMODE ==# 'lldb'
" }
let thread_n = thread_l + 1
else
" for ....
let thread_n = 49
endif
let notify_l = 74
call vimspector#SetLineBreakpoint( s:fn, thread_l )
@ -188,8 +194,8 @@ function! Test_Multiple_Threads_Step()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '- Thread: Thread #1 (paused)',
\ ' .*: threads!main@threads.cpp:' . string( thread_l )
\ '- Thread [0-9]\+: .* (paused)',
\ ' .*: .*@threads.cpp:' . string( thread_l )
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ 1,
@ -201,7 +207,7 @@ function! Test_Multiple_Threads_Step()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '+ Thread: Thread #2 (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ '$',
@ -214,7 +220,7 @@ function! Test_Multiple_Threads_Step()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '+ Thread: Thread #2 (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ '$',
@ -226,8 +232,8 @@ function! Test_Multiple_Threads_Step()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '+ Thread: Thread #2 (paused)',
\ '+ Thread: Thread #3 (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ -1,
@ -240,8 +246,8 @@ function! Test_Multiple_Threads_Step()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '+ Thread: Thread #2 (paused)',
\ '+ Thread: Thread #3 (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ -1,
@ -253,9 +259,9 @@ function! Test_Multiple_Threads_Step()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '+ Thread: Thread #2 (paused)',
\ '+ Thread: Thread #3 (paused)',
\ '+ Thread: Thread #4 (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ -2,
@ -269,9 +275,9 @@ function! Test_Multiple_Threads_Step()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '+ Thread: Thread #2 (paused)',
\ '+ Thread: Thread #3 (paused)',
\ '+ Thread: Thread #4 (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ -2,
@ -283,10 +289,10 @@ function! Test_Multiple_Threads_Step()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '+ Thread: Thread #2 (paused)',
\ '+ Thread: Thread #3 (paused)',
\ '+ Thread: Thread #4 (paused)',
\ '+ Thread: Thread #5 (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ -3,
@ -300,10 +306,10 @@ function! Test_Multiple_Threads_Step()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '+ Thread: Thread #2 (paused)',
\ '+ Thread: Thread #3 (paused)',
\ '+ Thread: Thread #4 (paused)',
\ '+ Thread: Thread #5 (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ -3,
@ -315,11 +321,11 @@ function! Test_Multiple_Threads_Step()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '+ Thread: Thread #2 (paused)',
\ '+ Thread: Thread #3 (paused)',
\ '+ Thread: Thread #4 (paused)',
\ '+ Thread: Thread #5 (paused)',
\ '+ Thread: Thread #6 (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ -4,
@ -334,10 +340,14 @@ function! Test_Multiple_Threads_Step()
call WaitForAssert( {->
\ AssertMatchist(
\ [
\ '+ Thread: Thread #6',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ '+ Thread [0-9]\+: .* (paused)',
\ ],
\ GetBufLine( winbufnr( g:vimspector_session_windows.stack_trace ),
\ '$',
\ -4,
\ '$' )
\ )
\ } )

View file

@ -3,6 +3,7 @@ CXXFLAGS=-g -O0 -std=c++17
.PHONY: all
TARGETS=simple variables struct printer threads
LDLIBS=-lpthread
all: $(TARGETS)