notomo / vusted

A busted wrapper for testing neovim plugin

Home Page:https://luarocks.org/modules/notomo/vusted

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pl.path requires LuaFileSystem error

linrongbin16 opened this issue · comments

first thanks to your work so I could do unit test with lua on Neovim.

Here's a CI pipeline I want to do vusted unit tests on Windows, to support Neovim plugin running on Windows: linrongbin16/commons.nvim#148

Here's the action runs: https://github.com/linrongbin16/commons.nvim/actions/runs/7382472681/job/20082321700

image

in the CI pipeline, I installed lua-5.1 and luarocks via the hererocks, then install all the vusted dependencies, they all succeed, but vusted failed to run with error:

pre-vimrc command line..script D:\a\commons.nvim\commons.nvim\env\bin/vusted_entry.vim, line 20
Vim(lua):E5108: Error executing lua
...commons.nvim\commons.nvim\env\/share/lua/5.1/pl\path.lua:26: pl.path requires LuaFileSystem
stack traceback:        [C]: in function 'error'
...commons.nvim\commons.nvim\env\/share/lua/5.1/pl\path.lua:26: in main chunk        [C]: in function 'require'
...s.nvim\commons.nvim\env\/share/lua/5.1/busted\runner.lua:3: in main chunk        [C]: in function 'require'        
...mons.nvim\commons.nvim\env\/share/lua/5.1/vusted/run.lua:18: in function <...mons.nvim\commons.nvim\env\/share/lua/5.1/vusted/run.lua:1>        
[string ":lua"]:10: in main chunk

I'm not sure why that happened, would you please help on that?

Hi! This is LuaFileSystem's limitation.

On Windows, the C runtime used to compile LuaFileSystem must be the same runtime that Lua uses, or some LuaFileSystem functions will not work.

https://lunarmodules.github.io/luafilesystem/manual.html#building

FYI: I use the following workaround.
https://github.com/notomo/action-setup-nvim-lua/blob/cc7bc230b4ed5c9cbb2df9570bb749f560b69001/src/luarocks.js#L57-L65

hi @notomo , really thanks to your reply, I had updated my CI yaml file: https://github.com/linrongbin16/commons.nvim/pull/148/files#diff-b803fcb7f17ed9235f1e5cb1fcd2f5d3b2838429d4368ae4c57ce4436577f03fR63-R85.

It's now:

  windows_unit_test:
    name: Windows Unit Test
    strategy:
      matrix:
        nvim_version: [stable, nightly, v0.6.0, v0.7.0]
        os: [windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - uses: rhysd/action-setup-vim@v1
        id: vim
        with:
          neovim: true
          version: ${{ matrix.nvim_version }}
      - uses: ilammy/msvc-dev-cmd@v1
      - uses: notomo/action-setup-nvim-lua@v1
      - run: |
          luarocks install busted
          luarocks install vusted
          vusted --shuffle ./test

It does following steps:

  1. checkout git repo source code, it's the plugin source code I will test.
  2. setup 'nvim'.
  3. setup MSVC (the cl) VC++ compiler.
  4. use action-setup-nvim-lua@v1 you mentioned above (I think it's going to install luarocks and luajit-2).
  5. setup busted and vusted, then run the unit tests.

But there's 2 more errors in action runs: https://github.com/linrongbin16/commons.nvim/actions/runs/7383346276/job/20084404068

The Error-1: failed to install luasystem library.

image

The Error-2: failed to find vusted executable.

image

I guess the error rootcause is failed to install luasystem, would you please help me?

hmm. I reproduced this.
But this is hard to resolve for now.
I'll look into it when I have time.
This may be action-setup-nvim-lua's problem.

hi @notomo , FYI:

cannot remember the exact resource, but I believe I had seem some thing say that, we should compile lua/luajit/luarocks with ilammy/msvc-dev-cmd (the MSVC VC++ compiler, e.g. the cl binary). Because default mingw/GCC has some issue, that could be the root cause of failure of luasystem.

There's also hererocks, a python pip package to help install lua/luajit/luarocks on Windows.

There's also a PR PR-14 in gh-actions-luarocks, which is relate to luarocks support in Windows.