actboy168 / bee.lua

Lua runtime and toolset
MIT License
160 stars 30 forks source link

[Bug Report] test_filesystem::test_appdata_path() failed when building from Homebrew #19

Closed laggardkernel closed 3 years ago

laggardkernel commented 3 years ago

Homebrew fakes $HOME with a temporary directory like /private/tmp/lua-language-server-20211002-15688-17zis4f/.brew_home during building. Test filesystem.test_appdata_path won't pass.

Related logs

[54/57] Link    Exe build/macos/bin/luamake
[55/57] Copy 3rd/bee.lua/bootstrap/main.lua build/macos/bin/main.lua
[55/57] build/macos/bin/luamake 3rd/bee.lua/test/test.lua
OS:             macOS
Arch:           x86_64
Compiler:       Clang 10.0.1
CRT:            libc++ 7000
DEBUG:          false
............................................F................................................
Failed tests:
-------------
1) filesystem.test_appdata_path
3rd/bee.lua/test/test_filesystem.lua:38: expected: /private/tmp/lua-language-server-20211002-15688-17zis4f/.brew_home/Library/Caches, actual: /Users/foobar/Library/Caches
stack traceback:
        3rd/bee.lua/test/test_filesystem.lua:38: in upvalue 'assertPathEquals'
        3rd/bee.lua/test/test_filesystem.lua:786: in upvalue 'filesystem.test_appdata_path'

Ran 93 tests in 0.420 seconds, 92 successes, 1 failures
[56/57] Copy build/macos/bin/luamake luamake
FAILED: build/macos/_/test
build/macos/bin/luamake 3rd/bee.lua/test/test.lua
ninja: build stopped: subcommand failed.

I changed the test function name to skip running it as a test to make the build success.

https://github.com/laggardkernel/homebrew-tap/blob/e4af1e17708b858cae9eb7223e4ca3a8cf0c00c3/Formula/lua-language-server.rb#L37-L41

Should we improve the test in bee.lua to support Homebrew? Or just leave the problem let it be fixed by the homebrew formula packager (the 'solution' what I'm using)? Not sure if it should be considered a bug of bee.lua.

actboy168 commented 3 years ago

I haven't used homebrew, and I don't know how to bypass the behavior of homebrew. Maybe you can tell me.

I don't think this is a bug in bee.lua, it's more like a bug in homebrew. If homebrew needs to hook something, it should hook everything to make the application unaware, right?

laggardkernel commented 3 years ago

I haven't used homebrew, and I don't know how to bypass the behavior of homebrew. Maybe you can tell me.

I have no idea how to fix the test for Homebrew either.

I don't think this is a bug in bee.lua, it's more like a bug in homebrew.

I agree with you, this is more a problem on the homebrew side.