mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Add beast SConstruct and .travis.yml
This commit is contained in:
26
.travis.yml
Normal file
26
.travis.yml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
language: cpp
|
||||||
|
|
||||||
|
compiler:
|
||||||
|
- gcc
|
||||||
|
- clang
|
||||||
|
before_install:
|
||||||
|
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||||
|
- sudo add-apt-repository -y ppa:boost-latest/ppa
|
||||||
|
- sudo apt-get update -qq
|
||||||
|
- sudo apt-get install -qq python-software-properties
|
||||||
|
- sudo apt-get install -qq g++-4.8
|
||||||
|
- sudo apt-get install -qq libboost1.55-all-dev
|
||||||
|
- sudo apt-get install -qq libssl-dev
|
||||||
|
- sudo apt-get install -qq gcc-4.8
|
||||||
|
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 40 --slave /usr/bin/g++ g++ /usr/bin/g++-4.8
|
||||||
|
- sudo update-alternatives --set gcc /usr/bin/gcc-4.8
|
||||||
|
# - sudo apt-get -y install binutils-gold
|
||||||
|
- g++ -v
|
||||||
|
- clang -v
|
||||||
|
script:
|
||||||
|
# Abort build on failure
|
||||||
|
- set -e
|
||||||
|
- scons
|
||||||
|
notifications:
|
||||||
|
email:
|
||||||
|
false
|
||||||
@@ -479,7 +479,7 @@
|
|||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\beast\crypto\tests\BinaryEncoding.test.cpp">
|
<ClCompile Include="..\..\beast\crypto\tests\BinaryEncoding.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
@@ -690,6 +690,12 @@
|
|||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\beast\threads\Threads.cpp" />
|
<ClCompile Include="..\..\beast\threads\Threads.cpp" />
|
||||||
|
<ClCompile Include="..\..\beast\unit_test\tests\main.cpp">
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||||
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||||
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\beast\utility\impl\Debug.cpp">
|
<ClCompile Include="..\..\beast\utility\impl\Debug.cpp">
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||||
|
|||||||
@@ -300,6 +300,9 @@
|
|||||||
<Filter Include="beast\streams\tests">
|
<Filter Include="beast\streams\tests">
|
||||||
<UniqueIdentifier>{63c495fa-b6b2-42ed-8ae3-9f3582e76bf5}</UniqueIdentifier>
|
<UniqueIdentifier>{63c495fa-b6b2-42ed-8ae3-9f3582e76bf5}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="beast\unit_test\tests">
|
||||||
|
<UniqueIdentifier>{8dc7ce09-9255-48c0-8a90-78a0f94d22c5}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\modules\beast_core\beast_core.h">
|
<ClInclude Include="..\..\modules\beast_core\beast_core.h">
|
||||||
@@ -1601,9 +1604,6 @@
|
|||||||
<ClCompile Include="..\..\beast\crypto\tests\UnsignedInteger.test.cpp">
|
<ClCompile Include="..\..\beast\crypto\tests\UnsignedInteger.test.cpp">
|
||||||
<Filter>beast\crypto\tests</Filter>
|
<Filter>beast\crypto\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\beast\crypto\tests\BinaryEncoding.test.cpp">
|
|
||||||
<Filter>beast\crypto\tests</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\..\beast\utility\tests\bassert.test.cpp">
|
<ClCompile Include="..\..\beast\utility\tests\bassert.test.cpp">
|
||||||
<Filter>beast\utility\tests</Filter>
|
<Filter>beast\utility\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
@@ -1634,6 +1634,12 @@
|
|||||||
<ClCompile Include="..\..\beast\utility\tests\hardened_hash.test.cpp">
|
<ClCompile Include="..\..\beast\utility\tests\hardened_hash.test.cpp">
|
||||||
<Filter>beast\utility\tests</Filter>
|
<Filter>beast\utility\tests</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\beast\crypto\tests\BinaryEncoding.cpp">
|
||||||
|
<Filter>beast\crypto\tests</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\beast\unit_test\tests\main.cpp">
|
||||||
|
<Filter>beast\unit_test\tests</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Text Include="..\..\TODO.txt">
|
<Text Include="..\..\TODO.txt">
|
||||||
|
|||||||
158
SConstruct
Normal file
158
SConstruct
Normal file
@@ -0,0 +1,158 @@
|
|||||||
|
# Beast scons file
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
import ntpath
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import textwrap
|
||||||
|
#import re
|
||||||
|
#import json
|
||||||
|
#import urlparse
|
||||||
|
#import posixpath
|
||||||
|
#import string
|
||||||
|
#import subprocess
|
||||||
|
#import platform
|
||||||
|
#import itertools
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Format a name value pair
|
||||||
|
def print_nv_pair(n, v):
|
||||||
|
name = ("%s" % n.rjust(10))
|
||||||
|
sys.stdout.write("%s \033[94m%s\033[0m\n" % (name, v))
|
||||||
|
|
||||||
|
# Pretty-print values as a build configuration
|
||||||
|
def print_build_vars(env,var):
|
||||||
|
val = env.get(var, '')
|
||||||
|
|
||||||
|
if val and val != '':
|
||||||
|
name = ("%s" % var.rjust(10))
|
||||||
|
|
||||||
|
wrapper = textwrap.TextWrapper()
|
||||||
|
wrapper.break_long_words = False
|
||||||
|
wrapper.break_on_hyphens = False
|
||||||
|
wrapper.width = 69
|
||||||
|
|
||||||
|
if type(val) is str:
|
||||||
|
lines = wrapper.wrap(val)
|
||||||
|
else:
|
||||||
|
lines = wrapper.wrap(" ".join(str(x) for x in val))
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
print_nv_pair (name, line)
|
||||||
|
name = " "
|
||||||
|
|
||||||
|
def print_build_config(env):
|
||||||
|
config_vars = ['CC', 'CXX', 'CFLAGS', 'CCFLAGS', 'CPPFLAGS',
|
||||||
|
'CXXFLAGS', 'LIBPATH', 'LINKFLAGS', 'LIBS']
|
||||||
|
sys.stdout.write("\nConfiguration:\n")
|
||||||
|
for var in config_vars:
|
||||||
|
print_build_vars(env,var)
|
||||||
|
print
|
||||||
|
|
||||||
|
def print_cmd_line(s, target, src, env):
|
||||||
|
target = (''.join([str(x) for x in target]))
|
||||||
|
source = (''.join([str(x) for x in src]))
|
||||||
|
name = target
|
||||||
|
print ' \033[94m' + name + '\033[0m'
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Returns the list of libraries needed by the test source file. This is
|
||||||
|
# accomplished by scanning the source file for a special comment line
|
||||||
|
# with this format, which must match exactly:
|
||||||
|
#
|
||||||
|
# // LIBS: <name>...
|
||||||
|
#
|
||||||
|
# path = path to source file
|
||||||
|
#
|
||||||
|
def get_libs(path):
|
||||||
|
prefix = '// LIBS:'
|
||||||
|
with open(path, 'rb') as f:
|
||||||
|
for line in f:
|
||||||
|
line = line.strip()
|
||||||
|
if line.startswith(prefix):
|
||||||
|
items = line.split(prefix, 1)[1].strip()
|
||||||
|
return [x.strip() for x in items.split(' ')]
|
||||||
|
|
||||||
|
# Returns the list of source modules needed by the test source file. This
|
||||||
|
#
|
||||||
|
# // MODULES: <module>...
|
||||||
|
#
|
||||||
|
# path = path to source file
|
||||||
|
#
|
||||||
|
def get_mods(path):
|
||||||
|
prefix = '// MODULES:'
|
||||||
|
with open(path, 'rb') as f:
|
||||||
|
for line in f:
|
||||||
|
line = line.strip()
|
||||||
|
if line.startswith(prefix):
|
||||||
|
items = line.split(prefix, 1)[1].strip()
|
||||||
|
items = [os.path.normpath(os.path.join(
|
||||||
|
os.path.dirname(path), x.strip())) for
|
||||||
|
x in items.split(' ')]
|
||||||
|
return items
|
||||||
|
|
||||||
|
# Build a stand alone executable that runs
|
||||||
|
# all the test suites in one source file
|
||||||
|
#
|
||||||
|
def build_test(env,path):
|
||||||
|
libs = get_libs(path)
|
||||||
|
mods = get_mods(path)
|
||||||
|
bin = os.path.basename(os.path.splitext(path)[0])
|
||||||
|
bin = os.path.join ("bin", bin)
|
||||||
|
srcs = ['beast/unit_test/tests/main.cpp']
|
||||||
|
srcs.append (path)
|
||||||
|
if mods:
|
||||||
|
srcs.extend (mods)
|
||||||
|
# All paths get normalized here, so we can use posix
|
||||||
|
# forward slashes for everything including on Windows
|
||||||
|
srcs = [os.path.normpath(os.path.join ('bin', x)) for x in srcs]
|
||||||
|
objs = [os.path.splitext(x)[0]+'.o' for x in srcs]
|
||||||
|
env_ = env
|
||||||
|
if libs:
|
||||||
|
env_.Append(LIBS = libs)
|
||||||
|
env_.Program (bin, srcs)
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
def main():
|
||||||
|
env = Environment()
|
||||||
|
|
||||||
|
env['PRINT_CMD_LINE_FUNC'] = print_cmd_line
|
||||||
|
|
||||||
|
env.VariantDir (os.path.join ('bin', 'beast'), 'beast', duplicate=0)
|
||||||
|
env.VariantDir (os.path.join ('bin', 'modules'), 'modules', duplicate=0)
|
||||||
|
|
||||||
|
# Copy important os environment variables into env
|
||||||
|
if os.environ.get ('CC', None):
|
||||||
|
env.Replace (CC = os.environ['CC'])
|
||||||
|
if os.environ.get ('CXX', None):
|
||||||
|
env.Replace (CXX = os.environ['CXX'])
|
||||||
|
if os.environ.get ('PATH', None):
|
||||||
|
env.Replace (PATH = os.environ['PATH'])
|
||||||
|
|
||||||
|
# Set up boost variables
|
||||||
|
home = os.environ.get("BOOST_HOME", None)
|
||||||
|
if home is not None:
|
||||||
|
env.Prepend (CPPPATH = home)
|
||||||
|
env.Append (LIBPATH = os.path.join (home, 'stage', 'lib'))
|
||||||
|
|
||||||
|
# Set up flags
|
||||||
|
env.Append(CXXFLAGS = [
|
||||||
|
'-std=c++11',
|
||||||
|
'-frtti',
|
||||||
|
'-g'
|
||||||
|
])
|
||||||
|
|
||||||
|
for root, dirs, files in os.walk('.'):
|
||||||
|
for path in files:
|
||||||
|
path = os.path.join(root,path)
|
||||||
|
if (path.endswith(".test.cpp")):
|
||||||
|
build_test(env,path)
|
||||||
|
|
||||||
|
print_build_config (env)
|
||||||
|
|
||||||
|
main()
|
||||||
|
|
||||||
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
// LIBS: boost_system
|
||||||
|
|
||||||
#if BEAST_INCLUDE_BEASTCONFIG
|
#if BEAST_INCLUDE_BEASTCONFIG
|
||||||
#include "../../../BeastConfig.h"
|
#include "../../../BeastConfig.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
#include <boost/asio/detail/handler_cont_helpers.hpp>
|
#include <boost/asio/detail/handler_cont_helpers.hpp>
|
||||||
#include <boost/asio/detail/handler_invoke_helpers.hpp>
|
#include <boost/asio/detail/handler_invoke_helpers.hpp>
|
||||||
|
|
||||||
#include <type_traits>
|
#include "../cxx14/type_traits.h" // <type_traits>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
// MODULES: ../impl/chrono_io.cpp
|
||||||
|
|
||||||
#include "../abstract_clock.h"
|
#include "../abstract_clock.h"
|
||||||
#include "../abstract_clock_io.h"
|
#include "../abstract_clock_io.h"
|
||||||
#include "../manual_clock.h"
|
#include "../manual_clock.h"
|
||||||
|
|||||||
@@ -25,5 +25,6 @@
|
|||||||
#include "impl/Sha256.cpp"
|
#include "impl/Sha256.cpp"
|
||||||
#include "impl/UnsignedInteger.cpp"
|
#include "impl/UnsignedInteger.cpp"
|
||||||
|
|
||||||
#include "tests/BinaryEncoding.test.cpp"
|
#include "tests/BinaryEncoding.cpp"
|
||||||
|
|
||||||
#include "tests/UnsignedInteger.test.cpp"
|
#include "tests/UnsignedInteger.test.cpp"
|
||||||
|
|||||||
@@ -22,9 +22,11 @@
|
|||||||
|
|
||||||
#include "../ByteOrder.h"
|
#include "../ByteOrder.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
// MODULES: ../../../modules/beast_core/beast_core.cpp ../../strings/Strings.cpp ../../chrono/Chrono.cpp ../../threads/Threads.cpp
|
||||||
#include "../BinaryEncoding.h"
|
#include "../BinaryEncoding.h"
|
||||||
#include "../UnsignedInteger.h"
|
#include "../UnsignedInteger.h"
|
||||||
|
|
||||||
@@ -26,4 +26,4 @@
|
|||||||
#include "impl/joyent_parser.cpp"
|
#include "impl/joyent_parser.cpp"
|
||||||
#include "impl/raw_parser.cpp"
|
#include "impl/raw_parser.cpp"
|
||||||
|
|
||||||
#include "tests/ParsedURL.test.cpp"
|
#include "tests/ParsedURL.cpp"
|
||||||
|
|||||||
@@ -17,6 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
#include "../basic_message.h"
|
||||||
|
|
||||||
|
#include <boost/system/error_code.hpp>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
namespace joyent {
|
namespace joyent {
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#ifndef BEAST_NET_DYNAMICBUFFER_H_INCLUDED
|
#ifndef BEAST_NET_DYNAMICBUFFER_H_INCLUDED
|
||||||
#define BEAST_NET_DYNAMICBUFFER_H_INCLUDED
|
#define BEAST_NET_DYNAMICBUFFER_H_INCLUDED
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <ios>
|
#include <ios>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <typeinfo>
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,8 @@
|
|||||||
#include "../detail/Parse.h"
|
#include "../detail/Parse.h"
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace beast {
|
namespace beast {
|
||||||
namespace IP {
|
namespace IP {
|
||||||
|
|
||||||
@@ -95,7 +96,7 @@ AddressV4::Proxy <true> AddressV4::operator[] (std::size_t index) const
|
|||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
bassertfalse;
|
throw std::out_of_range ("bad array index");
|
||||||
case 0: return Proxy <true> (24, &value);
|
case 0: return Proxy <true> (24, &value);
|
||||||
case 1: return Proxy <true> (16, &value);
|
case 1: return Proxy <true> (16, &value);
|
||||||
case 2: return Proxy <true> ( 8, &value);
|
case 2: return Proxy <true> ( 8, &value);
|
||||||
@@ -108,7 +109,7 @@ AddressV4::Proxy <false> AddressV4::operator[] (std::size_t index)
|
|||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
bassertfalse;
|
throw std::out_of_range ("bad array index");
|
||||||
case 0: return Proxy <false> (24, &value);
|
case 0: return Proxy <false> (24, &value);
|
||||||
case 1: return Proxy <false> (16, &value);
|
case 1: return Proxy <false> (16, &value);
|
||||||
case 2: return Proxy <false> ( 8, &value);
|
case 2: return Proxy <false> ( 8, &value);
|
||||||
|
|||||||
@@ -31,35 +31,35 @@ namespace IP {
|
|||||||
bool is_loopback (AddressV6 const&)
|
bool is_loopback (AddressV6 const&)
|
||||||
{
|
{
|
||||||
// VFALCO TODO
|
// VFALCO TODO
|
||||||
bassertfalse;
|
assert(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_unspecified (AddressV6 const&)
|
bool is_unspecified (AddressV6 const&)
|
||||||
{
|
{
|
||||||
// VFALCO TODO
|
// VFALCO TODO
|
||||||
bassertfalse;
|
assert(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_multicast (AddressV6 const&)
|
bool is_multicast (AddressV6 const&)
|
||||||
{
|
{
|
||||||
// VFALCO TODO
|
// VFALCO TODO
|
||||||
bassertfalse;
|
assert(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_private (AddressV6 const&)
|
bool is_private (AddressV6 const&)
|
||||||
{
|
{
|
||||||
// VFALCO TODO
|
// VFALCO TODO
|
||||||
bassertfalse;
|
assert(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_public (AddressV6 const&)
|
bool is_public (AddressV6 const&)
|
||||||
{
|
{
|
||||||
// VFALCO TODO
|
// VFALCO TODO
|
||||||
bassertfalse;
|
assert(false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,14 +68,14 @@ bool is_public (AddressV6 const&)
|
|||||||
std::string to_string (AddressV6 const&)
|
std::string to_string (AddressV6 const&)
|
||||||
{
|
{
|
||||||
// VFALCO TODO
|
// VFALCO TODO
|
||||||
bassertfalse;
|
assert(false);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::istream& operator>> (std::istream& is, AddressV6&)
|
std::istream& operator>> (std::istream& is, AddressV6&)
|
||||||
{
|
{
|
||||||
// VFALCO TODO
|
// VFALCO TODO
|
||||||
bassertfalse;
|
assert(false);
|
||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
// MODULES: ../impl/IPEndpoint.cpp ../impl/IPAddressV4.cpp ../impl/IPAddressV6.cpp
|
||||||
|
|
||||||
#if BEAST_INCLUDE_BEASTCONFIG
|
#if BEAST_INCLUDE_BEASTCONFIG
|
||||||
#include "../../BeastConfig.h"
|
#include "../../BeastConfig.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -28,4 +28,4 @@
|
|||||||
#include "impl/WaitableEvent.cpp"
|
#include "impl/WaitableEvent.cpp"
|
||||||
|
|
||||||
#include "tests/Atomic.test.cpp"
|
#include "tests/Atomic.test.cpp"
|
||||||
#include "tests/ServiceQueue.test.cpp"
|
#include "tests/ServiceQueue.cpp"
|
||||||
|
|||||||
@@ -440,6 +440,10 @@ void Thread::yield()
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#if BEAST_BSD
|
#if BEAST_BSD
|
||||||
// ???
|
// ???
|
||||||
|
|||||||
57
beast/unit_test/tests/main.cpp
Normal file
57
beast/unit_test/tests/main.cpp
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
/*
|
||||||
|
This file is part of Beast: https://github.com/vinniefalco/Beast
|
||||||
|
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
||||||
|
|
||||||
|
Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
copyright notice and this permission notice appear in all copies.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||||
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||||
|
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||||
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
//==============================================================================
|
||||||
|
|
||||||
|
#include "../../unit_test.h"
|
||||||
|
#include "../../streams/debug_ostream.h"
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# ifndef WIN32_LEAN_AND_MEAN // VC_EXTRALEAN
|
||||||
|
# define WIN32_LEAN_AND_MEAN
|
||||||
|
# include <windows.h>
|
||||||
|
# undef WIN32_LEAN_AND_MEAN
|
||||||
|
# else
|
||||||
|
# include <windows.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
|
// Simple main used to produce stand
|
||||||
|
// alone executables that run unit tests.
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
using namespace beast::unit_test;
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
{
|
||||||
|
int flags = _CrtSetDbgFlag (_CRTDBG_REPORT_FLAG);
|
||||||
|
flags |= _CRTDBG_LEAK_CHECK_DF;
|
||||||
|
_CrtSetDbgFlag (flags);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
{
|
||||||
|
beast::debug_ostream s;
|
||||||
|
reporter r (s);
|
||||||
|
bool failed (r.run_each (global_suites()));
|
||||||
|
if (failed)
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -17,6 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
// MODULES: ../../crypto/impl/Sha256.cpp
|
||||||
|
|
||||||
#if BEAST_INCLUDE_BEASTCONFIG
|
#if BEAST_INCLUDE_BEASTCONFIG
|
||||||
#include "../../../BeastConfig.h"
|
#include "../../../BeastConfig.h"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,154 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
/*
|
|
||||||
This file is part of Beast: https://github.com/vinniefalco/Beast
|
|
||||||
Copyright 2013, Vinnie Falco <vinnie.falco@gmail.com>
|
|
||||||
|
|
||||||
Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
|
||||||
copyright notice and this permission notice appear in all copies.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
||||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
||||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
||||||
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
||||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
||||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
||||||
*/
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
#ifndef BEAST_BEASTCONFIG_H_INCLUDED
|
|
||||||
#define BEAST_BEASTCONFIG_H_INCLUDED
|
|
||||||
|
|
||||||
/** Configuration file for Beast.
|
|
||||||
This sets various configurable options for Beast. In order to compile you
|
|
||||||
must place a copy of this file in a location where your build environment
|
|
||||||
can find it, and then customize its contents to suit your needs.
|
|
||||||
@file BeastConfig.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Diagnostics
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Config: BEAST_FORCE_DEBUG
|
|
||||||
Normally, BEAST_DEBUG is set to 1 or 0 based on compiler and project
|
|
||||||
settings, but if you define this value, you can override this to force it
|
|
||||||
to be true or false.
|
|
||||||
*/
|
|
||||||
#ifndef BEAST_FORCE_DEBUG
|
|
||||||
//#define BEAST_FORCE_DEBUG 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Config: BEAST_LOG_ASSERTIONS
|
|
||||||
If this flag is enabled, the the bassert and bassertfalse macros will always
|
|
||||||
use Logger::writeToLog() to write a message when an assertion happens.
|
|
||||||
Enabling it will also leave this turned on in release builds. When it's
|
|
||||||
disabled, however, the bassert and bassertfalse macros will not be compiled
|
|
||||||
in a release build.
|
|
||||||
@see bassert, bassertfalse, Logger
|
|
||||||
*/
|
|
||||||
#ifndef BEAST_LOG_ASSERTIONS
|
|
||||||
//#define BEAST_LOG_ASSERTIONS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Config: BEAST_CHECK_MEMORY_LEAKS
|
|
||||||
Enables a memory-leak check for certain objects when the app terminates.
|
|
||||||
See the LeakChecked class for more details about enabling leak checking for
|
|
||||||
specific classes.
|
|
||||||
*/
|
|
||||||
#ifndef BEAST_CHECK_MEMORY_LEAKS
|
|
||||||
//#define BEAST_CHECK_MEMORY_LEAKS 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Config: BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES
|
|
||||||
Setting this option makes Socket-derived classes generate compile errors
|
|
||||||
if they forget any of the virtual overrides As some Socket-derived classes
|
|
||||||
intentionally omit member functions that are not applicable, this macro
|
|
||||||
should only be enabled temporarily when writing your own Socket-derived
|
|
||||||
class, to make sure that the function signatures match as expected.
|
|
||||||
*/
|
|
||||||
#ifndef BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES
|
|
||||||
//#define BEAST_COMPILER_CHECKS_SOCKET_OVERRIDES 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Config: BEAST_CATCH_UNHANDLED_EXCEPTIONS
|
|
||||||
This will wrap thread entry points with an exception catching block.
|
|
||||||
A customizable hook is provided to get called when unhandled exceptions
|
|
||||||
are thrown.
|
|
||||||
@see ProtectedCall
|
|
||||||
*/
|
|
||||||
#ifndef BEAST_CATCH_UNHANDLED_EXCEPTIONS
|
|
||||||
//#define BEAST_CATCH_UNHANDLED_EXCEPTIONS 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Libraries
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Config: BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES
|
|
||||||
In a Visual C++ build, this can be used to stop the required system libs
|
|
||||||
being automatically added to the link stage.
|
|
||||||
*/
|
|
||||||
#ifndef BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES
|
|
||||||
//#define BEAST_DONT_AUTOLINK_TO_WIN32_LIBRARIES 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Config: BEAST_INCLUDE_ZLIB_CODE
|
|
||||||
This can be used to disable Beast's embedded 3rd-party zlib code.
|
|
||||||
You might need to tweak this if you're linking to an external zlib library
|
|
||||||
in your app, but for normal apps, this option should be left alone.
|
|
||||||
|
|
||||||
If you disable this, you might also want to set a value for
|
|
||||||
BEAST_ZLIB_INCLUDE_PATH, to specify the path where your zlib headers live.
|
|
||||||
*/
|
|
||||||
#ifndef BEAST_INCLUDE_ZLIB_CODE
|
|
||||||
//#define BEAST_INCLUDE_ZLIB_CODE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Config: BEAST_ZLIB_INCLUDE_PATH
|
|
||||||
This is included when BEAST_INCLUDE_ZLIB_CODE is set to zero.
|
|
||||||
*/
|
|
||||||
#ifndef BEAST_ZLIB_INCLUDE_PATH
|
|
||||||
#define BEAST_ZLIB_INCLUDE_PATH <zlib.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** Config: BEAST_FUNCTIONAL_USES_###
|
|
||||||
<functional> source configuration.
|
|
||||||
Set one of these to manually force a particular implementation of bind().
|
|
||||||
If nothing is chosen then beast will use whatever is appropriate for your
|
|
||||||
environment based on what is available.
|
|
||||||
If you override these, set ONE to 1 and the rest to 0
|
|
||||||
*/
|
|
||||||
#ifndef BEAST_FUNCTIONAL_USES_STD
|
|
||||||
//#define BEAST_FUNCTIONAL_USES_STD 0
|
|
||||||
#endif
|
|
||||||
#ifndef BEAST_FUNCTIONAL_USES_TR1
|
|
||||||
//#define BEAST_FUNCTIONAL_USES_TR1 0
|
|
||||||
#endif
|
|
||||||
#ifndef BEAST_FUNCTIONAL_USES_BOOST
|
|
||||||
//#define BEAST_FUNCTIONAL_USES_BOOST 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// Boost
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Config: BEAST_USE_BOOST_FEATURES
|
|
||||||
This activates boost specific features and improvements. If this is
|
|
||||||
turned on, the include paths for your build environment must be set
|
|
||||||
correctly to find the boost headers.
|
|
||||||
*/
|
|
||||||
#ifndef BEAST_USE_BOOST_FEATURES
|
|
||||||
//#define BEAST_USE_BOOST_FEATURES 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# This script makes sure that every directly includable header
|
|
||||||
# file compiles stand-alone for all supported platforms.
|
|
||||||
#
|
|
||||||
|
|
||||||
for f in $1/*.h $1/*/*.h
|
|
||||||
do
|
|
||||||
{
|
|
||||||
echo "Compilng '$f'"
|
|
||||||
g++ -xc++ - -c -o /dev/null <<EOF
|
|
||||||
#define BEAST_BEASTCONFIG_H_INCLUDED
|
|
||||||
#include "$f"
|
|
||||||
EOF
|
|
||||||
g++ -xc++ -std=c++11 - -c -o /dev/null <<EOF
|
|
||||||
#define BEAST_BEASTCONFIG_H_INCLUDED
|
|
||||||
#include "$f"
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
done
|
|
||||||
|
|
||||||
for f in $1/*/*.cpp
|
|
||||||
do
|
|
||||||
{
|
|
||||||
echo "Compilng '$f'"
|
|
||||||
g++ -xc++ -I$1/../config/ "$f" -c -o /dev/null
|
|
||||||
g++ -xc++ -std=c++11 -I$1/../config/ "$f" -c -o /dev/null
|
|
||||||
}
|
|
||||||
done
|
|
||||||
Reference in New Issue
Block a user