Add regression tests for lua support

Change Dockerfile to install lua, luajit and love and also to install
nodejs 12 needed to build the lua debug adapter. Create the
love-headless test in support/test/lua to test love without an x server.
This commit is contained in:
Eduardo Mezêncio 2020-11-16 15:08:55 -03:00
commit 85865e0012
9 changed files with 137 additions and 7 deletions

View file

@ -86,7 +86,7 @@ jobs:
- run: |
brew update-reset
brew doctor || true
for p in macvim tcl-tk llvm; do
for p in macvim tcl-tk llvm lua luajit love; do
brew install $p
brew outdated $p || brew upgrade $p
done

1
.gitignore vendored
View file

@ -6,6 +6,7 @@ tests/*.res
tests/messages
tests/debuglog
test.log
*.testlog
gadgets/
package/
*.pyc

View file

@ -141,10 +141,10 @@ runtime dependencies). They are categorised by their level of support:
| Go | Tested | `--enable-go` | vscode-go | Go, [Delve][] |
| TCL | Supported | `--all` or `--enable-tcl` | tclpro | TCL 8.5 |
| Bourne Shell | Supported | `--all` or `--enable-bash` | vscode-bash-debug | Bash v?? |
| Lua | Supported | `--all` or `--enable-lua` | local-lua-debugger-vscode | Node >=12.13.0, Npm, Lua interpreter |
| Node.js | Supported | `--force-enable-node` | vscode-node-debug2 | 6 < Node < 12, Npm |
| Javascript | Supported | `--force-enable-chrome` | debugger-for-chrome | Chrome |
| Java | Supported | `--force-enable-java ` | vscode-java-debug | Compatible LSP plugin (see [later](#java)) |
| Lua | Supported | `--force-enable-lua` | local-lua-debugger-vscode | Node, Npm, Lua interpreter |
| C# (dotnet core) | Experimental | `--force-enable-csharp` | netcoredbg | DotNet core |
| C# (mono) | Experimental | `--force-enable-csharp` | vscode-mono-debug | Mono |
| Python.legacy | Legacy | `--force-enable-python.legacy` | vscode-python | Node 10, Python 2.7 or Python 3 |
@ -1419,7 +1419,7 @@ Lua is supported through
This debugger uses stdio to communicate with the running process, so calls to
`io.read` will cause problems.
* `./install_gadget.py --force-enable-lua` or `:VimspectorInstall local-lua-debugger-vscode`
* `./install_gadget.py --enable-lua` or `:VimspectorInstall local-lua-debugger-vscode`
* Examples: `support/test/lua/simple` and `support/test/lua/love`
```json

View file

@ -497,10 +497,10 @@ GADGETS = {
},
'local-lua-debugger-vscode': {
'language': 'lua',
'enabled': False,
'enabled': True,
'repo': {
'url': 'https://github.com/tomblind/local-lua-debugger-vscode.git',
'ref': 'release-0.2.0'
'ref': 'release-${version}'
},
'all': {
'version': '0.2.0',

View file

@ -0,0 +1,17 @@
{
"$schema": "https://puremourning.github.io/vimspector/schema/vimspector.schema.json#",
"configurations": {
"love": {
"adapter": "lua-local",
"configuration": {
"request": "launch",
"type": "lua-local",
"cwd": "${workspaceFolder}",
"program": {
"command": "love"
},
"args": ["${workspaceFolder}"]
}
}
}
}

View file

@ -0,0 +1,12 @@
function love.conf(t)
t.modules.audio = false
t.modules.font = false
t.modules.graphics = false
t.modules.image = false
t.modules.mouse = false
t.modules.physics = false
t.modules.sound = false
t.modules.touch = false
t.modules.video = false
t.modules.window = false
end

View file

@ -0,0 +1,10 @@
if pcall(require, 'lldebugger') then
require('lldebugger').start()
end
local time = 0
function love.update(dt)
time = time + dt
love.event.quit()
end

View file

@ -4,6 +4,11 @@ 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 && \
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 \
python3-pip \
@ -17,9 +22,10 @@ RUN apt-get update && \
tcllib \
gdb \
lldb \
curl \
nodejs \
npm && \
lua5.1 \
luajit \
love && \
apt-get -y autoremove
RUN ln -fs /usr/share/zoneinfo/Europe/London /etc/localtime && \

View file

@ -0,0 +1,84 @@
function! SetUp()
let g:vimspector_enable_mappings = 'HUMAN'
call vimspector#test#setup#SetUpWithMappings( v:none )
endfunction
function! ClearDown()
call vimspector#test#setup#ClearDown()
endfunction
function! BaseTest( configuration )
let fn='simple.lua'
lcd ../support/test/lua/simple
exe 'edit ' . fn
call vimspector#SetLineBreakpoint( fn, 9 )
call vimspector#LaunchWithSettings( { 'configuration': a:configuration } )
" This debugger is ignoring stopOnEntry when not running a custom executable
" and always stopping on the first line after setting the hook. This first
" check assumes that behavior.
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 5, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 5 )
\ } )
" Continue
call feedkeys( "\<F5>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 9, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 9 )
\ } )
" Step
call feedkeys( "\<F10>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 10, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 10 )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipeout!
endfunction
function! Test_Lua_Simple()
call BaseTest( 'lua' )
endfunction
function! Test_Lua_Luajit()
call BaseTest( 'luajit' )
endfunction
function! Test_Lua_Love()
let fn='main.lua'
lcd ../support/test/lua/love-headless
exe 'edit ' . fn
call vimspector#SetLineBreakpoint( fn, 8 )
call vimspector#LaunchWithSettings( { 'configuration': 'love' } )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 8, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 8 )
\ } )
" Step
call feedkeys( "\<F10>", 'xt' )
call vimspector#test#signs#AssertCursorIsAtLineInBuffer( fn, 9, 1 )
call WaitForAssert( {->
\ vimspector#test#signs#AssertPCIsAtLineInBuffer( fn, 9 )
\ } )
call vimspector#test#setup#Reset()
lcd -
%bwipeout!
endfunction