mirror of
https://github.com/nodemcu/nodemcu-firmware.git
synced 2025-01-30 21:12:55 +08:00
c4baa9f3b9
* Create mispec_file.lua * Initial commit of gambiarra * Adapt gambiarra to NodeMCU * adapt to NodeMCU spacing and add nok functionality * Some refactoring to make it easier to add new functionality * Add methode `fail` to check failing code and pass error messages to output - fail can be called with a function that should fail and a string which should be contained in the errormessage. - Pass failed check reasons to output. * Create gambiarra_file.lua * Add reporting of tests that failed with Lua error * ok, nok and fail will terminate the running test * Add capability to run sync and async tests in mixed order and have a task.post inbetween them * fix gambiarra self test to also run on device (not only host) Use less ram in checking tests directly after they ran. Use nateie task.post to tame watchdog. * Update file tests + add async tmr tests * Another fix in executing async test * Catch errors in callbacks using node.setonerror * change interface to return an object with several test methods * Update README.md * Change interface of Gambiarra + add reason for failed eq * Update gambiarra documentation * Add coroutine testcases to gambiarra * Delete mispec_file.lua as it is superseeded by gambiarra_file.lua * improve regexp for stack frame extraction * Use Lua 53 debug capabilities * move actual tests upfront * remove debug code + optimization * Show errors immediately instead of at the end of the test, freeing memory earlier * Split tests to be run in 2 tranches * rename to NTest and move to new location * Add tests to checking mechanisms * Add luacheck to tests * Some pushing around of files * more (last) fixes and file juggling * Minor tweaks and forgotten checkin * Add NTest selftest to travis * Trying how to master travis * another try * restrict NTest selftest to linux
76 lines
1.6 KiB
Bash
Executable File
76 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
exists() {
|
|
if command -v "$1" >/dev/null 2>&1
|
|
then
|
|
return 0
|
|
else
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
usage() {
|
|
echo "
|
|
usage: bash tools/travis/run-luacheck.sh [-s]
|
|
|
|
Avarible options are:
|
|
-s: Standalone mode: Lua, LuaRocks and luacheck
|
|
will be installed in nodemcu-firmare/cache folder.
|
|
|
|
By default script will use luarocks installed in host system.
|
|
"
|
|
}
|
|
|
|
install_tools() {
|
|
if ! exists luarocks; then
|
|
echo "LuaRocks not found!"
|
|
exit 1
|
|
fi
|
|
|
|
eval "`luarocks path --bin`" #Set PATH for luacheck
|
|
#In Travis Path it's not changed by LuaRocks for some unknown reason
|
|
if [ "${TRAVIS}" = "true" ]; then
|
|
export PATH=$PATH:/home/travis/.luarocks/bin
|
|
fi
|
|
|
|
if ! exists luacheck; then
|
|
echo "Installing luacheck"
|
|
luarocks install --local luacheck || exit
|
|
fi
|
|
|
|
}
|
|
|
|
install_tools_standalone() {
|
|
if ! [ -x cache/localua/bin/luarocks ]; then
|
|
echo "Installing Lua 5.3 and LuaRocks"
|
|
bash tools/travis/localua.sh cache/localua || exit
|
|
fi
|
|
|
|
if ! [ -x cache/localua/bin/luacheck ]; then
|
|
echo "Installing luacheck"
|
|
cache/localua/bin/luarocks install luacheck || exit
|
|
fi
|
|
}
|
|
|
|
if [[ $1 == "" ]]; then
|
|
install_tools
|
|
else
|
|
while getopts "s" opt
|
|
do
|
|
case $opt in
|
|
(s) install_tools_standalone ;;
|
|
(*) usage; exit 1 ;;
|
|
esac
|
|
done
|
|
fi
|
|
|
|
echo "Static analysys of"
|
|
find lua_modules lua_examples -iname "*.lua" -print0 | xargs -0 echo
|
|
(find lua_modules lua_examples -iname "*.lua" -print0 | xargs -0 luacheck --config tools/luacheck_config.lua) || exit
|
|
|
|
echo "Static analysys of"
|
|
find tests -iname "*.lua" -print0 | xargs -0 echo
|
|
(find tests -iname "*.lua" -print0 | xargs -0 luacheck --config tools/luacheck_NTest_config.lua) || exit
|