feat add spdlog
Some checks failed
sm-rpc / build (Debug, aarch64-linux-gnu) (push) Failing after 29s
sm-rpc / build (Debug, arm-linux-gnueabihf) (push) Failing after 16s
sm-rpc / build (Debug, host.gcc) (push) Failing after 11s
sm-rpc / build (Debug, mipsel-linux-gnu) (push) Failing after 12s
sm-rpc / build (Release, aarch64-linux-gnu) (push) Failing after 11s
sm-rpc / build (Release, arm-linux-gnueabihf) (push) Failing after 11s
sm-rpc / build (Release, host.gcc) (push) Failing after 12s
sm-rpc / build (Release, mipsel-linux-gnu) (push) Failing after 16s

This commit is contained in:
tqcq
2025-08-22 18:22:57 +08:00
parent 3d395b45f0
commit c68893bace
2331 changed files with 1306786 additions and 103 deletions

View File

@@ -0,0 +1,35 @@
civet = require "ci/test/civet"
local curl = require "cURL"
describe("civetweb basic", function()
setup(function()
civet.start()
end)
teardown(function()
civet.stop()
end)
it("should serve a simple get request", function()
local out = ""
function capture(str)
out = out .. str
end
local c = curl.easy()
:setopt_url('http://localhost:' .. civet.port .. "/")
:setopt_writefunction(capture)
:perform()
:close()
--print('rescode:' .. c.getinfo(curl.INFO_RESPONSE_CODE))
assert.are.equal('Index of', string.match(out, 'Index of'))
assert.are.equal('01_basic_test_dir', string.match(out, '01_basic_test_dir'))
assert.are.equal('01_basic_test_file', string.match(out, '01_basic_test_file'))
end)
end)

View File

@@ -0,0 +1,34 @@
== Travis CI Tests
Travis is a service which will build your project when you commit or get pull requests on Github.
I have fixed and extended the travis configuration to build on the new sudo-less docker infrastructure.
=== CI Process
* On Check-in or Pull Requests clone the repo
* Run make WITH_LUA=1 WITH_DEBUG=1 WITH_IPV6=1 WITH_WEBSOCKET=1
* Build a standalone lua installation (separate from civetweb or the OS)
* Build LuaRocks in standalone installation
* Install a few rocks into the standalone installation
* Start the test script
=== test/ci_tests/01_basic/basic_spec.lua
On the initial checkin, there is only one test which demonstrates:
* reliably starting civetweb server on travis infrastructure
* waiting (polling) with lua.socket to establish the server is up and running
* using libcurl via lua to test that files in the specified docroot are available
* kill the civetweb server process
* waiting (polling) the server port to see that the server has freed it
=== Adding Tests
* Create a directory under ci_tests
* Add a spec file, so now we have ci_tests/02_my_awesome_test/awesome_spec.lua
* Any file under ci_tests which ends in _spec.lua will be automatically run
* Check out the 'busted' and lua-curl3 docs for more info
* https://github.com/Lua-cURL/Lua-cURLv3
* http://olivinelabs.com/busted/

View File

@@ -0,0 +1,42 @@
socket = require "socket"
local civet = {}
-- default params
civet.port=12345
civet.max_retry=100
civet.start_delay=0.1
function civet.start(docroot)
-- TODO: use a property
docroot = docroot or 'ci/test/01_basic/docroot'
assert(io.popen('./civetweb'
.. " -listening_ports " .. civet.port
.. " -document_root " .. docroot
.. " > /dev/null 2>&1 &"
))
-- wait until the server answers
for i=1,civet.max_retry do
local s = socket.connect('127.0.0.1', civet.port)
if s then
s:close()
break
end
socket.select(nil, nil, civet.start_delay) -- sleep
end
end
function civet.stop()
os.execute('killall civetweb')
-- wait until the server port closes
for i=1,civet.max_retry do
local s = socket.connect('127.0.0.1', civet.port)
if not s then
break
end
s:close()
socket.select(nil, nil, civet.start_delay) -- sleep
end
end
return civet