[M5] verify-curated-db.sh + boost recipe (header-only)
This commit is contained in:
17
CHANGELOG.md
17
CHANGELOG.md
@@ -87,6 +87,23 @@ All notable changes to cargoxx will be documented in this file.
|
|||||||
branch when the lockfile carries no rev.
|
branch when the lockfile carries no rev.
|
||||||
- `util::satisfies` treats `version == "*"` as a match against any
|
- `util::satisfies` treats `version == "*"` as a match against any
|
||||||
range, mirroring the existing `range == "*"` shortcut.
|
range, mirroring the existing `range == "*"` shortcut.
|
||||||
|
- `scripts/verify-curated-db.sh` plus per-package using-snippets at
|
||||||
|
`scripts/curated-snippets/<pkg>.cpp`. For each curated package the
|
||||||
|
script scaffolds a fresh project, `cargoxx add`s the dep, drops in a
|
||||||
|
snippet that exercises the library's API, and runs `cargoxx build`,
|
||||||
|
asserting the binary is produced. 21/25 packages pass against
|
||||||
|
`nixos-unstable`; the remaining 4 are documented as skipped:
|
||||||
|
`catch2`/`gtest` (their default linkdb targets ship their own
|
||||||
|
`main()` which collides with the snippet), `grpc` (needs `protobuf`
|
||||||
|
declared as a transitive dep — cross-package transitives are out of
|
||||||
|
v0.1 scope), `abseil-cpp` (nixpkgs builds it against libstdc++ while
|
||||||
|
our flake uses libc++ → ABI mismatch on the linker step).
|
||||||
|
- `data/linkdb.json`: `boost` recipe is now header-only —
|
||||||
|
`find_package(Boost REQUIRED)` + `Boost::headers`. Boost 1.89's
|
||||||
|
`BoostConfig.cmake` searches for separately-installed
|
||||||
|
`boost_<comp>Config.cmake` files that nixpkgs doesn't ship, so
|
||||||
|
the previous `COMPONENTS` form failed at configure time.
|
||||||
|
Linkdb-component tests now use `abseil-cpp` for component coverage.
|
||||||
- `cargoxx remove <pkg>` drops a declared dep from `Cargoxx.toml`,
|
- `cargoxx remove <pkg>` drops a declared dep from `Cargoxx.toml`,
|
||||||
errors when the dep is not declared. Other deps are preserved.
|
errors when the dep is not declared. Other deps are preserved.
|
||||||
- End-to-end verified on a freshly-scaffolded project. `tests/cmd_add.cpp`
|
- End-to-end verified on a freshly-scaffolded project. `tests/cmd_add.cpp`
|
||||||
|
|||||||
@@ -35,9 +35,8 @@
|
|||||||
{
|
{
|
||||||
"version": ">=1.70.0",
|
"version": ">=1.70.0",
|
||||||
"nixpkgs_attr": "boost",
|
"nixpkgs_attr": "boost",
|
||||||
"find_package": "Boost REQUIRED COMPONENTS {{components}}",
|
"find_package": "Boost REQUIRED",
|
||||||
"targets": ["Boost::{{component}}"],
|
"targets": ["Boost::headers"]
|
||||||
"components": "supported"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"openssl": [
|
"openssl": [
|
||||||
|
|||||||
8
scripts/curated-snippets/abseil-cpp.cpp
Normal file
8
scripts/curated-snippets/abseil-cpp.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include <absl/strings/str_cat.h>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
auto s = absl::StrCat("abseil-", "cpp");
|
||||||
|
std::println("abseil-cpp ok: {}", s);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
8
scripts/curated-snippets/boost.cpp
Normal file
8
scripts/curated-snippets/boost.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
boost::filesystem::path p{"/tmp"};
|
||||||
|
std::println("boost ok: {}", p.string());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
13
scripts/curated-snippets/cli11.cpp
Normal file
13
scripts/curated-snippets/cli11.cpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include <CLI/CLI.hpp>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main(int argc, char** argv) {
|
||||||
|
CLI::App app{"verify"};
|
||||||
|
try {
|
||||||
|
app.parse(argc, argv);
|
||||||
|
} catch (const CLI::ParseError& e) {
|
||||||
|
return app.exit(e);
|
||||||
|
}
|
||||||
|
std::println("cli11 ok");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
7
scripts/curated-snippets/curl.cpp
Normal file
7
scripts/curated-snippets/curl.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include <curl/curl.h>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::println("curl ok: {}", curl_version());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
8
scripts/curated-snippets/cxxopts.cpp
Normal file
8
scripts/curated-snippets/cxxopts.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include <cxxopts.hpp>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
cxxopts::Options opts("verify", "verify cxxopts");
|
||||||
|
std::println("cxxopts ok: {}", opts.program());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
8
scripts/curated-snippets/eigen.cpp
Normal file
8
scripts/curated-snippets/eigen.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include <Eigen/Core>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
Eigen::Vector2d v(1.0, 2.0);
|
||||||
|
std::println("eigen ok: ({},{})", v[0], v[1]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
7
scripts/curated-snippets/fmt.cpp
Normal file
7
scripts/curated-snippets/fmt.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include <fmt/core.h>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
fmt::print("fmt ok\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
13
scripts/curated-snippets/freetype.cpp
Normal file
13
scripts/curated-snippets/freetype.cpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#include <ft2build.h>
|
||||||
|
#include FT_FREETYPE_H
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
FT_Library lib = nullptr;
|
||||||
|
auto err = FT_Init_FreeType(&lib);
|
||||||
|
if (err == 0 && lib) {
|
||||||
|
FT_Done_FreeType(lib);
|
||||||
|
}
|
||||||
|
std::println("freetype ok: init err {}", err);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
9
scripts/curated-snippets/glfw.cpp
Normal file
9
scripts/curated-snippets/glfw.cpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#include <GLFW/glfw3.h>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int major = 0, minor = 0, rev = 0;
|
||||||
|
glfwGetVersion(&major, &minor, &rev);
|
||||||
|
std::println("glfw ok: {}.{}.{}", major, minor, rev);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
8
scripts/curated-snippets/glm.cpp
Normal file
8
scripts/curated-snippets/glm.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include <glm/glm.hpp>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
glm::vec3 v(1.0f, 2.0f, 3.0f);
|
||||||
|
std::println("glm ok: ({},{},{})", v.x, v.y, v.z);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
7
scripts/curated-snippets/grpc.cpp
Normal file
7
scripts/curated-snippets/grpc.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include <grpcpp/grpcpp.h>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::println("grpc ok: {}", grpc::Version());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
10
scripts/curated-snippets/libjpeg.cpp
Normal file
10
scripts/curated-snippets/libjpeg.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
// libjpeg's jpeglib.h relies on stdio types being already declared.
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <jpeglib.h>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::println("libjpeg ok: lib version {}", JPEG_LIB_VERSION);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
7
scripts/curated-snippets/libpng.cpp
Normal file
7
scripts/curated-snippets/libpng.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include <png.h>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::println("libpng ok: {}", png_access_version_number());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
10
scripts/curated-snippets/magic_enum.cpp
Normal file
10
scripts/curated-snippets/magic_enum.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include <magic_enum/magic_enum.hpp>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
enum class Color { Red, Green, Blue };
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
auto n = magic_enum::enum_count<Color>();
|
||||||
|
std::println("magic_enum ok: {} entries", n);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
9
scripts/curated-snippets/nlohmann_json.cpp
Normal file
9
scripts/curated-snippets/nlohmann_json.cpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
nlohmann::json j;
|
||||||
|
j["k"] = 42;
|
||||||
|
std::println("{}", j.dump());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
9
scripts/curated-snippets/openssl.cpp
Normal file
9
scripts/curated-snippets/openssl.cpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#include <openssl/evp.h>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
EVP_MD_CTX* ctx = EVP_MD_CTX_new();
|
||||||
|
EVP_MD_CTX_free(ctx);
|
||||||
|
std::println("openssl ok");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
8
scripts/curated-snippets/protobuf.cpp
Normal file
8
scripts/curated-snippets/protobuf.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include <google/protobuf/arena.h>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
google::protobuf::Arena arena;
|
||||||
|
std::println("protobuf ok: arena size {}", arena.SpaceUsed());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
12
scripts/curated-snippets/range-v3.cpp
Normal file
12
scripts/curated-snippets/range-v3.cpp
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#include <range/v3/view/iota.hpp>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
auto v = ranges::views::iota(0, 5);
|
||||||
|
int sum = 0;
|
||||||
|
for (int i : v) {
|
||||||
|
sum += i;
|
||||||
|
}
|
||||||
|
std::println("range-v3 ok: {}", sum);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
8
scripts/curated-snippets/sdl2.cpp
Normal file
8
scripts/curated-snippets/sdl2.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include <SDL2/SDL.h>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
auto* err = SDL_GetError();
|
||||||
|
std::println("sdl2 ok: SDL_GetError() = '{}'", err ? err : "");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
8
scripts/curated-snippets/spdlog.cpp
Normal file
8
scripts/curated-snippets/spdlog.cpp
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
spdlog::set_level(spdlog::level::info);
|
||||||
|
spdlog::info("spdlog ok");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
7
scripts/curated-snippets/sqlite3.cpp
Normal file
7
scripts/curated-snippets/sqlite3.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include <sqlite3.h>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::println("sqlite3 ok: {}", sqlite3_libversion());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
9
scripts/curated-snippets/tbb.cpp
Normal file
9
scripts/curated-snippets/tbb.cpp
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
#include <oneapi/tbb/parallel_for.h>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
int sum = 0;
|
||||||
|
oneapi::tbb::parallel_for(0, 10, [&](int i) { sum += i; });
|
||||||
|
std::println("tbb ok: {}", sum);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
7
scripts/curated-snippets/zlib.cpp
Normal file
7
scripts/curated-snippets/zlib.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include <zlib.h>
|
||||||
|
import std;
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
std::println("zlib ok: {}", zlibVersion());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
179
scripts/verify-curated-db.sh
Executable file
179
scripts/verify-curated-db.sh
Executable file
@@ -0,0 +1,179 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
#
|
||||||
|
# Build a tiny project for every curated-linkdb package, compile against the
|
||||||
|
# library, and verify the binary links. Catches nixpkgs attribute drift,
|
||||||
|
# find_package case mismatches, and missing components configurations.
|
||||||
|
#
|
||||||
|
# Usage:
|
||||||
|
# scripts/verify-curated-db.sh [pkg1 pkg2 ...]
|
||||||
|
#
|
||||||
|
# Env:
|
||||||
|
# CARGOXX absolute path to the cargoxx binary (default: ./build/cargoxx)
|
||||||
|
# VERIFY_DIR working directory (default: a fresh mktemp under /tmp)
|
||||||
|
# KEEP non-empty → leave VERIFY_DIR in place after the run
|
||||||
|
#
|
||||||
|
# Catch2 and gtest are intentionally skipped: their default linkdb targets
|
||||||
|
# (Catch2WithMain, GTest::gtest_main) supply their own main() and would
|
||||||
|
# collide with the using-snippet's int main().
|
||||||
|
|
||||||
|
set -uo pipefail
|
||||||
|
|
||||||
|
REPO_ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||||
|
CARGOXX="${CARGOXX:-${REPO_ROOT}/build/cargoxx}"
|
||||||
|
SNIPPETS_DIR="${REPO_ROOT}/scripts/curated-snippets"
|
||||||
|
|
||||||
|
if [[ ! -x "${CARGOXX}" ]]; then
|
||||||
|
echo "ERROR: cargoxx binary not found at ${CARGOXX}" >&2
|
||||||
|
echo " build it first: cmake --build build" >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${VERIFY_DIR:-}" ]]; then
|
||||||
|
VERIFY_DIR="$(mktemp -d -t cargoxx-verify-XXXXXX)"
|
||||||
|
fi
|
||||||
|
mkdir -p "${VERIFY_DIR}"
|
||||||
|
|
||||||
|
if [[ -z "${KEEP:-}" ]]; then
|
||||||
|
trap 'rm -rf "${VERIFY_DIR}"' EXIT
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "cargoxx: ${CARGOXX}"
|
||||||
|
echo "verify dir: ${VERIFY_DIR}"
|
||||||
|
echo
|
||||||
|
|
||||||
|
# Format: "name|version|components" (components is comma-separated, may be empty)
|
||||||
|
ALL_PACKAGES=(
|
||||||
|
"fmt|10.2.0|"
|
||||||
|
"spdlog|1.13.0|"
|
||||||
|
"nlohmann_json|3.11.0|"
|
||||||
|
"boost|1.84.0|"
|
||||||
|
"openssl|3.2.0|"
|
||||||
|
"zlib|1.3.0|"
|
||||||
|
"sqlite3|3.45.0|"
|
||||||
|
"curl|8.5.0|"
|
||||||
|
"protobuf|25.0.0|"
|
||||||
|
"eigen|3.4.0|"
|
||||||
|
"tbb|2021.10.0|"
|
||||||
|
"libpng|1.6.40|"
|
||||||
|
"libjpeg|3.0.1|"
|
||||||
|
"freetype|2.13.2|"
|
||||||
|
"glfw|3.3.9|"
|
||||||
|
"glm|0.9.9.8|"
|
||||||
|
"sdl2|2.28.5|"
|
||||||
|
"cli11|2.4.1|"
|
||||||
|
"cxxopts|3.2.0|"
|
||||||
|
"range-v3|0.12.0|"
|
||||||
|
"magic_enum|0.9.5|"
|
||||||
|
)
|
||||||
|
SKIPPED_PACKAGES=(
|
||||||
|
"catch2 (links Catch2WithMain — conflicts with the snippet's main())"
|
||||||
|
"gtest (links GTest::gtest_main — conflicts with the snippet's main())"
|
||||||
|
"grpc (find_dependency(Protobuf) transitive — needs cross-package deps)"
|
||||||
|
"abseil-cpp (nixpkgs builds it against libstdc++; our flake uses libc++)"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Allow running on a subset: ./scripts/verify-curated-db.sh fmt boost
|
||||||
|
FILTER=("$@")
|
||||||
|
|
||||||
|
is_filtered() {
|
||||||
|
local name="$1"
|
||||||
|
if [[ ${#FILTER[@]} -eq 0 ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
local f
|
||||||
|
for f in "${FILTER[@]}"; do
|
||||||
|
if [[ "${f}" == "${name}" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
ok=()
|
||||||
|
failed=()
|
||||||
|
|
||||||
|
run_one() {
|
||||||
|
local name="$1" version="$2" components="$3"
|
||||||
|
local snippet="${SNIPPETS_DIR}/${name}.cpp"
|
||||||
|
|
||||||
|
if [[ ! -f "${snippet}" ]]; then
|
||||||
|
echo " ✗ no snippet at ${snippet}" >&2
|
||||||
|
failed+=("${name}: missing snippet")
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
local proj="${VERIFY_DIR}/${name}"
|
||||||
|
rm -rf "${proj}"
|
||||||
|
|
||||||
|
pushd "${VERIFY_DIR}" >/dev/null || return 1
|
||||||
|
if ! "${CARGOXX}" new "${name}" >"${VERIFY_DIR}/${name}.new.log" 2>&1; then
|
||||||
|
echo " ✗ cargoxx new failed (log: ${VERIFY_DIR}/${name}.new.log)" >&2
|
||||||
|
failed+=("${name}: cargoxx new")
|
||||||
|
popd >/dev/null
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
popd >/dev/null
|
||||||
|
|
||||||
|
pushd "${proj}" >/dev/null || return 1
|
||||||
|
|
||||||
|
local add_args=("${name}@${version}")
|
||||||
|
if [[ -n "${components}" ]]; then
|
||||||
|
add_args+=("--components" "${components}")
|
||||||
|
fi
|
||||||
|
if ! "${CARGOXX}" add "${add_args[@]}" >"${VERIFY_DIR}/${name}.add.log" 2>&1; then
|
||||||
|
echo " ✗ cargoxx add failed (log: ${VERIFY_DIR}/${name}.add.log)" >&2
|
||||||
|
failed+=("${name}: cargoxx add")
|
||||||
|
popd >/dev/null
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cp "${snippet}" src/main.cpp
|
||||||
|
|
||||||
|
if ! "${CARGOXX}" build >"${VERIFY_DIR}/${name}.build.log" 2>&1; then
|
||||||
|
echo " ✗ cargoxx build failed (log: ${VERIFY_DIR}/${name}.build.log)" >&2
|
||||||
|
failed+=("${name}: cargoxx build")
|
||||||
|
popd >/dev/null
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -x "build/debug/${name}" ]]; then
|
||||||
|
echo " ✗ binary not produced at build/debug/${name}" >&2
|
||||||
|
failed+=("${name}: missing binary")
|
||||||
|
popd >/dev/null
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd >/dev/null
|
||||||
|
ok+=("${name}")
|
||||||
|
echo " ✓ ${name}"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
for entry in "${ALL_PACKAGES[@]}"; do
|
||||||
|
IFS='|' read -r name version components <<<"${entry}"
|
||||||
|
if ! is_filtered "${name}"; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo "=== ${name} ${version} ==="
|
||||||
|
run_one "${name}" "${version}" "${components}"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "============================="
|
||||||
|
echo "RESULTS"
|
||||||
|
echo "============================="
|
||||||
|
echo "OK: ${#ok[@]}"
|
||||||
|
for n in "${ok[@]}"; do echo " ✓ ${n}"; done
|
||||||
|
echo
|
||||||
|
if [[ ${#failed[@]} -gt 0 ]]; then
|
||||||
|
echo "FAILED: ${#failed[@]}"
|
||||||
|
for f in "${failed[@]}"; do echo " ✗ ${f}"; done
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
echo "SKIPPED: ${#SKIPPED_PACKAGES[@]} (test-framework targets supply own main)"
|
||||||
|
for s in "${SKIPPED_PACKAGES[@]}"; do echo " · ${s}"; done
|
||||||
|
|
||||||
|
if [[ ${#failed[@]} -gt 0 ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
@@ -49,16 +49,16 @@ TEST_CASE("cmd_add stores components when provided", "[cli][add]") {
|
|||||||
auto parent = fresh_dir();
|
auto parent = fresh_dir();
|
||||||
auto root = scaffold(parent);
|
auto root = scaffold(parent);
|
||||||
|
|
||||||
auto r = cmd_add(root, "boost", "1.84.0", {"filesystem", "system"},
|
auto r = cmd_add(root, "abseil-cpp", "20240116.0", {"strings", "base"},
|
||||||
overlay_path(parent));
|
overlay_path(parent));
|
||||||
REQUIRE(r.has_value());
|
REQUIRE(r.has_value());
|
||||||
|
|
||||||
auto m = manifest::parse(root / "Cargoxx.toml");
|
auto m = manifest::parse(root / "Cargoxx.toml");
|
||||||
REQUIRE(m.has_value());
|
REQUIRE(m.has_value());
|
||||||
REQUIRE(m->dependencies.size() == 1);
|
REQUIRE(m->dependencies.size() == 1);
|
||||||
REQUIRE(m->dependencies[0].name == "boost");
|
REQUIRE(m->dependencies[0].name == "abseil-cpp");
|
||||||
REQUIRE(m->dependencies[0].components ==
|
REQUIRE(m->dependencies[0].components ==
|
||||||
std::vector<std::string>{"filesystem", "system"});
|
std::vector<std::string>{"strings", "base"});
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("cmd_add accepts an empty version and stores '*'", "[cli][add]") {
|
TEST_CASE("cmd_add accepts an empty version and stores '*'", "[cli][add]") {
|
||||||
@@ -110,7 +110,7 @@ TEST_CASE("cmd_add rejects componentized package without components",
|
|||||||
auto parent = fresh_dir();
|
auto parent = fresh_dir();
|
||||||
auto root = scaffold(parent);
|
auto root = scaffold(parent);
|
||||||
|
|
||||||
auto r = cmd_add(root, "boost", "1.84.0", {}, overlay_path(parent));
|
auto r = cmd_add(root, "abseil-cpp", "20240116.0", {}, overlay_path(parent));
|
||||||
REQUIRE_FALSE(r.has_value());
|
REQUIRE_FALSE(r.has_value());
|
||||||
REQUIRE(r.error().code == ErrorCode::LinkdbComponentNotSupported);
|
REQUIRE(r.error().code == ErrorCode::LinkdbComponentNotSupported);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,16 +104,16 @@ TEST_CASE("cmd_build resolves a componentized dep", "[cli][build]") {
|
|||||||
auto parent = fresh_dir();
|
auto parent = fresh_dir();
|
||||||
REQUIRE(cmd_new("app", false, parent).has_value());
|
REQUIRE(cmd_new("app", false, parent).has_value());
|
||||||
auto root = parent / "app";
|
auto root = parent / "app";
|
||||||
add_dep(root, "boost", "1.84.0", {"filesystem", "system"});
|
add_dep(root, "abseil-cpp", "20240116.0", {"strings", "base"});
|
||||||
|
|
||||||
auto r = cmd_build(root, true, false, std::nullopt, overlay_path(parent));
|
auto r = cmd_build(root, true, false, std::nullopt, overlay_path(parent));
|
||||||
REQUIRE(r.has_value());
|
REQUIRE(r.has_value());
|
||||||
|
|
||||||
auto cmake_text = read_file(root / "build" / "CMakeLists.txt");
|
auto cmake_text = read_file(root / "build" / "CMakeLists.txt");
|
||||||
REQUIRE(cmake_text.find("find_package(Boost REQUIRED COMPONENTS filesystem system)") !=
|
REQUIRE(cmake_text.find("find_package(absl CONFIG REQUIRED)") !=
|
||||||
std::string::npos);
|
std::string::npos);
|
||||||
REQUIRE(cmake_text.find("Boost::filesystem") != std::string::npos);
|
REQUIRE(cmake_text.find("absl::strings") != std::string::npos);
|
||||||
REQUIRE(cmake_text.find("Boost::system") != std::string::npos);
|
REQUIRE(cmake_text.find("absl::base") != std::string::npos);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("cmd_build synthesizes a lockfile entry per dep", "[cli][build]") {
|
TEST_CASE("cmd_build synthesizes a lockfile entry per dep", "[cli][build]") {
|
||||||
|
|||||||
@@ -56,19 +56,19 @@ TEST_CASE("resolve fails for an unknown package", "[linkdb]") {
|
|||||||
REQUIRE(rec.error().code == ErrorCode::LinkdbUnknownPackage);
|
REQUIRE(rec.error().code == ErrorCode::LinkdbUnknownPackage);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("resolve substitutes boost components", "[linkdb]") {
|
TEST_CASE("resolve substitutes abseil-cpp components", "[linkdb]") {
|
||||||
auto db = open_db();
|
auto db = open_db();
|
||||||
auto rec = db.resolve("boost", "1.84.0", {"filesystem", "system"});
|
auto rec = db.resolve("abseil-cpp", "20240116.0", {"strings", "base"});
|
||||||
REQUIRE(rec.has_value());
|
REQUIRE(rec.has_value());
|
||||||
REQUIRE(rec->find_package == "Boost REQUIRED COMPONENTS filesystem system");
|
REQUIRE(rec->find_package == "absl CONFIG REQUIRED");
|
||||||
REQUIRE(rec->targets ==
|
REQUIRE(rec->targets ==
|
||||||
std::vector<std::string>{"Boost::filesystem", "Boost::system"});
|
std::vector<std::string>{"absl::strings", "absl::base"});
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("resolve fails when a componentized package gets no components",
|
TEST_CASE("resolve fails when a componentized package gets no components",
|
||||||
"[linkdb]") {
|
"[linkdb]") {
|
||||||
auto db = open_db();
|
auto db = open_db();
|
||||||
auto rec = db.resolve("boost", "1.84.0");
|
auto rec = db.resolve("abseil-cpp", "20240116.0");
|
||||||
REQUIRE_FALSE(rec.has_value());
|
REQUIRE_FALSE(rec.has_value());
|
||||||
REQUIRE(rec.error().code == ErrorCode::LinkdbComponentNotSupported);
|
REQUIRE(rec.error().code == ErrorCode::LinkdbComponentNotSupported);
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@ TEST_CASE("resolve covers all 25 curated packages", "[linkdb]") {
|
|||||||
{"fmt", "10.2.0", {}},
|
{"fmt", "10.2.0", {}},
|
||||||
{"spdlog", "1.13.0", {}},
|
{"spdlog", "1.13.0", {}},
|
||||||
{"nlohmann_json", "3.11.0", {}},
|
{"nlohmann_json", "3.11.0", {}},
|
||||||
{"boost", "1.84.0", {"system"}},
|
{"boost", "1.84.0", {}},
|
||||||
{"openssl", "3.2.0", {}},
|
{"openssl", "3.2.0", {}},
|
||||||
{"zlib", "1.3.0", {}},
|
{"zlib", "1.3.0", {}},
|
||||||
{"sqlite3", "3.45.0", {}},
|
{"sqlite3", "3.45.0", {}},
|
||||||
|
|||||||
Reference in New Issue
Block a user