Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 34360
Event Timeline
Wait... Lua? what Lua tests are you planning to add (for the bootloader)?
It's much better to not bolt Lua support on here, but instead in Kyua.
I should have marked this as "Request Changes" in the last message :/...
I can help put this support in Kyua.
We have Lua in userland now, in the form of /usr/libexec/flua, and we're starting to write both Lua and C modules for flua that need tested; see, for example, D26932 -- it would be a lot more painful to write these tests in C/C++/sh.
Sorry, the key point here is that I don't want to do an indirection through sh to invoke flua and interpret the results, we're going to have enough of these to write that it's much better to have a native library to do this translation.
Upon further inspection, I really like luaunit -- it can do TAP output, so it would be almost no work to hook up to the existing infrastructure. The default output format is actually really nice for diagnosing problems (see: https://luaunit.readthedocs.io/en/latest/#output-formats), which makes it more enticing.
I've submitted an upstream PR[0] to minimize (eliminate?) the need for Kyua work by allowing the TAP_TESTS_LUA infrastructure to use a shebang line like:
[0] https://github.com/bluebird75/luaunit/pull/133
#!/usr/bin/env -S LUAUNIT_DEFAULT_OUTPUT=TAP /usr/libexec/flua
With this, I was able to craft a Kyuafile and test it. While it's not terribly convenient for diagnosing what broke just from the report, IMHO this is sufficient for the initial integration -- I will likely later teach Kyua about the default output format, because it really is pretty good for understanding what went wrong (see the last execution in the below transcript)
root@viper:~/luaunit# cat test_kyua #!/usr/bin/env -S LUAUNIT_DEFAULT_OUTPUT=TAP /usr/libexec/flua local lu = require('luaunit') TestToto = {} function TestToto:test1_pass() local a = 1 lu.assertEquals(a, 1) end function TestToto:test2_fail() local a = 1 lu.assertEquals(a, 2) end os.exit(lu.LuaUnit.run()) root@viper:~/luaunit# kyua test -k Kyuafile test_kyua:main -> failed: 1 of 2 tests failed [0.092s] Results file id is root_luaunit.20201029-132826-268489 Results saved to /root/.kyua/store/results.root_luaunit.20201029-132826-268489.db 0/1 passed (1 failed) root@viper:~/luaunit# kyua report --verbose -r /root/.kyua/store/results.root_luaunit.20201029-132826-268489.db ===> Execution context Current directory: /root/luaunit Environment variables: APPEND_HISTORY=1 BLOCKSIZE=K EDITOR=vim HISTFILE=/root/.zsh_history HOME=/root LANG=en_US.UTF-8 LOGNAME=kevans MAIL=/var/mail/root OLDPWD=/root PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin:/root/bin PWD=/root/luaunit SAVEHIST=64 SHELL=/usr/local/bin/zsh SHLVL=1 TERM=xterm USER=root _=/usr/bin/kyua ===> test_kyua:main Result: failed: 1 of 2 tests failed Start time: 2020-10-29T13:28:26.458472Z End time: 2020-10-29T13:28:26.550464Z Duration: 0.092s Metadata: allowed_architectures is empty allowed_platforms is empty description is empty has_cleanup = false is_exclusive = false required_configs is empty required_disk_space = 0 required_files is empty required_memory = 0 required_programs is empty required_user is empty timeout = 300 Standard output: 1..2 # Started on Thu Oct 29 13:28:26 2020 # Starting class: TestToto ok 1 TestToto.test1_pass not ok 2 TestToto.test2_fail # /root/luaunit/test_kyua:12: expected: 2, actual: 1 # Ran 2 tests in 0.000 seconds, 1 success, 1 failure ===> Failed tests test_kyua:main -> failed: 1 of 2 tests failed [0.092s] ===> Summary Results read from /root/.kyua/store/results.root_luaunit.20201029-132826-268489.db Test cases: 1 total, 0 skipped, 0 expected failures, 0 broken, 1 failed Start time: 2020-10-29T13:28:26.458472Z End time: 2020-10-29T13:28:26.550464Z Total time: 0.092s root@viper:~/luaunit# /usr/libexec/flua test_kyua .F Failed tests: ------------- 1) TestToto.test2_fail test_kyua:12: expected: 2, actual: 1 stack traceback: test_kyua:12: in upvalue 'TestToto.test2_fail' Ran 2 tests in 0.000 seconds, 1 success, 1 failure