Pārlūkot izejas kodu

Update Catch2, and significantly compress it,

also some formatting and a missing header
default_compile_flags
vector-of-bool pirms 3 gadiem
vecāks
revīzija
c50c4a8082
12 mainītis faili ar 1084 papildinājumiem un 54874 dzēšanām
  1. +934
    -528
      res/catch2.hpp
  2. +1
    -0
      src/dds.main.cpp
  3. +2
    -2
      src/dds/build/builder.cpp
  4. +2
    -1
      src/dds/build/file_deps.cpp
  5. +1
    -1
      src/dds/build/file_deps.hpp
  6. +0
    -54331
      src/dds/catch2_embeddead.generated.cpp
  7. +87
    -0
      src/dds/catch2_embedded.generated.cpp
  8. +4
    -2
      src/dds/catch2_embedded.hpp
  9. +1
    -1
      src/dds/cli/dispatch_main.hpp
  10. +5
    -1
      src/dds/util/http/pool.cpp
  11. +2
    -1
      src/dds/util/http/response.cpp
  12. +45
    -6
      tools/prep-catch2.py

+ 934
- 528
res/catch2.hpp
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 1
- 0
src/dds.main.cpp Parādīt failu

@@ -10,6 +10,7 @@
#include <fmt/ostream.h>
#include <neo/event.hpp>

#include <clocale>
#include <filesystem>
#include <iostream>
#include <locale>

+ 2
- 2
src/dds/build/builder.cpp Parādīt failu

@@ -50,8 +50,8 @@ prepare_catch2_driver(test_lib test_driver, const build_params& params, build_en
if (!fs::exists(catch_hpp)) {
fs::create_directories(catch_hpp.parent_path());
auto hpp_strm = open(catch_hpp, std::ios::out | std::ios::binary);
hpp_strm.write(detail::catch2_embedded_single_header_str,
std::strlen(detail::catch2_embedded_single_header_str));
auto c2_str = detail::catch2_embedded_single_header_str();
hpp_strm.write(c2_str.data(), c2_str.size());
hpp_strm.close();
}
ret_lib.include_paths.push_back(test_include_root);

+ 2
- 1
src/dds/build/file_deps.cpp Parādīt failu

@@ -77,7 +77,8 @@ void dds::update_deps_info(neo::output<database> db_, const file_deps_info& deps
}
}

std::optional<prior_compilation> dds::get_prior_compilation(const database& db, path_ref output_path) {
std::optional<prior_compilation> dds::get_prior_compilation(const database& db,
path_ref output_path) {
auto cmd_ = db.command_of(output_path);
if (!cmd_) {
return {};

+ 1
- 1
src/dds/build/file_deps.hpp Parādīt failu

@@ -128,7 +128,7 @@ void update_deps_info(neo::output<database> db, const file_deps_info& info);
*/
struct prior_compilation {
std::vector<fs::path> newer_inputs;
completed_compilation previous_command;
completed_compilation previous_command;
};

/**

+ 0
- 54331
src/dds/catch2_embeddead.generated.cpp
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 87
- 0
src/dds/catch2_embedded.generated.cpp
Failā izmaiņas netiks attēlotas, jo tās ir par lielu
Parādīt failu


+ 4
- 2
src/dds/catch2_embedded.hpp Parādīt failu

@@ -1,7 +1,9 @@
#pragma once

#include <string_view>

namespace dds::detail {

extern const char* const catch2_embedded_single_header_str;
std::string_view catch2_embedded_single_header_str() noexcept;

} // namespace dds::detail
} // namespace dds::detail

+ 1
- 1
src/dds/cli/dispatch_main.hpp Parādīt failu

@@ -6,4 +6,4 @@ struct options;

int dispatch_main(const options&) noexcept;

} // namespace dds
} // namespace dds::cli

+ 5
- 1
src/dds/util/http/pool.cpp Parādīt failu

@@ -229,7 +229,11 @@ http_client http_pool::client_for_origin(const network_origin& origin) {
ret._pool = _impl;
if (iter == _impl->_clients.end()) {
// Nothing for this origin yet
dds_log(debug, "Opening new connection to {}://{}:{}", origin.protocol, origin.hostname, origin.port);
dds_log(debug,
"Opening new connection to {}://{}:{}",
origin.protocol,
origin.hostname,
origin.port);
auto ptr = std::make_shared<detail::http_client_impl>(origin);
ptr->connect();
ret._impl = ptr;

+ 2
- 1
src/dds/util/http/response.cpp Parādīt failu

@@ -25,7 +25,8 @@ std::optional<int> http_response_info::content_length() const noexcept {
return clen;
}

std::optional<std::string_view> http_response_info::header_value(std::string_view key) const noexcept {
std::optional<std::string_view>
http_response_info::header_value(std::string_view key) const noexcept {
auto hdr = headers.find(key);
if (!hdr) {
return {};

+ 45
- 6
tools/prep-catch2.py Parādīt failu

@@ -1,22 +1,61 @@
from pathlib import Path
import gzip

ROOT = Path(__file__).absolute().parent.parent
c2_header = ROOT / 'res/catch2.hpp'

buf = c2_header.read_bytes()
compr = gzip.compress(buf, compresslevel=9)
chars = ', '.join(f"'\\x{b:02x}'" for b in compr)

chars = ', '.join(f"'\\x{b:02x}'" for b in buf)

c2_embedded = ROOT / 'src/dds/catch2_embeddead_header.cpp'
def oct_encode_one(b: int) -> str:
if b >= 33 and b <= 126:
c = chr(b)
if c in ('"', '\\'):
return '\\' + c
return c
else:
return f'\\{oct(b)[2:]:>03}'


def oct_encode(b: bytes) -> str:
return ''.join(oct_encode_one(byt) for byt in b)


bufs = []
while compr:
head = compr[:2000]
compr = compr[len(head):]
octl = oct_encode(head)
bufs.append(f'"{octl}"_buf')

bufs_arr = ',\n '.join(bufs)

c2_embedded = ROOT / 'src/dds/catch2_embedded.generated.cpp'
c2_embedded.write_text(f'''
#include "./catch2_embedded.hpp"

#include <neo/gzip_io.hpp>
#include <neo/string_io.hpp>

using namespace neo::literals;

namespace dds::detail {{

static const char bytes[] = {{
{chars}, '\\x00'
static const neo::const_buffer catch2_gzip_bufs[] = {{
{bufs_arr}
}};
const char* const catch2_embedded_single_header_str = bytes;

}}
''')

std::string_view dds::detail::catch2_embedded_single_header_str() noexcept {{
static const std::string decompressed = [] {{
neo::string_dynbuf_io str;
neo::gzip_decompress(str, catch2_gzip_bufs);
str.shrink_uncommitted();
return std::move(str.string());
}}();
return decompressed;
}}
''')

Notiek ielāde…
Atcelt
Saglabāt