Fix Ubuntu builds

pull/705/head
Michael 5 years ago
parent 5300568da5
commit 5cef2865bd
No known key found for this signature in database
GPG Key ID: 2D51757B47E2434C

@ -1,7 +1,11 @@
FROM ubuntu:latest FROM ubuntu:xenial
RUN apt update && \ RUN apt update && \
apt install -y build-essential cmake git libcap-dev curl ninja-build apt-get install -y apt-transport-https ca-certificates gnupg software-properties-common wget && \
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc | apt-key add - && \
apt-add-repository 'deb https://apt.kitware.com/ubuntu/ xenial main' && \
apt-get update && \
apt install -y build-essential cmake git libcap-dev curl ninja-build libuv1-dev
WORKDIR /src/ WORKDIR /src/

@ -86,11 +86,6 @@ namespace llarp
// check for file // check for file
if(!fs::exists(fname, ec)) if(!fs::exists(fname, ec))
{ {
if(ec)
{
LogError(ec);
return false;
}
// regen and encode // regen and encode
RegenerateKeys(); RegenerateKeys();
if(!BEncode(&buf)) if(!BEncode(&buf))

@ -95,7 +95,7 @@ namespace llarp
if(ec) if(ec)
llarp::LogError("failed to set permissions on ", pathname); llarp::LogError("failed to set permissions on ", pathname);
} }
else if(!ec) // file is not there else // file is not there
{ {
errno = 0; errno = 0;
int fd = ::open(str.c_str(), O_RDWR | O_CREAT, 0600); int fd = ::open(str.c_str(), O_RDWR | O_CREAT, 0600);
@ -105,6 +105,7 @@ namespace llarp
::close(fd); ::close(fd);
} }
} }
if(ec) if(ec)
llarp::LogError("failed to ensure ", str, ", ", ec.message()); llarp::LogError("failed to ensure ", str, ", ", ec.message());
return ec; return ec;

@ -6,7 +6,7 @@ namespace llarp
{ {
namespace metrics namespace metrics
{ {
std::tuple< Id, bool > std::pair< Id, bool >
Registry::insert(string_view category, string_view name) Registry::insert(string_view category, string_view name)
{ {
// avoid life time issues, putting strings in the stringmem set // avoid life time issues, putting strings in the stringmem set
@ -18,7 +18,7 @@ namespace llarp
if(it != m_metrics.end()) if(it != m_metrics.end())
{ {
return std::make_tuple(Id(it->second.get()), false); return {Id(it->second.get()), false};
} }
auto cIt = m_categories.find(cStr); auto cIt = m_categories.find(cStr);

@ -286,7 +286,7 @@ namespace llarp
Registry & Registry &
operator=(const Registry &) = delete; operator=(const Registry &) = delete;
std::tuple< Id, bool > std::pair< Id, bool >
insert(string_view category, string_view name) insert(string_view category, string_view name)
EXCLUSIVE_LOCKS_REQUIRED(m_mutex); EXCLUSIVE_LOCKS_REQUIRED(m_mutex);

@ -91,20 +91,20 @@ TEST_P(SingleAttributeTest, value)
// clang-format off // clang-format off
static const SingleAttributeType singleAttributeType[] = { static const SingleAttributeType singleAttributeType[] = {
{"our_value", char('a'), StrEq("[ our_value = 'a' ]")}, SingleAttributeType("our_value", char('a'), StrEq("[ our_value = 'a' ]")),
{"our_value", bool(true), StrEq("[ our_value = true ]")}, SingleAttributeType("our_value", bool(true), StrEq("[ our_value = true ]")),
{"our_value", bool(false), StrEq("[ our_value = false ]")}, SingleAttributeType("our_value", bool(false), StrEq("[ our_value = false ]")),
{"our_value", short(123), StrEq("[ our_value = 123 ]")}, SingleAttributeType("our_value", short(123), StrEq("[ our_value = 123 ]")),
{"our_value", int(INT_MAX - 1), StrEq("[ our_value = 2147483646 ]")}, SingleAttributeType("our_value", int(INT_MAX - 1), StrEq("[ our_value = 2147483646 ]")),
{"our_value", static_cast< unsigned int >(std::numeric_limits< int >::max()) + 1, StrEq("[ our_value = 2147483648 ]")}, SingleAttributeType("our_value", static_cast< unsigned int >(std::numeric_limits< int >::max()) + 1, StrEq("[ our_value = 2147483648 ]")),
{"our_value", static_cast< const void * >(PTR_TYPE), AllOf(StartsWith("[ our_value = 0x"), EndsWith(" ]"))}, SingleAttributeType("our_value", static_cast< const void * >(PTR_TYPE), AllOf(StartsWith("[ our_value = 0x"), EndsWith(" ]"))),
{"our_value", static_cast< const char * >(PTR_TYPE), StrEq("[ our_value = \"abacus\" ]")}, SingleAttributeType("our_value", static_cast< const char * >(PTR_TYPE), StrEq("[ our_value = \"abacus\" ]")),
{"our_value", std::string("abacus"), StrEq("[ our_value = \"abacus\" ]")}, SingleAttributeType("our_value", std::string("abacus"), StrEq("[ our_value = \"abacus\" ]")),
{"our_value", static_cast< const int * >(&INT_VAL), AllOf(StartsWith("[ our_value = 0x"), EndsWith(" ]"))}, SingleAttributeType("our_value", static_cast< const int * >(&INT_VAL), AllOf(StartsWith("[ our_value = 0x"), EndsWith(" ]"))),
{"our_value", std::pair< int, std::string >(100, "abacus"), StrEq("[ our_value = [ 100 \"abacus\" ] ]")}, SingleAttributeType("our_value", std::pair< int, std::string >(100, "abacus"), StrEq("[ our_value = [ 100 \"abacus\" ] ]")),
{"our_value", std::tuple< int, std::string, int >(100, "abacus", 123), StrEq("[ our_value = [ 100 \"abacus\" 123 ] ]")}, SingleAttributeType("our_value", std::tuple< int, std::string, int >(100, "abacus", 123), StrEq("[ our_value = [ 100 \"abacus\" 123 ] ]")),
{"our_value", std::map< std::string, char >{{"one", 'a'}, {"two", 'b'}, {"three", 'c'}}, StrEq("[ our_value = [ [ \"one\" \'a\' ] [ \"three\" \'c\' ] [ \"two\" 'b' ] ] ]")}, SingleAttributeType("our_value", std::map< std::string, char >{{"one", 'a'}, {"two", 'b'}, {"three", 'c'}}, StrEq("[ our_value = [ [ \"one\" \'a\' ] [ \"three\" \'c\' ] [ \"two\" 'b' ] ] ]")),
{"our_value", PrintableType(), StrEq("[ our_value = PrintableType -2 -1 ]")}, SingleAttributeType("our_value", PrintableType(), StrEq("[ our_value = PrintableType -2 -1 ]")),
}; };
// clang-format on // clang-format on

Loading…
Cancel
Save