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
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:
35
third_party/prometheus/3rdparty/civetweb/ci/test/01_basic/basic_spec.lua
vendored
Normal file
35
third_party/prometheus/3rdparty/civetweb/ci/test/01_basic/basic_spec.lua
vendored
Normal 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)
|
||||
0
third_party/prometheus/3rdparty/civetweb/ci/test/01_basic/docroot/01_basic_test_file
vendored
Normal file
0
third_party/prometheus/3rdparty/civetweb/ci/test/01_basic/docroot/01_basic_test_file
vendored
Normal file
34
third_party/prometheus/3rdparty/civetweb/ci/test/README.md
vendored
Normal file
34
third_party/prometheus/3rdparty/civetweb/ci/test/README.md
vendored
Normal 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/
|
||||
|
||||
42
third_party/prometheus/3rdparty/civetweb/ci/test/civet.lua
vendored
Normal file
42
third_party/prometheus/3rdparty/civetweb/ci/test/civet.lua
vendored
Normal 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
|
||||
14
third_party/prometheus/3rdparty/civetweb/ci/travis/install_rocks.sh
vendored
Executable file
14
third_party/prometheus/3rdparty/civetweb/ci/travis/install_rocks.sh
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ev
|
||||
|
||||
source ci/travis/lua_env.sh
|
||||
|
||||
# add any rocks required for ci_tests to this list
|
||||
# lua-curl depends on a libcurl development package (i.e. libcurl4-openssl-dev)
|
||||
ROCKS=(lua-curl busted)
|
||||
|
||||
for ROCK in ${ROCKS[*]}
|
||||
do
|
||||
$LUAROCKS install $ROCK
|
||||
done
|
||||
|
||||
5
third_party/prometheus/3rdparty/civetweb/ci/travis/lua_env.sh
vendored
Executable file
5
third_party/prometheus/3rdparty/civetweb/ci/travis/lua_env.sh
vendored
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
LUAROCKS=ci/lua/bin/luarocks
|
||||
eval $($LUAROCKS path --bin)
|
||||
|
||||
15
third_party/prometheus/3rdparty/civetweb/ci/travis/platform.sh
vendored
Executable file
15
third_party/prometheus/3rdparty/civetweb/ci/travis/platform.sh
vendored
Executable file
@@ -0,0 +1,15 @@
|
||||
if [ -z "$PLATFORM" ]; then
|
||||
PLATFORM=$TRAVIS_OS_NAME;
|
||||
fi
|
||||
|
||||
if [ "$PLATFORM" == "osx" ]; then
|
||||
PLATFORM="macosx";
|
||||
fi
|
||||
|
||||
if [ -z "$PLATFORM" ]; then
|
||||
if [ "$(uname)" == "Linux" ]; then
|
||||
PLATFORM="linux";
|
||||
else
|
||||
PLATFORM="macosx";
|
||||
fi;
|
||||
fi
|
||||
7
third_party/prometheus/3rdparty/civetweb/ci/travis/run_ci_tests.sh
vendored
Executable file
7
third_party/prometheus/3rdparty/civetweb/ci/travis/run_ci_tests.sh
vendored
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ev
|
||||
|
||||
source ci/travis/lua_env.sh
|
||||
busted -o TAP ci/test/
|
||||
|
||||
|
||||
61
third_party/prometheus/3rdparty/civetweb/ci/travis/setup_lua.sh
vendored
Executable file
61
third_party/prometheus/3rdparty/civetweb/ci/travis/setup_lua.sh
vendored
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env /bash
|
||||
set -ev
|
||||
|
||||
# this script installs a lua / luarocks environment in .travis/lua
|
||||
# this is necessary because travis docker architecture (the fast way)
|
||||
# does not permit sudo, and does not contain a useful lua installation
|
||||
|
||||
# After this script is finished, you can configure your environment to
|
||||
# use it by sourcing lua_env.sh
|
||||
|
||||
source ci/travis/platform.sh
|
||||
|
||||
# The current versions when this script was written
|
||||
LUA_VERSION=5.2.4
|
||||
LUAROCKS_VERSION=2.2.2
|
||||
|
||||
# directory where this script is located
|
||||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
|
||||
# civetweb base dir
|
||||
PROJECT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../.. && pwd )
|
||||
|
||||
# fetch and unpack lua src
|
||||
cd $SCRIPT_DIR
|
||||
LUA_BASE=lua-$LUA_VERSION
|
||||
rm -rf $LUA_BASE
|
||||
curl http://www.lua.org/ftp/$LUA_BASE.tar.gz | tar zx
|
||||
|
||||
# build lua
|
||||
cd $LUA_BASE
|
||||
make $PLATFORM
|
||||
make local
|
||||
|
||||
# mv built lua install to target Lua dir
|
||||
LUA_DIR=$PROJECT_DIR/ci/lua
|
||||
rm -rf $LUA_DIR
|
||||
mv $SCRIPT_DIR/$LUA_BASE/install $LUA_DIR
|
||||
|
||||
# add to path required by luarocks installer
|
||||
export PATH=$LUA_DIR/bin:$PATH
|
||||
|
||||
|
||||
# fetch and unpack luarocks
|
||||
cd $SCRIPT_DIR
|
||||
LUAROCKS_BASE=luarocks-$LUAROCKS_VERSION
|
||||
rm -rf ${LUAROCKS_BASE}
|
||||
LUAROCKS_URL=http://luarocks.org/releases/${LUAROCKS_BASE}.tar.gz
|
||||
# -L because it's a 302 redirect
|
||||
curl -L $LUAROCKS_URL | tar xzp
|
||||
cd $LUAROCKS_BASE
|
||||
|
||||
# build luarocks
|
||||
./configure --prefix=$LUA_DIR
|
||||
make build
|
||||
make install
|
||||
|
||||
# cleanup source dirs
|
||||
cd $SCRIPT_DIR
|
||||
rm -rf $LUAROCKS_BASE
|
||||
rm -rf $LUA_BASE
|
||||
|
||||
Reference in New Issue
Block a user