From 5175eb75668fa4462768d08134e7594b3cfdda47 Mon Sep 17 00:00:00 2001 From: Xieamoe Date: Wed, 14 Feb 2024 01:53:46 -0800 Subject: [PATCH] Fixed testing on guix. --- CMakeLists.txt | 1 + tests/rdricpp.scm => rdricpp.scm | 5 +- rdricpp_local.scm | 140 +++++++++++++++++++++++++++++++ tests/CMakeLists.txt | 19 ++++- 4 files changed, 159 insertions(+), 6 deletions(-) rename tests/rdricpp.scm => rdricpp.scm (94%) create mode 100644 rdricpp_local.scm diff --git a/CMakeLists.txt b/CMakeLists.txt index df7a7b9..0189aa3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ # Works with 3.14 and tested through 3.28 cmake_minimum_required(VERSION 3.14...3.28) + project(Rdricpp VERSION 0.2 DESCRIPTION "Rikaitan Deinflector Reference Implementation in C++." diff --git a/tests/rdricpp.scm b/rdricpp.scm similarity index 94% rename from tests/rdricpp.scm rename to rdricpp.scm index 79091b7..a7cea54 100644 --- a/tests/rdricpp.scm +++ b/rdricpp.scm @@ -69,9 +69,9 @@ (uri (git-reference (url "https://codeberg.org/xieamoe/rdricpp.git") - (commit "269b0e679e05fecf6d5b25ce8a105caa94361de5"))) + (commit "8bfb4a86cc"))) (sha256 - (base32 "1db9wq9k2vsygwks0qp1bb4i4bpdklhz7h4iv5x24k17hwxkbjyh")))) + (base32 "3f341ba9241d612ef2dbbf02ada0371534b86077")))) (build-system cmake-build-system) (arguments @@ -101,3 +101,4 @@ license:zlib)))) rdricpp + diff --git a/rdricpp_local.scm b/rdricpp_local.scm new file mode 100644 index 0000000..0243db9 --- /dev/null +++ b/rdricpp_local.scm @@ -0,0 +1,140 @@ + +(define-module (gd-tools) + #:use-module (gnu packages cmake) + #:use-module (gnu packages compression) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages search) + #:use-module (gnu packages web) + + #:use-module (gnu packages gcc) + #:use-module (gnu packages tls) + #:use-module (gnu packages cpp) + #:use-module (gnu packages glib) + #:use-module (gnu packages nss) + #:use-module (gnu packages datastructures) + + #:use-module (gnu packages certs) + #:use-module (gnu packages check) + #:use-module (guix build-system qt) + #:use-module (gnu packages curl) + #:use-module (guix utils) + #:use-module (guix search-paths) + #:use-module (guix build-system cmake) + #:use-module (guix build-system gnu) + #:use-module (guix download) + #:use-module (guix gexp) + + #:use-module (guix git-download) + #:use-module (guix packages) + #:use-module ((guix licenses) #:prefix license:)) + +(define-public catch2-full +(package + (name "Catch2") + (version "3.5.2") + (source (local-file "../Catch2-3.5.2" "guile-checkout" + #:recursive? #t)) + (build-system cmake-build-system) + (arguments + ( list #:cmake cmake + #:tests? #f + ) + ) + + (native-inputs + (list + gcc-13 + pkg-config + )) + + (synopsis "C++ Requests: Curl for People ") + (description + "Catch2 is mainly a unit testing framework for C++, but it also + provides basic micro-benchmarking features, and simple BDD macros. + + Catch2's main advantage is that using it is both simple and natural. + Test names do not have to be valid identifiers, assertions look like + normal C++ boolean expressions, and sections provide a nice and local + way to share set-up and tear-down code in tests.") + (home-page "https://github.com/catchorg/Catch2") + (license + (list license:boost1.0)))) + +(define-public libcpr +(package + (name "cpr") + (version "1.5") + (source (local-file "./cpr-1.10.5" "guile-checkout" + #:recursive? #t)) + (build-system cmake-build-system) + (arguments + ( list #:cmake cmake + #:tests? #f + ) + ) + + + (native-inputs + (list + openssl + gcc-13 + curl + pkg-config + + )) + (inputs + (list + curl + openssl + )) + + (synopsis "C++ Requests: Curl for People ") + (description + "C++ Requests is a simple wrapper around libcurl inspired by the excellent Python Requests project. + + Despite its name, libcurl's easy interface is anything but, and making mistakes, + misusing it is a common source of error and frustration. Using the more expressive + language facilities of C++17 'or C++11 in case you use cpr < 1.10.0', this library + captures the essence of making network calls into a few concise idioms.") + (home-page "https://github.com/libcpr/cpr") + (license + (list license:expat)))) + +(define-public rdricpp +(package + (name "rdricpp") + (version "1.5") + (source (local-file "" "guile-checkout" + #:recursive? #t)) + (build-system cmake-build-system) + (arguments + ( list #:cmake cmake + ;;#:tests? #f + #:configure-flags + #~(list "-DGUIX=1") + ) + ) + + + (native-inputs + (list + gcc-13 + pkg-config + + )) + (inputs + (list + catch2-full + )) + + (synopsis "Rikaitan Deinflector Reference Implementation in C++.") + (description + "Rikaitan Deinflector Reference Implementation in C++.") + (home-page "https://github.com/Ajatt-Tools/rdricpp") + (license + (list license:gpl3+ + license:zlib)))) + + + +rdricpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 63dd683..b6cc91c 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,5 +1,10 @@ # Testing library -if (APPLE OR UNIX OR WIN32 NOT guix) + +message("Guix = ${GUIX}") + +if ( (NOT ${GUIX}) ) +message("NOT GUIX") + include(FetchContent) FetchContent_Declare( catch GIT_REPOSITORY https://github.com/catchorg/Catch2.git @@ -7,12 +12,18 @@ if (APPLE OR UNIX OR WIN32 NOT guix) FetchContent_MakeAvailable(catch) endif() #Adds Catch2::Catch2 - +#If building manually #add_subdirectory(Catch2-3.5.2) include(CTest) -#include(Catch) -include(Catch.cmake) + + +if ( ${GUIX} ) + include(Catch.cmake) +else() + include(Catch) +endif() + add_executable(tests tests.cpp test_cases.cpp test_cases.h) target_compile_features(tests PRIVATE cxx_std_23)