From d8fa99e53044a18eb72e9a434b7c08bd22c9fcb6 Mon Sep 17 00:00:00 2001 From: Pouria Rezaei Date: Sat, 6 Jul 2024 19:57:52 +0330 Subject: [PATCH] system/nix: Tests for 2.15+ Signed-off-by: Pouria Rezaei --- system/nix/fix_nix_options.patch | 134 ++++++++++--------------------- system/nix/nix.SlackBuild | 2 +- 2 files changed, 42 insertions(+), 94 deletions(-) diff --git a/system/nix/fix_nix_options.patch b/system/nix/fix_nix_options.patch index 181a8f641..fb4ed0794 100644 --- a/system/nix/fix_nix_options.patch +++ b/system/nix/fix_nix_options.patch @@ -141,96 +141,44 @@ index 871f2f3..21897d0 100644 auto path = sqlite3_db_filename(db, nullptr); auto errMsg = sqlite3_errmsg(db); -diff --git a/flake.nix b/flake.nix -index 71f6270..86c0a4f 100644 ---- a/flake.nix -+++ b/flake.nix -@@ -540,6 +540,8 @@ - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = ["fortify"]; -+ -+ NIX_CFLAGS_COMPILE = "-DCOVERAGE=1"; - }; - - # API docs for Nix's unstable internal C++ interfaces. -diff --git a/src/libexpr/tests/value/context.cc b/src/libexpr/tests/value/context.cc -index 083359b..88b3f32 100644 ---- a/src/libexpr/tests/value/context.cc -+++ b/src/libexpr/tests/value/context.cc -@@ -116,6 +116,8 @@ Gen Arbitrary::arbitrary() - - namespace nix { - -+#ifndef COVERAGE -+ - RC_GTEST_FIXTURE_PROP( - NixStringContextElemTest, - prop_round_rip, -@@ -124,4 +126,6 @@ RC_GTEST_FIXTURE_PROP( - RC_ASSERT(o == NixStringContextElem::parse(store(), o.to_string(store()))); - } - -+#endif -+ - } -diff --git a/src/libstore/tests/derived-path.cc b/src/libstore/tests/derived-path.cc -index e6d32db..343f7aa 100644 ---- a/src/libstore/tests/derived-path.cc -+++ b/src/libstore/tests/derived-path.cc -@@ -51,6 +51,8 @@ TEST_F(DerivedPathTest, force_init) - { - } - -+#ifndef COVERAGE -+ - RC_GTEST_FIXTURE_PROP( - DerivedPathTest, - prop_legacy_round_rip, -@@ -67,4 +69,6 @@ RC_GTEST_FIXTURE_PROP( - RC_ASSERT(o == DerivedPath::parse(*store, o.to_string(*store))); - } - -+#endif -+ - } -diff --git a/src/libstore/tests/outputs-spec.cc b/src/libstore/tests/outputs-spec.cc -index 984d1d9..2832cef 100644 ---- a/src/libstore/tests/outputs-spec.cc -+++ b/src/libstore/tests/outputs-spec.cc -@@ -222,6 +222,8 @@ Gen Arbitrary::arbitrary() - - namespace nix { - -+#ifndef COVERAGE -+ - RC_GTEST_PROP( - OutputsSpec, - prop_round_rip, -@@ -230,4 +232,6 @@ RC_GTEST_PROP( - RC_ASSERT(o == OutputsSpec::parse(o.to_string())); - } - -+#endif -+ - } -diff --git a/src/libstore/tests/path.cc b/src/libstore/tests/path.cc -index 430aa00..efa35ef 100644 ---- a/src/libstore/tests/path.cc -+++ b/src/libstore/tests/path.cc -@@ -134,6 +134,8 @@ Gen Arbitrary::arbitrary() - - namespace nix { - -+#ifndef COVERAGE -+ - RC_GTEST_FIXTURE_PROP( - StorePathTest, - prop_regex_accept, -@@ -150,4 +152,6 @@ RC_GTEST_FIXTURE_PROP( - RC_ASSERT(p == store->parseStorePath(store->printStorePath(p))); - } - -+#endif -+ - } +diff --git a/configure.ac b/configure.ac +index e587bd5..f221ae2 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -289,25 +289,7 @@ PKG_CHECK_MODULES([GTEST], [gtest_main]) + + + # Look for rapidcheck. +-AC_ARG_VAR([RAPIDCHECK_HEADERS], [include path of gtest headers shipped by RAPIDCHECK]) +-# No pkg-config yet, https://github.com/emil-e/rapidcheck/issues/302 +-AC_LANG_PUSH(C++) +-AC_SUBST(RAPIDCHECK_HEADERS) +-[CXXFLAGS="-I $RAPIDCHECK_HEADERS $CXXFLAGS"] +-[LIBS="-lrapidcheck -lgtest $LIBS"] +-AC_CHECK_HEADERS([rapidcheck/gtest.h], [], [], [#include ]) +-dnl AC_CHECK_LIB doesn't work for C++ libs with mangled symbols +-AC_LINK_IFELSE([ +- AC_LANG_PROGRAM([[ +- #include +- #include +- ]], [[ +- return RUN_ALL_TESTS(); +- ]]) +- ], +- [], +- [AC_MSG_ERROR([librapidcheck is not found.])]) +-AC_LANG_POP(C++) ++PKG_CHECK_MODULES([RAPIDCHECK], [rapidcheck rapidcheck_gtest]) + + fi + +diff --git a/doc/internal-api/doxygen.cfg.in b/doc/internal-api/doxygen.cfg.in +index 8f52653..c942a28 100644 +--- a/doc/internal-api/doxygen.cfg.in ++++ b/doc/internal-api/doxygen.cfg.in +@@ -60,4 +60,4 @@ INPUT = \ + # RECURSIVE has no effect here. + # This tag requires that the tag SEARCH_INCLUDES is set to YES. + +-INCLUDE_PATH = @RAPIDCHECK_HEADERS@ ++INCLUDE_PATH = diff --git a/system/nix/nix.SlackBuild b/system/nix/nix.SlackBuild index 4abff9ce6..b727606c4 100644 --- a/system/nix/nix.SlackBuild +++ b/system/nix/nix.SlackBuild @@ -105,7 +105,7 @@ find -L . \ # - Added global CFLAGS. # - Changed to ignore offset, since function hasn't still implemented # in Slackware 15's sqlite. -# - Disabled rapidcheck tests in the coverage run. +# - Simplified rapidcheck headers patch -p1 < $CWD/fix_nix_options.patch autoreconf -vfim