From fbdc5549085b1162109e8853799a627f479c5a72 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 26 Jun 2024 21:19:44 -0400 Subject: [PATCH 01/36] Fix Nix shell for building Perl too --- src/perl/package.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/src/perl/package.nix b/src/perl/package.nix index 85f1547b7..e1a84924c 100644 --- a/src/perl/package.nix +++ b/src/perl/package.nix @@ -40,6 +40,7 @@ perl.pkgs.toPerlModule (stdenv.mkDerivation (finalAttrs: { meson ninja pkg-config + perl ]; buildInputs = [ From 31257009e1562e00a4c99dd93e3e31e0c9074522 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 26 Jun 2024 22:15:33 -0400 Subject: [PATCH 02/36] Meson build for libexpr and libflake --- meson.build | 8 +- packaging/components.nix | 5 +- src/libexpr/.version | 1 + src/libexpr/meson.build | 254 +++++++++++++++++++++++++ src/libexpr/meson.options | 3 + src/libexpr/package.nix | 130 +++++++++++++ src/libexpr/primops/fetchTree.cc | 2 +- src/libfetchers/meson.build | 46 ++--- src/libfetchers/package.nix | 7 +- src/libflake/.version | 1 + src/libflake/meson.build | 120 ++++++++++++ src/libflake/package.nix | 99 ++++++++++ src/libstore/meson.build | 40 ++-- src/libstore/package.nix | 3 - tests/unit/libutil-support/meson.build | 39 ++-- tests/unit/libutil/meson.build | 95 ++++----- 16 files changed, 731 insertions(+), 122 deletions(-) create mode 120000 src/libexpr/.version create mode 100644 src/libexpr/meson.build create mode 100644 src/libexpr/meson.options create mode 100644 src/libexpr/package.nix create mode 120000 src/libflake/.version create mode 100644 src/libflake/meson.build create mode 100644 src/libflake/package.nix diff --git a/meson.build b/meson.build index 085ac0865..7832eb488 100644 --- a/meson.build +++ b/meson.build @@ -9,13 +9,19 @@ project('nix-dev-shell', 'cpp', subproject('libutil') subproject('libstore') subproject('libfetchers') -subproject('perl') +subproject('libexpr') +subproject('libflake') + +# Docs subproject('internal-api-docs') subproject('external-api-docs') # C wrappers subproject('libutil-c') +# Language Bindings +subproject('perl') + # Testing subproject('libutil-test-support') subproject('libutil-test') diff --git a/packaging/components.nix b/packaging/components.nix index b5e47969e..01b4e826e 100644 --- a/packaging/components.nix +++ b/packaging/components.nix @@ -19,10 +19,13 @@ in nix-fetchers = callPackage ../src/libfetchers/package.nix { }; - nix-perl-bindings = callPackage ../src/perl/package.nix { }; + nix-expr = callPackage ../src/libexpr/package.nix { }; + + nix-flake = callPackage ../src/libflake/package.nix { }; nix-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { }; nix-external-api-docs = callPackage ../src/external-api-docs/package.nix { }; + nix-perl-bindings = callPackage ../src/perl/package.nix { }; } diff --git a/src/libexpr/.version b/src/libexpr/.version new file mode 120000 index 000000000..b7badcd0c --- /dev/null +++ b/src/libexpr/.version @@ -0,0 +1 @@ +../../.version \ No newline at end of file diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build new file mode 100644 index 000000000..8f08decd4 --- /dev/null +++ b/src/libexpr/meson.build @@ -0,0 +1,254 @@ +project('nix-expr', 'cpp', + version : files('.version'), + default_options : [ + 'cpp_std=c++2a', + # TODO(Qyriad): increase the warning level + 'warning_level=1', + 'debug=true', + 'optimization=2', + 'errorlogs=true', # Please print logs for tests that fail + ], + meson_version : '>= 1.1', + license : 'LGPL-2.1-or-later', +) + +cxx = meson.get_compiler('cpp') + +# See note in ../nix-util/meson.build +deps_private = [ ] + +# See note in ../nix-util/meson.build +deps_public = [ ] + +# See note in ../nix-util/meson.build +deps_public_subproject = [ ] + +# See note in ../nix-util/meson.build +deps_other = [ ] + +configdata = configuration_data() + +foreach nix_dep : [ + dependency('nix-util'), + dependency('nix-store'), + dependency('nix-fetchers'), +] + if nix_dep.type_name() == 'internal' + deps_public_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_public += nix_dep + endif +endforeach + +# This is only conditional to work around +# https://github.com/mesonbuild/meson/issues/13293. It should be +# unconditional. +if not (host_machine.system() == 'windows' and cxx.get_id() == 'gcc') + deps_private += dependency('threads') +endif + +boost = dependency( + 'boost', + modules : ['container', 'context'], +) +# boost is a public dependency, but not a pkg-config dependency unfortunately, so we +# put in `deps_other`. +deps_other += boost + +nlohmann_json = dependency('nlohmann_json', version : '>= 3.9') +deps_public += nlohmann_json + +bdw_gc = dependency('bdw-gc', required : get_option('gc')) +if bdw_gc.found() + deps_public += bdw_gc + foreach funcspec : [ + 'pthread_attr_get_np', + 'pthread_getattr_np', + ] + define_name = 'HAVE_' + funcspec.underscorify().to_upper() + define_value = cxx.has_function(funcspec).to_int() + configdata.set(define_name, define_value) + endforeach + configdata.set('GC_THREADS', 1) +endif +configdata.set('HAVE_BOEHMGC', bdw_gc.found().to_int()) + +config_h = configure_file( + configuration : configdata, + output : 'config-expr.h', +) + +add_project_arguments( + # TODO(Qyriad): Yes this is how the autoconf+Make system did it. + # It would be nice for our headers to be idempotent instead. + '-include', 'config-util.h', + '-include', 'config-store.h', + # '-include', 'config-fetchers.h', + '-include', 'config-expr.h', + '-Wno-deprecated-declarations', + '-Wimplicit-fallthrough', + '-Werror=switch', + '-Werror=switch-enum', + '-Wdeprecated-copy', + '-Wignored-qualifiers', + # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked + # at ~1% overhead in `nix search`. + # + # FIXME: remove when we get meson 1.4.0 which will default this to on for us: + # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions + '-D_GLIBCXX_ASSERTIONS=1', + language : 'cpp', +) + +parser_tab = custom_target( + input : 'parser.y', + output : [ + 'parser-tab.cc', + 'parser-tab.hh', + ], + command : [ + 'bison', + '-v', + '-o', + '@OUTPUT0@', + '@INPUT@', + '-d', + ], + # NOTE(Qyriad): Meson doesn't support installing only part of a custom target, so we add + # an install script below which removes parser-tab.cc. + install : true, + install_dir : get_option('includedir') / 'nix', +) + +lexer_tab = custom_target( + input : [ + 'lexer.l', + parser_tab, + ], + output : [ + 'lexer-tab.cc', + 'lexer-tab.hh', + ], + command : [ + 'flex', + '--outfile', + '@OUTPUT0@', + '--header-file=' + '@OUTPUT1@', + '@INPUT0@', + ], + # NOTE(Qyriad): Meson doesn't support installing only part of a custom target, so we add + # an install script below which removes lexer-tab.cc. + install : true, + install_dir : get_option('includedir') / 'nix', +) + +generated_headers = [] +foreach header : [ + 'imported-drv-to-derivation.nix', + 'fetchurl.nix', + 'flake/call-flake.nix', + 'primops/derivation.nix', +] + generated_headers += custom_target( + command : [ 'bash', '-c', '{ echo \'R"__NIX_STR(\' && cat @INPUT@ && echo \')__NIX_STR"\'; } > "$1"', '_ignored_argv0', '@OUTPUT@' ], + input : header, + output : '@PLAINNAME@.gen.hh', + ) +endforeach + + +sources = files( + 'attr-path.cc', + 'attr-set.cc', + 'eval-cache.cc', + 'eval-error.cc', + 'eval-gc.cc', + 'eval-settings.cc', + 'eval.cc', + 'function-trace.cc', + 'get-drvs.cc', + 'json-to-value.cc', + 'nixexpr.cc', + 'paths.cc', + 'primops.cc', + 'primops/context.cc', + 'primops/fetchClosure.cc', + 'primops/fetchMercurial.cc', + 'primops/fetchTree.cc', + 'primops/fromTOML.cc', + 'print-ambiguous.cc', + 'print.cc', + 'search-path.cc', + 'value-to-json.cc', + 'value-to-xml.cc', + 'value/context.cc', +) + +headers = [config_h] + files( + 'attr-path.hh', + 'attr-set.hh', + 'eval-cache.hh', + 'eval-error.hh', + 'eval-gc.hh', + 'eval-inline.hh', + 'eval-settings.hh', + 'eval.hh', + 'function-trace.hh', + 'gc-small-vector.hh', + 'get-drvs.hh', + 'json-to-value.hh', + 'nixexpr.hh', + 'parser-state.hh', + 'pos-idx.hh', + 'pos-table.hh', + 'primops.hh', + 'print-ambiguous.hh', + 'print-options.hh', + 'print.hh', + 'repl-exit-status.hh', + 'search-path.hh', + 'symbol-table.hh', + 'value-to-json.hh', + 'value-to-xml.hh', + 'value.hh', + 'value/context.hh', +) + +this_library = library( + 'nixexpr', + sources, + parser_tab, + lexer_tab, + generated_headers, + dependencies : deps_public + deps_private + deps_other, + install : true, +) + +install_headers(headers, subdir : 'nix', preserve_path : true) + +requires = [] +foreach dep : deps_public_subproject + requires += dep.name() +endforeach +requires += deps_public + +import('pkgconfig').generate( + this_library, + filebase : meson.project_name(), + name : 'Nix', + description : 'Nix Package Manager', + subdirs : ['nix'], + extra_cflags : ['-std=c++2a'], + requires : requires, + requires_private : deps_private, + libraries_private : ['-lboost_container', '-lboost_context'], +) + +meson.override_dependency(meson.project_name(), declare_dependency( + include_directories : include_directories('.'), + link_with : this_library, + compile_args : ['-std=c++2a'], + dependencies : deps_public_subproject + deps_public, +)) diff --git a/src/libexpr/meson.options b/src/libexpr/meson.options new file mode 100644 index 000000000..242d30ea7 --- /dev/null +++ b/src/libexpr/meson.options @@ -0,0 +1,3 @@ +option('gc', type : 'feature', + description : 'enable garbage collection in the Nix expression evaluator (requires Boehm GC)', +) diff --git a/src/libexpr/package.nix b/src/libexpr/package.nix new file mode 100644 index 000000000..223b04042 --- /dev/null +++ b/src/libexpr/package.nix @@ -0,0 +1,130 @@ +{ lib +, stdenv +, releaseTools + +, meson +, ninja +, pkg-config + +, nix-util +, nix-store +, nix-fetchers +, boost +, boehmgc +, nlohmann_json + +# Configuration Options + +, versionSuffix ? "" + +# Check test coverage of Nix. Probably want to use with at least +# one of `doCheck` or `doInstallCheck` enabled. +, withCoverageChecks ? false + +# Whether to use garbage collection for the Nix language evaluator. +# +# If it is disabled, we just leak memory, but this is not as bad as it +# sounds so long as evaluation just takes places within short-lived +# processes. (When the process exits, the memory is reclaimed; it is +# only leaked *within* the process.) +# +# Temporarily disabled on Windows because the `GC_throw_bad_alloc` +# symbol is missing during linking. +, enableGC ? !stdenv.hostPlatform.isWindows +}: + +let + inherit (lib) fileset; + + version = lib.fileContents ./.version + versionSuffix; + + mkDerivation = + if withCoverageChecks + then + # TODO support `finalAttrs` args function in + # `releaseTools.coverageAnalysis`. + argsFun: + releaseTools.coverageAnalysis (let args = argsFun args; in args) + else stdenv.mkDerivation; +in + +mkDerivation (finalAttrs: { + pname = "nix-expr"; + inherit version; + + src = fileset.toSource { + root = ./.; + fileset = fileset.unions [ + ./meson.build + ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; + }; + + outputs = [ "out" "dev" ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + buildInputs = [ + boost + ]; + + propagatedBuildInputs = [ + nix-util + nix-store + nix-fetchers + nlohmann_json + ] ++ lib.optional enableGC boehmgc; + + disallowedReferences = [ boost ]; + + preConfigure = + # "Inline" .version so it's not a symlink, and includes the suffix + '' + echo ${version} > .version + ''; + + mesonFlags = [ + (lib.mesonFeature "gc" enableGC) + ]; + + env = { + # Needed for Meson to find Boost. + # https://github.com/NixOS/nixpkgs/issues/86131. + BOOST_INCLUDEDIR = "${lib.getDev boost}/include"; + BOOST_LIBRARYDIR = "${lib.getLib boost}/lib"; + } // lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) { + LDFLAGS = "-fuse-ld=gold"; + }; + + enableParallelBuilding = true; + + postInstall = + # Remove absolute path to boost libs that ends up in `Libs.private` + # by default, and would clash with out `disallowedReferences`. Part + # of the https://github.com/NixOS/nixpkgs/issues/45462 workaround. + '' + sed -i "$out/lib/pkgconfig/nix-expr.pc" -e 's, ${lib.getLib boost}[^ ]*,,g' + ''; + + separateDebugInfo = !stdenv.hostPlatform.isStatic; + + # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 + strictDeps = !withCoverageChecks; + + hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; + + meta = { + platforms = lib.platforms.unix ++ lib.platforms.windows; + }; + +} // lib.optionalAttrs withCoverageChecks { + lcovFilter = [ "*/boost/*" "*-tab.*" ]; + + hardeningDisable = [ "fortify" ]; +}) diff --git a/src/libexpr/primops/fetchTree.cc b/src/libexpr/primops/fetchTree.cc index fa6b1c4b6..567b73f9a 100644 --- a/src/libexpr/primops/fetchTree.cc +++ b/src/libexpr/primops/fetchTree.cc @@ -1,4 +1,4 @@ -#include "libfetchers/attrs.hh" +#include "attrs.hh" #include "primops.hh" #include "eval-inline.hh" #include "eval-settings.hh" diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build index d7975ac65..c17021527 100644 --- a/src/libfetchers/meson.build +++ b/src/libfetchers/meson.build @@ -20,27 +20,24 @@ deps_private = [ ] # See note in ../nix-util/meson.build deps_public = [ ] +# See note in ../nix-util/meson.build +deps_public_subproject = [ ] + # See note in ../nix-util/meson.build deps_other = [ ] -configdata = configuration_data() - -nix_util = dependency('nix-util') -if nix_util.type_name() == 'internal' - # subproject sadly no good for pkg-config module - deps_other += nix_util -else - deps_public += nix_util -endif - -nix_store = dependency('nix-store') -if nix_store.type_name() == 'internal' - # subproject sadly no good for pkg-config module - deps_other += nix_store -else - deps_public += nix_store -endif - +foreach nix_dep : [ + dependency('nix-util'), + dependency('nix-store'), +] + if nix_dep.type_name() == 'internal' + deps_public_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_public += nix_dep + endif +endforeach nlohmann_json = dependency('nlohmann_json', version : '>= 3.9') deps_public += nlohmann_json @@ -113,14 +110,9 @@ this_library = library( install_headers(headers, subdir : 'nix', preserve_path : true) requires = [] -if nix_util.type_name() == 'internal' - # `requires` cannot contain declared dependencies (from the - # subproject), so we need to do this manually - requires += 'nix-util' -endif -if nix_store.type_name() == 'internal' - requires += 'nix-store' -endif +foreach dep : deps_public_subproject + requires += dep.name() +endforeach requires += deps_public import('pkgconfig').generate( @@ -138,5 +130,5 @@ meson.override_dependency(meson.project_name(), declare_dependency( include_directories : include_directories('.'), link_with : this_library, compile_args : ['-std=c++2a'], - dependencies : [nix_util, nix_store], + dependencies : deps_public_subproject + deps_public, )) diff --git a/src/libfetchers/package.nix b/src/libfetchers/package.nix index a5583d14c..d2560255e 100644 --- a/src/libfetchers/package.nix +++ b/src/libfetchers/package.nix @@ -38,7 +38,7 @@ let in mkDerivation (finalAttrs: { - pname = "nix-fetchers"; + pname = "nix-flake"; inherit version; src = fileset.toSource { @@ -80,11 +80,6 @@ mkDerivation (finalAttrs: { enableParallelBuilding = true; - postInstall = - # Remove absolute path to boost libs - '' - ''; - separateDebugInfo = !stdenv.hostPlatform.isStatic; # TODO `releaseTools.coverageAnalysis` in Nixpkgs needs to be updated diff --git a/src/libflake/.version b/src/libflake/.version new file mode 120000 index 000000000..b7badcd0c --- /dev/null +++ b/src/libflake/.version @@ -0,0 +1 @@ +../../.version \ No newline at end of file diff --git a/src/libflake/meson.build b/src/libflake/meson.build new file mode 100644 index 000000000..c0862a484 --- /dev/null +++ b/src/libflake/meson.build @@ -0,0 +1,120 @@ +project('nix-flake', 'cpp', + version : files('.version'), + default_options : [ + 'cpp_std=c++2a', + # TODO(Qyriad): increase the warning level + 'warning_level=1', + 'debug=true', + 'optimization=2', + 'errorlogs=true', # Please print logs for tests that fail + ], + meson_version : '>= 1.1', + license : 'LGPL-2.1-or-later', +) + +cxx = meson.get_compiler('cpp') + +# See note in ../nix-util/meson.build +deps_private = [ ] + +# See note in ../nix-util/meson.build +deps_public = [ ] + +# See note in ../nix-util/meson.build +deps_public_subproject = [ ] + +# See note in ../nix-util/meson.build +deps_other = [ ] + +foreach nix_dep : [ + dependency('nix-util'), + dependency('nix-store'), + dependency('nix-fetchers'), + dependency('nix-expr'), +] + if nix_dep.type_name() == 'internal' + deps_public_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_public += nix_dep + endif +endforeach + +nlohmann_json = dependency('nlohmann_json', version : '>= 3.9') +deps_public += nlohmann_json + +libgit2 = dependency('libgit2') +deps_public += libgit2 + +add_project_arguments( + # TODO(Qyriad): Yes this is how the autoconf+Make system did it. + # It would be nice for our headers to be idempotent instead. + '-include', 'config-util.h', + '-include', 'config-store.h', + # '-include', 'config-fetchers.h', + '-include', 'config-expr.h', + '-Wno-deprecated-declarations', + '-Wimplicit-fallthrough', + '-Werror=switch', + '-Werror=switch-enum', + '-Wdeprecated-copy', + '-Wignored-qualifiers', + # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked + # at ~1% overhead in `nix search`. + # + # FIXME: remove when we get meson 1.4.0 which will default this to on for us: + # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions + '-D_GLIBCXX_ASSERTIONS=1', + language : 'cpp', +) + +sources = files( + 'flake-settings.cc', + 'flake/config.cc', + 'flake/flake.cc', + 'flake/flakeref.cc', + 'flake/url-name.cc', + 'flake/lockfile.cc', +) + +headers = files( + 'flake-settings.hh', + 'flake/flake.hh', + 'flake/flakeref.hh', + 'flake/lockfile.hh', + 'flake/url-name.hh', +) + +this_library = library( + 'nixflake', + sources, + dependencies : deps_public + deps_private + deps_other, + install : true, +) + +install_headers(headers, subdir : 'nix', preserve_path : true) + +requires = [] +foreach dep : deps_public_subproject + requires += dep.name() +endforeach +requires += deps_public + +import('pkgconfig').generate( + this_library, + filebase : meson.project_name(), + name : 'Nix', + description : 'Nix Package Manager', + subdirs : ['nix'], + extra_cflags : ['-std=c++2a'], + requires : requires, + requires_private : deps_private, +) + +meson.override_dependency(meson.project_name(), declare_dependency( + include_directories : include_directories('.'), + link_with : this_library, + compile_args : ['-std=c++2a'], + dependencies : deps_public_subproject + deps_public, +)) diff --git a/src/libflake/package.nix b/src/libflake/package.nix new file mode 100644 index 000000000..1280df7b7 --- /dev/null +++ b/src/libflake/package.nix @@ -0,0 +1,99 @@ +{ lib +, stdenv +, releaseTools + +, meson +, ninja +, pkg-config + +, nix-util +, nix-store +, nix-fetchers +, nix-expr +, nlohmann_json +, libgit2 +, man + +# Configuration Options + +, versionSuffix ? "" + +# Check test coverage of Nix. Probably want to use with with at least +# one of `doCheck` or `doInstallCheck` enabled. +, withCoverageChecks ? false + +}: + +let + inherit (lib) fileset; + + version = lib.fileContents ./.version + versionSuffix; + + mkDerivation = + if withCoverageChecks + then + # TODO support `finalAttrs` args function in + # `releaseTools.coverageAnalysis`. + argsFun: + releaseTools.coverageAnalysis (let args = argsFun args; in args) + else stdenv.mkDerivation; +in + +mkDerivation (finalAttrs: { + pname = "nix-flake"; + inherit version; + + src = fileset.toSource { + root = ./.; + fileset = fileset.unions [ + ./meson.build + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; + }; + + outputs = [ "out" "dev" ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + propagatedBuildInputs = [ + nix-store + nix-util + nix-fetchers + nix-expr + nlohmann_json + ]; + + preConfigure = + # "Inline" .version so its not a symlink, and includes the suffix + '' + echo ${version} > .version + ''; + + env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) { + LDFLAGS = "-fuse-ld=gold"; + }; + + enableParallelBuilding = true; + + separateDebugInfo = !stdenv.hostPlatform.isStatic; + + # TODO `releaseTools.coverageAnalysis` in Nixpkgs needs to be updated + # to work with `strictDeps`. + strictDeps = !withCoverageChecks; + + hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; + + meta = { + platforms = lib.platforms.unix ++ lib.platforms.windows; + }; + +} // lib.optionalAttrs withCoverageChecks { + lcovFilter = [ "*-tab.*" ]; + + hardeningDisable = ["fortify"]; +}) diff --git a/src/libstore/meson.build b/src/libstore/meson.build index d9237c55a..c2384dd78 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -20,6 +20,9 @@ deps_private = [ ] # See note in ../nix-util/meson.build deps_public = [ ] +# See note in ../nix-util/meson.build +deps_public_subproject = [ ] + # See note in ../nix-util/meson.build deps_other = [ ] @@ -30,13 +33,17 @@ configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) configdata.set_quoted('SYSTEM', host_machine.system()) -nix_util = dependency('nix-util') -if nix_util.type_name() == 'internal' - # subproject sadly no good for pkg-config module - deps_other += nix_util -else - deps_public += nix_util -endif +foreach nix_dep : [ + dependency('nix-util'), +] + if nix_dep.type_name() == 'internal' + deps_public_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_public += nix_dep + endif +endforeach run_command('ln', '-s', meson.project_build_root() / '__nothing_link_target', @@ -122,13 +129,16 @@ if enable_embedded_sandbox_shell endif generated_headers = [] -foreach header : [ 'schema.sql', 'ca-specific-schema.sql' ] +foreach header : [ + 'schema.sql', + 'ca-specific-schema.sql', +] generated_headers += custom_target( command : [ 'bash', '-c', '{ echo \'R"__NIX_STR(\' && cat @INPUT@ && echo \')__NIX_STR"\'; } > "$1"', '_ignored_argv0', '@OUTPUT@' ], input : header, output : '@PLAINNAME@.gen.hh', install : true, - install_dir : get_option('includedir') / 'nix' + install_dir : get_option('includedir') / 'nix', ) endforeach @@ -248,7 +258,7 @@ include_dirs = [ include_directories('build'), ] -headers = [config_h] +files( +headers = [config_h] + files( 'binary-cache-store.hh', 'build-result.hh', 'build/derivation-goal.hh', @@ -427,11 +437,9 @@ this_library = library( install_headers(headers, subdir : 'nix', preserve_path : true) requires = [] -if nix_util.type_name() == 'internal' - # `requires` cannot contain declared dependencies (from the - # subproject), so we need to do this manually - requires += 'nix-util' -endif +foreach dep : deps_public_subproject + requires += dep.name() +endforeach requires += deps_public import('pkgconfig').generate( @@ -450,5 +458,5 @@ meson.override_dependency(meson.project_name(), declare_dependency( include_directories : include_dirs, link_with : this_library, compile_args : ['-std=c++2a'], - dependencies : [nix_util], + dependencies : deps_public_subproject + deps_public, )) diff --git a/src/libstore/package.nix b/src/libstore/package.nix index e118f3cd2..f27dac2f6 100644 --- a/src/libstore/package.nix +++ b/src/libstore/package.nix @@ -23,9 +23,6 @@ # Check test coverage of Nix. Probably want to use with at least # one of `doCheck` or `doInstallCheck` enabled. , withCoverageChecks ? false - -# Avoid setting things that would interfere with a functioning devShell -, forDevShell ? false }: let diff --git a/tests/unit/libutil-support/meson.build b/tests/unit/libutil-support/meson.build index c0345a6ee..d5ee8eed7 100644 --- a/tests/unit/libutil-support/meson.build +++ b/tests/unit/libutil-support/meson.build @@ -20,9 +20,27 @@ deps_private = [ ] # See note in ../nix-util/meson.build deps_public = [ ] +# See note in ../nix-util/meson.build +deps_public_subproject = [ ] + # See note in ../nix-util/meson.build deps_other = [ ] +foreach nix_dep : [ + dependency('nix-util'), +] + if nix_dep.type_name() == 'internal' + deps_public_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_public += nix_dep + endif +endforeach + +rapidcheck = dependency('rapidcheck') +deps_public += rapidcheck + add_project_arguments( '-Wno-deprecated-declarations', '-Wimplicit-fallthrough', @@ -66,17 +84,6 @@ else linker_export_flags = [] endif -nix_util = dependency('nix-util') -if nix_util.type_name() == 'internal' - # subproject sadly no good for pkg-config module - deps_other += nix_util -else - deps_public += nix_util -endif - -rapidcheck = dependency('rapidcheck') -deps_public += rapidcheck - this_library = library( 'nix-util-test-support', sources, @@ -90,7 +97,11 @@ this_library = library( install_headers(headers, subdir : 'nix', preserve_path : true) -libraries_private = [] +requires = [] +foreach dep : deps_public_subproject + requires += dep.name() +endforeach +requires += deps_public import('pkgconfig').generate( this_library, @@ -99,7 +110,7 @@ import('pkgconfig').generate( description : 'Nix Package Manager', subdirs : ['nix'], extra_cflags : ['-std=c++2a'], - requires : deps_public, + requires : requires, requires_private : deps_private, ) @@ -107,5 +118,5 @@ meson.override_dependency(meson.project_name(), declare_dependency( include_directories : include_dirs, link_with : this_library, compile_args : ['-std=c++2a'], - dependencies : [], + dependencies : deps_public_subproject + deps_public, )) diff --git a/tests/unit/libutil/meson.build b/tests/unit/libutil/meson.build index cc13c4364..3f6e0fe65 100644 --- a/tests/unit/libutil/meson.build +++ b/tests/unit/libutil/meson.build @@ -18,18 +18,57 @@ cxx = meson.get_compiler('cpp') deps_private = [ ] # See note in ../nix-util/meson.build -deps_public = [ ] +deps_private_subproject = [ ] # See note in ../nix-util/meson.build deps_other = [ ] configdata = configuration_data() +# TODO rename, because it will conflict with downstream projects +configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) + +foreach nix_dep : [ + dependency('nix-util'), + dependency('nix-util-c'), + dependency('nix-util-test-support'), +] + if nix_dep.type_name() == 'internal' + deps_private_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_private += nix_dep + endif +endforeach + +if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' + # Windows DLLs are stricter about symbol visibility than Unix shared + # objects --- see https://gcc.gnu.org/wiki/Visibility for details. + # This is a temporary sledgehammer to export everything like on Unix, + # and not detail with this yet. + # + # TODO do not do this, and instead do fine-grained export annotations. + linker_export_flags = ['-Wl,--export-all-symbols'] +else + linker_export_flags = [] +endif + +rapidcheck = dependency('rapidcheck') +deps_private += rapidcheck + +gtest = dependency('gtest', main : true) +deps_private += gtest + +config_h = configure_file( + configuration : configdata, + output : 'config-util-test.h', +) + add_project_arguments( # TODO(Qyriad): Yes this is how the autoconf+Make system did it. # It would be nice for our headers to be idempotent instead. '-include', 'config-util-test.h', - # '-include', 'config-store.h', '-Wno-deprecated-declarations', '-Wimplicit-fallthrough', '-Werror=switch', @@ -46,14 +85,6 @@ add_project_arguments( language : 'cpp', ) -# TODO rename, because it will conflict with downstream projects -configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) - -config_h = configure_file( - configuration : configdata, - output : 'config-util-test.h', -) - sources = files( 'args.cc', 'canon-path.cc', @@ -80,52 +111,11 @@ sources = files( include_dirs = [include_directories('.')] -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif - -nix_util = dependency('nix-util') -if nix_util.type_name() == 'internal' - # subproject sadly no good for pkg-config module - deps_other += nix_util -else - deps_public += nix_util -endif - -nix_util_c = dependency('nix-util-c') -if nix_util_c.type_name() == 'internal' - # subproject sadly no good for pkg-config module - deps_other += nix_util_c -else - deps_public += nix_util_c -endif - -nix_util_test_support = dependency('nix-util-test-support') -if nix_util_test_support.type_name() == 'internal' - # subproject sadly no good for pkg-config module - deps_other += nix_util_test_support -else - deps_public += nix_util_test_support -endif - -rapidcheck = dependency('rapidcheck') -deps_public += rapidcheck - -gtest = dependency('gtest', main : true) -deps_public += gtest this_exe = executable( 'nix-util-test', sources, - dependencies : deps_public + deps_private + deps_other, + dependencies : deps_private_subproject + deps_private + deps_other, include_directories : include_dirs, # TODO: -lrapidcheck, see ../libutil-support/build.meson link_args: linker_export_flags + ['-lrapidcheck'], @@ -139,5 +129,4 @@ meson.override_dependency(meson.project_name(), declare_dependency( include_directories : include_dirs, link_with : this_exe, compile_args : ['-std=c++2a'], - dependencies : [], )) From 4fa8068b78444f691a9a3d3c16efdcfcd540ce9a Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 10:19:03 -0400 Subject: [PATCH 03/36] Mesonify other external API --- meson.build | 7 ++ src/libexpr-c/.version | 1 + src/libexpr-c/meson.build | 159 ++++++++++++++++++++++++++++++++++++ src/libexpr/meson.build | 8 +- src/libfetchers/meson.build | 4 +- src/libflake/meson.build | 6 +- src/libstore-c/.version | 1 + src/libstore-c/meson.build | 151 ++++++++++++++++++++++++++++++++++ src/libstore/meson.build | 6 +- src/libutil-c/meson.build | 81 ++++++++++++------ src/libutil/meson.build | 4 +- src/perl/lib/Nix/Store.xs | 4 +- 12 files changed, 392 insertions(+), 40 deletions(-) create mode 120000 src/libexpr-c/.version create mode 100644 src/libexpr-c/meson.build create mode 120000 src/libstore-c/.version create mode 100644 src/libstore-c/meson.build diff --git a/meson.build b/meson.build index 7832eb488..2a3932a40 100644 --- a/meson.build +++ b/meson.build @@ -18,6 +18,8 @@ subproject('external-api-docs') # C wrappers subproject('libutil-c') +subproject('libstore-c') +subproject('libexpr-c') # Language Bindings subproject('perl') @@ -25,3 +27,8 @@ subproject('perl') # Testing subproject('libutil-test-support') subproject('libutil-test') +#subproject('libstore-test-support') +#subproject('libstore-test') +#subproject('libexpr-test-support') +#subproject('libexpr-test') +#subproject('libflake-test') diff --git a/src/libexpr-c/.version b/src/libexpr-c/.version new file mode 120000 index 000000000..b7badcd0c --- /dev/null +++ b/src/libexpr-c/.version @@ -0,0 +1 @@ +../../.version \ No newline at end of file diff --git a/src/libexpr-c/meson.build b/src/libexpr-c/meson.build new file mode 100644 index 000000000..5abf2b477 --- /dev/null +++ b/src/libexpr-c/meson.build @@ -0,0 +1,159 @@ +project('nix-expr-c', 'cpp', + version : files('.version'), + default_options : [ + 'cpp_std=c++2a', + # TODO(Qyriad): increase the warning level + 'warning_level=1', + 'debug=true', + 'optimization=2', + 'errorlogs=true', # Please print logs for tests that fail + ], + meson_version : '>= 1.1', + license : 'LGPL-2.1-or-later', +) + +cxx = meson.get_compiler('cpp') + +# See note in ../nix-util/meson.build +deps_private = [ ] + +# See note in ../nix-util/meson.build +deps_private_subproject = [ ] + +# See note in ../nix-util/meson.build +deps_public = [ ] + +# See note in ../nix-util/meson.build +deps_public_subproject = [ ] + +# See note in ../nix-util/meson.build +deps_other = [ ] + +configdata = configuration_data() + +foreach nix_dep : [ + dependency('nix-util'), + dependency('nix-store'), + dependency('nix-expr'), +] + if nix_dep.type_name() == 'internal' + deps_private_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_private += nix_dep + endif +endforeach + +foreach nix_dep : [ + dependency('nix-util-c'), + dependency('nix-store-c'), +] + if nix_dep.type_name() == 'internal' + deps_public_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_public += nix_dep + endif +endforeach + +config_h = configure_file( + configuration : configdata, + output : 'config-expr.h', +) + +add_project_arguments( + # TODO(Qyriad): Yes this is how the autoconf+Make system did it. + # It would be nice for our headers to be idempotent instead. + + # From C++ libraries, only for internals + '-include', 'config-util.hh', + '-include', 'config-store.hh', + '-include', 'config-expr.hh', + + # From C libraries, for our public, installed headers too + '-include', 'config-util.h', + '-include', 'config-store.h', + '-include', 'config-expr.h', + '-Wno-deprecated-declarations', + '-Wimplicit-fallthrough', + '-Werror=switch', + '-Werror=switch-enum', + '-Wdeprecated-copy', + '-Wignored-qualifiers', + # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked + # at ~1% overhead in `nix search`. + # + # FIXME: remove when we get meson 1.4.0 which will default this to on for us: + # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions + '-D_GLIBCXX_ASSERTIONS=1', + language : 'cpp', +) + +sources = files( + 'nix_api_expr.cc', + 'nix_api_external.cc', + 'nix_api_value.cc', +) + +include_dirs = [include_directories('.')] + +headers = [config_h] + files( + 'nix_api_expr.h', + 'nix_api_external.h', + 'nix_api_value.h', +) + +if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' + # Windows DLLs are stricter ab_subprojectout symbol visibility than Unix shared + # objects --- see https://gcc.gnu.org/wiki/Visibility for details. + # This is a temporary sledgehammer to export everything like on Unix, + # and not detail with this yet. + # + # TODO do not do this, and instead do fine-grained export annotations. + linker_export_flags = ['-Wl,--export-all-symbols'] +else + linker_export_flags = [] +endif + +this_library = library( + 'nixexprc', + sources, + dependencies : deps_public + deps_private + deps_other, + include_directories : include_dirs, + link_args: linker_export_flags, + install : true, +) + +install_headers(headers, subdir : 'nix', preserve_path : true) + +requires_private = [] +foreach dep : deps_private_subproject + requires_private += dep.name() +endforeach +requires_private += deps_private + +requires_public = [] +foreach dep : deps_public_subproject + requires_public += dep.name() +endforeach +requires_public += deps_public + +import('pkgconfig').generate( + this_library, + filebase : meson.project_name(), + name : 'Nix', + description : 'Nix Package Manager', + subdirs : ['nix'], + extra_cflags : ['-std=c++2a'], + requires : requires_public, + requires_private : requires_private, +) + +meson.override_dependency(meson.project_name(), declare_dependency( + include_directories : include_dirs, + link_with : this_library, + compile_args : ['-std=c++2a'], + dependencies : [], +)) diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index 8f08decd4..34e4dec3b 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -77,16 +77,16 @@ configdata.set('HAVE_BOEHMGC', bdw_gc.found().to_int()) config_h = configure_file( configuration : configdata, - output : 'config-expr.h', + output : 'config-expr.hh', ) add_project_arguments( # TODO(Qyriad): Yes this is how the autoconf+Make system did it. # It would be nice for our headers to be idempotent instead. - '-include', 'config-util.h', - '-include', 'config-store.h', + '-include', 'config-util.hh', + '-include', 'config-store.hh', # '-include', 'config-fetchers.h', - '-include', 'config-expr.h', + '-include', 'config-expr.hh', '-Wno-deprecated-declarations', '-Wimplicit-fallthrough', '-Werror=switch', diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build index c17021527..938ee27d4 100644 --- a/src/libfetchers/meson.build +++ b/src/libfetchers/meson.build @@ -48,8 +48,8 @@ deps_public += libgit2 add_project_arguments( # TODO(Qyriad): Yes this is how the autoconf+Make system did it. # It would be nice for our headers to be idempotent instead. - '-include', 'config-util.h', - '-include', 'config-store.h', + '-include', 'config-util.hh', + '-include', 'config-store.hh', # '-include', 'config-fetchers.h', '-Wno-deprecated-declarations', '-Wimplicit-fallthrough', diff --git a/src/libflake/meson.build b/src/libflake/meson.build index c0862a484..1c0a3ae77 100644 --- a/src/libflake/meson.build +++ b/src/libflake/meson.build @@ -50,10 +50,10 @@ deps_public += libgit2 add_project_arguments( # TODO(Qyriad): Yes this is how the autoconf+Make system did it. # It would be nice for our headers to be idempotent instead. - '-include', 'config-util.h', - '-include', 'config-store.h', + '-include', 'config-util.hh', + '-include', 'config-store.hh', # '-include', 'config-fetchers.h', - '-include', 'config-expr.h', + '-include', 'config-expr.hh', '-Wno-deprecated-declarations', '-Wimplicit-fallthrough', '-Werror=switch', diff --git a/src/libstore-c/.version b/src/libstore-c/.version new file mode 120000 index 000000000..b7badcd0c --- /dev/null +++ b/src/libstore-c/.version @@ -0,0 +1 @@ +../../.version \ No newline at end of file diff --git a/src/libstore-c/meson.build b/src/libstore-c/meson.build new file mode 100644 index 000000000..049dda0e2 --- /dev/null +++ b/src/libstore-c/meson.build @@ -0,0 +1,151 @@ +project('nix-store-c', 'cpp', + version : files('.version'), + default_options : [ + 'cpp_std=c++2a', + # TODO(Qyriad): increase the warning level + 'warning_level=1', + 'debug=true', + 'optimization=2', + 'errorlogs=true', # Please print logs for tests that fail + ], + meson_version : '>= 1.1', + license : 'LGPL-2.1-or-later', +) + +cxx = meson.get_compiler('cpp') + +# See note in ../nix-util/meson.build +deps_private = [ ] + +# See note in ../nix-util/meson.build +deps_private_subproject = [ ] + +# See note in ../nix-util/meson.build +deps_public = [ ] + +# See note in ../nix-util/meson.build +deps_public_subproject = [ ] + +# See note in ../nix-util/meson.build +deps_other = [ ] + +configdata = configuration_data() + +foreach nix_dep : [ + dependency('nix-util'), + dependency('nix-store'), +] + if nix_dep.type_name() == 'internal' + deps_private_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_private += nix_dep + endif +endforeach + +foreach nix_dep : [ + dependency('nix-util-c'), +] + if nix_dep.type_name() == 'internal' + deps_public_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_public += nix_dep + endif +endforeach + +config_h = configure_file( + configuration : configdata, + output : 'config-store.h', +) + +add_project_arguments( + # TODO(Qyriad): Yes this is how the autoconf+Make system did it. + # It would be nice for our headers to be idempotent instead. + + # From C++ libraries, only for internals + '-include', 'config-util.hh', + '-include', 'config-store.hh', + + # From C libraries, for our public, installed headers too + '-include', 'config-util.h', + '-include', 'config-store.h', + '-Wno-deprecated-declarations', + '-Wimplicit-fallthrough', + '-Werror=switch', + '-Werror=switch-enum', + '-Wdeprecated-copy', + '-Wignored-qualifiers', + # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked + # at ~1% overhead in `nix search`. + # + # FIXME: remove when we get meson 1.4.0 which will default this to on for us: + # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions + '-D_GLIBCXX_ASSERTIONS=1', + language : 'cpp', +) + +sources = files( + 'nix_api_store.cc', +) + +include_dirs = [include_directories('.')] + +headers = [config_h] + files( + 'nix_api_store.h', +) + +if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' + # Windows DLLs are stricter ab_subprojectout symbol visibility than Unix shared + # objects --- see https://gcc.gnu.org/wiki/Visibility for details. + # This is a temporary sledgehammer to export everything like on Unix, + # and not detail with this yet. + # + # TODO do not do this, and instead do fine-grained export annotations. + linker_export_flags = ['-Wl,--export-all-symbols'] +else + linker_export_flags = [] +endif + +this_library = library( + 'nixstorec', + sources, + dependencies : deps_public + deps_private + deps_other, + include_directories : include_dirs, + link_args: linker_export_flags, + install : true, +) + +install_headers(headers, subdir : 'nix', preserve_path : true) + +requires_private = [] +foreach dep : deps_private_subproject + requires_private += dep.name() +endforeach +requires_private += deps_private + +requires_public = [] +foreach dep : deps_public_subproject + requires_public += dep.name() +endforeach +requires_public += deps_public + +import('pkgconfig').generate( + this_library, + filebase : meson.project_name(), + name : 'Nix', + description : 'Nix Package Manager', + subdirs : ['nix'], + extra_cflags : ['-std=c++2a'], + requires : requires_public, + requires_private : requires_private, +) + +meson.override_dependency(meson.project_name(), declare_dependency( + include_directories : include_dirs, + link_with : this_library, + compile_args : ['-std=c++2a'], + dependencies : [], +)) diff --git a/src/libstore/meson.build b/src/libstore/meson.build index c2384dd78..7277eb49d 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -162,14 +162,14 @@ endif config_h = configure_file( configuration : configdata, - output : 'config-store.h', + output : 'config-store.hh', ) add_project_arguments( # TODO(Qyriad): Yes this is how the autoconf+Make system did it. # It would be nice for our headers to be idempotent instead. - '-include', 'config-util.h', - '-include', 'config-store.h', + '-include', 'config-util.hh', + '-include', 'config-store.hh', '-Wno-deprecated-declarations', '-Wimplicit-fallthrough', '-Werror=switch', diff --git a/src/libutil-c/meson.build b/src/libutil-c/meson.build index 5de288e18..7ebbe3d06 100644 --- a/src/libutil-c/meson.build +++ b/src/libutil-c/meson.build @@ -17,19 +17,60 @@ cxx = meson.get_compiler('cpp') # See note in ../nix-util/meson.build deps_private = [ ] +# See note in ../nix-util/meson.build +deps_private_subproject = [ ] + # See note in ../nix-util/meson.build deps_public = [ ] +# See note in ../nix-util/meson.build +deps_public_subproject = [ ] + # See note in ../nix-util/meson.build deps_other = [ ] configdata = configuration_data() +foreach nix_dep : [ + dependency('nix-util'), +] + if nix_dep.type_name() == 'internal' + deps_private_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_private += nix_dep + endif +endforeach + +foreach nix_dep : [ +] + if nix_dep.type_name() == 'internal' + deps_public_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_public += nix_dep + endif +endforeach + +# TODO rename, because it will conflict with downstream projects +configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) + +config_h = configure_file( + configuration : configdata, + output : 'config-util.h', +) + add_project_arguments( # TODO(Qyriad): Yes this is how the autoconf+Make system did it. # It would be nice for our headers to be idempotent instead. + + # From C++ libraries, only for internals + '-include', 'config-util.hh', + + # From C libraries, for our public, installed headers too '-include', 'config-util.h', - # '-include', 'config-store.h', '-Wno-deprecated-declarations', '-Wimplicit-fallthrough', '-Werror=switch', @@ -52,13 +93,12 @@ sources = files( include_dirs = [include_directories('.')] -headers = files( +headers = [config_h] + files( 'nix_api_util.h', - 'nix_api_util_internal.h', ) if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared + # Windows DLLs are stricter ab_subprojectout symbol visibility than Unix shared # objects --- see https://gcc.gnu.org/wiki/Visibility for details. # This is a temporary sledgehammer to export everything like on Unix, # and not detail with this yet. @@ -69,22 +109,6 @@ else linker_export_flags = [] endif -nix_util = dependency('nix-util') -if nix_util.type_name() == 'internal' - # subproject sadly no good for pkg-config module - deps_other += nix_util -else - deps_public += nix_util -endif - -# TODO rename, because it will conflict with downstream projects -configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) - -config_h = configure_file( - configuration : configdata, - output : 'config-util.h', -) - this_library = library( 'nixutilc', sources, @@ -96,7 +120,17 @@ this_library = library( install_headers(headers, subdir : 'nix', preserve_path : true) -libraries_private = [] +requires_private = [] +foreach dep : deps_private_subproject + requires_private += dep.name() +endforeach +requires_private += deps_private + +requires_public = [] +foreach dep : deps_public_subproject + requires_public += dep.name() +endforeach +requires_public += deps_public import('pkgconfig').generate( this_library, @@ -105,9 +139,8 @@ import('pkgconfig').generate( description : 'Nix Package Manager', subdirs : ['nix'], extra_cflags : ['-std=c++2a'], - requires : deps_public, - requires_private : deps_private, - libraries_private : libraries_private, + requires : requires_public, + requires_private : requires_private, ) meson.override_dependency(meson.project_name(), declare_dependency( diff --git a/src/libutil/meson.build b/src/libutil/meson.build index 099c0c65f..c9dfee651 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -132,13 +132,13 @@ deps_public += nlohmann_json config_h = configure_file( configuration : configdata, - output : 'config-util.h', + output : 'config-util.hh', ) add_project_arguments( # TODO(Qyriad): Yes this is how the autoconf+Make system did it. # It would be nice for our headers to be idempotent instead. - '-include', 'config-util.h', + '-include', 'config-util.hh', '-Wno-deprecated-declarations', '-Wimplicit-fallthrough', '-Werror=switch', diff --git a/src/perl/lib/Nix/Store.xs b/src/perl/lib/Nix/Store.xs index acce25f3a..f951437c8 100644 --- a/src/perl/lib/Nix/Store.xs +++ b/src/perl/lib/Nix/Store.xs @@ -1,5 +1,5 @@ -#include "config-util.h" -#include "config-store.h" +#include "config-util.hh" +#include "config-store.hh" #include "EXTERN.h" #include "perl.h" From 17a8c2bfce97bc857ddd519ae7054d7d930ced39 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 11:28:08 -0400 Subject: [PATCH 04/36] Unit tests and external libraries --- .gitignore | 10 +- Makefile | 19 --- Makefile.config.in | 1 - configure.ac | 22 --- doc/manual/src/contributing/hacking.md | 1 - doc/manual/src/contributing/testing.md | 10 +- maintainers/flake-module.nix | 122 ++++++++-------- meson.build | 11 +- mk/common-test.sh | 2 +- package.nix | 35 +---- packaging/components.nix | 32 ++++- src/internal-api-docs/doxygen.cfg.in | 42 +++--- src/internal-api-docs/package.nix | 1 - src/libexpr-test-support/.version | 1 + src/libexpr-test-support/meson.build | 128 +++++++++++++++++ .../libexpr-test-support}/tests/libexpr.hh | 0 .../tests/nix_api_expr.hh | 0 .../tests/value/context.cc | 0 .../tests/value/context.hh | 0 src/libexpr-test/.version | 1 + .../libexpr-test}/derived-path.cc | 0 .../libexpr-test}/error_traces.cc | 0 .../unit/libexpr => src/libexpr-test}/eval.cc | 0 .../unit/libexpr => src/libexpr-test}/json.cc | 0 .../unit/libexpr => src/libexpr-test}/main.cc | 0 src/libexpr-test/meson.build | 125 +++++++++++++++++ .../libexpr-test}/nix_api_expr.cc | 0 .../libexpr-test}/nix_api_external.cc | 0 .../libexpr-test}/nix_api_value.cc | 0 .../libexpr => src/libexpr-test}/primops.cc | 0 .../libexpr-test}/search-path.cc | 0 .../libexpr => src/libexpr-test}/trivial.cc | 0 .../libexpr-test}/value/context.cc | 0 .../libexpr-test}/value/print.cc | 0 .../libexpr-test}/value/value.cc | 0 src/libfetchers-test/.version | 1 + .../data/public-key/defaultType.json | 0 .../data/public-key/noRoundTrip.json | 0 .../data/public-key/simple.json | 0 src/libfetchers-test/meson.build | 109 +++++++++++++++ .../libfetchers-test}/public-key.cc | 0 src/libflake-test/.version | 1 + .../libflake-test}/flakeref.cc | 0 src/libflake-test/meson.build | 114 +++++++++++++++ .../libflake-test}/url-name.cc | 0 src/libstore-test-support/.version | 1 + src/libstore-test-support/meson.build | 130 ++++++++++++++++++ .../tests/derived-path.cc | 0 .../tests/derived-path.hh | 0 .../libstore-test-support}/tests/libstore.hh | 0 .../tests/nix_api_store.hh | 0 .../tests/outputs-spec.cc | 0 .../tests/outputs-spec.hh | 0 .../libstore-test-support}/tests/path.cc | 0 .../libstore-test-support}/tests/path.hh | 0 .../libstore-test-support}/tests/protocol.hh | 0 src/libstore-test/.version | 1 + .../libstore-test}/common-protocol.cc | 0 .../libstore-test}/content-address.cc | 0 .../data/common-protocol/content-address.bin | Bin .../data/common-protocol/drv-output.bin | Bin .../optional-content-address.bin | Bin .../common-protocol/optional-store-path.bin | Bin .../data/common-protocol/realisation.bin | Bin .../data/common-protocol/set.bin | Bin .../data/common-protocol/store-path.bin | Bin .../data/common-protocol/string.bin | Bin .../data/common-protocol/vector.bin | Bin .../advanced-attributes-defaults.drv | 0 .../advanced-attributes-defaults.json | 0 ...d-attributes-structured-attrs-defaults.drv | 0 ...-attributes-structured-attrs-defaults.json | 0 .../advanced-attributes-structured-attrs.drv | 0 .../advanced-attributes-structured-attrs.json | 0 .../data/derivation/advanced-attributes.drv | 0 .../derivation/bad-old-version-dyn-deps.drv | 0 .../data/derivation/bad-version.drv | 0 .../data/derivation/dynDerivationDeps.drv | 0 .../data/derivation/dynDerivationDeps.json | 0 .../data/derivation/output-caFixedFlat.json | 0 .../data/derivation/output-caFixedNAR.json | 0 .../data/derivation/output-caFixedText.json | 0 .../data/derivation/output-caFloating.json | 0 .../data/derivation/output-deferred.json | 0 .../data/derivation/output-impure.json | 0 .../derivation/output-inputAddressed.json | 0 .../libstore-test}/data/derivation/simple.drv | 0 .../data/derivation/simple.json | 0 .../libstore-test}/data/machines/bad_format | 0 .../libstore-test}/data/machines/valid | 0 .../libstore-test}/data/nar-info/impure.json | 0 .../libstore-test}/data/nar-info/pure.json | 0 .../data/path-info/empty_impure.json | 0 .../data/path-info/empty_pure.json | 0 .../libstore-test}/data/path-info/impure.json | 0 .../libstore-test}/data/path-info/pure.json | 0 .../data/serve-protocol/build-options-2.1.bin | Bin .../data/serve-protocol/build-options-2.2.bin | Bin .../data/serve-protocol/build-options-2.3.bin | Bin .../data/serve-protocol/build-options-2.7.bin | Bin .../data/serve-protocol/build-result-2.2.bin | Bin .../data/serve-protocol/build-result-2.3.bin | Bin .../data/serve-protocol/build-result-2.6.bin | Bin .../data/serve-protocol/content-address.bin | Bin .../data/serve-protocol/drv-output.bin | Bin .../serve-protocol/handshake-to-client.bin | Bin .../optional-content-address.bin | Bin .../serve-protocol/optional-store-path.bin | Bin .../data/serve-protocol/realisation.bin | Bin .../data/serve-protocol/set.bin | Bin .../data/serve-protocol/store-path.bin | Bin .../data/serve-protocol/string.bin | Bin .../unkeyed-valid-path-info-2.3.bin | Bin .../unkeyed-valid-path-info-2.4.bin | Bin .../data/serve-protocol/vector.bin | Bin .../data/store-reference/auto.txt | 0 .../data/store-reference/auto_param.txt | 0 .../data/store-reference/local_1.txt | 0 .../data/store-reference/local_2.txt | 0 .../store-reference/local_shorthand_1.txt | 0 .../store-reference/local_shorthand_2.txt | 0 .../data/store-reference/ssh.txt | 0 .../data/store-reference/unix.txt | 0 .../data/store-reference/unix_shorthand.txt | 0 .../data/worker-protocol/build-mode.bin | Bin .../worker-protocol/build-result-1.27.bin | Bin .../worker-protocol/build-result-1.28.bin | Bin .../worker-protocol/build-result-1.29.bin | Bin .../worker-protocol/build-result-1.37.bin | Bin .../client-handshake-info_1_30.bin | 0 .../client-handshake-info_1_33.bin | Bin .../client-handshake-info_1_35.bin | Bin .../data/worker-protocol/content-address.bin | Bin .../worker-protocol/derived-path-1.29.bin | Bin .../worker-protocol/derived-path-1.30.bin | Bin .../data/worker-protocol/drv-output.bin | Bin .../worker-protocol/handshake-to-client.bin | Bin .../keyed-build-result-1.29.bin | Bin .../optional-content-address.bin | Bin .../worker-protocol/optional-store-path.bin | Bin .../worker-protocol/optional-trusted-flag.bin | Bin .../data/worker-protocol/realisation.bin | Bin .../data/worker-protocol/set.bin | Bin .../data/worker-protocol/store-path.bin | Bin .../data/worker-protocol/string.bin | Bin .../unkeyed-valid-path-info-1.15.bin | Bin .../worker-protocol/valid-path-info-1.15.bin | Bin .../worker-protocol/valid-path-info-1.16.bin | Bin .../data/worker-protocol/vector.bin | Bin .../derivation-advanced-attrs.cc | 0 .../libstore-test}/derivation.cc | 0 .../libstore-test}/derived-path.cc | 0 .../libstore-test}/downstream-placeholder.cc | 0 .../libstore-test}/machines.cc | 0 src/libstore-test/meson.build | 123 +++++++++++++++++ .../libstore-test}/nar-info-disk-cache.cc | 0 .../libstore-test}/nar-info.cc | 0 .../libstore-test}/nix_api_store.cc | 0 .../libstore-test}/outputs-spec.cc | 0 .../libstore-test}/path-info.cc | 0 .../libstore => src/libstore-test}/path.cc | 0 .../libstore-test}/references.cc | 0 .../libstore-test}/serve-protocol.cc | 0 .../libstore-test}/store-reference.cc | 0 .../libstore-test}/worker-protocol.cc | 0 src/libutil-test | 1 - src/libutil-test-support | 1 - src/libutil-test-support/.version | 1 + .../libutil-test-support}/meson.build | 3 + .../libutil-test-support}/package.nix | 0 .../tests/characterization.hh | 0 .../libutil-test-support}/tests/hash.cc | 0 .../libutil-test-support}/tests/hash.hh | 0 .../tests/nix_api_util.hh | 0 .../tests/string_callback.cc | 0 .../tests/string_callback.hh | 0 src/libutil-test/.version | 1 + .../unit/libutil => src/libutil-test}/args.cc | 0 .../libutil-test}/canon-path.cc | 0 .../libutil-test}/chunked-vector.cc | 0 .../libutil => src/libutil-test}/closure.cc | 0 .../libutil-test}/compression.cc | 0 .../libutil => src/libutil-test}/config.cc | 0 .../libutil-test}/data/git/check-data.sh | 0 .../data/git/hello-world-blob.bin | Bin .../libutil-test}/data/git/hello-world.bin | Bin .../libutil-test}/data/git/tree.bin | Bin .../libutil-test}/data/git/tree.txt | 0 .../libutil-test}/file-content-address.cc | 0 .../unit/libutil => src/libutil-test}/git.cc | 2 +- .../unit/libutil => src/libutil-test}/hash.cc | 0 .../libutil => src/libutil-test}/hilite.cc | 0 .../libutil-test}/json-utils.cc | 0 .../libutil => src/libutil-test}/logging.cc | 0 .../libutil => src/libutil-test}/lru-cache.cc | 0 .../libutil => src/libutil-test}/meson.build | 17 +-- .../libutil-test}/nix_api_util.cc | 0 .../libutil => src/libutil-test}/package.nix | 0 .../unit/libutil => src/libutil-test}/pool.cc | 0 .../libutil-test}/references.cc | 0 .../libutil => src/libutil-test}/spawn.cc | 0 .../libutil-test}/suggestions.cc | 0 .../libutil => src/libutil-test}/tests.cc | 0 .../unit/libutil => src/libutil-test}/url.cc | 0 .../libutil-test}/xml-writer.cc | 0 tests/unit/libexpr-support/local.mk | 23 ---- tests/unit/libexpr/local.mk | 45 ------ tests/unit/libfetchers/local.mk | 37 ----- tests/unit/libflake/local.mk | 43 ------ tests/unit/libstore-support/local.mk | 21 --- tests/unit/libstore/local.mk | 38 ----- tests/unit/libutil-support/.version | 1 - tests/unit/libutil-support/local.mk | 19 --- tests/unit/libutil/.version | 1 - tests/unit/libutil/local.mk | 37 ----- 215 files changed, 873 insertions(+), 461 deletions(-) create mode 120000 src/libexpr-test-support/.version create mode 100644 src/libexpr-test-support/meson.build rename {tests/unit/libexpr-support => src/libexpr-test-support}/tests/libexpr.hh (100%) rename {tests/unit/libexpr-support => src/libexpr-test-support}/tests/nix_api_expr.hh (100%) rename {tests/unit/libexpr-support => src/libexpr-test-support}/tests/value/context.cc (100%) rename {tests/unit/libexpr-support => src/libexpr-test-support}/tests/value/context.hh (100%) create mode 120000 src/libexpr-test/.version rename {tests/unit/libexpr => src/libexpr-test}/derived-path.cc (100%) rename {tests/unit/libexpr => src/libexpr-test}/error_traces.cc (100%) rename {tests/unit/libexpr => src/libexpr-test}/eval.cc (100%) rename {tests/unit/libexpr => src/libexpr-test}/json.cc (100%) rename {tests/unit/libexpr => src/libexpr-test}/main.cc (100%) create mode 100644 src/libexpr-test/meson.build rename {tests/unit/libexpr => src/libexpr-test}/nix_api_expr.cc (100%) rename {tests/unit/libexpr => src/libexpr-test}/nix_api_external.cc (100%) rename {tests/unit/libexpr => src/libexpr-test}/nix_api_value.cc (100%) rename {tests/unit/libexpr => src/libexpr-test}/primops.cc (100%) rename {tests/unit/libexpr => src/libexpr-test}/search-path.cc (100%) rename {tests/unit/libexpr => src/libexpr-test}/trivial.cc (100%) rename {tests/unit/libexpr => src/libexpr-test}/value/context.cc (100%) rename {tests/unit/libexpr => src/libexpr-test}/value/print.cc (100%) rename {tests/unit/libexpr => src/libexpr-test}/value/value.cc (100%) create mode 120000 src/libfetchers-test/.version rename {tests/unit/libfetchers => src/libfetchers-test}/data/public-key/defaultType.json (100%) rename {tests/unit/libfetchers => src/libfetchers-test}/data/public-key/noRoundTrip.json (100%) rename {tests/unit/libfetchers => src/libfetchers-test}/data/public-key/simple.json (100%) create mode 100644 src/libfetchers-test/meson.build rename {tests/unit/libfetchers => src/libfetchers-test}/public-key.cc (100%) create mode 120000 src/libflake-test/.version rename {tests/unit/libflake => src/libflake-test}/flakeref.cc (100%) create mode 100644 src/libflake-test/meson.build rename {tests/unit/libflake => src/libflake-test}/url-name.cc (100%) create mode 120000 src/libstore-test-support/.version create mode 100644 src/libstore-test-support/meson.build rename {tests/unit/libstore-support => src/libstore-test-support}/tests/derived-path.cc (100%) rename {tests/unit/libstore-support => src/libstore-test-support}/tests/derived-path.hh (100%) rename {tests/unit/libstore-support => src/libstore-test-support}/tests/libstore.hh (100%) rename {tests/unit/libstore-support => src/libstore-test-support}/tests/nix_api_store.hh (100%) rename {tests/unit/libstore-support => src/libstore-test-support}/tests/outputs-spec.cc (100%) rename {tests/unit/libstore-support => src/libstore-test-support}/tests/outputs-spec.hh (100%) rename {tests/unit/libstore-support => src/libstore-test-support}/tests/path.cc (100%) rename {tests/unit/libstore-support => src/libstore-test-support}/tests/path.hh (100%) rename {tests/unit/libstore-support => src/libstore-test-support}/tests/protocol.hh (100%) create mode 120000 src/libstore-test/.version rename {tests/unit/libstore => src/libstore-test}/common-protocol.cc (100%) rename {tests/unit/libstore => src/libstore-test}/content-address.cc (100%) rename {tests/unit/libstore => src/libstore-test}/data/common-protocol/content-address.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/common-protocol/drv-output.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/common-protocol/optional-content-address.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/common-protocol/optional-store-path.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/common-protocol/realisation.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/common-protocol/set.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/common-protocol/store-path.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/common-protocol/string.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/common-protocol/vector.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/advanced-attributes-defaults.drv (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/advanced-attributes-defaults.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/advanced-attributes-structured-attrs-defaults.drv (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/advanced-attributes-structured-attrs-defaults.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/advanced-attributes-structured-attrs.drv (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/advanced-attributes-structured-attrs.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/advanced-attributes.drv (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/bad-old-version-dyn-deps.drv (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/bad-version.drv (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/dynDerivationDeps.drv (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/dynDerivationDeps.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/output-caFixedFlat.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/output-caFixedNAR.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/output-caFixedText.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/output-caFloating.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/output-deferred.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/output-impure.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/output-inputAddressed.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/simple.drv (100%) rename {tests/unit/libstore => src/libstore-test}/data/derivation/simple.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/machines/bad_format (100%) rename {tests/unit/libstore => src/libstore-test}/data/machines/valid (100%) rename {tests/unit/libstore => src/libstore-test}/data/nar-info/impure.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/nar-info/pure.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/path-info/empty_impure.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/path-info/empty_pure.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/path-info/impure.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/path-info/pure.json (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/build-options-2.1.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/build-options-2.2.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/build-options-2.3.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/build-options-2.7.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/build-result-2.2.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/build-result-2.3.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/build-result-2.6.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/content-address.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/drv-output.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/handshake-to-client.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/optional-content-address.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/optional-store-path.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/realisation.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/set.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/store-path.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/string.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/unkeyed-valid-path-info-2.3.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/unkeyed-valid-path-info-2.4.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/serve-protocol/vector.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/store-reference/auto.txt (100%) rename {tests/unit/libstore => src/libstore-test}/data/store-reference/auto_param.txt (100%) rename {tests/unit/libstore => src/libstore-test}/data/store-reference/local_1.txt (100%) rename {tests/unit/libstore => src/libstore-test}/data/store-reference/local_2.txt (100%) rename {tests/unit/libstore => src/libstore-test}/data/store-reference/local_shorthand_1.txt (100%) rename {tests/unit/libstore => src/libstore-test}/data/store-reference/local_shorthand_2.txt (100%) rename {tests/unit/libstore => src/libstore-test}/data/store-reference/ssh.txt (100%) rename {tests/unit/libstore => src/libstore-test}/data/store-reference/unix.txt (100%) rename {tests/unit/libstore => src/libstore-test}/data/store-reference/unix_shorthand.txt (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/build-mode.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/build-result-1.27.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/build-result-1.28.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/build-result-1.29.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/build-result-1.37.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/client-handshake-info_1_30.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/client-handshake-info_1_33.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/client-handshake-info_1_35.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/content-address.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/derived-path-1.29.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/derived-path-1.30.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/drv-output.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/handshake-to-client.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/keyed-build-result-1.29.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/optional-content-address.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/optional-store-path.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/optional-trusted-flag.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/realisation.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/set.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/store-path.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/string.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/unkeyed-valid-path-info-1.15.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/valid-path-info-1.15.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/valid-path-info-1.16.bin (100%) rename {tests/unit/libstore => src/libstore-test}/data/worker-protocol/vector.bin (100%) rename {tests/unit/libstore => src/libstore-test}/derivation-advanced-attrs.cc (100%) rename {tests/unit/libstore => src/libstore-test}/derivation.cc (100%) rename {tests/unit/libstore => src/libstore-test}/derived-path.cc (100%) rename {tests/unit/libstore => src/libstore-test}/downstream-placeholder.cc (100%) rename {tests/unit/libstore => src/libstore-test}/machines.cc (100%) create mode 100644 src/libstore-test/meson.build rename {tests/unit/libstore => src/libstore-test}/nar-info-disk-cache.cc (100%) rename {tests/unit/libstore => src/libstore-test}/nar-info.cc (100%) rename {tests/unit/libstore => src/libstore-test}/nix_api_store.cc (100%) rename {tests/unit/libstore => src/libstore-test}/outputs-spec.cc (100%) rename {tests/unit/libstore => src/libstore-test}/path-info.cc (100%) rename {tests/unit/libstore => src/libstore-test}/path.cc (100%) rename {tests/unit/libstore => src/libstore-test}/references.cc (100%) rename {tests/unit/libstore => src/libstore-test}/serve-protocol.cc (100%) rename {tests/unit/libstore => src/libstore-test}/store-reference.cc (100%) rename {tests/unit/libstore => src/libstore-test}/worker-protocol.cc (100%) delete mode 120000 src/libutil-test delete mode 120000 src/libutil-test-support create mode 120000 src/libutil-test-support/.version rename {tests/unit/libutil-support => src/libutil-test-support}/meson.build (95%) rename {tests/unit/libutil-support => src/libutil-test-support}/package.nix (100%) rename {tests/unit/libutil-support => src/libutil-test-support}/tests/characterization.hh (100%) rename {tests/unit/libutil-support => src/libutil-test-support}/tests/hash.cc (100%) rename {tests/unit/libutil-support => src/libutil-test-support}/tests/hash.hh (100%) rename {tests/unit/libutil-support => src/libutil-test-support}/tests/nix_api_util.hh (100%) rename {tests/unit/libutil-support => src/libutil-test-support}/tests/string_callback.cc (100%) rename {tests/unit/libutil-support => src/libutil-test-support}/tests/string_callback.hh (100%) create mode 120000 src/libutil-test/.version rename {tests/unit/libutil => src/libutil-test}/args.cc (100%) rename {tests/unit/libutil => src/libutil-test}/canon-path.cc (100%) rename {tests/unit/libutil => src/libutil-test}/chunked-vector.cc (100%) rename {tests/unit/libutil => src/libutil-test}/closure.cc (100%) rename {tests/unit/libutil => src/libutil-test}/compression.cc (100%) rename {tests/unit/libutil => src/libutil-test}/config.cc (100%) rename {tests/unit/libutil => src/libutil-test}/data/git/check-data.sh (100%) rename {tests/unit/libutil => src/libutil-test}/data/git/hello-world-blob.bin (100%) rename {tests/unit/libutil => src/libutil-test}/data/git/hello-world.bin (100%) rename {tests/unit/libutil => src/libutil-test}/data/git/tree.bin (100%) rename {tests/unit/libutil => src/libutil-test}/data/git/tree.txt (100%) rename {tests/unit/libutil => src/libutil-test}/file-content-address.cc (100%) rename {tests/unit/libutil => src/libutil-test}/git.cc (99%) rename {tests/unit/libutil => src/libutil-test}/hash.cc (100%) rename {tests/unit/libutil => src/libutil-test}/hilite.cc (100%) rename {tests/unit/libutil => src/libutil-test}/json-utils.cc (100%) rename {tests/unit/libutil => src/libutil-test}/logging.cc (100%) rename {tests/unit/libutil => src/libutil-test}/lru-cache.cc (100%) rename {tests/unit/libutil => src/libutil-test}/meson.build (88%) rename {tests/unit/libutil => src/libutil-test}/nix_api_util.cc (100%) rename {tests/unit/libutil => src/libutil-test}/package.nix (100%) rename {tests/unit/libutil => src/libutil-test}/pool.cc (100%) rename {tests/unit/libutil => src/libutil-test}/references.cc (100%) rename {tests/unit/libutil => src/libutil-test}/spawn.cc (100%) rename {tests/unit/libutil => src/libutil-test}/suggestions.cc (100%) rename {tests/unit/libutil => src/libutil-test}/tests.cc (100%) rename {tests/unit/libutil => src/libutil-test}/url.cc (100%) rename {tests/unit/libutil => src/libutil-test}/xml-writer.cc (100%) delete mode 100644 tests/unit/libexpr-support/local.mk delete mode 100644 tests/unit/libexpr/local.mk delete mode 100644 tests/unit/libfetchers/local.mk delete mode 100644 tests/unit/libflake/local.mk delete mode 100644 tests/unit/libstore-support/local.mk delete mode 100644 tests/unit/libstore/local.mk delete mode 120000 tests/unit/libutil-support/.version delete mode 100644 tests/unit/libutil-support/local.mk delete mode 100644 tests/unit/libutil/.version delete mode 100644 tests/unit/libutil/local.mk diff --git a/.gitignore b/.gitignore index a17b627f4..838cac335 100644 --- a/.gitignore +++ b/.gitignore @@ -49,22 +49,22 @@ perl/Makefile.config /src/libexpr/parser-tab.output /src/libexpr/nix.tbl /src/libexpr/tests -/tests/unit/libexpr/libnixexpr-tests +/src/libexpr-test/libnixexpr-tests # /src/libfetchers -/tests/unit/libfetchers/libnixfetchers-tests +/src/libfetchers-test/libnixfetchers-tests # /src/libflake -/tests/unit/libflake/libnixflake-tests +/src/libflake-test/libnixflake-tests # /src/libstore/ *.gen.* /src/libstore/tests -/tests/unit/libstore/libnixstore-tests +/src/libstore-test/libnixstore-tests # /src/libutil/ /src/libutil/tests -/tests/unit/libutil/libnixutil-tests +/src/libutil-test/libnixutil-tests /src/nix/nix diff --git a/Makefile b/Makefile index bb64a104e..a65cdbd40 100644 --- a/Makefile +++ b/Makefile @@ -38,18 +38,6 @@ makefiles += \ endif endif -ifeq ($(ENABLE_UNIT_TESTS), yes) -makefiles += \ - tests/unit/libutil/local.mk \ - tests/unit/libutil-support/local.mk \ - tests/unit/libstore/local.mk \ - tests/unit/libstore-support/local.mk \ - tests/unit/libfetchers/local.mk \ - tests/unit/libexpr/local.mk \ - tests/unit/libexpr-support/local.mk \ - tests/unit/libflake/local.mk -endif - ifeq ($(ENABLE_FUNCTIONAL_TESTS), yes) ifdef HOST_UNIX makefiles += \ @@ -103,13 +91,6 @@ include mk/lib.mk # These must be defined after `mk/lib.mk`. Otherwise the first rule # incorrectly becomes the default target. -ifneq ($(ENABLE_UNIT_TESTS), yes) -.PHONY: check -check: - @echo "Unit tests are disabled. Configure without '--disable-unit-tests', or avoid calling 'make check'." - @exit 1 -endif - ifneq ($(ENABLE_FUNCTIONAL_TESTS), yes) .PHONY: installcheck installcheck: diff --git a/Makefile.config.in b/Makefile.config.in index 3100d2073..e131484f6 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -12,7 +12,6 @@ ENABLE_BUILD = @ENABLE_BUILD@ ENABLE_DOC_GEN = @ENABLE_DOC_GEN@ ENABLE_FUNCTIONAL_TESTS = @ENABLE_FUNCTIONAL_TESTS@ ENABLE_S3 = @ENABLE_S3@ -ENABLE_UNIT_TESTS = @ENABLE_UNIT_TESTS@ GTEST_LIBS = @GTEST_LIBS@ HAVE_LIBCPUID = @HAVE_LIBCPUID@ HAVE_SECCOMP = @HAVE_SECCOMP@ diff --git a/configure.ac b/configure.ac index 4f66a3efc..b9f190166 100644 --- a/configure.ac +++ b/configure.ac @@ -141,18 +141,6 @@ AC_ARG_ENABLE(build, AS_HELP_STRING([--disable-build],[Do not build nix]), ENABLE_BUILD=$enableval, ENABLE_BUILD=yes) AC_SUBST(ENABLE_BUILD) -# Building without unit tests is useful for bootstrapping with a smaller footprint -# or running the tests in a separate derivation. Otherwise, we do compile and -# run them. - -AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--disable-unit-tests],[Do not build the tests]), - ENABLE_UNIT_TESTS=$enableval, ENABLE_UNIT_TESTS=$ENABLE_BUILD) -AC_SUBST(ENABLE_UNIT_TESTS) - -AS_IF( - [test "$ENABLE_BUILD" == "no" && test "$ENABLE_UNIT_TESTS" == "yes"], - [AC_MSG_ERROR([Cannot enable unit tests when building overall is disabled. Please do not pass '--enable-unit-tests' or do not pass '--disable-build'.])]) - AC_ARG_ENABLE(functional-tests, AS_HELP_STRING([--disable-functional-tests],[Do not build the tests]), ENABLE_FUNCTIONAL_TESTS=$enableval, ENABLE_FUNCTIONAL_TESTS=yes) AC_SUBST(ENABLE_FUNCTIONAL_TESTS) @@ -365,16 +353,6 @@ if test "$gc" = yes; then CFLAGS="$old_CFLAGS" fi -AS_IF([test "$ENABLE_UNIT_TESTS" == "yes"],[ - -# Look for gtest. -PKG_CHECK_MODULES([GTEST], [gtest_main gmock_main]) - -# Look for rapidcheck. -PKG_CHECK_MODULES([RAPIDCHECK], [rapidcheck rapidcheck_gtest]) - -]) - # Look for nlohmann/json. PKG_CHECK_MODULES([NLOHMANN_JSON], [nlohmann_json >= 3.9]) diff --git a/doc/manual/src/contributing/hacking.md b/doc/manual/src/contributing/hacking.md index 08ba84faa..c128515e9 100644 --- a/doc/manual/src/contributing/hacking.md +++ b/doc/manual/src/contributing/hacking.md @@ -122,7 +122,6 @@ Run `make` with [`-e` / `--environment-overrides`](https://www.gnu.org/software/ The docs can take a while to build, so you may want to disable this for local development. - `ENABLE_FUNCTIONAL_TESTS=yes` to enable building the functional tests. -- `ENABLE_UNIT_TESTS=yes` to enable building the unit tests. - `OPTIMIZE=1` to enable optimizations. - `libraries=libutil programs=` to only build a specific library. diff --git a/doc/manual/src/contributing/testing.md b/doc/manual/src/contributing/testing.md index 717deabd7..ed9c25f7a 100644 --- a/doc/manual/src/contributing/testing.md +++ b/doc/manual/src/contributing/testing.md @@ -59,15 +59,15 @@ The unit tests are defined using the [googletest] and [rapidcheck] frameworks. > … > ``` -The tests for each Nix library (`libnixexpr`, `libnixstore`, etc..) live inside a directory `tests/unit/${library_name_without-nix}`. -Given an interface (header) and implementation pair in the original library, say, `src/libexpr/value/context.{hh,cc}`, we write tests for it in `tests/unit/libexpr/tests/value/context.cc`, and (possibly) declare/define additional interfaces for testing purposes in `tests/unit/libexpr-support/tests/value/context.{hh,cc}`. +The tests for each Nix library (`libnixexpr`, `libnixstore`, etc..) live inside a directory `src/${library_name_without-nix}-test`. +Given an interface (header) and implementation pair in the original library, say, `src/libexpr/value/context.{hh,cc}`, we write tests for it in `src/libexpr-test/value/context.cc`, and (possibly) declare/define additional interfaces for testing purposes in `src/libexpr-test-support/tests/value/context.{hh,cc}`. Data for unit tests is stored in a `data` subdir of the directory for each unit test executable. -For example, `libnixstore` code is in `src/libstore`, and its test data is in `tests/unit/libstore/data`. -The path to the `tests/unit/data` directory is passed to the unit test executable with the environment variable `_NIX_TEST_UNIT_DATA`. +For example, `libnixstore` code is in `src/libstore`, and its test data is in `src/libstore-test/data`. +The path to the `src/${library_name_without-nix}-test/data` directory is passed to the unit test executable with the environment variable `_NIX_TEST_UNIT_DATA`. Note that each executable only gets the data for its tests. -The unit test libraries are in `tests/unit/${library_name_without-nix}-lib`. +The unit test libraries are in `src/${library_name_without-nix}-test-support`. All headers are in a `tests` subdirectory so they are included with `#include "tests/"`. The use of all these separate directories for the unit tests might seem inconvenient, as for example the tests are not "right next to" the part of the code they are testing. diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index 8f95e788b..b78e5f63a 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -15,7 +15,7 @@ excludes = [ # We don't want to format test data # ''tests/(?!nixos/).*\.nix'' - ''^tests/unit/[^/]*/data/.*$'' + ''^src/[^/]*-test/[^/]*/data/.*$'' # Don't format vendored code ''^doc/manual/redirects\.js$'' @@ -429,65 +429,65 @@ ''^tests/nixos/ca-fd-leak/sender\.c'' ''^tests/nixos/ca-fd-leak/smuggler\.c'' ''^tests/nixos/user-sandboxing/attacker\.c'' - ''^tests/unit/libexpr-support/tests/libexpr\.hh'' - ''^tests/unit/libexpr-support/tests/value/context\.cc'' - ''^tests/unit/libexpr-support/tests/value/context\.hh'' - ''^tests/unit/libexpr/derived-path\.cc'' - ''^tests/unit/libexpr/error_traces\.cc'' - ''^tests/unit/libexpr/eval\.cc'' - ''^tests/unit/libexpr/json\.cc'' - ''^tests/unit/libexpr/main\.cc'' - ''^tests/unit/libexpr/primops\.cc'' - ''^tests/unit/libexpr/search-path\.cc'' - ''^tests/unit/libexpr/trivial\.cc'' - ''^tests/unit/libexpr/value/context\.cc'' - ''^tests/unit/libexpr/value/print\.cc'' - ''^tests/unit/libfetchers/public-key\.cc'' - ''^tests/unit/libflake/flakeref\.cc'' - ''^tests/unit/libflake/url-name\.cc'' - ''^tests/unit/libstore-support/tests/derived-path\.cc'' - ''^tests/unit/libstore-support/tests/derived-path\.hh'' - ''^tests/unit/libstore-support/tests/nix_api_store\.hh'' - ''^tests/unit/libstore-support/tests/outputs-spec\.cc'' - ''^tests/unit/libstore-support/tests/outputs-spec\.hh'' - ''^tests/unit/libstore-support/tests/path\.cc'' - ''^tests/unit/libstore-support/tests/path\.hh'' - ''^tests/unit/libstore-support/tests/protocol\.hh'' - ''^tests/unit/libstore/common-protocol\.cc'' - ''^tests/unit/libstore/content-address\.cc'' - ''^tests/unit/libstore/derivation\.cc'' - ''^tests/unit/libstore/derived-path\.cc'' - ''^tests/unit/libstore/downstream-placeholder\.cc'' - ''^tests/unit/libstore/machines\.cc'' - ''^tests/unit/libstore/nar-info-disk-cache\.cc'' - ''^tests/unit/libstore/nar-info\.cc'' - ''^tests/unit/libstore/outputs-spec\.cc'' - ''^tests/unit/libstore/path-info\.cc'' - ''^tests/unit/libstore/path\.cc'' - ''^tests/unit/libstore/serve-protocol\.cc'' - ''^tests/unit/libstore/worker-protocol\.cc'' - ''^tests/unit/libutil-support/tests/characterization\.hh'' - ''^tests/unit/libutil-support/tests/hash\.cc'' - ''^tests/unit/libutil-support/tests/hash\.hh'' - ''^tests/unit/libutil/args\.cc'' - ''^tests/unit/libutil/canon-path\.cc'' - ''^tests/unit/libutil/chunked-vector\.cc'' - ''^tests/unit/libutil/closure\.cc'' - ''^tests/unit/libutil/compression\.cc'' - ''^tests/unit/libutil/config\.cc'' - ''^tests/unit/libutil/file-content-address\.cc'' - ''^tests/unit/libutil/git\.cc'' - ''^tests/unit/libutil/hash\.cc'' - ''^tests/unit/libutil/hilite\.cc'' - ''^tests/unit/libutil/json-utils\.cc'' - ''^tests/unit/libutil/logging\.cc'' - ''^tests/unit/libutil/lru-cache\.cc'' - ''^tests/unit/libutil/pool\.cc'' - ''^tests/unit/libutil/references\.cc'' - ''^tests/unit/libutil/suggestions\.cc'' - ''^tests/unit/libutil/tests\.cc'' - ''^tests/unit/libutil/url\.cc'' - ''^tests/unit/libutil/xml-writer\.cc'' + ''^src/libexpr-test-support/tests/libexpr\.hh'' + ''^src/libexpr-test-support/tests/value/context\.cc'' + ''^src/libexpr-test-support/tests/value/context\.hh'' + ''^src/libexpr-test/derived-path\.cc'' + ''^src/libexpr-test/error_traces\.cc'' + ''^src/libexpr-test/eval\.cc'' + ''^src/libexpr-test/json\.cc'' + ''^src/libexpr-test/main\.cc'' + ''^src/libexpr-test/primops\.cc'' + ''^src/libexpr-test/search-path\.cc'' + ''^src/libexpr-test/trivial\.cc'' + ''^src/libexpr-test/value/context\.cc'' + ''^src/libexpr-test/value/print\.cc'' + ''^src/libfetchers-test/public-key\.cc'' + ''^src/libflake-test/flakeref\.cc'' + ''^src/libflake-test/url-name\.cc'' + ''^src/libstore-test-support/tests/derived-path\.cc'' + ''^src/libstore-test-support/tests/derived-path\.hh'' + ''^src/libstore-test-support/tests/nix_api_store\.hh'' + ''^src/libstore-test-support/tests/outputs-spec\.cc'' + ''^src/libstore-test-support/tests/outputs-spec\.hh'' + ''^src/libstore-test-support/tests/path\.cc'' + ''^src/libstore-test-support/tests/path\.hh'' + ''^src/libstore-test-support/tests/protocol\.hh'' + ''^src/libstore-test/common-protocol\.cc'' + ''^src/libstore-test/content-address\.cc'' + ''^src/libstore-test/derivation\.cc'' + ''^src/libstore-test/derived-path\.cc'' + ''^src/libstore-test/downstream-placeholder\.cc'' + ''^src/libstore-test/machines\.cc'' + ''^src/libstore-test/nar-info-disk-cache\.cc'' + ''^src/libstore-test/nar-info\.cc'' + ''^src/libstore-test/outputs-spec\.cc'' + ''^src/libstore-test/path-info\.cc'' + ''^src/libstore-test/path\.cc'' + ''^src/libstore-test/serve-protocol\.cc'' + ''^src/libstore-test/worker-protocol\.cc'' + ''^src/libutil-test-support/tests/characterization\.hh'' + ''^src/libutil-test-support/tests/hash\.cc'' + ''^src/libutil-test-support/tests/hash\.hh'' + ''^src/libutil-test/args\.cc'' + ''^src/libutil-test/canon-path\.cc'' + ''^src/libutil-test/chunked-vector\.cc'' + ''^src/libutil-test/closure\.cc'' + ''^src/libutil-test/compression\.cc'' + ''^src/libutil-test/config\.cc'' + ''^src/libutil-test/file-content-address\.cc'' + ''^src/libutil-test/git\.cc'' + ''^src/libutil-test/hash\.cc'' + ''^src/libutil-test/hilite\.cc'' + ''^src/libutil-test/json-utils\.cc'' + ''^src/libutil-test/logging\.cc'' + ''^src/libutil-test/lru-cache\.cc'' + ''^src/libutil-test/pool\.cc'' + ''^src/libutil-test/references\.cc'' + ''^src/libutil-test/suggestions\.cc'' + ''^src/libutil-test/tests\.cc'' + ''^src/libutil-test/url\.cc'' + ''^src/libutil-test/xml-writer\.cc'' ]; }; shellcheck = { @@ -666,7 +666,7 @@ ''^tests/functional/user-envs\.sh$'' ''^tests/functional/why-depends\.sh$'' ''^tests/functional/zstd\.sh$'' - ''^tests/unit/libutil/data/git/check-data\.sh$'' + ''^src/libutil-test/data/git/check-data\.sh$'' ]; }; # TODO: nixfmt, https://github.com/NixOS/nixfmt/issues/153 diff --git a/meson.build b/meson.build index 2a3932a40..fb38d7ef2 100644 --- a/meson.build +++ b/meson.build @@ -27,8 +27,9 @@ subproject('perl') # Testing subproject('libutil-test-support') subproject('libutil-test') -#subproject('libstore-test-support') -#subproject('libstore-test') -#subproject('libexpr-test-support') -#subproject('libexpr-test') -#subproject('libflake-test') +subproject('libstore-test-support') +subproject('libstore-test') +subproject('libfetchers-test') +subproject('libexpr-test-support') +subproject('libexpr-test') +subproject('libflake-test') diff --git a/mk/common-test.sh b/mk/common-test.sh index c80abd381..817422c40 100644 --- a/mk/common-test.sh +++ b/mk/common-test.sh @@ -4,7 +4,7 @@ # remove file extension. test_name=$(echo -n "${test?must be defined by caller (test runner)}" | sed \ - -e "s|^tests/unit/[^/]*/data/||" \ + -e "s|^src/[^/]*-test/data/||" \ -e "s|^tests/functional/||" \ -e "s|\.sh$||" \ ) diff --git a/package.nix b/package.nix index 158696f30..0661dc080 100644 --- a/package.nix +++ b/package.nix @@ -52,10 +52,6 @@ # Whether to build Nix. Useful to skip for tasks like testing existing pre-built versions of Nix , doBuild ? true -# Run the unit tests as part of the build. See `installUnitTests` for an -# alternative to this. -, doCheck ? __forDefaults.canRunInstalled - # Run the functional tests as part of the build. , doInstallCheck ? test-client != null || __forDefaults.canRunInstalled @@ -88,11 +84,6 @@ # - readline , readlineFlavor ? if stdenv.hostPlatform.isWindows then "readline" else "editline" -# Whether to install unit tests. This is useful when cross compiling -# since we cannot run them natively during the build, but can do so -# later. -, installUnitTests ? doBuild && !__forDefaults.canExecuteHost - # For running the functional tests against a pre-built Nix. Probably # want to use in conjunction with `doBuild = false;`. , test-daemon ? null @@ -118,7 +109,7 @@ let # things which should instead be gotten via `finalAttrs` in order to # work with overriding. attrs = { - inherit doBuild doCheck doInstallCheck; + inherit doBuild doInstallCheck; }; mkDerivation = @@ -134,16 +125,11 @@ in mkDerivation (finalAttrs: let inherit (finalAttrs) - doCheck doInstallCheck ; doBuild = !finalAttrs.dontBuild; - # Either running the unit tests during the build, or installing them - # to be run later, requiresthe unit tests to be built. - buildUnitTests = doCheck || installUnitTests; - in { inherit pname version; @@ -175,10 +161,8 @@ in { (fileset.difference ./src ./src/perl) ./COPYING ./scripts/local.mk - ] ++ lib.optionals buildUnitTests [ + ] ++ lib.optionals enableManual [ ./doc/manual - ] ++ lib.optionals buildUnitTests [ - ./tests/unit ] ++ lib.optionals doInstallCheck [ ./tests/functional ])); @@ -191,8 +175,6 @@ in { # If we are doing just build or just docs, the one thing will use # "out". We only need additional outputs if we are doing both. ++ lib.optional (doBuild && enableManual) "doc" - ++ lib.optional installUnitTests "check" - ++ lib.optional doCheck "testresults" ; nativeBuildInputs = [ @@ -234,9 +216,6 @@ in { ({ inherit readline editline; }.${readlineFlavor}) ] ++ lib.optionals enableMarkdown [ lowdown - ] ++ lib.optionals buildUnitTests [ - gtest - rapidcheck ] ++ lib.optional stdenv.isLinux libseccomp ++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid # There have been issues building these dependencies @@ -252,7 +231,6 @@ in { ] ++ lib.optional enableGC boehmgc; dontBuild = !attrs.doBuild; - doCheck = attrs.doCheck; disallowedReferences = [ boost ]; @@ -278,18 +256,13 @@ in { configureFlags = [ (lib.enableFeature doBuild "build") - (lib.enableFeature buildUnitTests "unit-tests") (lib.enableFeature doInstallCheck "functional-tests") (lib.enableFeature enableManual "doc-gen") (lib.enableFeature enableGC "gc") (lib.enableFeature enableMarkdown "markdown") - (lib.enableFeature installUnitTests "install-unit-tests") (lib.withFeatureAs true "readline-flavor" readlineFlavor) ] ++ lib.optionals (!forDevShell) [ "--sysconfdir=/etc" - ] ++ lib.optionals installUnitTests [ - "--with-check-bin-dir=${builtins.placeholder "check"}/bin" - "--with-check-lib-dir=${builtins.placeholder "check"}/lib" ] ++ lib.optionals (doBuild) [ "--with-boost=${boost}/lib" ] ++ lib.optionals (doBuild && stdenv.isLinux) [ @@ -375,10 +348,6 @@ in { platforms = lib.platforms.unix ++ lib.platforms.windows; mainProgram = "nix"; broken = !(lib.all (a: a) [ - # We cannot run or install unit tests if we don't build them or - # Nix proper (which they depend on). - (installUnitTests -> doBuild) - (doCheck -> doBuild) # The build process for the manual currently requires extracting # data from the Nix executable we are trying to document. (enableManual -> doBuild) diff --git a/packaging/components.nix b/packaging/components.nix index 01b4e826e..0189f4ca3 100644 --- a/packaging/components.nix +++ b/packaging/components.nix @@ -8,18 +8,40 @@ in nix = callPackage ../package.nix { }; nix-util = callPackage ../src/libutil/package.nix { }; - - nix-util-test-support = callPackage ../tests/unit/libutil-support/package.nix { }; - - nix-util-test = callPackage ../tests/unit/libutil/package.nix { }; - + nix-util-test-support = callPackage ../src/libutil-test-support/package.nix { }; + nix-util-test = callPackage ../src/libutil-test/package.nix { }; nix-util-c = callPackage ../src/libutil-c/package.nix { }; nix-store = callPackage ../src/libstore/package.nix { }; + nix-store-test-support = callPackage ../src/libstore-test-support/package.nix { }; + nix-store-test = callPackage ../src/libstore-test/package.nix { }; + nix-store-c = callPackage ../src/libstore-c/package.nix { }; nix-fetchers = callPackage ../src/libfetchers/package.nix { }; + nix-fetchers-test = callPackage ../src/libfetchers-test/package.nix { }; + nix-fetchers-c = callPackage ../src/libfetchers-c/package.nix { }; nix-expr = callPackage ../src/libexpr/package.nix { }; + nix-expr-test-support = callPackage ../src/libexpr-test-support/package.nix { }; + nix-expr-test = callPackage ../src/libexpr-test/package.nix { }; + nix-expr-c = callPackage ../src/libexpr-c/package.nix { }; + + nix-flake = callPackage ../src/libflake/package.nix { }; + nix-flake-c = callPackage ../src/libflake-c/package.nix { }; + + nix-store = callPackage ../src/libstore/package.nix { }; + nix-store-test-support = callPackage ../src/libstore-test-support/package.nix { }; + nix-store-test = callPackage ../src/libstore-test/package.nix { }; + nix-store-c = callPackage ../src/libstore-c/package.nix { }; + + nix-fetchers = callPackage ../src/libfetchers/package.nix { }; + nix-fetchers-test = callPackage ../src/libfetchers-test/package.nix { }; + nix-fetchers-c = callPackage ../src/libfetchers-c/package.nix { }; + + nix-expr = callPackage ../src/libexpr/package.nix { }; + nix-expr-test-support = callPackage ../src/libexpr-test-support/package.nix { }; + nix-expr-test = callPackage ../src/libexpr-test/package.nix { }; + nix-expr-c = callPackage ../src/libexpr-c/package.nix { }; nix-flake = callPackage ../src/libflake/package.nix { }; diff --git a/src/internal-api-docs/doxygen.cfg.in b/src/internal-api-docs/doxygen.cfg.in index 9e7425581..395e43fe1 100644 --- a/src/internal-api-docs/doxygen.cfg.in +++ b/src/internal-api-docs/doxygen.cfg.in @@ -38,27 +38,27 @@ GENERATE_LATEX = NO # so they can expand variables despite configure variables. INPUT = \ - @src@/src/libcmd \ - @src@/src/libexpr \ - @src@/src/libexpr/flake \ - @src@/tests/unit/libexpr \ - @src@/tests/unit/libexpr/value \ - @src@/tests/unit/libexpr/test \ - @src@/tests/unit/libexpr/test/value \ - @src@/src/libexpr/value \ - @src@/src/libfetchers \ - @src@/src/libmain \ - @src@/src/libstore \ - @src@/src/libstore/build \ - @src@/src/libstore/builtins \ - @src@/tests/unit/libstore \ - @src@/tests/unit/libstore/test \ - @src@/src/libutil \ - @src@/tests/unit/libutil \ - @src@/tests/unit/libutil/test \ - @src@/src/nix \ - @src@/src/nix-env \ - @src@/src/nix-store + @src@/libcmd \ + @src@/libexpr \ + @src@/libexpr/flake \ + @src@/libexpr-test \ + @src@/libexpr-test/value \ + @src@/libexpr-test-support/test \ + @src@/libexpr-test-support/test/value \ + @src@/libexpr/value \ + @src@/libfetchers \ + @src@/libmain \ + @src@/libstore \ + @src@/libstore/build \ + @src@/libstore/builtins \ + @src@/libstore-test \ + @src@/libstore-test-support/test \ + @src@/libutil \ + @src@/libutil-test \ + @src@/libutil-test-support/test \ + @src@/nix \ + @src@/nix-env \ + @src@/nix-store # If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names # in the source code. If set to NO, only conditional compilation will be diff --git a/src/internal-api-docs/package.nix b/src/internal-api-docs/package.nix index fa54d55f3..6a3bc0501 100644 --- a/src/internal-api-docs/package.nix +++ b/src/internal-api-docs/package.nix @@ -28,7 +28,6 @@ stdenv.mkDerivation (finalAttrs: { # Source is not compiled, but still must be available for Doxygen # to gather comments. (cpp ../.) - (cpp ../../tests/unit) ]; }; diff --git a/src/libexpr-test-support/.version b/src/libexpr-test-support/.version new file mode 120000 index 000000000..b7badcd0c --- /dev/null +++ b/src/libexpr-test-support/.version @@ -0,0 +1 @@ +../../.version \ No newline at end of file diff --git a/src/libexpr-test-support/meson.build b/src/libexpr-test-support/meson.build new file mode 100644 index 000000000..5ab0661ca --- /dev/null +++ b/src/libexpr-test-support/meson.build @@ -0,0 +1,128 @@ +project('nix-expr-test-support', 'cpp', + version : files('.version'), + default_options : [ + 'cpp_std=c++2a', + # TODO(Qyriad): increase the warning level + 'warning_level=1', + 'debug=true', + 'optimization=2', + 'errorlogs=true', # Please print logs for tests that fail + ], + meson_version : '>= 1.1', + license : 'LGPL-2.1-or-later', +) + +cxx = meson.get_compiler('cpp') + +# See note in ../nix-util/meson.build +deps_private = [ ] + +# See note in ../nix-util/meson.build +deps_public = [ ] + +# See note in ../nix-util/meson.build +deps_public_subproject = [ ] + +# See note in ../nix-util/meson.build +deps_other = [ ] + +foreach nix_dep : [ + dependency('nix-util'), + dependency('nix-util-test-support'), + dependency('nix-store'), + dependency('nix-store-test-support'), + dependency('nix-expr'), +] + if nix_dep.type_name() == 'internal' + deps_public_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_public += nix_dep + endif +endforeach + +rapidcheck = dependency('rapidcheck') +deps_public += rapidcheck + +add_project_arguments( + # TODO(Qyriad): Yes this is how the autoconf+Make system did it. + # It would be nice for our headers to be idempotent instead. + '-include', 'config-util.hh', + '-include', 'config-store.hh', + '-include', 'config-expr.hh', + '-Wno-deprecated-declarations', + '-Wimplicit-fallthrough', + '-Werror=switch', + '-Werror=switch-enum', + '-Wdeprecated-copy', + '-Wignored-qualifiers', + # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked + # at ~1% overhead in `nix search`. + # + # FIXME: remove when we get meson 1.4.0 which will default this to on for us: + # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions + '-D_GLIBCXX_ASSERTIONS=1', + language : 'cpp', +) + +sources = files( + 'tests/value/context.cc', +) + +include_dirs = [include_directories('.')] + +headers = files( + 'tests/libexpr.hh', + 'tests/nix_api_expr.hh', + 'tests/value/context.hh', +) + +if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' + # Windows DLLs are stricter about symbol visibility than Unix shared + # objects --- see https://gcc.gnu.org/wiki/Visibility for details. + # This is a temporary sledgehammer to export everything like on Unix, + # and not detail with this yet. + # + # TODO do not do this, and instead do fine-grained export annotations. + linker_export_flags = ['-Wl,--export-all-symbols'] +else + linker_export_flags = [] +endif + +this_library = library( + 'nix-expr-test-support', + sources, + dependencies : deps_public + deps_private + deps_other, + include_directories : include_dirs, + # TODO: Remove `-lrapidcheck` when https://github.com/emil-e/rapidcheck/pull/326 + # is available. See also ../libutil/build.meson + link_args: linker_export_flags + ['-lrapidcheck'], + install : true, +) + +install_headers(headers, subdir : 'nix', preserve_path : true) + +requires = [] +foreach dep : deps_public_subproject + requires += dep.name() +endforeach +requires += deps_public + +import('pkgconfig').generate( + this_library, + filebase : meson.project_name(), + name : 'Nix', + description : 'Nix Package Manager', + subdirs : ['nix'], + extra_cflags : ['-std=c++2a'], + requires : requires, + requires_private : deps_private, +) + +meson.override_dependency(meson.project_name(), declare_dependency( + include_directories : include_dirs, + link_with : this_library, + compile_args : ['-std=c++2a'], + dependencies : deps_public_subproject + deps_public, +)) diff --git a/tests/unit/libexpr-support/tests/libexpr.hh b/src/libexpr-test-support/tests/libexpr.hh similarity index 100% rename from tests/unit/libexpr-support/tests/libexpr.hh rename to src/libexpr-test-support/tests/libexpr.hh diff --git a/tests/unit/libexpr-support/tests/nix_api_expr.hh b/src/libexpr-test-support/tests/nix_api_expr.hh similarity index 100% rename from tests/unit/libexpr-support/tests/nix_api_expr.hh rename to src/libexpr-test-support/tests/nix_api_expr.hh diff --git a/tests/unit/libexpr-support/tests/value/context.cc b/src/libexpr-test-support/tests/value/context.cc similarity index 100% rename from tests/unit/libexpr-support/tests/value/context.cc rename to src/libexpr-test-support/tests/value/context.cc diff --git a/tests/unit/libexpr-support/tests/value/context.hh b/src/libexpr-test-support/tests/value/context.hh similarity index 100% rename from tests/unit/libexpr-support/tests/value/context.hh rename to src/libexpr-test-support/tests/value/context.hh diff --git a/src/libexpr-test/.version b/src/libexpr-test/.version new file mode 120000 index 000000000..b7badcd0c --- /dev/null +++ b/src/libexpr-test/.version @@ -0,0 +1 @@ +../../.version \ No newline at end of file diff --git a/tests/unit/libexpr/derived-path.cc b/src/libexpr-test/derived-path.cc similarity index 100% rename from tests/unit/libexpr/derived-path.cc rename to src/libexpr-test/derived-path.cc diff --git a/tests/unit/libexpr/error_traces.cc b/src/libexpr-test/error_traces.cc similarity index 100% rename from tests/unit/libexpr/error_traces.cc rename to src/libexpr-test/error_traces.cc diff --git a/tests/unit/libexpr/eval.cc b/src/libexpr-test/eval.cc similarity index 100% rename from tests/unit/libexpr/eval.cc rename to src/libexpr-test/eval.cc diff --git a/tests/unit/libexpr/json.cc b/src/libexpr-test/json.cc similarity index 100% rename from tests/unit/libexpr/json.cc rename to src/libexpr-test/json.cc diff --git a/tests/unit/libexpr/main.cc b/src/libexpr-test/main.cc similarity index 100% rename from tests/unit/libexpr/main.cc rename to src/libexpr-test/main.cc diff --git a/src/libexpr-test/meson.build b/src/libexpr-test/meson.build new file mode 100644 index 000000000..d4b0db51f --- /dev/null +++ b/src/libexpr-test/meson.build @@ -0,0 +1,125 @@ +project('nix-expr-test', 'cpp', + version : files('.version'), + default_options : [ + 'cpp_std=c++2a', + # TODO(Qyriad): increase the warning level + 'warning_level=1', + 'debug=true', + 'optimization=2', + 'errorlogs=true', # Please print logs for tests that fail + ], + meson_version : '>= 1.1', + license : 'LGPL-2.1-or-later', +) + +cxx = meson.get_compiler('cpp') + +# See note in ../nix-util/meson.build +deps_private = [ ] + +# See note in ../nix-util/meson.build +deps_private_subproject = [ ] + +# See note in ../nix-util/meson.build +deps_other = [ ] + +foreach nix_dep : [ + dependency('nix-util'), + dependency('nix-util-c'), + dependency('nix-util-test-support'), + dependency('nix-store'), + dependency('nix-store-c'), + dependency('nix-store-test-support'), + dependency('nix-expr'), + dependency('nix-expr-c'), + dependency('nix-expr-test-support'), +] + if nix_dep.type_name() == 'internal' + deps_private_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_private += nix_dep + endif +endforeach + +if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' + # Windows DLLs are stricter about symbol visibility than Unix shared + # objects --- see https://gcc.gnu.org/wiki/Visibility for details. + # This is a temporary sledgehammer to export everything like on Unix, + # and not detail with this yet. + # + # TODO do not do this, and instead do fine-grained export annotations. + linker_export_flags = ['-Wl,--export-all-symbols'] +else + linker_export_flags = [] +endif + +rapidcheck = dependency('rapidcheck') +deps_private += rapidcheck + +gtest = dependency('gtest', main : true) +deps_private += gtest + +add_project_arguments( + # TODO(Qyriad): Yes this is how the autoconf+Make system did it. + # It would be nice for our headers to be idempotent instead. + '-include', 'config-util.hh', + '-include', 'config-store.hh', + '-include', 'config-store.hh', + '-include', 'config-util.h', + '-include', 'config-store.h', + '-include', 'config-expr.h', + '-Wno-deprecated-declarations', + '-Wimplicit-fallthrough', + '-Werror=switch', + '-Werror=switch-enum', + '-Wdeprecated-copy', + '-Wignored-qualifiers', + # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked + # at ~1% overhead in `nix search`. + # + # FIXME: remove when we get meson 1.4.0 which will default this to on for us: + # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions + '-D_GLIBCXX_ASSERTIONS=1', + language : 'cpp', +) + +sources = files( + 'derived-path.cc', + 'error_traces.cc', + 'eval.cc', + 'json.cc', + 'main.cc', + 'nix_api_expr.cc', + 'nix_api_external.cc', + 'nix_api_value.cc', + 'primops.cc', + 'search-path.cc', + 'trivial.cc', + 'value/context.cc', + 'value/print.cc', + 'value/value.cc', +) + +include_dirs = [include_directories('.')] + + +this_exe = executable( + meson.project_name(), + sources, + dependencies : deps_private_subproject + deps_private + deps_other, + include_directories : include_dirs, + # TODO: -lrapidcheck, see ../libutil-support/build.meson + link_args: linker_export_flags + ['-lrapidcheck'], + # get main from gtest + install : true, +) + +test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data']) + +meson.override_dependency(meson.project_name(), declare_dependency( + include_directories : include_dirs, + link_with : this_exe, + compile_args : ['-std=c++2a'], +)) diff --git a/tests/unit/libexpr/nix_api_expr.cc b/src/libexpr-test/nix_api_expr.cc similarity index 100% rename from tests/unit/libexpr/nix_api_expr.cc rename to src/libexpr-test/nix_api_expr.cc diff --git a/tests/unit/libexpr/nix_api_external.cc b/src/libexpr-test/nix_api_external.cc similarity index 100% rename from tests/unit/libexpr/nix_api_external.cc rename to src/libexpr-test/nix_api_external.cc diff --git a/tests/unit/libexpr/nix_api_value.cc b/src/libexpr-test/nix_api_value.cc similarity index 100% rename from tests/unit/libexpr/nix_api_value.cc rename to src/libexpr-test/nix_api_value.cc diff --git a/tests/unit/libexpr/primops.cc b/src/libexpr-test/primops.cc similarity index 100% rename from tests/unit/libexpr/primops.cc rename to src/libexpr-test/primops.cc diff --git a/tests/unit/libexpr/search-path.cc b/src/libexpr-test/search-path.cc similarity index 100% rename from tests/unit/libexpr/search-path.cc rename to src/libexpr-test/search-path.cc diff --git a/tests/unit/libexpr/trivial.cc b/src/libexpr-test/trivial.cc similarity index 100% rename from tests/unit/libexpr/trivial.cc rename to src/libexpr-test/trivial.cc diff --git a/tests/unit/libexpr/value/context.cc b/src/libexpr-test/value/context.cc similarity index 100% rename from tests/unit/libexpr/value/context.cc rename to src/libexpr-test/value/context.cc diff --git a/tests/unit/libexpr/value/print.cc b/src/libexpr-test/value/print.cc similarity index 100% rename from tests/unit/libexpr/value/print.cc rename to src/libexpr-test/value/print.cc diff --git a/tests/unit/libexpr/value/value.cc b/src/libexpr-test/value/value.cc similarity index 100% rename from tests/unit/libexpr/value/value.cc rename to src/libexpr-test/value/value.cc diff --git a/src/libfetchers-test/.version b/src/libfetchers-test/.version new file mode 120000 index 000000000..b7badcd0c --- /dev/null +++ b/src/libfetchers-test/.version @@ -0,0 +1 @@ +../../.version \ No newline at end of file diff --git a/tests/unit/libfetchers/data/public-key/defaultType.json b/src/libfetchers-test/data/public-key/defaultType.json similarity index 100% rename from tests/unit/libfetchers/data/public-key/defaultType.json rename to src/libfetchers-test/data/public-key/defaultType.json diff --git a/tests/unit/libfetchers/data/public-key/noRoundTrip.json b/src/libfetchers-test/data/public-key/noRoundTrip.json similarity index 100% rename from tests/unit/libfetchers/data/public-key/noRoundTrip.json rename to src/libfetchers-test/data/public-key/noRoundTrip.json diff --git a/tests/unit/libfetchers/data/public-key/simple.json b/src/libfetchers-test/data/public-key/simple.json similarity index 100% rename from tests/unit/libfetchers/data/public-key/simple.json rename to src/libfetchers-test/data/public-key/simple.json diff --git a/src/libfetchers-test/meson.build b/src/libfetchers-test/meson.build new file mode 100644 index 000000000..be031f592 --- /dev/null +++ b/src/libfetchers-test/meson.build @@ -0,0 +1,109 @@ +project('nix-fetchers-test', 'cpp', + version : files('.version'), + default_options : [ + 'cpp_std=c++2a', + # TODO(Qyriad): increase the warning level + 'warning_level=1', + 'debug=true', + 'optimization=2', + 'errorlogs=true', # Please print logs for tests that fail + ], + meson_version : '>= 1.1', + license : 'LGPL-2.1-or-later', +) + +cxx = meson.get_compiler('cpp') + +# See note in ../nix-util/meson.build +deps_private = [ ] + +# See note in ../nix-util/meson.build +deps_private_subproject = [ ] + +# See note in ../nix-util/meson.build +deps_other = [ ] + +foreach nix_dep : [ + dependency('nix-util'), + dependency('nix-util-c'), + dependency('nix-util-test-support'), + dependency('nix-store'), + dependency('nix-store-c'), + dependency('nix-store-test-support'), + dependency('nix-fetchers'), +] + if nix_dep.type_name() == 'internal' + deps_private_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_private += nix_dep + endif +endforeach + +if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' + # Windows DLLs are stricter about symbol visibility than Unix shared + # objects --- see https://gcc.gnu.org/wiki/Visibility for details. + # This is a temporary sledgehammer to export everything like on Unix, + # and not detail with this yet. + # + # TODO do not do this, and instead do fine-grained export annotations. + linker_export_flags = ['-Wl,--export-all-symbols'] +else + linker_export_flags = [] +endif + +rapidcheck = dependency('rapidcheck') +deps_private += rapidcheck + +gtest = dependency('gtest', main : true) +deps_private += gtest + +add_project_arguments( + # TODO(Qyriad): Yes this is how the autoconf+Make system did it. + # It would be nice for our headers to be idempotent instead. + '-include', 'config-util.hh', + '-include', 'config-store.hh', + '-include', 'config-store.hh', + '-include', 'config-util.h', + '-include', 'config-store.h', + '-Wno-deprecated-declarations', + '-Wimplicit-fallthrough', + '-Werror=switch', + '-Werror=switch-enum', + '-Wdeprecated-copy', + '-Wignored-qualifiers', + # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked + # at ~1% overhead in `nix search`. + # + # FIXME: remove when we get meson 1.4.0 which will default this to on for us: + # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions + '-D_GLIBCXX_ASSERTIONS=1', + language : 'cpp', +) + +sources = files( + 'public-key.cc', +) + +include_dirs = [include_directories('.')] + + +this_exe = executable( + meson.project_name(), + sources, + dependencies : deps_private_subproject + deps_private + deps_other, + include_directories : include_dirs, + # TODO: -lrapidcheck, see ../libutil-support/build.meson + link_args: linker_export_flags + ['-lrapidcheck'], + # get main from gtest + install : true, +) + +test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data']) + +meson.override_dependency(meson.project_name(), declare_dependency( + include_directories : include_dirs, + link_with : this_exe, + compile_args : ['-std=c++2a'], +)) diff --git a/tests/unit/libfetchers/public-key.cc b/src/libfetchers-test/public-key.cc similarity index 100% rename from tests/unit/libfetchers/public-key.cc rename to src/libfetchers-test/public-key.cc diff --git a/src/libflake-test/.version b/src/libflake-test/.version new file mode 120000 index 000000000..b7badcd0c --- /dev/null +++ b/src/libflake-test/.version @@ -0,0 +1 @@ +../../.version \ No newline at end of file diff --git a/tests/unit/libflake/flakeref.cc b/src/libflake-test/flakeref.cc similarity index 100% rename from tests/unit/libflake/flakeref.cc rename to src/libflake-test/flakeref.cc diff --git a/src/libflake-test/meson.build b/src/libflake-test/meson.build new file mode 100644 index 000000000..a9df80885 --- /dev/null +++ b/src/libflake-test/meson.build @@ -0,0 +1,114 @@ +project('nix-flake-test', 'cpp', + version : files('.version'), + default_options : [ + 'cpp_std=c++2a', + # TODO(Qyriad): increase the warning level + 'warning_level=1', + 'debug=true', + 'optimization=2', + 'errorlogs=true', # Please print logs for tests that fail + ], + meson_version : '>= 1.1', + license : 'LGPL-2.1-or-later', +) + +cxx = meson.get_compiler('cpp') + +# See note in ../nix-util/meson.build +deps_private = [ ] + +# See note in ../nix-util/meson.build +deps_private_subproject = [ ] + +# See note in ../nix-util/meson.build +deps_other = [ ] + +foreach nix_dep : [ + dependency('nix-util'), + dependency('nix-util-c'), + dependency('nix-util-test-support'), + dependency('nix-store'), + dependency('nix-store-c'), + dependency('nix-store-test-support'), + dependency('nix-expr'), + dependency('nix-expr-c'), + dependency('nix-expr-test-support'), + dependency('nix-flake'), +] + if nix_dep.type_name() == 'internal' + deps_private_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_private += nix_dep + endif +endforeach + +if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' + # Windows DLLs are stricter about symbol visibility than Unix shared + # objects --- see https://gcc.gnu.org/wiki/Visibility for details. + # This is a temporary sledgehammer to export everything like on Unix, + # and not detail with this yet. + # + # TODO do not do this, and instead do fine-grained export annotations. + linker_export_flags = ['-Wl,--export-all-symbols'] +else + linker_export_flags = [] +endif + +rapidcheck = dependency('rapidcheck') +deps_private += rapidcheck + +gtest = dependency('gtest', main : true) +deps_private += gtest + +add_project_arguments( + # TODO(Qyriad): Yes this is how the autoconf+Make system did it. + # It would be nice for our headers to be idempotent instead. + '-include', 'config-util.hh', + '-include', 'config-store.hh', + '-include', 'config-expr.hh', + '-include', 'config-util.h', + '-include', 'config-store.h', + '-include', 'config-expr.h', + '-Wno-deprecated-declarations', + '-Wimplicit-fallthrough', + '-Werror=switch', + '-Werror=switch-enum', + '-Wdeprecated-copy', + '-Wignored-qualifiers', + # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked + # at ~1% overhead in `nix search`. + # + # FIXME: remove when we get meson 1.4.0 which will default this to on for us: + # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions + '-D_GLIBCXX_ASSERTIONS=1', + language : 'cpp', +) + +sources = files( + 'flakeref.cc', + 'url-name.cc', +) + +include_dirs = [include_directories('.')] + + +this_exe = executable( + meson.project_name(), + sources, + dependencies : deps_private_subproject + deps_private + deps_other, + include_directories : include_dirs, + # TODO: -lrapidcheck, see ../libutil-support/build.meson + link_args: linker_export_flags + ['-lrapidcheck'], + # get main from gtest + install : true, +) + +test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data']) + +meson.override_dependency(meson.project_name(), declare_dependency( + include_directories : include_dirs, + link_with : this_exe, + compile_args : ['-std=c++2a'], +)) diff --git a/tests/unit/libflake/url-name.cc b/src/libflake-test/url-name.cc similarity index 100% rename from tests/unit/libflake/url-name.cc rename to src/libflake-test/url-name.cc diff --git a/src/libstore-test-support/.version b/src/libstore-test-support/.version new file mode 120000 index 000000000..b7badcd0c --- /dev/null +++ b/src/libstore-test-support/.version @@ -0,0 +1 @@ +../../.version \ No newline at end of file diff --git a/src/libstore-test-support/meson.build b/src/libstore-test-support/meson.build new file mode 100644 index 000000000..186d9b72a --- /dev/null +++ b/src/libstore-test-support/meson.build @@ -0,0 +1,130 @@ +project('nix-store-test-support', 'cpp', + version : files('.version'), + default_options : [ + 'cpp_std=c++2a', + # TODO(Qyriad): increase the warning level + 'warning_level=1', + 'debug=true', + 'optimization=2', + 'errorlogs=true', # Please print logs for tests that fail + ], + meson_version : '>= 1.1', + license : 'LGPL-2.1-or-later', +) + +cxx = meson.get_compiler('cpp') + +# See note in ../nix-util/meson.build +deps_private = [ ] + +# See note in ../nix-util/meson.build +deps_public = [ ] + +# See note in ../nix-util/meson.build +deps_public_subproject = [ ] + +# See note in ../nix-util/meson.build +deps_other = [ ] + +foreach nix_dep : [ + dependency('nix-util'), + dependency('nix-util-test-support'), + dependency('nix-store'), +] + if nix_dep.type_name() == 'internal' + deps_public_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_public += nix_dep + endif +endforeach + +rapidcheck = dependency('rapidcheck') +deps_public += rapidcheck + +add_project_arguments( + # TODO(Qyriad): Yes this is how the autoconf+Make system did it. + # It would be nice for our headers to be idempotent instead. + '-include', 'config-util.hh', + '-include', 'config-store.hh', + '-Wno-deprecated-declarations', + '-Wimplicit-fallthrough', + '-Werror=switch', + '-Werror=switch-enum', + '-Wdeprecated-copy', + '-Wignored-qualifiers', + # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked + # at ~1% overhead in `nix search`. + # + # FIXME: remove when we get meson 1.4.0 which will default this to on for us: + # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions + '-D_GLIBCXX_ASSERTIONS=1', + language : 'cpp', +) + +sources = files( + 'tests/derived-path.cc', + 'tests/outputs-spec.cc', + 'tests/path.cc', +) + +include_dirs = [include_directories('.')] + +headers = files( + 'tests/derived-path.hh', + 'tests/libstore.hh', + 'tests/nix_api_store.hh', + 'tests/outputs-spec.hh', + 'tests/path.hh', + 'tests/protocol.hh', +) + +if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' + # Windows DLLs are stricter about symbol visibility than Unix shared + # objects --- see https://gcc.gnu.org/wiki/Visibility for details. + # This is a temporary sledgehammer to export everything like on Unix, + # and not detail with this yet. + # + # TODO do not do this, and instead do fine-grained export annotations. + linker_export_flags = ['-Wl,--export-all-symbols'] +else + linker_export_flags = [] +endif + +this_library = library( + 'nix-store-test-support', + sources, + dependencies : deps_public + deps_private + deps_other, + include_directories : include_dirs, + # TODO: Remove `-lrapidcheck` when https://github.com/emil-e/rapidcheck/pull/326 + # is available. See also ../libutil/build.meson + link_args: linker_export_flags + ['-lrapidcheck'], + install : true, +) + +install_headers(headers, subdir : 'nix', preserve_path : true) + +requires = [] +foreach dep : deps_public_subproject + requires += dep.name() +endforeach +requires += deps_public + +import('pkgconfig').generate( + this_library, + filebase : meson.project_name(), + name : 'Nix', + description : 'Nix Package Manager', + subdirs : ['nix'], + extra_cflags : ['-std=c++2a'], + requires : requires, + requires_private : deps_private, +) + +meson.override_dependency(meson.project_name(), declare_dependency( + include_directories : include_dirs, + link_with : this_library, + compile_args : ['-std=c++2a'], + dependencies : deps_public_subproject + deps_public, +)) diff --git a/tests/unit/libstore-support/tests/derived-path.cc b/src/libstore-test-support/tests/derived-path.cc similarity index 100% rename from tests/unit/libstore-support/tests/derived-path.cc rename to src/libstore-test-support/tests/derived-path.cc diff --git a/tests/unit/libstore-support/tests/derived-path.hh b/src/libstore-test-support/tests/derived-path.hh similarity index 100% rename from tests/unit/libstore-support/tests/derived-path.hh rename to src/libstore-test-support/tests/derived-path.hh diff --git a/tests/unit/libstore-support/tests/libstore.hh b/src/libstore-test-support/tests/libstore.hh similarity index 100% rename from tests/unit/libstore-support/tests/libstore.hh rename to src/libstore-test-support/tests/libstore.hh diff --git a/tests/unit/libstore-support/tests/nix_api_store.hh b/src/libstore-test-support/tests/nix_api_store.hh similarity index 100% rename from tests/unit/libstore-support/tests/nix_api_store.hh rename to src/libstore-test-support/tests/nix_api_store.hh diff --git a/tests/unit/libstore-support/tests/outputs-spec.cc b/src/libstore-test-support/tests/outputs-spec.cc similarity index 100% rename from tests/unit/libstore-support/tests/outputs-spec.cc rename to src/libstore-test-support/tests/outputs-spec.cc diff --git a/tests/unit/libstore-support/tests/outputs-spec.hh b/src/libstore-test-support/tests/outputs-spec.hh similarity index 100% rename from tests/unit/libstore-support/tests/outputs-spec.hh rename to src/libstore-test-support/tests/outputs-spec.hh diff --git a/tests/unit/libstore-support/tests/path.cc b/src/libstore-test-support/tests/path.cc similarity index 100% rename from tests/unit/libstore-support/tests/path.cc rename to src/libstore-test-support/tests/path.cc diff --git a/tests/unit/libstore-support/tests/path.hh b/src/libstore-test-support/tests/path.hh similarity index 100% rename from tests/unit/libstore-support/tests/path.hh rename to src/libstore-test-support/tests/path.hh diff --git a/tests/unit/libstore-support/tests/protocol.hh b/src/libstore-test-support/tests/protocol.hh similarity index 100% rename from tests/unit/libstore-support/tests/protocol.hh rename to src/libstore-test-support/tests/protocol.hh diff --git a/src/libstore-test/.version b/src/libstore-test/.version new file mode 120000 index 000000000..b7badcd0c --- /dev/null +++ b/src/libstore-test/.version @@ -0,0 +1 @@ +../../.version \ No newline at end of file diff --git a/tests/unit/libstore/common-protocol.cc b/src/libstore-test/common-protocol.cc similarity index 100% rename from tests/unit/libstore/common-protocol.cc rename to src/libstore-test/common-protocol.cc diff --git a/tests/unit/libstore/content-address.cc b/src/libstore-test/content-address.cc similarity index 100% rename from tests/unit/libstore/content-address.cc rename to src/libstore-test/content-address.cc diff --git a/tests/unit/libstore/data/common-protocol/content-address.bin b/src/libstore-test/data/common-protocol/content-address.bin similarity index 100% rename from tests/unit/libstore/data/common-protocol/content-address.bin rename to src/libstore-test/data/common-protocol/content-address.bin diff --git a/tests/unit/libstore/data/common-protocol/drv-output.bin b/src/libstore-test/data/common-protocol/drv-output.bin similarity index 100% rename from tests/unit/libstore/data/common-protocol/drv-output.bin rename to src/libstore-test/data/common-protocol/drv-output.bin diff --git a/tests/unit/libstore/data/common-protocol/optional-content-address.bin b/src/libstore-test/data/common-protocol/optional-content-address.bin similarity index 100% rename from tests/unit/libstore/data/common-protocol/optional-content-address.bin rename to src/libstore-test/data/common-protocol/optional-content-address.bin diff --git a/tests/unit/libstore/data/common-protocol/optional-store-path.bin b/src/libstore-test/data/common-protocol/optional-store-path.bin similarity index 100% rename from tests/unit/libstore/data/common-protocol/optional-store-path.bin rename to src/libstore-test/data/common-protocol/optional-store-path.bin diff --git a/tests/unit/libstore/data/common-protocol/realisation.bin b/src/libstore-test/data/common-protocol/realisation.bin similarity index 100% rename from tests/unit/libstore/data/common-protocol/realisation.bin rename to src/libstore-test/data/common-protocol/realisation.bin diff --git a/tests/unit/libstore/data/common-protocol/set.bin b/src/libstore-test/data/common-protocol/set.bin similarity index 100% rename from tests/unit/libstore/data/common-protocol/set.bin rename to src/libstore-test/data/common-protocol/set.bin diff --git a/tests/unit/libstore/data/common-protocol/store-path.bin b/src/libstore-test/data/common-protocol/store-path.bin similarity index 100% rename from tests/unit/libstore/data/common-protocol/store-path.bin rename to src/libstore-test/data/common-protocol/store-path.bin diff --git a/tests/unit/libstore/data/common-protocol/string.bin b/src/libstore-test/data/common-protocol/string.bin similarity index 100% rename from tests/unit/libstore/data/common-protocol/string.bin rename to src/libstore-test/data/common-protocol/string.bin diff --git a/tests/unit/libstore/data/common-protocol/vector.bin b/src/libstore-test/data/common-protocol/vector.bin similarity index 100% rename from tests/unit/libstore/data/common-protocol/vector.bin rename to src/libstore-test/data/common-protocol/vector.bin diff --git a/tests/unit/libstore/data/derivation/advanced-attributes-defaults.drv b/src/libstore-test/data/derivation/advanced-attributes-defaults.drv similarity index 100% rename from tests/unit/libstore/data/derivation/advanced-attributes-defaults.drv rename to src/libstore-test/data/derivation/advanced-attributes-defaults.drv diff --git a/tests/unit/libstore/data/derivation/advanced-attributes-defaults.json b/src/libstore-test/data/derivation/advanced-attributes-defaults.json similarity index 100% rename from tests/unit/libstore/data/derivation/advanced-attributes-defaults.json rename to src/libstore-test/data/derivation/advanced-attributes-defaults.json diff --git a/tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs-defaults.drv b/src/libstore-test/data/derivation/advanced-attributes-structured-attrs-defaults.drv similarity index 100% rename from tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs-defaults.drv rename to src/libstore-test/data/derivation/advanced-attributes-structured-attrs-defaults.drv diff --git a/tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs-defaults.json b/src/libstore-test/data/derivation/advanced-attributes-structured-attrs-defaults.json similarity index 100% rename from tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs-defaults.json rename to src/libstore-test/data/derivation/advanced-attributes-structured-attrs-defaults.json diff --git a/tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs.drv b/src/libstore-test/data/derivation/advanced-attributes-structured-attrs.drv similarity index 100% rename from tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs.drv rename to src/libstore-test/data/derivation/advanced-attributes-structured-attrs.drv diff --git a/tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs.json b/src/libstore-test/data/derivation/advanced-attributes-structured-attrs.json similarity index 100% rename from tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs.json rename to src/libstore-test/data/derivation/advanced-attributes-structured-attrs.json diff --git a/tests/unit/libstore/data/derivation/advanced-attributes.drv b/src/libstore-test/data/derivation/advanced-attributes.drv similarity index 100% rename from tests/unit/libstore/data/derivation/advanced-attributes.drv rename to src/libstore-test/data/derivation/advanced-attributes.drv diff --git a/tests/unit/libstore/data/derivation/bad-old-version-dyn-deps.drv b/src/libstore-test/data/derivation/bad-old-version-dyn-deps.drv similarity index 100% rename from tests/unit/libstore/data/derivation/bad-old-version-dyn-deps.drv rename to src/libstore-test/data/derivation/bad-old-version-dyn-deps.drv diff --git a/tests/unit/libstore/data/derivation/bad-version.drv b/src/libstore-test/data/derivation/bad-version.drv similarity index 100% rename from tests/unit/libstore/data/derivation/bad-version.drv rename to src/libstore-test/data/derivation/bad-version.drv diff --git a/tests/unit/libstore/data/derivation/dynDerivationDeps.drv b/src/libstore-test/data/derivation/dynDerivationDeps.drv similarity index 100% rename from tests/unit/libstore/data/derivation/dynDerivationDeps.drv rename to src/libstore-test/data/derivation/dynDerivationDeps.drv diff --git a/tests/unit/libstore/data/derivation/dynDerivationDeps.json b/src/libstore-test/data/derivation/dynDerivationDeps.json similarity index 100% rename from tests/unit/libstore/data/derivation/dynDerivationDeps.json rename to src/libstore-test/data/derivation/dynDerivationDeps.json diff --git a/tests/unit/libstore/data/derivation/output-caFixedFlat.json b/src/libstore-test/data/derivation/output-caFixedFlat.json similarity index 100% rename from tests/unit/libstore/data/derivation/output-caFixedFlat.json rename to src/libstore-test/data/derivation/output-caFixedFlat.json diff --git a/tests/unit/libstore/data/derivation/output-caFixedNAR.json b/src/libstore-test/data/derivation/output-caFixedNAR.json similarity index 100% rename from tests/unit/libstore/data/derivation/output-caFixedNAR.json rename to src/libstore-test/data/derivation/output-caFixedNAR.json diff --git a/tests/unit/libstore/data/derivation/output-caFixedText.json b/src/libstore-test/data/derivation/output-caFixedText.json similarity index 100% rename from tests/unit/libstore/data/derivation/output-caFixedText.json rename to src/libstore-test/data/derivation/output-caFixedText.json diff --git a/tests/unit/libstore/data/derivation/output-caFloating.json b/src/libstore-test/data/derivation/output-caFloating.json similarity index 100% rename from tests/unit/libstore/data/derivation/output-caFloating.json rename to src/libstore-test/data/derivation/output-caFloating.json diff --git a/tests/unit/libstore/data/derivation/output-deferred.json b/src/libstore-test/data/derivation/output-deferred.json similarity index 100% rename from tests/unit/libstore/data/derivation/output-deferred.json rename to src/libstore-test/data/derivation/output-deferred.json diff --git a/tests/unit/libstore/data/derivation/output-impure.json b/src/libstore-test/data/derivation/output-impure.json similarity index 100% rename from tests/unit/libstore/data/derivation/output-impure.json rename to src/libstore-test/data/derivation/output-impure.json diff --git a/tests/unit/libstore/data/derivation/output-inputAddressed.json b/src/libstore-test/data/derivation/output-inputAddressed.json similarity index 100% rename from tests/unit/libstore/data/derivation/output-inputAddressed.json rename to src/libstore-test/data/derivation/output-inputAddressed.json diff --git a/tests/unit/libstore/data/derivation/simple.drv b/src/libstore-test/data/derivation/simple.drv similarity index 100% rename from tests/unit/libstore/data/derivation/simple.drv rename to src/libstore-test/data/derivation/simple.drv diff --git a/tests/unit/libstore/data/derivation/simple.json b/src/libstore-test/data/derivation/simple.json similarity index 100% rename from tests/unit/libstore/data/derivation/simple.json rename to src/libstore-test/data/derivation/simple.json diff --git a/tests/unit/libstore/data/machines/bad_format b/src/libstore-test/data/machines/bad_format similarity index 100% rename from tests/unit/libstore/data/machines/bad_format rename to src/libstore-test/data/machines/bad_format diff --git a/tests/unit/libstore/data/machines/valid b/src/libstore-test/data/machines/valid similarity index 100% rename from tests/unit/libstore/data/machines/valid rename to src/libstore-test/data/machines/valid diff --git a/tests/unit/libstore/data/nar-info/impure.json b/src/libstore-test/data/nar-info/impure.json similarity index 100% rename from tests/unit/libstore/data/nar-info/impure.json rename to src/libstore-test/data/nar-info/impure.json diff --git a/tests/unit/libstore/data/nar-info/pure.json b/src/libstore-test/data/nar-info/pure.json similarity index 100% rename from tests/unit/libstore/data/nar-info/pure.json rename to src/libstore-test/data/nar-info/pure.json diff --git a/tests/unit/libstore/data/path-info/empty_impure.json b/src/libstore-test/data/path-info/empty_impure.json similarity index 100% rename from tests/unit/libstore/data/path-info/empty_impure.json rename to src/libstore-test/data/path-info/empty_impure.json diff --git a/tests/unit/libstore/data/path-info/empty_pure.json b/src/libstore-test/data/path-info/empty_pure.json similarity index 100% rename from tests/unit/libstore/data/path-info/empty_pure.json rename to src/libstore-test/data/path-info/empty_pure.json diff --git a/tests/unit/libstore/data/path-info/impure.json b/src/libstore-test/data/path-info/impure.json similarity index 100% rename from tests/unit/libstore/data/path-info/impure.json rename to src/libstore-test/data/path-info/impure.json diff --git a/tests/unit/libstore/data/path-info/pure.json b/src/libstore-test/data/path-info/pure.json similarity index 100% rename from tests/unit/libstore/data/path-info/pure.json rename to src/libstore-test/data/path-info/pure.json diff --git a/tests/unit/libstore/data/serve-protocol/build-options-2.1.bin b/src/libstore-test/data/serve-protocol/build-options-2.1.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/build-options-2.1.bin rename to src/libstore-test/data/serve-protocol/build-options-2.1.bin diff --git a/tests/unit/libstore/data/serve-protocol/build-options-2.2.bin b/src/libstore-test/data/serve-protocol/build-options-2.2.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/build-options-2.2.bin rename to src/libstore-test/data/serve-protocol/build-options-2.2.bin diff --git a/tests/unit/libstore/data/serve-protocol/build-options-2.3.bin b/src/libstore-test/data/serve-protocol/build-options-2.3.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/build-options-2.3.bin rename to src/libstore-test/data/serve-protocol/build-options-2.3.bin diff --git a/tests/unit/libstore/data/serve-protocol/build-options-2.7.bin b/src/libstore-test/data/serve-protocol/build-options-2.7.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/build-options-2.7.bin rename to src/libstore-test/data/serve-protocol/build-options-2.7.bin diff --git a/tests/unit/libstore/data/serve-protocol/build-result-2.2.bin b/src/libstore-test/data/serve-protocol/build-result-2.2.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/build-result-2.2.bin rename to src/libstore-test/data/serve-protocol/build-result-2.2.bin diff --git a/tests/unit/libstore/data/serve-protocol/build-result-2.3.bin b/src/libstore-test/data/serve-protocol/build-result-2.3.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/build-result-2.3.bin rename to src/libstore-test/data/serve-protocol/build-result-2.3.bin diff --git a/tests/unit/libstore/data/serve-protocol/build-result-2.6.bin b/src/libstore-test/data/serve-protocol/build-result-2.6.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/build-result-2.6.bin rename to src/libstore-test/data/serve-protocol/build-result-2.6.bin diff --git a/tests/unit/libstore/data/serve-protocol/content-address.bin b/src/libstore-test/data/serve-protocol/content-address.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/content-address.bin rename to src/libstore-test/data/serve-protocol/content-address.bin diff --git a/tests/unit/libstore/data/serve-protocol/drv-output.bin b/src/libstore-test/data/serve-protocol/drv-output.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/drv-output.bin rename to src/libstore-test/data/serve-protocol/drv-output.bin diff --git a/tests/unit/libstore/data/serve-protocol/handshake-to-client.bin b/src/libstore-test/data/serve-protocol/handshake-to-client.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/handshake-to-client.bin rename to src/libstore-test/data/serve-protocol/handshake-to-client.bin diff --git a/tests/unit/libstore/data/serve-protocol/optional-content-address.bin b/src/libstore-test/data/serve-protocol/optional-content-address.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/optional-content-address.bin rename to src/libstore-test/data/serve-protocol/optional-content-address.bin diff --git a/tests/unit/libstore/data/serve-protocol/optional-store-path.bin b/src/libstore-test/data/serve-protocol/optional-store-path.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/optional-store-path.bin rename to src/libstore-test/data/serve-protocol/optional-store-path.bin diff --git a/tests/unit/libstore/data/serve-protocol/realisation.bin b/src/libstore-test/data/serve-protocol/realisation.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/realisation.bin rename to src/libstore-test/data/serve-protocol/realisation.bin diff --git a/tests/unit/libstore/data/serve-protocol/set.bin b/src/libstore-test/data/serve-protocol/set.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/set.bin rename to src/libstore-test/data/serve-protocol/set.bin diff --git a/tests/unit/libstore/data/serve-protocol/store-path.bin b/src/libstore-test/data/serve-protocol/store-path.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/store-path.bin rename to src/libstore-test/data/serve-protocol/store-path.bin diff --git a/tests/unit/libstore/data/serve-protocol/string.bin b/src/libstore-test/data/serve-protocol/string.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/string.bin rename to src/libstore-test/data/serve-protocol/string.bin diff --git a/tests/unit/libstore/data/serve-protocol/unkeyed-valid-path-info-2.3.bin b/src/libstore-test/data/serve-protocol/unkeyed-valid-path-info-2.3.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/unkeyed-valid-path-info-2.3.bin rename to src/libstore-test/data/serve-protocol/unkeyed-valid-path-info-2.3.bin diff --git a/tests/unit/libstore/data/serve-protocol/unkeyed-valid-path-info-2.4.bin b/src/libstore-test/data/serve-protocol/unkeyed-valid-path-info-2.4.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/unkeyed-valid-path-info-2.4.bin rename to src/libstore-test/data/serve-protocol/unkeyed-valid-path-info-2.4.bin diff --git a/tests/unit/libstore/data/serve-protocol/vector.bin b/src/libstore-test/data/serve-protocol/vector.bin similarity index 100% rename from tests/unit/libstore/data/serve-protocol/vector.bin rename to src/libstore-test/data/serve-protocol/vector.bin diff --git a/tests/unit/libstore/data/store-reference/auto.txt b/src/libstore-test/data/store-reference/auto.txt similarity index 100% rename from tests/unit/libstore/data/store-reference/auto.txt rename to src/libstore-test/data/store-reference/auto.txt diff --git a/tests/unit/libstore/data/store-reference/auto_param.txt b/src/libstore-test/data/store-reference/auto_param.txt similarity index 100% rename from tests/unit/libstore/data/store-reference/auto_param.txt rename to src/libstore-test/data/store-reference/auto_param.txt diff --git a/tests/unit/libstore/data/store-reference/local_1.txt b/src/libstore-test/data/store-reference/local_1.txt similarity index 100% rename from tests/unit/libstore/data/store-reference/local_1.txt rename to src/libstore-test/data/store-reference/local_1.txt diff --git a/tests/unit/libstore/data/store-reference/local_2.txt b/src/libstore-test/data/store-reference/local_2.txt similarity index 100% rename from tests/unit/libstore/data/store-reference/local_2.txt rename to src/libstore-test/data/store-reference/local_2.txt diff --git a/tests/unit/libstore/data/store-reference/local_shorthand_1.txt b/src/libstore-test/data/store-reference/local_shorthand_1.txt similarity index 100% rename from tests/unit/libstore/data/store-reference/local_shorthand_1.txt rename to src/libstore-test/data/store-reference/local_shorthand_1.txt diff --git a/tests/unit/libstore/data/store-reference/local_shorthand_2.txt b/src/libstore-test/data/store-reference/local_shorthand_2.txt similarity index 100% rename from tests/unit/libstore/data/store-reference/local_shorthand_2.txt rename to src/libstore-test/data/store-reference/local_shorthand_2.txt diff --git a/tests/unit/libstore/data/store-reference/ssh.txt b/src/libstore-test/data/store-reference/ssh.txt similarity index 100% rename from tests/unit/libstore/data/store-reference/ssh.txt rename to src/libstore-test/data/store-reference/ssh.txt diff --git a/tests/unit/libstore/data/store-reference/unix.txt b/src/libstore-test/data/store-reference/unix.txt similarity index 100% rename from tests/unit/libstore/data/store-reference/unix.txt rename to src/libstore-test/data/store-reference/unix.txt diff --git a/tests/unit/libstore/data/store-reference/unix_shorthand.txt b/src/libstore-test/data/store-reference/unix_shorthand.txt similarity index 100% rename from tests/unit/libstore/data/store-reference/unix_shorthand.txt rename to src/libstore-test/data/store-reference/unix_shorthand.txt diff --git a/tests/unit/libstore/data/worker-protocol/build-mode.bin b/src/libstore-test/data/worker-protocol/build-mode.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/build-mode.bin rename to src/libstore-test/data/worker-protocol/build-mode.bin diff --git a/tests/unit/libstore/data/worker-protocol/build-result-1.27.bin b/src/libstore-test/data/worker-protocol/build-result-1.27.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/build-result-1.27.bin rename to src/libstore-test/data/worker-protocol/build-result-1.27.bin diff --git a/tests/unit/libstore/data/worker-protocol/build-result-1.28.bin b/src/libstore-test/data/worker-protocol/build-result-1.28.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/build-result-1.28.bin rename to src/libstore-test/data/worker-protocol/build-result-1.28.bin diff --git a/tests/unit/libstore/data/worker-protocol/build-result-1.29.bin b/src/libstore-test/data/worker-protocol/build-result-1.29.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/build-result-1.29.bin rename to src/libstore-test/data/worker-protocol/build-result-1.29.bin diff --git a/tests/unit/libstore/data/worker-protocol/build-result-1.37.bin b/src/libstore-test/data/worker-protocol/build-result-1.37.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/build-result-1.37.bin rename to src/libstore-test/data/worker-protocol/build-result-1.37.bin diff --git a/tests/unit/libstore/data/worker-protocol/client-handshake-info_1_30.bin b/src/libstore-test/data/worker-protocol/client-handshake-info_1_30.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/client-handshake-info_1_30.bin rename to src/libstore-test/data/worker-protocol/client-handshake-info_1_30.bin diff --git a/tests/unit/libstore/data/worker-protocol/client-handshake-info_1_33.bin b/src/libstore-test/data/worker-protocol/client-handshake-info_1_33.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/client-handshake-info_1_33.bin rename to src/libstore-test/data/worker-protocol/client-handshake-info_1_33.bin diff --git a/tests/unit/libstore/data/worker-protocol/client-handshake-info_1_35.bin b/src/libstore-test/data/worker-protocol/client-handshake-info_1_35.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/client-handshake-info_1_35.bin rename to src/libstore-test/data/worker-protocol/client-handshake-info_1_35.bin diff --git a/tests/unit/libstore/data/worker-protocol/content-address.bin b/src/libstore-test/data/worker-protocol/content-address.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/content-address.bin rename to src/libstore-test/data/worker-protocol/content-address.bin diff --git a/tests/unit/libstore/data/worker-protocol/derived-path-1.29.bin b/src/libstore-test/data/worker-protocol/derived-path-1.29.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/derived-path-1.29.bin rename to src/libstore-test/data/worker-protocol/derived-path-1.29.bin diff --git a/tests/unit/libstore/data/worker-protocol/derived-path-1.30.bin b/src/libstore-test/data/worker-protocol/derived-path-1.30.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/derived-path-1.30.bin rename to src/libstore-test/data/worker-protocol/derived-path-1.30.bin diff --git a/tests/unit/libstore/data/worker-protocol/drv-output.bin b/src/libstore-test/data/worker-protocol/drv-output.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/drv-output.bin rename to src/libstore-test/data/worker-protocol/drv-output.bin diff --git a/tests/unit/libstore/data/worker-protocol/handshake-to-client.bin b/src/libstore-test/data/worker-protocol/handshake-to-client.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/handshake-to-client.bin rename to src/libstore-test/data/worker-protocol/handshake-to-client.bin diff --git a/tests/unit/libstore/data/worker-protocol/keyed-build-result-1.29.bin b/src/libstore-test/data/worker-protocol/keyed-build-result-1.29.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/keyed-build-result-1.29.bin rename to src/libstore-test/data/worker-protocol/keyed-build-result-1.29.bin diff --git a/tests/unit/libstore/data/worker-protocol/optional-content-address.bin b/src/libstore-test/data/worker-protocol/optional-content-address.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/optional-content-address.bin rename to src/libstore-test/data/worker-protocol/optional-content-address.bin diff --git a/tests/unit/libstore/data/worker-protocol/optional-store-path.bin b/src/libstore-test/data/worker-protocol/optional-store-path.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/optional-store-path.bin rename to src/libstore-test/data/worker-protocol/optional-store-path.bin diff --git a/tests/unit/libstore/data/worker-protocol/optional-trusted-flag.bin b/src/libstore-test/data/worker-protocol/optional-trusted-flag.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/optional-trusted-flag.bin rename to src/libstore-test/data/worker-protocol/optional-trusted-flag.bin diff --git a/tests/unit/libstore/data/worker-protocol/realisation.bin b/src/libstore-test/data/worker-protocol/realisation.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/realisation.bin rename to src/libstore-test/data/worker-protocol/realisation.bin diff --git a/tests/unit/libstore/data/worker-protocol/set.bin b/src/libstore-test/data/worker-protocol/set.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/set.bin rename to src/libstore-test/data/worker-protocol/set.bin diff --git a/tests/unit/libstore/data/worker-protocol/store-path.bin b/src/libstore-test/data/worker-protocol/store-path.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/store-path.bin rename to src/libstore-test/data/worker-protocol/store-path.bin diff --git a/tests/unit/libstore/data/worker-protocol/string.bin b/src/libstore-test/data/worker-protocol/string.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/string.bin rename to src/libstore-test/data/worker-protocol/string.bin diff --git a/tests/unit/libstore/data/worker-protocol/unkeyed-valid-path-info-1.15.bin b/src/libstore-test/data/worker-protocol/unkeyed-valid-path-info-1.15.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/unkeyed-valid-path-info-1.15.bin rename to src/libstore-test/data/worker-protocol/unkeyed-valid-path-info-1.15.bin diff --git a/tests/unit/libstore/data/worker-protocol/valid-path-info-1.15.bin b/src/libstore-test/data/worker-protocol/valid-path-info-1.15.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/valid-path-info-1.15.bin rename to src/libstore-test/data/worker-protocol/valid-path-info-1.15.bin diff --git a/tests/unit/libstore/data/worker-protocol/valid-path-info-1.16.bin b/src/libstore-test/data/worker-protocol/valid-path-info-1.16.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/valid-path-info-1.16.bin rename to src/libstore-test/data/worker-protocol/valid-path-info-1.16.bin diff --git a/tests/unit/libstore/data/worker-protocol/vector.bin b/src/libstore-test/data/worker-protocol/vector.bin similarity index 100% rename from tests/unit/libstore/data/worker-protocol/vector.bin rename to src/libstore-test/data/worker-protocol/vector.bin diff --git a/tests/unit/libstore/derivation-advanced-attrs.cc b/src/libstore-test/derivation-advanced-attrs.cc similarity index 100% rename from tests/unit/libstore/derivation-advanced-attrs.cc rename to src/libstore-test/derivation-advanced-attrs.cc diff --git a/tests/unit/libstore/derivation.cc b/src/libstore-test/derivation.cc similarity index 100% rename from tests/unit/libstore/derivation.cc rename to src/libstore-test/derivation.cc diff --git a/tests/unit/libstore/derived-path.cc b/src/libstore-test/derived-path.cc similarity index 100% rename from tests/unit/libstore/derived-path.cc rename to src/libstore-test/derived-path.cc diff --git a/tests/unit/libstore/downstream-placeholder.cc b/src/libstore-test/downstream-placeholder.cc similarity index 100% rename from tests/unit/libstore/downstream-placeholder.cc rename to src/libstore-test/downstream-placeholder.cc diff --git a/tests/unit/libstore/machines.cc b/src/libstore-test/machines.cc similarity index 100% rename from tests/unit/libstore/machines.cc rename to src/libstore-test/machines.cc diff --git a/src/libstore-test/meson.build b/src/libstore-test/meson.build new file mode 100644 index 000000000..83d3244d4 --- /dev/null +++ b/src/libstore-test/meson.build @@ -0,0 +1,123 @@ +project('nix-store-test', 'cpp', + version : files('.version'), + default_options : [ + 'cpp_std=c++2a', + # TODO(Qyriad): increase the warning level + 'warning_level=1', + 'debug=true', + 'optimization=2', + 'errorlogs=true', # Please print logs for tests that fail + ], + meson_version : '>= 1.1', + license : 'LGPL-2.1-or-later', +) + +cxx = meson.get_compiler('cpp') + +# See note in ../nix-util/meson.build +deps_private = [ ] + +# See note in ../nix-util/meson.build +deps_private_subproject = [ ] + +# See note in ../nix-util/meson.build +deps_other = [ ] + +foreach nix_dep : [ + dependency('nix-util'), + dependency('nix-util-c'), + dependency('nix-util-test-support'), + dependency('nix-store'), + dependency('nix-store-c'), + dependency('nix-store-test-support'), +] + if nix_dep.type_name() == 'internal' + deps_private_subproject += nix_dep + # subproject sadly no good for pkg-config module + deps_other += nix_dep + else + deps_private += nix_dep + endif +endforeach + +if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' + # Windows DLLs are stricter about symbol visibility than Unix shared + # objects --- see https://gcc.gnu.org/wiki/Visibility for details. + # This is a temporary sledgehammer to export everything like on Unix, + # and not detail with this yet. + # + # TODO do not do this, and instead do fine-grained export annotations. + linker_export_flags = ['-Wl,--export-all-symbols'] +else + linker_export_flags = [] +endif + +rapidcheck = dependency('rapidcheck') +deps_private += rapidcheck + +gtest = dependency('gtest', main : true) +deps_private += gtest + +add_project_arguments( + # TODO(Qyriad): Yes this is how the autoconf+Make system did it. + # It would be nice for our headers to be idempotent instead. + '-include', 'config-util.hh', + '-include', 'config-store.hh', + '-include', 'config-util.h', + '-include', 'config-store.h', + '-Wno-deprecated-declarations', + '-Wimplicit-fallthrough', + '-Werror=switch', + '-Werror=switch-enum', + '-Wdeprecated-copy', + '-Wignored-qualifiers', + # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked + # at ~1% overhead in `nix search`. + # + # FIXME: remove when we get meson 1.4.0 which will default this to on for us: + # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions + '-D_GLIBCXX_ASSERTIONS=1', + language : 'cpp', +) + +sources = files( + 'common-protocol.cc', + 'content-address.cc', + 'derivation-advanced-attrs.cc', + 'derivation.cc', + 'derived-path.cc', + 'downstream-placeholder.cc', + 'machines.cc', + 'nar-info-disk-cache.cc', + 'nar-info.cc', + 'nix_api_store.cc', + 'outputs-spec.cc', + 'path-info.cc', + 'path.cc', + 'references.cc', + 'serve-protocol.cc', + 'store-reference.cc', + 'worker-protocol.cc', +) + +include_dirs = [include_directories('.')] + + +this_exe = executable( + meson.project_name(), + sources, + dependencies : deps_private_subproject + deps_private + deps_other, + include_directories : include_dirs, + # TODO: -lrapidcheck, see ../libutil-support/build.meson + link_args: linker_export_flags + ['-lrapidcheck'], + # get main from gtest + install : true, +) + +test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data']) + +meson.override_dependency(meson.project_name(), declare_dependency( + include_directories : include_dirs, + link_with : this_exe, + compile_args : ['-std=c++2a'], +)) diff --git a/tests/unit/libstore/nar-info-disk-cache.cc b/src/libstore-test/nar-info-disk-cache.cc similarity index 100% rename from tests/unit/libstore/nar-info-disk-cache.cc rename to src/libstore-test/nar-info-disk-cache.cc diff --git a/tests/unit/libstore/nar-info.cc b/src/libstore-test/nar-info.cc similarity index 100% rename from tests/unit/libstore/nar-info.cc rename to src/libstore-test/nar-info.cc diff --git a/tests/unit/libstore/nix_api_store.cc b/src/libstore-test/nix_api_store.cc similarity index 100% rename from tests/unit/libstore/nix_api_store.cc rename to src/libstore-test/nix_api_store.cc diff --git a/tests/unit/libstore/outputs-spec.cc b/src/libstore-test/outputs-spec.cc similarity index 100% rename from tests/unit/libstore/outputs-spec.cc rename to src/libstore-test/outputs-spec.cc diff --git a/tests/unit/libstore/path-info.cc b/src/libstore-test/path-info.cc similarity index 100% rename from tests/unit/libstore/path-info.cc rename to src/libstore-test/path-info.cc diff --git a/tests/unit/libstore/path.cc b/src/libstore-test/path.cc similarity index 100% rename from tests/unit/libstore/path.cc rename to src/libstore-test/path.cc diff --git a/tests/unit/libstore/references.cc b/src/libstore-test/references.cc similarity index 100% rename from tests/unit/libstore/references.cc rename to src/libstore-test/references.cc diff --git a/tests/unit/libstore/serve-protocol.cc b/src/libstore-test/serve-protocol.cc similarity index 100% rename from tests/unit/libstore/serve-protocol.cc rename to src/libstore-test/serve-protocol.cc diff --git a/tests/unit/libstore/store-reference.cc b/src/libstore-test/store-reference.cc similarity index 100% rename from tests/unit/libstore/store-reference.cc rename to src/libstore-test/store-reference.cc diff --git a/tests/unit/libstore/worker-protocol.cc b/src/libstore-test/worker-protocol.cc similarity index 100% rename from tests/unit/libstore/worker-protocol.cc rename to src/libstore-test/worker-protocol.cc diff --git a/src/libutil-test b/src/libutil-test deleted file mode 120000 index 62c86f54b..000000000 --- a/src/libutil-test +++ /dev/null @@ -1 +0,0 @@ -../tests/unit/libutil/ \ No newline at end of file diff --git a/src/libutil-test-support b/src/libutil-test-support deleted file mode 120000 index f7da46d4c..000000000 --- a/src/libutil-test-support +++ /dev/null @@ -1 +0,0 @@ -../tests/unit/libutil-support/ \ No newline at end of file diff --git a/src/libutil-test-support/.version b/src/libutil-test-support/.version new file mode 120000 index 000000000..b7badcd0c --- /dev/null +++ b/src/libutil-test-support/.version @@ -0,0 +1 @@ +../../.version \ No newline at end of file diff --git a/tests/unit/libutil-support/meson.build b/src/libutil-test-support/meson.build similarity index 95% rename from tests/unit/libutil-support/meson.build rename to src/libutil-test-support/meson.build index d5ee8eed7..4a8f8b54e 100644 --- a/tests/unit/libutil-support/meson.build +++ b/src/libutil-test-support/meson.build @@ -42,6 +42,9 @@ rapidcheck = dependency('rapidcheck') deps_public += rapidcheck add_project_arguments( + # TODO(Qyriad): Yes this is how the autoconf+Make system did it. + # It would be nice for our headers to be idempotent instead. + '-include', 'config-util.hh', '-Wno-deprecated-declarations', '-Wimplicit-fallthrough', '-Werror=switch', diff --git a/tests/unit/libutil-support/package.nix b/src/libutil-test-support/package.nix similarity index 100% rename from tests/unit/libutil-support/package.nix rename to src/libutil-test-support/package.nix diff --git a/tests/unit/libutil-support/tests/characterization.hh b/src/libutil-test-support/tests/characterization.hh similarity index 100% rename from tests/unit/libutil-support/tests/characterization.hh rename to src/libutil-test-support/tests/characterization.hh diff --git a/tests/unit/libutil-support/tests/hash.cc b/src/libutil-test-support/tests/hash.cc similarity index 100% rename from tests/unit/libutil-support/tests/hash.cc rename to src/libutil-test-support/tests/hash.cc diff --git a/tests/unit/libutil-support/tests/hash.hh b/src/libutil-test-support/tests/hash.hh similarity index 100% rename from tests/unit/libutil-support/tests/hash.hh rename to src/libutil-test-support/tests/hash.hh diff --git a/tests/unit/libutil-support/tests/nix_api_util.hh b/src/libutil-test-support/tests/nix_api_util.hh similarity index 100% rename from tests/unit/libutil-support/tests/nix_api_util.hh rename to src/libutil-test-support/tests/nix_api_util.hh diff --git a/tests/unit/libutil-support/tests/string_callback.cc b/src/libutil-test-support/tests/string_callback.cc similarity index 100% rename from tests/unit/libutil-support/tests/string_callback.cc rename to src/libutil-test-support/tests/string_callback.cc diff --git a/tests/unit/libutil-support/tests/string_callback.hh b/src/libutil-test-support/tests/string_callback.hh similarity index 100% rename from tests/unit/libutil-support/tests/string_callback.hh rename to src/libutil-test-support/tests/string_callback.hh diff --git a/src/libutil-test/.version b/src/libutil-test/.version new file mode 120000 index 000000000..b7badcd0c --- /dev/null +++ b/src/libutil-test/.version @@ -0,0 +1 @@ +../../.version \ No newline at end of file diff --git a/tests/unit/libutil/args.cc b/src/libutil-test/args.cc similarity index 100% rename from tests/unit/libutil/args.cc rename to src/libutil-test/args.cc diff --git a/tests/unit/libutil/canon-path.cc b/src/libutil-test/canon-path.cc similarity index 100% rename from tests/unit/libutil/canon-path.cc rename to src/libutil-test/canon-path.cc diff --git a/tests/unit/libutil/chunked-vector.cc b/src/libutil-test/chunked-vector.cc similarity index 100% rename from tests/unit/libutil/chunked-vector.cc rename to src/libutil-test/chunked-vector.cc diff --git a/tests/unit/libutil/closure.cc b/src/libutil-test/closure.cc similarity index 100% rename from tests/unit/libutil/closure.cc rename to src/libutil-test/closure.cc diff --git a/tests/unit/libutil/compression.cc b/src/libutil-test/compression.cc similarity index 100% rename from tests/unit/libutil/compression.cc rename to src/libutil-test/compression.cc diff --git a/tests/unit/libutil/config.cc b/src/libutil-test/config.cc similarity index 100% rename from tests/unit/libutil/config.cc rename to src/libutil-test/config.cc diff --git a/tests/unit/libutil/data/git/check-data.sh b/src/libutil-test/data/git/check-data.sh similarity index 100% rename from tests/unit/libutil/data/git/check-data.sh rename to src/libutil-test/data/git/check-data.sh diff --git a/tests/unit/libutil/data/git/hello-world-blob.bin b/src/libutil-test/data/git/hello-world-blob.bin similarity index 100% rename from tests/unit/libutil/data/git/hello-world-blob.bin rename to src/libutil-test/data/git/hello-world-blob.bin diff --git a/tests/unit/libutil/data/git/hello-world.bin b/src/libutil-test/data/git/hello-world.bin similarity index 100% rename from tests/unit/libutil/data/git/hello-world.bin rename to src/libutil-test/data/git/hello-world.bin diff --git a/tests/unit/libutil/data/git/tree.bin b/src/libutil-test/data/git/tree.bin similarity index 100% rename from tests/unit/libutil/data/git/tree.bin rename to src/libutil-test/data/git/tree.bin diff --git a/tests/unit/libutil/data/git/tree.txt b/src/libutil-test/data/git/tree.txt similarity index 100% rename from tests/unit/libutil/data/git/tree.txt rename to src/libutil-test/data/git/tree.txt diff --git a/tests/unit/libutil/file-content-address.cc b/src/libutil-test/file-content-address.cc similarity index 100% rename from tests/unit/libutil/file-content-address.cc rename to src/libutil-test/file-content-address.cc diff --git a/tests/unit/libutil/git.cc b/src/libutil-test/git.cc similarity index 99% rename from tests/unit/libutil/git.cc rename to src/libutil-test/git.cc index ff934c117..7c360d7c5 100644 --- a/tests/unit/libutil/git.cc +++ b/src/libutil-test/git.cc @@ -88,7 +88,7 @@ TEST_F(GitTest, blob_write) { /** * This data is for "shallow" tree tests. However, we use "real" hashes * so that we can check our test data in a small shell script test test - * (`tests/unit/libutil/data/git/check-data.sh`). + * (`src/libutil-test/data/git/check-data.sh`). */ const static Tree tree = { { diff --git a/tests/unit/libutil/hash.cc b/src/libutil-test/hash.cc similarity index 100% rename from tests/unit/libutil/hash.cc rename to src/libutil-test/hash.cc diff --git a/tests/unit/libutil/hilite.cc b/src/libutil-test/hilite.cc similarity index 100% rename from tests/unit/libutil/hilite.cc rename to src/libutil-test/hilite.cc diff --git a/tests/unit/libutil/json-utils.cc b/src/libutil-test/json-utils.cc similarity index 100% rename from tests/unit/libutil/json-utils.cc rename to src/libutil-test/json-utils.cc diff --git a/tests/unit/libutil/logging.cc b/src/libutil-test/logging.cc similarity index 100% rename from tests/unit/libutil/logging.cc rename to src/libutil-test/logging.cc diff --git a/tests/unit/libutil/lru-cache.cc b/src/libutil-test/lru-cache.cc similarity index 100% rename from tests/unit/libutil/lru-cache.cc rename to src/libutil-test/lru-cache.cc diff --git a/tests/unit/libutil/meson.build b/src/libutil-test/meson.build similarity index 88% rename from tests/unit/libutil/meson.build rename to src/libutil-test/meson.build index 3f6e0fe65..c3d72b976 100644 --- a/tests/unit/libutil/meson.build +++ b/src/libutil-test/meson.build @@ -23,11 +23,6 @@ deps_private_subproject = [ ] # See note in ../nix-util/meson.build deps_other = [ ] -configdata = configuration_data() - -# TODO rename, because it will conflict with downstream projects -configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) - foreach nix_dep : [ dependency('nix-util'), dependency('nix-util-c'), @@ -60,15 +55,11 @@ deps_private += rapidcheck gtest = dependency('gtest', main : true) deps_private += gtest -config_h = configure_file( - configuration : configdata, - output : 'config-util-test.h', -) - add_project_arguments( # TODO(Qyriad): Yes this is how the autoconf+Make system did it. # It would be nice for our headers to be idempotent instead. - '-include', 'config-util-test.h', + '-include', 'config-util.hh', + '-include', 'config-util.h', '-Wno-deprecated-declarations', '-Wimplicit-fallthrough', '-Werror=switch', @@ -113,7 +104,7 @@ include_dirs = [include_directories('.')] this_exe = executable( - 'nix-util-test', + meson.project_name(), sources, dependencies : deps_private_subproject + deps_private + deps_other, include_directories : include_dirs, @@ -123,7 +114,7 @@ this_exe = executable( install : true, ) -test('nix-util-test', this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data']) +test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data']) meson.override_dependency(meson.project_name(), declare_dependency( include_directories : include_dirs, diff --git a/tests/unit/libutil/nix_api_util.cc b/src/libutil-test/nix_api_util.cc similarity index 100% rename from tests/unit/libutil/nix_api_util.cc rename to src/libutil-test/nix_api_util.cc diff --git a/tests/unit/libutil/package.nix b/src/libutil-test/package.nix similarity index 100% rename from tests/unit/libutil/package.nix rename to src/libutil-test/package.nix diff --git a/tests/unit/libutil/pool.cc b/src/libutil-test/pool.cc similarity index 100% rename from tests/unit/libutil/pool.cc rename to src/libutil-test/pool.cc diff --git a/tests/unit/libutil/references.cc b/src/libutil-test/references.cc similarity index 100% rename from tests/unit/libutil/references.cc rename to src/libutil-test/references.cc diff --git a/tests/unit/libutil/spawn.cc b/src/libutil-test/spawn.cc similarity index 100% rename from tests/unit/libutil/spawn.cc rename to src/libutil-test/spawn.cc diff --git a/tests/unit/libutil/suggestions.cc b/src/libutil-test/suggestions.cc similarity index 100% rename from tests/unit/libutil/suggestions.cc rename to src/libutil-test/suggestions.cc diff --git a/tests/unit/libutil/tests.cc b/src/libutil-test/tests.cc similarity index 100% rename from tests/unit/libutil/tests.cc rename to src/libutil-test/tests.cc diff --git a/tests/unit/libutil/url.cc b/src/libutil-test/url.cc similarity index 100% rename from tests/unit/libutil/url.cc rename to src/libutil-test/url.cc diff --git a/tests/unit/libutil/xml-writer.cc b/src/libutil-test/xml-writer.cc similarity index 100% rename from tests/unit/libutil/xml-writer.cc rename to src/libutil-test/xml-writer.cc diff --git a/tests/unit/libexpr-support/local.mk b/tests/unit/libexpr-support/local.mk deleted file mode 100644 index 0501de33c..000000000 --- a/tests/unit/libexpr-support/local.mk +++ /dev/null @@ -1,23 +0,0 @@ -libraries += libexpr-test-support - -libexpr-test-support_NAME = libnixexpr-test-support - -libexpr-test-support_DIR := $(d) - -ifeq ($(INSTALL_UNIT_TESTS), yes) - libexpr-test-support_INSTALL_DIR := $(checklibdir) -else - libexpr-test-support_INSTALL_DIR := -endif - -libexpr-test-support_SOURCES := \ - $(wildcard $(d)/tests/*.cc) \ - $(wildcard $(d)/tests/value/*.cc) - -libexpr-test-support_CXXFLAGS += $(libexpr-tests_EXTRA_INCLUDES) - -libexpr-test-support_LIBS = \ - libstore-test-support libutil-test-support \ - libexpr libstore libutil - -libexpr-test-support_LDFLAGS := $(THREAD_LDFLAGS) -lrapidcheck diff --git a/tests/unit/libexpr/local.mk b/tests/unit/libexpr/local.mk deleted file mode 100644 index 1617e2823..000000000 --- a/tests/unit/libexpr/local.mk +++ /dev/null @@ -1,45 +0,0 @@ -check: libexpr-tests_RUN - -programs += libexpr-tests - -libexpr-tests_NAME := libnixexpr-tests - -libexpr-tests_ENV := _NIX_TEST_UNIT_DATA=$(d)/data GTEST_OUTPUT=xml:$$testresults/libexpr-tests.xml - -libexpr-tests_DIR := $(d) - -ifeq ($(INSTALL_UNIT_TESTS), yes) - libexpr-tests_INSTALL_DIR := $(checkbindir) -else - libexpr-tests_INSTALL_DIR := -endif - -libexpr-tests_SOURCES := \ - $(wildcard $(d)/*.cc) \ - $(wildcard $(d)/value/*.cc) \ - $(wildcard $(d)/flake/*.cc) - -libexpr-tests_EXTRA_INCLUDES = \ - -I tests/unit/libexpr-support \ - -I tests/unit/libstore-support \ - -I tests/unit/libutil-support \ - $(INCLUDE_libexpr) \ - $(INCLUDE_libexprc) \ - $(INCLUDE_libfetchers) \ - $(INCLUDE_libstore) \ - $(INCLUDE_libstorec) \ - $(INCLUDE_libutil) \ - $(INCLUDE_libutilc) - -libexpr-tests_CXXFLAGS += $(libexpr-tests_EXTRA_INCLUDES) - -libexpr-tests_LIBS = \ - libexpr-test-support libstore-test-support libutil-test-support \ - libexpr libexprc libfetchers libstore libstorec libutil libutilc - -libexpr-tests_LDFLAGS := -lrapidcheck $(GTEST_LIBS) -lgmock - -ifdef HOST_WINDOWS - # Increase the default reserved stack size to 65 MB so Nix doesn't run out of space - libexpr-tests_LDFLAGS += -Wl,--stack,$(shell echo $$((65 * 1024 * 1024))) -endif diff --git a/tests/unit/libfetchers/local.mk b/tests/unit/libfetchers/local.mk deleted file mode 100644 index 286a59030..000000000 --- a/tests/unit/libfetchers/local.mk +++ /dev/null @@ -1,37 +0,0 @@ -check: libfetchers-tests_RUN - -programs += libfetchers-tests - -libfetchers-tests_NAME = libnixfetchers-tests - -libfetchers-tests_ENV := _NIX_TEST_UNIT_DATA=$(d)/data GTEST_OUTPUT=xml:$$testresults/libfetchers-tests.xml - -libfetchers-tests_DIR := $(d) - -ifeq ($(INSTALL_UNIT_TESTS), yes) - libfetchers-tests_INSTALL_DIR := $(checkbindir) -else - libfetchers-tests_INSTALL_DIR := -endif - -libfetchers-tests_SOURCES := $(wildcard $(d)/*.cc) - -libfetchers-tests_EXTRA_INCLUDES = \ - -I tests/unit/libstore-support \ - -I tests/unit/libutil-support \ - $(INCLUDE_libfetchers) \ - $(INCLUDE_libstore) \ - $(INCLUDE_libutil) - -libfetchers-tests_CXXFLAGS += $(libfetchers-tests_EXTRA_INCLUDES) - -libfetchers-tests_LIBS = \ - libstore-test-support libutil-test-support \ - libfetchers libstore libutil - -libfetchers-tests_LDFLAGS := -lrapidcheck $(GTEST_LIBS) - -ifdef HOST_WINDOWS - # Increase the default reserved stack size to 65 MB so Nix doesn't run out of space - libfetchers-tests_LDFLAGS += -Wl,--stack,$(shell echo $$((65 * 1024 * 1024))) -endif diff --git a/tests/unit/libflake/local.mk b/tests/unit/libflake/local.mk deleted file mode 100644 index 590bcf7c0..000000000 --- a/tests/unit/libflake/local.mk +++ /dev/null @@ -1,43 +0,0 @@ -check: libflake-tests_RUN - -programs += libflake-tests - -libflake-tests_NAME := libnixflake-tests - -libflake-tests_ENV := _NIX_TEST_UNIT_DATA=$(d)/data GTEST_OUTPUT=xml:$$testresults/libflake-tests.xml - -libflake-tests_DIR := $(d) - -ifeq ($(INSTALL_UNIT_TESTS), yes) - libflake-tests_INSTALL_DIR := $(checkbindir) -else - libflake-tests_INSTALL_DIR := -endif - -libflake-tests_SOURCES := \ - $(wildcard $(d)/*.cc) \ - $(wildcard $(d)/value/*.cc) \ - $(wildcard $(d)/flake/*.cc) - -libflake-tests_EXTRA_INCLUDES = \ - -I tests/unit/libflake-support \ - -I tests/unit/libstore-support \ - -I tests/unit/libutil-support \ - $(INCLUDE_libflake) \ - $(INCLUDE_libexpr) \ - $(INCLUDE_libfetchers) \ - $(INCLUDE_libstore) \ - $(INCLUDE_libutil) \ - -libflake-tests_CXXFLAGS += $(libflake-tests_EXTRA_INCLUDES) - -libflake-tests_LIBS = \ - libexpr-test-support libstore-test-support libutil-test-support \ - libflake libexpr libfetchers libstore libutil - -libflake-tests_LDFLAGS := -lrapidcheck $(GTEST_LIBS) -lgmock - -ifdef HOST_WINDOWS - # Increase the default reserved stack size to 65 MB so Nix doesn't run out of space - libflake-tests_LDFLAGS += -Wl,--stack,$(shell echo $$((65 * 1024 * 1024))) -endif diff --git a/tests/unit/libstore-support/local.mk b/tests/unit/libstore-support/local.mk deleted file mode 100644 index 56dedd825..000000000 --- a/tests/unit/libstore-support/local.mk +++ /dev/null @@ -1,21 +0,0 @@ -libraries += libstore-test-support - -libstore-test-support_NAME = libnixstore-test-support - -libstore-test-support_DIR := $(d) - -ifeq ($(INSTALL_UNIT_TESTS), yes) - libstore-test-support_INSTALL_DIR := $(checklibdir) -else - libstore-test-support_INSTALL_DIR := -endif - -libstore-test-support_SOURCES := $(wildcard $(d)/tests/*.cc) - -libstore-test-support_CXXFLAGS += $(libstore-tests_EXTRA_INCLUDES) - -libstore-test-support_LIBS = \ - libutil-test-support \ - libstore libutil - -libstore-test-support_LDFLAGS := $(THREAD_LDFLAGS) -lrapidcheck diff --git a/tests/unit/libstore/local.mk b/tests/unit/libstore/local.mk deleted file mode 100644 index 8d3d6b0af..000000000 --- a/tests/unit/libstore/local.mk +++ /dev/null @@ -1,38 +0,0 @@ -check: libstore-tests_RUN - -programs += libstore-tests - -libstore-tests_NAME = libnixstore-tests - -libstore-tests_ENV := _NIX_TEST_UNIT_DATA=$(d)/data GTEST_OUTPUT=xml:$$testresults/libstore-tests.xml - -libstore-tests_DIR := $(d) - -ifeq ($(INSTALL_UNIT_TESTS), yes) - libstore-tests_INSTALL_DIR := $(checkbindir) -else - libstore-tests_INSTALL_DIR := -endif - -libstore-tests_SOURCES := $(wildcard $(d)/*.cc) - -libstore-tests_EXTRA_INCLUDES = \ - -I tests/unit/libstore-support \ - -I tests/unit/libutil-support \ - $(INCLUDE_libstore) \ - $(INCLUDE_libstorec) \ - $(INCLUDE_libutil) \ - $(INCLUDE_libutilc) - -libstore-tests_CXXFLAGS += $(libstore-tests_EXTRA_INCLUDES) - -libstore-tests_LIBS = \ - libstore-test-support libutil-test-support \ - libstore libstorec libutil libutilc - -libstore-tests_LDFLAGS := -lrapidcheck $(GTEST_LIBS) - -ifdef HOST_WINDOWS - # Increase the default reserved stack size to 65 MB so Nix doesn't run out of space - libstore-tests_LDFLAGS += -Wl,--stack,$(shell echo $$((65 * 1024 * 1024))) -endif diff --git a/tests/unit/libutil-support/.version b/tests/unit/libutil-support/.version deleted file mode 120000 index 0df9915bf..000000000 --- a/tests/unit/libutil-support/.version +++ /dev/null @@ -1 +0,0 @@ -../../../.version \ No newline at end of file diff --git a/tests/unit/libutil-support/local.mk b/tests/unit/libutil-support/local.mk deleted file mode 100644 index 5f7835c9f..000000000 --- a/tests/unit/libutil-support/local.mk +++ /dev/null @@ -1,19 +0,0 @@ -libraries += libutil-test-support - -libutil-test-support_NAME = libnixutil-test-support - -libutil-test-support_DIR := $(d) - -ifeq ($(INSTALL_UNIT_TESTS), yes) - libutil-test-support_INSTALL_DIR := $(checklibdir) -else - libutil-test-support_INSTALL_DIR := -endif - -libutil-test-support_SOURCES := $(wildcard $(d)/tests/*.cc) - -libutil-test-support_CXXFLAGS += $(libutil-tests_EXTRA_INCLUDES) - -libutil-test-support_LIBS = libutil - -libutil-test-support_LDFLAGS := $(THREAD_LDFLAGS) -lrapidcheck diff --git a/tests/unit/libutil/.version b/tests/unit/libutil/.version deleted file mode 100644 index ad2261920..000000000 --- a/tests/unit/libutil/.version +++ /dev/null @@ -1 +0,0 @@ -2.24.0 diff --git a/tests/unit/libutil/local.mk b/tests/unit/libutil/local.mk deleted file mode 100644 index 404f35cf1..000000000 --- a/tests/unit/libutil/local.mk +++ /dev/null @@ -1,37 +0,0 @@ -check: libutil-tests_RUN - -programs += libutil-tests - -libutil-tests_NAME = libnixutil-tests - -libutil-tests_ENV := _NIX_TEST_UNIT_DATA=$(d)/data GTEST_OUTPUT=xml:$$testresults/libutil-tests.xml - -libutil-tests_DIR := $(d) - -ifeq ($(INSTALL_UNIT_TESTS), yes) - libutil-tests_INSTALL_DIR := $(checkbindir) -else - libutil-tests_INSTALL_DIR := -endif - -libutil-tests_SOURCES := $(wildcard $(d)/*.cc) - -libutil-tests_EXTRA_INCLUDES = \ - -I tests/unit/libutil-support \ - $(INCLUDE_libutil) \ - $(INCLUDE_libutilc) - -libutil-tests_CXXFLAGS += $(libutil-tests_EXTRA_INCLUDES) - -libutil-tests_LIBS = libutil-test-support libutil libutilc - -libutil-tests_LDFLAGS := -lrapidcheck $(GTEST_LIBS) - -ifdef HOST_WINDOWS - # Increase the default reserved stack size to 65 MB so Nix doesn't run out of space - libutil-tests_LDFLAGS += -Wl,--stack,$(shell echo $$((65 * 1024 * 1024))) -endif - -check: $(d)/data/git/check-data.sh.test - -$(eval $(call run-test,$(d)/data/git/check-data.sh)) From a81e319528c511affd165401c2eadf2554ff5e07 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 12:17:13 -0400 Subject: [PATCH 05/36] Deduplicating --- meson-utils/export/meson.build | 30 ++++++++++++++++ meson-utils/meson.build | 36 +++++++++++++++++++ src/libcmd/meson-utils | 1 + src/libexpr-c/meson-utils | 1 + src/libexpr-c/meson.build | 45 ++---------------------- src/libexpr-test-support/meson-utils | 1 + src/libexpr-test-support/meson.build | 36 ++----------------- src/libexpr-test/meson-utils | 1 + src/libexpr-test/meson.build | 15 +------- src/libexpr/meson-utils | 1 + src/libexpr/meson.build | 39 +++------------------ src/libfetchers-test/meson-utils | 1 + src/libfetchers-test/meson.build | 15 +------- src/libfetchers/meson-utils | 1 + src/libfetchers/meson.build | 38 ++++---------------- src/libflake-test/meson-utils | 1 + src/libflake-test/meson.build | 15 +------- src/libflake/meson-utils | 1 + src/libflake/meson.build | 38 +++----------------- src/libmain/meson-utils | 1 + src/libstore-c/meson-utils | 1 + src/libstore-c/meson.build | 45 ++---------------------- src/libstore-test-support/meson-utils | 1 + src/libstore-test-support/meson.build | 36 ++----------------- src/libstore-test/meson-utils | 1 + src/libstore-test/meson.build | 15 +------- src/libstore/meson-utils | 1 + src/libstore/meson.build | 37 ++------------------ src/libutil-c/meson-utils | 1 + src/libutil-c/meson.build | 45 ++---------------------- src/libutil-test-support/meson-utils | 1 + src/libutil-test-support/meson.build | 36 ++----------------- src/libutil-test/meson-utils | 1 + src/libutil-test/meson.build | 15 +------- src/libutil/meson-utils | 1 + src/libutil/meson.build | 50 ++------------------------- 36 files changed, 128 insertions(+), 476 deletions(-) create mode 100644 meson-utils/export/meson.build create mode 100644 meson-utils/meson.build create mode 120000 src/libcmd/meson-utils create mode 120000 src/libexpr-c/meson-utils create mode 120000 src/libexpr-test-support/meson-utils create mode 120000 src/libexpr-test/meson-utils create mode 120000 src/libexpr/meson-utils create mode 120000 src/libfetchers-test/meson-utils create mode 120000 src/libfetchers/meson-utils create mode 120000 src/libflake-test/meson-utils create mode 120000 src/libflake/meson-utils create mode 120000 src/libmain/meson-utils create mode 120000 src/libstore-c/meson-utils create mode 120000 src/libstore-test-support/meson-utils create mode 120000 src/libstore-test/meson-utils create mode 120000 src/libstore/meson-utils create mode 120000 src/libutil-c/meson-utils create mode 120000 src/libutil-test-support/meson-utils create mode 120000 src/libutil-test/meson-utils create mode 120000 src/libutil/meson-utils diff --git a/meson-utils/export/meson.build b/meson-utils/export/meson.build new file mode 100644 index 000000000..40f6dcd59 --- /dev/null +++ b/meson-utils/export/meson.build @@ -0,0 +1,30 @@ +requires_private = [] +foreach dep : deps_private_subproject + requires_private += dep.name() +endforeach +requires_private += deps_private + +requires_public = [] +foreach dep : deps_public_subproject + requires_public += dep.name() +endforeach +requires_public += deps_public + +import('pkgconfig').generate( + this_library, + filebase : meson.project_name(), + name : 'Nix', + description : 'Nix Package Manager', + subdirs : ['nix'], + extra_cflags : ['-std=c++2a'], + requires : requires_public, + requires_private : requires_private, + libraries_private : libraries_private, +) + +meson.override_dependency(meson.project_name(), declare_dependency( + include_directories : include_dirs, + link_with : this_library, + compile_args : ['-std=c++2a'], + dependencies : deps_public_subproject + deps_public, +)) diff --git a/meson-utils/meson.build b/meson-utils/meson.build new file mode 100644 index 000000000..89fbfdb36 --- /dev/null +++ b/meson-utils/meson.build @@ -0,0 +1,36 @@ +# These are private dependencies with pkg-config files. What private +# means is that the dependencies are used by the library but they are +# *not* used (e.g. `#include`-ed) in any installed header file, and only +# in regular source code (`*.cc`) or private, uninstalled headers. They +# are thus part of the *implementation* of the library, but not its +# *interface*. +# +# See `man pkg-config` for some details. +deps_private = [ ] + +# These are public dependencies with pkg-config files. Public is the +# opposite of private: these dependencies are used in installed header +# files. They are part of the interface (and implementation) of the +# library. +# +# N.B. This concept is mostly unrelated to our own concept of a public +# (stable) API, for consumption outside of the Nix repository. +# `libnixutil` is an unstable C++ library, whose public interface is +# likewise unstable. `libutilc` conversely is a hopefully-soon stable +# C library, whose public interface --- including public but not private +# dependencies --- will also likewise soon be stable. +# +# N.B. For distributions that care about "ABI" stablity and not just +# "API" stability, the private dependencies also matter as they can +# potentially affect the public ABI. +deps_public = [ ] + +# These are subproject deps (type == "internal"). They are other +# packages in `/src` in this repo. The private vs public distinction is +# the same as above. +deps_private_subproject = [ ] +deps_public_subproject = [ ] + +# These are dependencencies without pkg-config files. Ideally they are +# just private, but they may also be public (e.g. boost). +deps_other = [ ] diff --git a/src/libcmd/meson-utils b/src/libcmd/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libcmd/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libexpr-c/meson-utils b/src/libexpr-c/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libexpr-c/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libexpr-c/meson.build b/src/libexpr-c/meson.build index 5abf2b477..e20589484 100644 --- a/src/libexpr-c/meson.build +++ b/src/libexpr-c/meson.build @@ -14,20 +14,7 @@ project('nix-expr-c', 'cpp', cxx = meson.get_compiler('cpp') -# See note in ../nix-util/meson.build -deps_private = [ ] - -# See note in ../nix-util/meson.build -deps_private_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_public = [ ] - -# See note in ../nix-util/meson.build -deps_public_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_other = [ ] +subdir('meson-utils') configdata = configuration_data() @@ -128,32 +115,6 @@ this_library = library( install_headers(headers, subdir : 'nix', preserve_path : true) -requires_private = [] -foreach dep : deps_private_subproject - requires_private += dep.name() -endforeach -requires_private += deps_private +libraries_private = [] -requires_public = [] -foreach dep : deps_public_subproject - requires_public += dep.name() -endforeach -requires_public += deps_public - -import('pkgconfig').generate( - this_library, - filebase : meson.project_name(), - name : 'Nix', - description : 'Nix Package Manager', - subdirs : ['nix'], - extra_cflags : ['-std=c++2a'], - requires : requires_public, - requires_private : requires_private, -) - -meson.override_dependency(meson.project_name(), declare_dependency( - include_directories : include_dirs, - link_with : this_library, - compile_args : ['-std=c++2a'], - dependencies : [], -)) +subdir('meson-utils/export') diff --git a/src/libexpr-test-support/meson-utils b/src/libexpr-test-support/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libexpr-test-support/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libexpr-test-support/meson.build b/src/libexpr-test-support/meson.build index 5ab0661ca..15138744f 100644 --- a/src/libexpr-test-support/meson.build +++ b/src/libexpr-test-support/meson.build @@ -14,17 +14,7 @@ project('nix-expr-test-support', 'cpp', cxx = meson.get_compiler('cpp') -# See note in ../nix-util/meson.build -deps_private = [ ] - -# See note in ../nix-util/meson.build -deps_public = [ ] - -# See note in ../nix-util/meson.build -deps_public_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_other = [ ] +subdir('meson-utils') foreach nix_dep : [ dependency('nix-util'), @@ -103,26 +93,6 @@ this_library = library( install_headers(headers, subdir : 'nix', preserve_path : true) -requires = [] -foreach dep : deps_public_subproject - requires += dep.name() -endforeach -requires += deps_public +libraries_private = [] -import('pkgconfig').generate( - this_library, - filebase : meson.project_name(), - name : 'Nix', - description : 'Nix Package Manager', - subdirs : ['nix'], - extra_cflags : ['-std=c++2a'], - requires : requires, - requires_private : deps_private, -) - -meson.override_dependency(meson.project_name(), declare_dependency( - include_directories : include_dirs, - link_with : this_library, - compile_args : ['-std=c++2a'], - dependencies : deps_public_subproject + deps_public, -)) +subdir('meson-utils/export') diff --git a/src/libexpr-test/meson-utils b/src/libexpr-test/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libexpr-test/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libexpr-test/meson.build b/src/libexpr-test/meson.build index d4b0db51f..cf6fb477c 100644 --- a/src/libexpr-test/meson.build +++ b/src/libexpr-test/meson.build @@ -14,14 +14,7 @@ project('nix-expr-test', 'cpp', cxx = meson.get_compiler('cpp') -# See note in ../nix-util/meson.build -deps_private = [ ] - -# See note in ../nix-util/meson.build -deps_private_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_other = [ ] +subdir('meson-utils') foreach nix_dep : [ dependency('nix-util'), @@ -117,9 +110,3 @@ this_exe = executable( ) test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data']) - -meson.override_dependency(meson.project_name(), declare_dependency( - include_directories : include_dirs, - link_with : this_exe, - compile_args : ['-std=c++2a'], -)) diff --git a/src/libexpr/meson-utils b/src/libexpr/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libexpr/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index 34e4dec3b..401ac6673 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -14,17 +14,7 @@ project('nix-expr', 'cpp', cxx = meson.get_compiler('cpp') -# See note in ../nix-util/meson.build -deps_private = [ ] - -# See note in ../nix-util/meson.build -deps_public = [ ] - -# See note in ../nix-util/meson.build -deps_public_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_other = [ ] +subdir('meson-utils') configdata = configuration_data() @@ -186,6 +176,8 @@ sources = files( 'value/context.cc', ) +include_dirs = [include_directories('.')] + headers = [config_h] + files( 'attr-path.hh', 'attr-set.hh', @@ -228,27 +220,6 @@ this_library = library( install_headers(headers, subdir : 'nix', preserve_path : true) -requires = [] -foreach dep : deps_public_subproject - requires += dep.name() -endforeach -requires += deps_public +libraries_private = [] -import('pkgconfig').generate( - this_library, - filebase : meson.project_name(), - name : 'Nix', - description : 'Nix Package Manager', - subdirs : ['nix'], - extra_cflags : ['-std=c++2a'], - requires : requires, - requires_private : deps_private, - libraries_private : ['-lboost_container', '-lboost_context'], -) - -meson.override_dependency(meson.project_name(), declare_dependency( - include_directories : include_directories('.'), - link_with : this_library, - compile_args : ['-std=c++2a'], - dependencies : deps_public_subproject + deps_public, -)) +subdir('meson-utils/export') diff --git a/src/libfetchers-test/meson-utils b/src/libfetchers-test/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libfetchers-test/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libfetchers-test/meson.build b/src/libfetchers-test/meson.build index be031f592..ceadaf22a 100644 --- a/src/libfetchers-test/meson.build +++ b/src/libfetchers-test/meson.build @@ -14,14 +14,7 @@ project('nix-fetchers-test', 'cpp', cxx = meson.get_compiler('cpp') -# See note in ../nix-util/meson.build -deps_private = [ ] - -# See note in ../nix-util/meson.build -deps_private_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_other = [ ] +subdir('meson-utils') foreach nix_dep : [ dependency('nix-util'), @@ -101,9 +94,3 @@ this_exe = executable( ) test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data']) - -meson.override_dependency(meson.project_name(), declare_dependency( - include_directories : include_dirs, - link_with : this_exe, - compile_args : ['-std=c++2a'], -)) diff --git a/src/libfetchers/meson-utils b/src/libfetchers/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libfetchers/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build index 938ee27d4..6954358af 100644 --- a/src/libfetchers/meson.build +++ b/src/libfetchers/meson.build @@ -14,17 +14,9 @@ project('nix-fetchers', 'cpp', cxx = meson.get_compiler('cpp') -# See note in ../nix-util/meson.build -deps_private = [ ] +subdir('meson-utils') -# See note in ../nix-util/meson.build -deps_public = [ ] - -# See note in ../nix-util/meson.build -deps_public_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_other = [ ] +configdata = configuration_data() foreach nix_dep : [ dependency('nix-util'), @@ -86,6 +78,8 @@ sources = files( 'tarball.cc', ) +include_dirs = [include_directories('.')] + headers = files( 'attrs.hh', 'cache.hh', @@ -109,26 +103,6 @@ this_library = library( install_headers(headers, subdir : 'nix', preserve_path : true) -requires = [] -foreach dep : deps_public_subproject - requires += dep.name() -endforeach -requires += deps_public +libraries_private = [] -import('pkgconfig').generate( - this_library, - filebase : meson.project_name(), - name : 'Nix', - description : 'Nix Package Manager', - subdirs : ['nix'], - extra_cflags : ['-std=c++2a'], - requires : requires, - requires_private : deps_private, -) - -meson.override_dependency(meson.project_name(), declare_dependency( - include_directories : include_directories('.'), - link_with : this_library, - compile_args : ['-std=c++2a'], - dependencies : deps_public_subproject + deps_public, -)) +subdir('meson-utils/export') diff --git a/src/libflake-test/meson-utils b/src/libflake-test/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libflake-test/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libflake-test/meson.build b/src/libflake-test/meson.build index a9df80885..4ae532800 100644 --- a/src/libflake-test/meson.build +++ b/src/libflake-test/meson.build @@ -14,14 +14,7 @@ project('nix-flake-test', 'cpp', cxx = meson.get_compiler('cpp') -# See note in ../nix-util/meson.build -deps_private = [ ] - -# See note in ../nix-util/meson.build -deps_private_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_other = [ ] +subdir('meson-utils') foreach nix_dep : [ dependency('nix-util'), @@ -106,9 +99,3 @@ this_exe = executable( ) test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data']) - -meson.override_dependency(meson.project_name(), declare_dependency( - include_directories : include_dirs, - link_with : this_exe, - compile_args : ['-std=c++2a'], -)) diff --git a/src/libflake/meson-utils b/src/libflake/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libflake/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libflake/meson.build b/src/libflake/meson.build index 1c0a3ae77..bb85543a2 100644 --- a/src/libflake/meson.build +++ b/src/libflake/meson.build @@ -14,17 +14,7 @@ project('nix-flake', 'cpp', cxx = meson.get_compiler('cpp') -# See note in ../nix-util/meson.build -deps_private = [ ] - -# See note in ../nix-util/meson.build -deps_public = [ ] - -# See note in ../nix-util/meson.build -deps_public_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_other = [ ] +subdir('meson-utils') foreach nix_dep : [ dependency('nix-util'), @@ -78,6 +68,8 @@ sources = files( 'flake/lockfile.cc', ) +include_dirs = [include_directories('.')] + headers = files( 'flake-settings.hh', 'flake/flake.hh', @@ -95,26 +87,6 @@ this_library = library( install_headers(headers, subdir : 'nix', preserve_path : true) -requires = [] -foreach dep : deps_public_subproject - requires += dep.name() -endforeach -requires += deps_public +libraries_private = [] -import('pkgconfig').generate( - this_library, - filebase : meson.project_name(), - name : 'Nix', - description : 'Nix Package Manager', - subdirs : ['nix'], - extra_cflags : ['-std=c++2a'], - requires : requires, - requires_private : deps_private, -) - -meson.override_dependency(meson.project_name(), declare_dependency( - include_directories : include_directories('.'), - link_with : this_library, - compile_args : ['-std=c++2a'], - dependencies : deps_public_subproject + deps_public, -)) +subdir('meson-utils/export') diff --git a/src/libmain/meson-utils b/src/libmain/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libmain/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libstore-c/meson-utils b/src/libstore-c/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libstore-c/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libstore-c/meson.build b/src/libstore-c/meson.build index 049dda0e2..48efbae6f 100644 --- a/src/libstore-c/meson.build +++ b/src/libstore-c/meson.build @@ -14,20 +14,7 @@ project('nix-store-c', 'cpp', cxx = meson.get_compiler('cpp') -# See note in ../nix-util/meson.build -deps_private = [ ] - -# See note in ../nix-util/meson.build -deps_private_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_public = [ ] - -# See note in ../nix-util/meson.build -deps_public_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_other = [ ] +subdir('meson-utils') configdata = configuration_data() @@ -120,32 +107,6 @@ this_library = library( install_headers(headers, subdir : 'nix', preserve_path : true) -requires_private = [] -foreach dep : deps_private_subproject - requires_private += dep.name() -endforeach -requires_private += deps_private +libraries_private = [] -requires_public = [] -foreach dep : deps_public_subproject - requires_public += dep.name() -endforeach -requires_public += deps_public - -import('pkgconfig').generate( - this_library, - filebase : meson.project_name(), - name : 'Nix', - description : 'Nix Package Manager', - subdirs : ['nix'], - extra_cflags : ['-std=c++2a'], - requires : requires_public, - requires_private : requires_private, -) - -meson.override_dependency(meson.project_name(), declare_dependency( - include_directories : include_dirs, - link_with : this_library, - compile_args : ['-std=c++2a'], - dependencies : [], -)) +subdir('meson-utils/export') diff --git a/src/libstore-test-support/meson-utils b/src/libstore-test-support/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libstore-test-support/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libstore-test-support/meson.build b/src/libstore-test-support/meson.build index 186d9b72a..3f7104062 100644 --- a/src/libstore-test-support/meson.build +++ b/src/libstore-test-support/meson.build @@ -14,17 +14,7 @@ project('nix-store-test-support', 'cpp', cxx = meson.get_compiler('cpp') -# See note in ../nix-util/meson.build -deps_private = [ ] - -# See note in ../nix-util/meson.build -deps_public = [ ] - -# See note in ../nix-util/meson.build -deps_public_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_other = [ ] +subdir('meson-utils') foreach nix_dep : [ dependency('nix-util'), @@ -105,26 +95,6 @@ this_library = library( install_headers(headers, subdir : 'nix', preserve_path : true) -requires = [] -foreach dep : deps_public_subproject - requires += dep.name() -endforeach -requires += deps_public +libraries_private = [] -import('pkgconfig').generate( - this_library, - filebase : meson.project_name(), - name : 'Nix', - description : 'Nix Package Manager', - subdirs : ['nix'], - extra_cflags : ['-std=c++2a'], - requires : requires, - requires_private : deps_private, -) - -meson.override_dependency(meson.project_name(), declare_dependency( - include_directories : include_dirs, - link_with : this_library, - compile_args : ['-std=c++2a'], - dependencies : deps_public_subproject + deps_public, -)) +subdir('meson-utils/export') diff --git a/src/libstore-test/meson-utils b/src/libstore-test/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libstore-test/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libstore-test/meson.build b/src/libstore-test/meson.build index 83d3244d4..ed86a0ea9 100644 --- a/src/libstore-test/meson.build +++ b/src/libstore-test/meson.build @@ -14,14 +14,7 @@ project('nix-store-test', 'cpp', cxx = meson.get_compiler('cpp') -# See note in ../nix-util/meson.build -deps_private = [ ] - -# See note in ../nix-util/meson.build -deps_private_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_other = [ ] +subdir('meson-utils') foreach nix_dep : [ dependency('nix-util'), @@ -115,9 +108,3 @@ this_exe = executable( ) test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data']) - -meson.override_dependency(meson.project_name(), declare_dependency( - include_directories : include_dirs, - link_with : this_exe, - compile_args : ['-std=c++2a'], -)) diff --git a/src/libstore/meson-utils b/src/libstore/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libstore/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libstore/meson.build b/src/libstore/meson.build index 7277eb49d..2acd03f23 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -14,17 +14,7 @@ project('nix-store', 'cpp', cxx = meson.get_compiler('cpp') -# See note in ../nix-util/meson.build -deps_private = [ ] - -# See note in ../nix-util/meson.build -deps_public = [ ] - -# See note in ../nix-util/meson.build -deps_public_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_other = [ ] +subdir('meson-utils') configdata = configuration_data() @@ -436,27 +426,6 @@ this_library = library( install_headers(headers, subdir : 'nix', preserve_path : true) -requires = [] -foreach dep : deps_public_subproject - requires += dep.name() -endforeach -requires += deps_public +libraries_private = ['-lboost_container'] -import('pkgconfig').generate( - this_library, - filebase : meson.project_name(), - name : 'Nix', - description : 'Nix Package Manager', - subdirs : ['nix'], - extra_cflags : ['-std=c++2a'], - requires : requires, - requires_private : deps_private, - libraries_private : ['-lboost_container'], -) - -meson.override_dependency(meson.project_name(), declare_dependency( - include_directories : include_dirs, - link_with : this_library, - compile_args : ['-std=c++2a'], - dependencies : deps_public_subproject + deps_public, -)) +subdir('meson-utils/export') diff --git a/src/libutil-c/meson-utils b/src/libutil-c/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libutil-c/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libutil-c/meson.build b/src/libutil-c/meson.build index 7ebbe3d06..b8e25d213 100644 --- a/src/libutil-c/meson.build +++ b/src/libutil-c/meson.build @@ -14,20 +14,7 @@ project('nix-util-c', 'cpp', cxx = meson.get_compiler('cpp') -# See note in ../nix-util/meson.build -deps_private = [ ] - -# See note in ../nix-util/meson.build -deps_private_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_public = [ ] - -# See note in ../nix-util/meson.build -deps_public_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_other = [ ] +subdir('meson-utils') configdata = configuration_data() @@ -120,32 +107,6 @@ this_library = library( install_headers(headers, subdir : 'nix', preserve_path : true) -requires_private = [] -foreach dep : deps_private_subproject - requires_private += dep.name() -endforeach -requires_private += deps_private +libraries_private = [] -requires_public = [] -foreach dep : deps_public_subproject - requires_public += dep.name() -endforeach -requires_public += deps_public - -import('pkgconfig').generate( - this_library, - filebase : meson.project_name(), - name : 'Nix', - description : 'Nix Package Manager', - subdirs : ['nix'], - extra_cflags : ['-std=c++2a'], - requires : requires_public, - requires_private : requires_private, -) - -meson.override_dependency(meson.project_name(), declare_dependency( - include_directories : include_dirs, - link_with : this_library, - compile_args : ['-std=c++2a'], - dependencies : [], -)) +subdir('meson-utils/export') diff --git a/src/libutil-test-support/meson-utils b/src/libutil-test-support/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libutil-test-support/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libutil-test-support/meson.build b/src/libutil-test-support/meson.build index 4a8f8b54e..1dee897cb 100644 --- a/src/libutil-test-support/meson.build +++ b/src/libutil-test-support/meson.build @@ -14,17 +14,7 @@ project('nix-util-test-support', 'cpp', cxx = meson.get_compiler('cpp') -# See note in ../nix-util/meson.build -deps_private = [ ] - -# See note in ../nix-util/meson.build -deps_public = [ ] - -# See note in ../nix-util/meson.build -deps_public_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_other = [ ] +subdir('meson-utils') foreach nix_dep : [ dependency('nix-util'), @@ -100,26 +90,6 @@ this_library = library( install_headers(headers, subdir : 'nix', preserve_path : true) -requires = [] -foreach dep : deps_public_subproject - requires += dep.name() -endforeach -requires += deps_public +libraries_private = [] -import('pkgconfig').generate( - this_library, - filebase : meson.project_name(), - name : 'Nix', - description : 'Nix Package Manager', - subdirs : ['nix'], - extra_cflags : ['-std=c++2a'], - requires : requires, - requires_private : deps_private, -) - -meson.override_dependency(meson.project_name(), declare_dependency( - include_directories : include_dirs, - link_with : this_library, - compile_args : ['-std=c++2a'], - dependencies : deps_public_subproject + deps_public, -)) +subdir('meson-utils/export') diff --git a/src/libutil-test/meson-utils b/src/libutil-test/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libutil-test/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libutil-test/meson.build b/src/libutil-test/meson.build index c3d72b976..e91675455 100644 --- a/src/libutil-test/meson.build +++ b/src/libutil-test/meson.build @@ -14,14 +14,7 @@ project('nix-util-test', 'cpp', cxx = meson.get_compiler('cpp') -# See note in ../nix-util/meson.build -deps_private = [ ] - -# See note in ../nix-util/meson.build -deps_private_subproject = [ ] - -# See note in ../nix-util/meson.build -deps_other = [ ] +subdir('meson-utils') foreach nix_dep : [ dependency('nix-util'), @@ -115,9 +108,3 @@ this_exe = executable( ) test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data']) - -meson.override_dependency(meson.project_name(), declare_dependency( - include_directories : include_dirs, - link_with : this_exe, - compile_args : ['-std=c++2a'], -)) diff --git a/src/libutil/meson-utils b/src/libutil/meson-utils new file mode 120000 index 000000000..41c67447e --- /dev/null +++ b/src/libutil/meson-utils @@ -0,0 +1 @@ +../../meson-utils \ No newline at end of file diff --git a/src/libutil/meson.build b/src/libutil/meson.build index c9dfee651..036a867db 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -14,36 +14,7 @@ project('nix-util', 'cpp', cxx = meson.get_compiler('cpp') -# These are private dependencies with pkg-config files. What private -# means is that the dependencies are used by the library but they are -# *not* used (e.g. `#include`-ed) in any installed header file, and only -# in regular source code (`*.cc`) or private, uninstalled headers. They -# are thus part of the *implementation* of the library, but not its -# *interface*. -# -# See `man pkg-config` for some details. -deps_private = [ ] - -# These are public dependencies with pkg-config files. Public is the -# opposite of private: these dependencies are used in installed header -# files. They are part of the interface (and implementation) of the -# library. -# -# N.B. This concept is mostly unrelated to our own concept of a public -# (stable) API, for consumption outside of the Nix repository. -# `libnixutil` is an unstable C++ library, whose public interface is -# likewise unstable. `libutilc` conversely is a hopefully-soon stable -# C library, whose public interface --- including public but not private -# dependencies --- will also likewise soon be stable. -# -# N.B. For distributions that care about "ABI" stablity and not just -# "API" stability, the private dependencies also matter as they can -# potentially affect the public ABI. -deps_public = [ ] - -# These are dependencencies without pkg-config files. Ideally they are -# just private, but they may also be public (e.g. boost). -deps_other = [ ] +subdir('meson-utils') configdata = configuration_data() @@ -315,21 +286,4 @@ if host_machine.system() == 'windows' libraries_private += ['-lws2_32'] endif -import('pkgconfig').generate( - this_library, - filebase : meson.project_name(), - name : 'Nix', - description : 'Nix Package Manager', - subdirs : ['nix'], - extra_cflags : ['-std=c++2a'], - requires : deps_public, - requires_private : deps_private, - libraries_private : libraries_private, -) - -meson.override_dependency(meson.project_name(), declare_dependency( - include_directories : include_dirs, - link_with : this_library, - compile_args : ['-std=c++2a'], - dependencies : [], -)) +subdir('meson-utils/export') From d902481a365c82c7620bcfd2c661589c0246fe00 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 12:19:42 -0400 Subject: [PATCH 06/36] Better org --- meson-utils/{ => deps-lists}/meson.build | 0 src/libexpr-c/meson.build | 2 +- src/libexpr-test-support/meson.build | 2 +- src/libexpr-test/meson.build | 2 +- src/libexpr/meson.build | 2 +- src/libfetchers-test/meson.build | 2 +- src/libfetchers/meson.build | 2 +- src/libflake-test/meson.build | 2 +- src/libflake/meson.build | 2 +- src/libstore-c/meson.build | 2 +- src/libstore-test-support/meson.build | 2 +- src/libstore-test/meson.build | 2 +- src/libstore/meson.build | 2 +- src/libutil-c/meson.build | 2 +- src/libutil-test-support/meson.build | 2 +- src/libutil-test/meson.build | 2 +- src/libutil/meson.build | 2 +- 17 files changed, 16 insertions(+), 16 deletions(-) rename meson-utils/{ => deps-lists}/meson.build (100%) diff --git a/meson-utils/meson.build b/meson-utils/deps-lists/meson.build similarity index 100% rename from meson-utils/meson.build rename to meson-utils/deps-lists/meson.build diff --git a/src/libexpr-c/meson.build b/src/libexpr-c/meson.build index e20589484..af4965b54 100644 --- a/src/libexpr-c/meson.build +++ b/src/libexpr-c/meson.build @@ -14,7 +14,7 @@ project('nix-expr-c', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils') +subdir('meson-utils/deps-lists') configdata = configuration_data() diff --git a/src/libexpr-test-support/meson.build b/src/libexpr-test-support/meson.build index 15138744f..2755ce8f0 100644 --- a/src/libexpr-test-support/meson.build +++ b/src/libexpr-test-support/meson.build @@ -14,7 +14,7 @@ project('nix-expr-test-support', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils') +subdir('meson-utils/deps-lists') foreach nix_dep : [ dependency('nix-util'), diff --git a/src/libexpr-test/meson.build b/src/libexpr-test/meson.build index cf6fb477c..78701d6c3 100644 --- a/src/libexpr-test/meson.build +++ b/src/libexpr-test/meson.build @@ -14,7 +14,7 @@ project('nix-expr-test', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils') +subdir('meson-utils/deps-lists') foreach nix_dep : [ dependency('nix-util'), diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index 401ac6673..3c06710a2 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -14,7 +14,7 @@ project('nix-expr', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils') +subdir('meson-utils/deps-lists') configdata = configuration_data() diff --git a/src/libfetchers-test/meson.build b/src/libfetchers-test/meson.build index ceadaf22a..98a5bb549 100644 --- a/src/libfetchers-test/meson.build +++ b/src/libfetchers-test/meson.build @@ -14,7 +14,7 @@ project('nix-fetchers-test', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils') +subdir('meson-utils/deps-lists') foreach nix_dep : [ dependency('nix-util'), diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build index 6954358af..491324c7f 100644 --- a/src/libfetchers/meson.build +++ b/src/libfetchers/meson.build @@ -14,7 +14,7 @@ project('nix-fetchers', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils') +subdir('meson-utils/deps-lists') configdata = configuration_data() diff --git a/src/libflake-test/meson.build b/src/libflake-test/meson.build index 4ae532800..00fe90f6e 100644 --- a/src/libflake-test/meson.build +++ b/src/libflake-test/meson.build @@ -14,7 +14,7 @@ project('nix-flake-test', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils') +subdir('meson-utils/deps-lists') foreach nix_dep : [ dependency('nix-util'), diff --git a/src/libflake/meson.build b/src/libflake/meson.build index bb85543a2..18c667b54 100644 --- a/src/libflake/meson.build +++ b/src/libflake/meson.build @@ -14,7 +14,7 @@ project('nix-flake', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils') +subdir('meson-utils/deps-lists') foreach nix_dep : [ dependency('nix-util'), diff --git a/src/libstore-c/meson.build b/src/libstore-c/meson.build index 48efbae6f..66446fa20 100644 --- a/src/libstore-c/meson.build +++ b/src/libstore-c/meson.build @@ -14,7 +14,7 @@ project('nix-store-c', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils') +subdir('meson-utils/deps-lists') configdata = configuration_data() diff --git a/src/libstore-test-support/meson.build b/src/libstore-test-support/meson.build index 3f7104062..9acb6b4ad 100644 --- a/src/libstore-test-support/meson.build +++ b/src/libstore-test-support/meson.build @@ -14,7 +14,7 @@ project('nix-store-test-support', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils') +subdir('meson-utils/deps-lists') foreach nix_dep : [ dependency('nix-util'), diff --git a/src/libstore-test/meson.build b/src/libstore-test/meson.build index ed86a0ea9..0753f9e71 100644 --- a/src/libstore-test/meson.build +++ b/src/libstore-test/meson.build @@ -14,7 +14,7 @@ project('nix-store-test', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils') +subdir('meson-utils/deps-lists') foreach nix_dep : [ dependency('nix-util'), diff --git a/src/libstore/meson.build b/src/libstore/meson.build index 2acd03f23..6e79a0e85 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -14,7 +14,7 @@ project('nix-store', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils') +subdir('meson-utils/deps-lists') configdata = configuration_data() diff --git a/src/libutil-c/meson.build b/src/libutil-c/meson.build index b8e25d213..612138ad9 100644 --- a/src/libutil-c/meson.build +++ b/src/libutil-c/meson.build @@ -14,7 +14,7 @@ project('nix-util-c', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils') +subdir('meson-utils/deps-lists') configdata = configuration_data() diff --git a/src/libutil-test-support/meson.build b/src/libutil-test-support/meson.build index 1dee897cb..00e39f6ab 100644 --- a/src/libutil-test-support/meson.build +++ b/src/libutil-test-support/meson.build @@ -14,7 +14,7 @@ project('nix-util-test-support', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils') +subdir('meson-utils/deps-lists') foreach nix_dep : [ dependency('nix-util'), diff --git a/src/libutil-test/meson.build b/src/libutil-test/meson.build index e91675455..0be920a41 100644 --- a/src/libutil-test/meson.build +++ b/src/libutil-test/meson.build @@ -14,7 +14,7 @@ project('nix-util-test', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils') +subdir('meson-utils/deps-lists') foreach nix_dep : [ dependency('nix-util'), diff --git a/src/libutil/meson.build b/src/libutil/meson.build index 036a867db..337480d82 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -14,7 +14,7 @@ project('nix-util', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils') +subdir('meson-utils/deps-lists') configdata = configuration_data() From 4609ab318cc81df3c3f686cd8c444a2557f08420 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 12:21:00 -0400 Subject: [PATCH 07/36] Fix internal API docs --- src/internal-api-docs/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/internal-api-docs/meson.build b/src/internal-api-docs/meson.build index 2568c56cf..54eb7e5dd 100644 --- a/src/internal-api-docs/meson.build +++ b/src/internal-api-docs/meson.build @@ -12,7 +12,7 @@ doxygen_cfg = configure_file( configuration : { 'PROJECT_NUMBER': meson.project_version(), 'OUTPUT_DIRECTORY' : meson.current_build_dir(), - 'src' : fs.parent(fs.parent(meson.project_source_root())), + 'src' : fs.parent(fs.parent(meson.project_source_root())) / 'src', }, ) From c88f83b471030e6b065b0cb678f59f3d4696cb18 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 12:34:03 -0400 Subject: [PATCH 08/36] More dedup --- meson-utils/subprojects/meson.build | 19 +++++++++++++++++++ src/libexpr-c/meson.build | 25 ++++++------------------- src/libexpr-test-support/meson.build | 13 ++++--------- src/libexpr-test/meson.build | 13 ++++--------- src/libexpr/meson.build | 13 ++++--------- src/libfetchers-test/meson.build | 13 ++++--------- src/libfetchers/meson.build | 13 ++++--------- src/libflake-test/meson.build | 13 ++++--------- src/libflake/meson.build | 13 ++++--------- src/libstore-c/meson.build | 25 ++++++------------------- src/libstore-test-support/meson.build | 13 ++++--------- src/libstore-test/meson.build | 13 ++++--------- src/libstore/meson.build | 13 ++++--------- src/libutil-c/meson.build | 22 +++------------------- src/libutil-test-support/meson.build | 13 ++++--------- src/libutil-test/meson.build | 13 ++++--------- src/libutil/meson.build | 6 ++++++ 17 files changed, 88 insertions(+), 165 deletions(-) create mode 100644 meson-utils/subprojects/meson.build diff --git a/meson-utils/subprojects/meson.build b/meson-utils/subprojects/meson.build new file mode 100644 index 000000000..30a54ed91 --- /dev/null +++ b/meson-utils/subprojects/meson.build @@ -0,0 +1,19 @@ +foreach maybe_subproject_dep : deps_private_maybe_subproject + if maybe_subproject_dep.type_name() == 'internal' + deps_private_subproject += maybe_subproject_dep + # subproject sadly no good for pkg-config module + deps_other += maybe_subproject_dep + else + deps_private += maybe_subproject_dep + endif +endforeach + +foreach maybe_subproject_dep : deps_public_maybe_subproject + if maybe_subproject_dep.type_name() == 'internal' + deps_public_subproject += maybe_subproject_dep + # subproject sadly no good for pkg-config module + deps_other += maybe_subproject_dep + else + deps_public += maybe_subproject_dep + endif +endforeach diff --git a/src/libexpr-c/meson.build b/src/libexpr-c/meson.build index af4965b54..50616d0d8 100644 --- a/src/libexpr-c/meson.build +++ b/src/libexpr-c/meson.build @@ -18,32 +18,19 @@ subdir('meson-utils/deps-lists') configdata = configuration_data() -foreach nix_dep : [ +deps_private_maybe_subproject = [ dependency('nix-util'), dependency('nix-store'), dependency('nix-expr'), ] - if nix_dep.type_name() == 'internal' - deps_private_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_private += nix_dep - endif -endforeach - -foreach nix_dep : [ +deps_public_maybe_subproject = [ dependency('nix-util-c'), dependency('nix-store-c'), ] - if nix_dep.type_name() == 'internal' - deps_public_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_public += nix_dep - endif -endforeach +subdir('meson-utils/subprojects') + +# TODO rename, because it will conflict with downstream projects +configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) config_h = configure_file( configuration : configdata, diff --git a/src/libexpr-test-support/meson.build b/src/libexpr-test-support/meson.build index 2755ce8f0..5dbc6b1b5 100644 --- a/src/libexpr-test-support/meson.build +++ b/src/libexpr-test-support/meson.build @@ -16,21 +16,16 @@ cxx = meson.get_compiler('cpp') subdir('meson-utils/deps-lists') -foreach nix_dep : [ +deps_private_maybe_subproject = [ +] +deps_public_maybe_subproject = [ dependency('nix-util'), dependency('nix-util-test-support'), dependency('nix-store'), dependency('nix-store-test-support'), dependency('nix-expr'), ] - if nix_dep.type_name() == 'internal' - deps_public_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_public += nix_dep - endif -endforeach +subdir('meson-utils/subprojects') rapidcheck = dependency('rapidcheck') deps_public += rapidcheck diff --git a/src/libexpr-test/meson.build b/src/libexpr-test/meson.build index 78701d6c3..cf1c48729 100644 --- a/src/libexpr-test/meson.build +++ b/src/libexpr-test/meson.build @@ -16,7 +16,9 @@ cxx = meson.get_compiler('cpp') subdir('meson-utils/deps-lists') -foreach nix_dep : [ +deps_private_maybe_subproject = [ +] +deps_public_maybe_subproject = [ dependency('nix-util'), dependency('nix-util-c'), dependency('nix-util-test-support'), @@ -27,14 +29,7 @@ foreach nix_dep : [ dependency('nix-expr-c'), dependency('nix-expr-test-support'), ] - if nix_dep.type_name() == 'internal' - deps_private_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_private += nix_dep - endif -endforeach +subdir('meson-utils/subprojects') if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' # Windows DLLs are stricter about symbol visibility than Unix shared diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index 3c06710a2..30981a66e 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -18,19 +18,14 @@ subdir('meson-utils/deps-lists') configdata = configuration_data() -foreach nix_dep : [ +deps_private_maybe_subproject = [ +] +deps_public_maybe_subproject = [ dependency('nix-util'), dependency('nix-store'), dependency('nix-fetchers'), ] - if nix_dep.type_name() == 'internal' - deps_public_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_public += nix_dep - endif -endforeach +subdir('meson-utils/subprojects') # This is only conditional to work around # https://github.com/mesonbuild/meson/issues/13293. It should be diff --git a/src/libfetchers-test/meson.build b/src/libfetchers-test/meson.build index 98a5bb549..7f35cbeca 100644 --- a/src/libfetchers-test/meson.build +++ b/src/libfetchers-test/meson.build @@ -16,7 +16,9 @@ cxx = meson.get_compiler('cpp') subdir('meson-utils/deps-lists') -foreach nix_dep : [ +deps_private_maybe_subproject = [ +] +deps_public_maybe_subproject = [ dependency('nix-util'), dependency('nix-util-c'), dependency('nix-util-test-support'), @@ -25,14 +27,7 @@ foreach nix_dep : [ dependency('nix-store-test-support'), dependency('nix-fetchers'), ] - if nix_dep.type_name() == 'internal' - deps_private_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_private += nix_dep - endif -endforeach +subdir('meson-utils/subprojects') if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' # Windows DLLs are stricter about symbol visibility than Unix shared diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build index 491324c7f..07ec2bc57 100644 --- a/src/libfetchers/meson.build +++ b/src/libfetchers/meson.build @@ -18,18 +18,13 @@ subdir('meson-utils/deps-lists') configdata = configuration_data() -foreach nix_dep : [ +deps_private_maybe_subproject = [ +] +deps_public_maybe_subproject = [ dependency('nix-util'), dependency('nix-store'), ] - if nix_dep.type_name() == 'internal' - deps_public_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_public += nix_dep - endif -endforeach +subdir('meson-utils/subprojects') nlohmann_json = dependency('nlohmann_json', version : '>= 3.9') deps_public += nlohmann_json diff --git a/src/libflake-test/meson.build b/src/libflake-test/meson.build index 00fe90f6e..1a488ec13 100644 --- a/src/libflake-test/meson.build +++ b/src/libflake-test/meson.build @@ -16,7 +16,9 @@ cxx = meson.get_compiler('cpp') subdir('meson-utils/deps-lists') -foreach nix_dep : [ +deps_private_maybe_subproject = [ +] +deps_public_maybe_subproject = [ dependency('nix-util'), dependency('nix-util-c'), dependency('nix-util-test-support'), @@ -28,14 +30,7 @@ foreach nix_dep : [ dependency('nix-expr-test-support'), dependency('nix-flake'), ] - if nix_dep.type_name() == 'internal' - deps_private_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_private += nix_dep - endif -endforeach +subdir('meson-utils/subprojects') if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' # Windows DLLs are stricter about symbol visibility than Unix shared diff --git a/src/libflake/meson.build b/src/libflake/meson.build index 18c667b54..b0c172f0c 100644 --- a/src/libflake/meson.build +++ b/src/libflake/meson.build @@ -16,20 +16,15 @@ cxx = meson.get_compiler('cpp') subdir('meson-utils/deps-lists') -foreach nix_dep : [ +deps_private_maybe_subproject = [ +] +deps_public_maybe_subproject = [ dependency('nix-util'), dependency('nix-store'), dependency('nix-fetchers'), dependency('nix-expr'), ] - if nix_dep.type_name() == 'internal' - deps_public_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_public += nix_dep - endif -endforeach +subdir('meson-utils/subprojects') nlohmann_json = dependency('nlohmann_json', version : '>= 3.9') deps_public += nlohmann_json diff --git a/src/libstore-c/meson.build b/src/libstore-c/meson.build index 66446fa20..3e59050fd 100644 --- a/src/libstore-c/meson.build +++ b/src/libstore-c/meson.build @@ -18,30 +18,17 @@ subdir('meson-utils/deps-lists') configdata = configuration_data() -foreach nix_dep : [ +deps_private_maybe_subproject = [ dependency('nix-util'), dependency('nix-store'), ] - if nix_dep.type_name() == 'internal' - deps_private_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_private += nix_dep - endif -endforeach - -foreach nix_dep : [ +deps_public_maybe_subproject = [ dependency('nix-util-c'), ] - if nix_dep.type_name() == 'internal' - deps_public_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_public += nix_dep - endif -endforeach +subdir('meson-utils/subprojects') + +# TODO rename, because it will conflict with downstream projects +configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) config_h = configure_file( configuration : configdata, diff --git a/src/libstore-test-support/meson.build b/src/libstore-test-support/meson.build index 9acb6b4ad..959125561 100644 --- a/src/libstore-test-support/meson.build +++ b/src/libstore-test-support/meson.build @@ -16,19 +16,14 @@ cxx = meson.get_compiler('cpp') subdir('meson-utils/deps-lists') -foreach nix_dep : [ +deps_private_maybe_subproject = [ +] +deps_public_maybe_subproject = [ dependency('nix-util'), dependency('nix-util-test-support'), dependency('nix-store'), ] - if nix_dep.type_name() == 'internal' - deps_public_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_public += nix_dep - endif -endforeach +subdir('meson-utils/subprojects') rapidcheck = dependency('rapidcheck') deps_public += rapidcheck diff --git a/src/libstore-test/meson.build b/src/libstore-test/meson.build index 0753f9e71..4469c6d6a 100644 --- a/src/libstore-test/meson.build +++ b/src/libstore-test/meson.build @@ -16,7 +16,9 @@ cxx = meson.get_compiler('cpp') subdir('meson-utils/deps-lists') -foreach nix_dep : [ +deps_private_maybe_subproject = [ +] +deps_public_maybe_subproject = [ dependency('nix-util'), dependency('nix-util-c'), dependency('nix-util-test-support'), @@ -24,14 +26,7 @@ foreach nix_dep : [ dependency('nix-store-c'), dependency('nix-store-test-support'), ] - if nix_dep.type_name() == 'internal' - deps_private_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_private += nix_dep - endif -endforeach +subdir('meson-utils/subprojects') if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' # Windows DLLs are stricter about symbol visibility than Unix shared diff --git a/src/libstore/meson.build b/src/libstore/meson.build index 6e79a0e85..d5dcb1931 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -23,17 +23,12 @@ configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) configdata.set_quoted('SYSTEM', host_machine.system()) -foreach nix_dep : [ +deps_private_maybe_subproject = [ +] +deps_public_maybe_subproject = [ dependency('nix-util'), ] - if nix_dep.type_name() == 'internal' - deps_public_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_public += nix_dep - endif -endforeach +subdir('meson-utils/subprojects') run_command('ln', '-s', meson.project_build_root() / '__nothing_link_target', diff --git a/src/libutil-c/meson.build b/src/libutil-c/meson.build index 612138ad9..35338cbbc 100644 --- a/src/libutil-c/meson.build +++ b/src/libutil-c/meson.build @@ -18,28 +18,12 @@ subdir('meson-utils/deps-lists') configdata = configuration_data() -foreach nix_dep : [ +deps_private_maybe_subproject = [ dependency('nix-util'), ] - if nix_dep.type_name() == 'internal' - deps_private_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_private += nix_dep - endif -endforeach - -foreach nix_dep : [ +deps_public_maybe_subproject = [ ] - if nix_dep.type_name() == 'internal' - deps_public_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_public += nix_dep - endif -endforeach +subdir('meson-utils/subprojects') # TODO rename, because it will conflict with downstream projects configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) diff --git a/src/libutil-test-support/meson.build b/src/libutil-test-support/meson.build index 00e39f6ab..1b8a14355 100644 --- a/src/libutil-test-support/meson.build +++ b/src/libutil-test-support/meson.build @@ -16,17 +16,12 @@ cxx = meson.get_compiler('cpp') subdir('meson-utils/deps-lists') -foreach nix_dep : [ +deps_private_maybe_subproject = [ +] +deps_public_maybe_subproject = [ dependency('nix-util'), ] - if nix_dep.type_name() == 'internal' - deps_public_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_public += nix_dep - endif -endforeach +subdir('meson-utils/subprojects') rapidcheck = dependency('rapidcheck') deps_public += rapidcheck diff --git a/src/libutil-test/meson.build b/src/libutil-test/meson.build index 0be920a41..36e8c2288 100644 --- a/src/libutil-test/meson.build +++ b/src/libutil-test/meson.build @@ -16,19 +16,14 @@ cxx = meson.get_compiler('cpp') subdir('meson-utils/deps-lists') -foreach nix_dep : [ +deps_private_maybe_subproject = [ +] +deps_public_maybe_subproject = [ dependency('nix-util'), dependency('nix-util-c'), dependency('nix-util-test-support'), ] - if nix_dep.type_name() == 'internal' - deps_private_subproject += nix_dep - # subproject sadly no good for pkg-config module - deps_other += nix_dep - else - deps_private += nix_dep - endif -endforeach +subdir('meson-utils/subprojects') if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' # Windows DLLs are stricter about symbol visibility than Unix shared diff --git a/src/libutil/meson.build b/src/libutil/meson.build index 337480d82..d0e9f02c4 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -18,6 +18,12 @@ subdir('meson-utils/deps-lists') configdata = configuration_data() +deps_private_maybe_subproject = [ +] +deps_public_maybe_subproject = [ +] +subdir('meson-utils/subprojects') + # Check for each of these functions, and create a define like `#define # HAVE_LUTIMES 1`. The `#define` is unconditional, 0 for not found and 1 # for found. One therefore uses it with `#if` not `#ifdef`. From d6f57f3260c9a8c66367f7cedfc256b3b0894acd Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 12:42:43 -0400 Subject: [PATCH 09/36] More dedup --- meson-utils/export-all-symbols/meson.build | 11 +++++++++++ src/libexpr-c/meson.build | 12 +----------- src/libexpr-test-support/meson.build | 12 +----------- src/libexpr-test/meson.build | 12 +----------- src/libfetchers-test/meson.build | 12 +----------- src/libflake-test/meson.build | 12 +----------- src/libstore-c/meson.build | 12 +----------- src/libstore-test-support/meson.build | 12 +----------- src/libstore-test/meson.build | 12 +----------- src/libstore/meson.build | 7 +------ src/libutil-c/meson.build | 12 +----------- src/libutil-test-support/meson.build | 12 +----------- src/libutil-test/meson.build | 12 +----------- src/libutil/meson.build | 12 +----------- 14 files changed, 24 insertions(+), 138 deletions(-) create mode 100644 meson-utils/export-all-symbols/meson.build diff --git a/meson-utils/export-all-symbols/meson.build b/meson-utils/export-all-symbols/meson.build new file mode 100644 index 000000000..d7c086749 --- /dev/null +++ b/meson-utils/export-all-symbols/meson.build @@ -0,0 +1,11 @@ +if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' + # Windows DLLs are stricter about symbol visibility than Unix shared + # objects --- see https://gcc.gnu.org/wiki/Visibility for details. + # This is a temporary sledgehammer to export everything like on Unix, + # and not detail with this yet. + # + # TODO do not do this, and instead do fine-grained export annotations. + linker_export_flags = ['-Wl,--export-all-symbols'] +else + linker_export_flags = [] +endif diff --git a/src/libexpr-c/meson.build b/src/libexpr-c/meson.build index 50616d0d8..b242c2d8e 100644 --- a/src/libexpr-c/meson.build +++ b/src/libexpr-c/meson.build @@ -79,17 +79,7 @@ headers = [config_h] + files( 'nix_api_value.h', ) -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter ab_subprojectout symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') this_library = library( 'nixexprc', diff --git a/src/libexpr-test-support/meson.build b/src/libexpr-test-support/meson.build index 5dbc6b1b5..4209a4464 100644 --- a/src/libexpr-test-support/meson.build +++ b/src/libexpr-test-support/meson.build @@ -63,17 +63,7 @@ headers = files( 'tests/value/context.hh', ) -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') this_library = library( 'nix-expr-test-support', diff --git a/src/libexpr-test/meson.build b/src/libexpr-test/meson.build index cf1c48729..11ab5c6e2 100644 --- a/src/libexpr-test/meson.build +++ b/src/libexpr-test/meson.build @@ -31,17 +31,7 @@ deps_public_maybe_subproject = [ ] subdir('meson-utils/subprojects') -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') rapidcheck = dependency('rapidcheck') deps_private += rapidcheck diff --git a/src/libfetchers-test/meson.build b/src/libfetchers-test/meson.build index 7f35cbeca..846d2d70a 100644 --- a/src/libfetchers-test/meson.build +++ b/src/libfetchers-test/meson.build @@ -29,17 +29,7 @@ deps_public_maybe_subproject = [ ] subdir('meson-utils/subprojects') -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') rapidcheck = dependency('rapidcheck') deps_private += rapidcheck diff --git a/src/libflake-test/meson.build b/src/libflake-test/meson.build index 1a488ec13..e4665ce9c 100644 --- a/src/libflake-test/meson.build +++ b/src/libflake-test/meson.build @@ -32,17 +32,7 @@ deps_public_maybe_subproject = [ ] subdir('meson-utils/subprojects') -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') rapidcheck = dependency('rapidcheck') deps_private += rapidcheck diff --git a/src/libstore-c/meson.build b/src/libstore-c/meson.build index 3e59050fd..b86209720 100644 --- a/src/libstore-c/meson.build +++ b/src/libstore-c/meson.build @@ -71,17 +71,7 @@ headers = [config_h] + files( 'nix_api_store.h', ) -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter ab_subprojectout symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') this_library = library( 'nixstorec', diff --git a/src/libstore-test-support/meson.build b/src/libstore-test-support/meson.build index 959125561..9c798e9cb 100644 --- a/src/libstore-test-support/meson.build +++ b/src/libstore-test-support/meson.build @@ -65,17 +65,7 @@ headers = files( 'tests/protocol.hh', ) -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') this_library = library( 'nix-store-test-support', diff --git a/src/libstore-test/meson.build b/src/libstore-test/meson.build index 4469c6d6a..3ec7fbbd7 100644 --- a/src/libstore-test/meson.build +++ b/src/libstore-test/meson.build @@ -28,17 +28,7 @@ deps_public_maybe_subproject = [ ] subdir('meson-utils/subprojects') -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') rapidcheck = dependency('rapidcheck') deps_private += rapidcheck diff --git a/src/libstore/meson.build b/src/libstore/meson.build index d5dcb1931..a552fc819 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -401,12 +401,7 @@ foreach name, value : cpp_str_defines ] endforeach -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # See note in `../nix-util/meson.build` - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') this_library = library( 'nixstore', diff --git a/src/libutil-c/meson.build b/src/libutil-c/meson.build index 35338cbbc..b8c74bf11 100644 --- a/src/libutil-c/meson.build +++ b/src/libutil-c/meson.build @@ -68,17 +68,7 @@ headers = [config_h] + files( 'nix_api_util.h', ) -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter ab_subprojectout symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') this_library = library( 'nixutilc', diff --git a/src/libutil-test-support/meson.build b/src/libutil-test-support/meson.build index 1b8a14355..4239003c5 100644 --- a/src/libutil-test-support/meson.build +++ b/src/libutil-test-support/meson.build @@ -60,17 +60,7 @@ headers = files( 'tests/string_callback.hh', ) -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') this_library = library( 'nix-util-test-support', diff --git a/src/libutil-test/meson.build b/src/libutil-test/meson.build index 36e8c2288..8d9d32151 100644 --- a/src/libutil-test/meson.build +++ b/src/libutil-test/meson.build @@ -25,17 +25,7 @@ deps_public_maybe_subproject = [ ] subdir('meson-utils/subprojects') -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') rapidcheck = dependency('rapidcheck') deps_private += rapidcheck diff --git a/src/libutil/meson.build b/src/libutil/meson.build index d0e9f02c4..84e47b4b4 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -257,17 +257,7 @@ else subdir('unix') endif -if host_machine.system() == 'cygwin' or host_machine.system() == 'windows' - # Windows DLLs are stricter about symbol visibility than Unix shared - # objects --- see https://gcc.gnu.org/wiki/Visibility for details. - # This is a temporary sledgehammer to export everything like on Unix, - # and not detail with this yet. - # - # TODO do not do this, and instead do fine-grained export annotations. - linker_export_flags = ['-Wl,--export-all-symbols'] -else - linker_export_flags = [] -endif +subdir('meson-utils/export-all-symbols') this_library = library( 'nixutil', From 8198888bc41b3aeff445b730556a701024eabdf2 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 12:57:32 -0400 Subject: [PATCH 10/36] More dedup --- meson-utils/threads/meson.build | 6 ++++++ src/libexpr/meson.build | 7 +------ src/libstore/meson.build | 7 +------ src/libutil/meson.build | 7 +------ 4 files changed, 9 insertions(+), 18 deletions(-) create mode 100644 meson-utils/threads/meson.build diff --git a/meson-utils/threads/meson.build b/meson-utils/threads/meson.build new file mode 100644 index 000000000..294160de1 --- /dev/null +++ b/meson-utils/threads/meson.build @@ -0,0 +1,6 @@ +# This is only conditional to work around +# https://github.com/mesonbuild/meson/issues/13293. It should be +# unconditional. +if not (host_machine.system() == 'windows' and cxx.get_id() == 'gcc') + deps_private += dependency('threads') +endif diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index 30981a66e..8d37947b1 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -27,12 +27,7 @@ deps_public_maybe_subproject = [ ] subdir('meson-utils/subprojects') -# This is only conditional to work around -# https://github.com/mesonbuild/meson/issues/13293. It should be -# unconditional. -if not (host_machine.system() == 'windows' and cxx.get_id() == 'gcc') - deps_private += dependency('threads') -endif +subdir('meson-utils/threads') boost = dependency( 'boost', diff --git a/src/libstore/meson.build b/src/libstore/meson.build index a552fc819..8ec12e42f 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -67,12 +67,7 @@ has_acl_support = cxx.has_header('sys/xattr.h') \ and cxx.has_function('lremovexattr') configdata.set('HAVE_ACL_SUPPORT', has_acl_support.to_int()) -# This is only conditional to work around -# https://github.com/mesonbuild/meson/issues/13293. It should be -# unconditional. -if not (host_machine.system() == 'windows' and cxx.get_id() == 'gcc') - deps_private += dependency('threads') -endif +subdir('meson-utils/threads') boost = dependency( 'boost', diff --git a/src/libutil/meson.build b/src/libutil/meson.build index 84e47b4b4..317b06da0 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -48,12 +48,7 @@ foreach funcspec : check_funcs configdata.set(define_name, define_value) endforeach -# This is only conditional to work around -# https://github.com/mesonbuild/meson/issues/13293. It should be -# unconditional. -if not (host_machine.system() == 'windows' and cxx.get_id() == 'gcc') - deps_private += dependency('threads') -endif +subdir('meson-utils/threads') if host_machine.system() == 'windows' socket = cxx.find_library('ws2_32') From 8399bd6b8f86b74688a45acd4913414fcc19583b Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 16:11:52 -0400 Subject: [PATCH 11/36] Dedup --- meson-utils/diagnostics/meson.build | 16 ++++++++++++++++ src/libexpr-c/meson.build | 14 ++------------ src/libexpr-test-support/meson.build | 14 ++------------ src/libexpr-test/meson.build | 14 ++------------ src/libexpr/meson.build | 15 ++------------- src/libfetchers-test/meson.build | 14 ++------------ src/libfetchers/meson.build | 15 ++------------- src/libflake-test/meson.build | 14 ++------------ src/libflake/meson.build | 14 ++------------ src/libstore-c/meson.build | 14 ++------------ src/libstore-test-support/meson.build | 14 ++------------ src/libstore-test/meson.build | 14 ++------------ src/libstore/meson.build | 15 ++------------- src/libutil-c/meson.build | 15 ++------------- src/libutil-test-support/meson.build | 15 ++------------- src/libutil-test/meson.build | 15 ++------------- src/libutil/meson.build | 15 ++------------- 17 files changed, 48 insertions(+), 199 deletions(-) create mode 100644 meson-utils/diagnostics/meson.build diff --git a/meson-utils/diagnostics/meson.build b/meson-utils/diagnostics/meson.build new file mode 100644 index 000000000..eb0c636c0 --- /dev/null +++ b/meson-utils/diagnostics/meson.build @@ -0,0 +1,16 @@ +add_project_arguments( + '-Wno-deprecated-declarations', + '-Wimplicit-fallthrough', + '-Werror=switch', + '-Werror=switch-enum', + '-Werror=unused-result', + '-Wdeprecated-copy', + '-Wignored-qualifiers', + # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked + # at ~1% overhead in `nix search`. + # + # FIXME: remove when we get meson 1.4.0 which will default this to on for us: + # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions + '-D_GLIBCXX_ASSERTIONS=1', + language : 'cpp', +) diff --git a/src/libexpr-c/meson.build b/src/libexpr-c/meson.build index b242c2d8e..477640240 100644 --- a/src/libexpr-c/meson.build +++ b/src/libexpr-c/meson.build @@ -50,21 +50,11 @@ add_project_arguments( '-include', 'config-util.h', '-include', 'config-store.h', '-include', 'config-expr.h', - '-Wno-deprecated-declarations', - '-Wimplicit-fallthrough', - '-Werror=switch', - '-Werror=switch-enum', - '-Wdeprecated-copy', - '-Wignored-qualifiers', - # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked - # at ~1% overhead in `nix search`. - # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) +subdir('meson-utils/diagnostics') + sources = files( 'nix_api_expr.cc', 'nix_api_external.cc', diff --git a/src/libexpr-test-support/meson.build b/src/libexpr-test-support/meson.build index 4209a4464..ad3108a61 100644 --- a/src/libexpr-test-support/meson.build +++ b/src/libexpr-test-support/meson.build @@ -36,21 +36,11 @@ add_project_arguments( '-include', 'config-util.hh', '-include', 'config-store.hh', '-include', 'config-expr.hh', - '-Wno-deprecated-declarations', - '-Wimplicit-fallthrough', - '-Werror=switch', - '-Werror=switch-enum', - '-Wdeprecated-copy', - '-Wignored-qualifiers', - # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked - # at ~1% overhead in `nix search`. - # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) +subdir('meson-utils/diagnostics') + sources = files( 'tests/value/context.cc', ) diff --git a/src/libexpr-test/meson.build b/src/libexpr-test/meson.build index 11ab5c6e2..e5bb771e3 100644 --- a/src/libexpr-test/meson.build +++ b/src/libexpr-test/meson.build @@ -48,21 +48,11 @@ add_project_arguments( '-include', 'config-util.h', '-include', 'config-store.h', '-include', 'config-expr.h', - '-Wno-deprecated-declarations', - '-Wimplicit-fallthrough', - '-Werror=switch', - '-Werror=switch-enum', - '-Wdeprecated-copy', - '-Wignored-qualifiers', - # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked - # at ~1% overhead in `nix search`. - # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) +subdir('meson-utils/diagnostics') + sources = files( 'derived-path.cc', 'error_traces.cc', diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index 8d37947b1..d99f80486 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -66,22 +66,11 @@ add_project_arguments( '-include', 'config-util.hh', '-include', 'config-store.hh', # '-include', 'config-fetchers.h', - '-include', 'config-expr.hh', - '-Wno-deprecated-declarations', - '-Wimplicit-fallthrough', - '-Werror=switch', - '-Werror=switch-enum', - '-Wdeprecated-copy', - '-Wignored-qualifiers', - # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked - # at ~1% overhead in `nix search`. - # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) +subdir('meson-utils/diagnostics') + parser_tab = custom_target( input : 'parser.y', output : [ diff --git a/src/libfetchers-test/meson.build b/src/libfetchers-test/meson.build index 846d2d70a..30056c64a 100644 --- a/src/libfetchers-test/meson.build +++ b/src/libfetchers-test/meson.build @@ -45,21 +45,11 @@ add_project_arguments( '-include', 'config-store.hh', '-include', 'config-util.h', '-include', 'config-store.h', - '-Wno-deprecated-declarations', - '-Wimplicit-fallthrough', - '-Werror=switch', - '-Werror=switch-enum', - '-Wdeprecated-copy', - '-Wignored-qualifiers', - # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked - # at ~1% overhead in `nix search`. - # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) +subdir('meson-utils/diagnostics') + sources = files( 'public-key.cc', ) diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build index 07ec2bc57..16645bda3 100644 --- a/src/libfetchers/meson.build +++ b/src/libfetchers/meson.build @@ -38,22 +38,11 @@ add_project_arguments( '-include', 'config-util.hh', '-include', 'config-store.hh', # '-include', 'config-fetchers.h', - '-Wno-deprecated-declarations', - '-Wimplicit-fallthrough', - '-Werror=switch', - '-Werror=switch-enum', - '-Werror=unused-result', - '-Wdeprecated-copy', - '-Wignored-qualifiers', - # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked - # at ~1% overhead in `nix search`. - # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) +subdir('meson-utils/diagnostics') + sources = files( 'attrs.cc', 'cache.cc', diff --git a/src/libflake-test/meson.build b/src/libflake-test/meson.build index e4665ce9c..b5f0c2fb4 100644 --- a/src/libflake-test/meson.build +++ b/src/libflake-test/meson.build @@ -49,21 +49,11 @@ add_project_arguments( '-include', 'config-util.h', '-include', 'config-store.h', '-include', 'config-expr.h', - '-Wno-deprecated-declarations', - '-Wimplicit-fallthrough', - '-Werror=switch', - '-Werror=switch-enum', - '-Wdeprecated-copy', - '-Wignored-qualifiers', - # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked - # at ~1% overhead in `nix search`. - # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) +subdir('meson-utils/diagnostics') + sources = files( 'flakeref.cc', 'url-name.cc', diff --git a/src/libflake/meson.build b/src/libflake/meson.build index b0c172f0c..13541fc43 100644 --- a/src/libflake/meson.build +++ b/src/libflake/meson.build @@ -39,21 +39,11 @@ add_project_arguments( '-include', 'config-store.hh', # '-include', 'config-fetchers.h', '-include', 'config-expr.hh', - '-Wno-deprecated-declarations', - '-Wimplicit-fallthrough', - '-Werror=switch', - '-Werror=switch-enum', - '-Wdeprecated-copy', - '-Wignored-qualifiers', - # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked - # at ~1% overhead in `nix search`. - # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) +subdir('meson-utils/diagnostics') + sources = files( 'flake-settings.cc', 'flake/config.cc', diff --git a/src/libstore-c/meson.build b/src/libstore-c/meson.build index b86209720..cd068fed2 100644 --- a/src/libstore-c/meson.build +++ b/src/libstore-c/meson.build @@ -46,21 +46,11 @@ add_project_arguments( # From C libraries, for our public, installed headers too '-include', 'config-util.h', '-include', 'config-store.h', - '-Wno-deprecated-declarations', - '-Wimplicit-fallthrough', - '-Werror=switch', - '-Werror=switch-enum', - '-Wdeprecated-copy', - '-Wignored-qualifiers', - # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked - # at ~1% overhead in `nix search`. - # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) +subdir('meson-utils/diagnostics') + sources = files( 'nix_api_store.cc', ) diff --git a/src/libstore-test-support/meson.build b/src/libstore-test-support/meson.build index 9c798e9cb..adf6f685e 100644 --- a/src/libstore-test-support/meson.build +++ b/src/libstore-test-support/meson.build @@ -33,21 +33,11 @@ add_project_arguments( # It would be nice for our headers to be idempotent instead. '-include', 'config-util.hh', '-include', 'config-store.hh', - '-Wno-deprecated-declarations', - '-Wimplicit-fallthrough', - '-Werror=switch', - '-Werror=switch-enum', - '-Wdeprecated-copy', - '-Wignored-qualifiers', - # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked - # at ~1% overhead in `nix search`. - # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) +subdir('meson-utils/diagnostics') + sources = files( 'tests/derived-path.cc', 'tests/outputs-spec.cc', diff --git a/src/libstore-test/meson.build b/src/libstore-test/meson.build index 3ec7fbbd7..cb561977c 100644 --- a/src/libstore-test/meson.build +++ b/src/libstore-test/meson.build @@ -43,21 +43,11 @@ add_project_arguments( '-include', 'config-store.hh', '-include', 'config-util.h', '-include', 'config-store.h', - '-Wno-deprecated-declarations', - '-Wimplicit-fallthrough', - '-Werror=switch', - '-Werror=switch-enum', - '-Wdeprecated-copy', - '-Wignored-qualifiers', - # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked - # at ~1% overhead in `nix search`. - # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) +subdir('meson-utils/diagnostics') + sources = files( 'common-protocol.cc', 'content-address.cc', diff --git a/src/libstore/meson.build b/src/libstore/meson.build index 8ec12e42f..d2a5acb18 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -150,22 +150,11 @@ add_project_arguments( # It would be nice for our headers to be idempotent instead. '-include', 'config-util.hh', '-include', 'config-store.hh', - '-Wno-deprecated-declarations', - '-Wimplicit-fallthrough', - '-Werror=switch', - '-Werror=switch-enum', - '-Werror=unused-result', - '-Wdeprecated-copy', - '-Wignored-qualifiers', - # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked - # at ~1% overhead in `nix search`. - # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) +subdir('meson-utils/diagnostics') + sources = files( 'binary-cache-store.cc', 'build-result.cc', diff --git a/src/libutil-c/meson.build b/src/libutil-c/meson.build index b8c74bf11..6c316784d 100644 --- a/src/libutil-c/meson.build +++ b/src/libutil-c/meson.build @@ -42,22 +42,11 @@ add_project_arguments( # From C libraries, for our public, installed headers too '-include', 'config-util.h', - '-Wno-deprecated-declarations', - '-Wimplicit-fallthrough', - '-Werror=switch', - '-Werror=switch-enum', - '-Werror=unused-result', - '-Wdeprecated-copy', - '-Wignored-qualifiers', - # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked - # at ~1% overhead in `nix search`. - # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) +subdir('meson-utils/diagnostics') + sources = files( 'nix_api_util.cc', ) diff --git a/src/libutil-test-support/meson.build b/src/libutil-test-support/meson.build index 4239003c5..d63fabce5 100644 --- a/src/libutil-test-support/meson.build +++ b/src/libutil-test-support/meson.build @@ -30,22 +30,11 @@ add_project_arguments( # TODO(Qyriad): Yes this is how the autoconf+Make system did it. # It would be nice for our headers to be idempotent instead. '-include', 'config-util.hh', - '-Wno-deprecated-declarations', - '-Wimplicit-fallthrough', - '-Werror=switch', - '-Werror=switch-enum', - '-Werror=unused-result', - '-Wdeprecated-copy', - '-Wignored-qualifiers', - # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked - # at ~1% overhead in `nix search`. - # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) +subdir('meson-utils/diagnostics') + sources = files( 'tests/hash.cc', 'tests/string_callback.cc', diff --git a/src/libutil-test/meson.build b/src/libutil-test/meson.build index 8d9d32151..43001ca68 100644 --- a/src/libutil-test/meson.build +++ b/src/libutil-test/meson.build @@ -38,22 +38,11 @@ add_project_arguments( # It would be nice for our headers to be idempotent instead. '-include', 'config-util.hh', '-include', 'config-util.h', - '-Wno-deprecated-declarations', - '-Wimplicit-fallthrough', - '-Werror=switch', - '-Werror=switch-enum', - '-Werror=unused-result', - '-Wdeprecated-copy', - '-Wignored-qualifiers', - # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked - # at ~1% overhead in `nix search`. - # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) +subdir('meson-utils/diagnostics') + sources = files( 'args.cc', 'canon-path.cc', diff --git a/src/libutil/meson.build b/src/libutil/meson.build index 317b06da0..7a4dfaf50 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -111,22 +111,11 @@ add_project_arguments( # TODO(Qyriad): Yes this is how the autoconf+Make system did it. # It would be nice for our headers to be idempotent instead. '-include', 'config-util.hh', - '-Wno-deprecated-declarations', - '-Wimplicit-fallthrough', - '-Werror=switch', - '-Werror=switch-enum', - '-Werror=unused-result', - '-Wdeprecated-copy', - '-Wignored-qualifiers', - # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked - # at ~1% overhead in `nix search`. - # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) +subdir('meson-utils/diagnostics') + sources = files( 'archive.cc', 'args.cc', From 0b539dea4a380235696db6265215a8cca0f33821 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 17:28:31 -0400 Subject: [PATCH 12/36] Improve boost hacks --- flake.nix | 6 +++--- package.nix | 29 +-------------------------- packaging/components.nix | 17 ---------------- packaging/dependencies.nix | 13 +++++++++++++ src/libcmd/network-proxy.cc | 5 +++-- src/libexpr/package.nix | 15 +------------- src/libstore/meson.build | 2 +- src/libstore/package.nix | 10 ---------- src/libutil/meson.build | 7 +------ src/libutil/package.nix | 39 ++----------------------------------- src/perl/package.nix | 14 +------------ 11 files changed, 26 insertions(+), 131 deletions(-) diff --git a/flake.nix b/flake.nix index 582a946c4..04fc94a55 100644 --- a/flake.nix +++ b/flake.nix @@ -207,7 +207,7 @@ # https://github.com/NixOS/nixpkgs/issues/320448 "static-" = nixpkgsFor.${system}.static; }) - (nixpkgsPrefix: nixpkgs: + (nixpkgsPrefix: nixpkgs: flatMapAttrs nixpkgs.nixComponents (pkgName: pkg: flatMapAttrs pkg.tests or {} @@ -304,8 +304,8 @@ env = { # Needed for Meson to find Boost. # https://github.com/NixOS/nixpkgs/issues/86131. - BOOST_INCLUDEDIR = "${lib.getDev pkgs.boost}/include"; - BOOST_LIBRARYDIR = "${lib.getLib pkgs.boost}/lib"; + BOOST_INCLUDEDIR = "${lib.getDev pkgs.nixDependencies.boost}/include"; + BOOST_LIBRARYDIR = "${lib.getLib pkgs.nixDependencies.boost}/lib"; # For `make format`, to work without installing pre-commit _NIX_PRE_COMMIT_HOOKS_CONFIG = "${(pkgs.formats.yaml { }).generate "pre-commit-config.yaml" modular.pre-commit.settings.rawConfig}"; diff --git a/package.nix b/package.nix index 0661dc080..28d7e788f 100644 --- a/package.nix +++ b/package.nix @@ -199,7 +199,6 @@ in { ; buildInputs = lib.optionals doBuild [ - boost brotli bzip2 curl @@ -227,33 +226,12 @@ in { ; propagatedBuildInputs = [ + boost nlohmann_json ] ++ lib.optional enableGC boehmgc; dontBuild = !attrs.doBuild; - disallowedReferences = [ boost ]; - - preConfigure = lib.optionalString (doBuild && ! stdenv.hostPlatform.isStatic) ( - '' - # Copy libboost_context so we don't get all of Boost in our closure. - # https://github.com/NixOS/nixpkgs/issues/45462 - mkdir -p $out/lib - cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib - rm -f $out/lib/*.a - '' + lib.optionalString stdenv.hostPlatform.isLinux '' - chmod u+w $out/lib/*.so.* - patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.* - '' + lib.optionalString stdenv.hostPlatform.isDarwin '' - for LIB in $out/lib/*.dylib; do - chmod u+w $LIB - install_name_tool -id $LIB $LIB - install_name_tool -delete_rpath ${boost}/lib/ $LIB || true - done - install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib - '' - ); - configureFlags = [ (lib.enableFeature doBuild "build") (lib.enableFeature doInstallCheck "functional-tests") @@ -295,11 +273,6 @@ in { lib.optionalString stdenv.hostPlatform.isStatic '' mkdir -p $out/nix-support echo "file binary-dist $out/bin/nix" >> $out/nix-support/hydra-build-products - '' + lib.optionalString stdenv.isDarwin '' - install_name_tool \ - -change ${boost}/lib/libboost_context.dylib \ - $out/lib/libboost_context.dylib \ - $out/lib/libnixutil.dylib '' ) + lib.optionalString enableManual '' mkdir -p ''${!outputDoc}/nix-support diff --git a/packaging/components.nix b/packaging/components.nix index 0189f4ca3..97b989f1f 100644 --- a/packaging/components.nix +++ b/packaging/components.nix @@ -26,23 +26,6 @@ in nix-expr-test = callPackage ../src/libexpr-test/package.nix { }; nix-expr-c = callPackage ../src/libexpr-c/package.nix { }; - nix-flake = callPackage ../src/libflake/package.nix { }; - nix-flake-c = callPackage ../src/libflake-c/package.nix { }; - - nix-store = callPackage ../src/libstore/package.nix { }; - nix-store-test-support = callPackage ../src/libstore-test-support/package.nix { }; - nix-store-test = callPackage ../src/libstore-test/package.nix { }; - nix-store-c = callPackage ../src/libstore-c/package.nix { }; - - nix-fetchers = callPackage ../src/libfetchers/package.nix { }; - nix-fetchers-test = callPackage ../src/libfetchers-test/package.nix { }; - nix-fetchers-c = callPackage ../src/libfetchers-c/package.nix { }; - - nix-expr = callPackage ../src/libexpr/package.nix { }; - nix-expr-test-support = callPackage ../src/libexpr-test-support/package.nix { }; - nix-expr-test = callPackage ../src/libexpr-test/package.nix { }; - nix-expr-c = callPackage ../src/libexpr-c/package.nix { }; - nix-flake = callPackage ../src/libflake/package.nix { }; nix-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { }; diff --git a/packaging/dependencies.nix b/packaging/dependencies.nix index 484385128..b2349f02c 100644 --- a/packaging/dependencies.nix +++ b/packaging/dependencies.nix @@ -52,6 +52,19 @@ scope: { enableLargeConfig = true; }; + # Hack until https://github.com/NixOS/nixpkgs/issues/45462 is fixed. + boost = (pkgs.boost.override { + extraB2Args = [ + "--with-container" + "--with-context" + "--with-coroutine" + ]; + }).overrideAttrs (old: { + # Need to remove `--with-*` to use `--with-libraries=...` + buildPhase = pkgs.lib.replaceStrings [ "--without-python" ] [ "" ] old.buildPhase; + installPhase = pkgs.lib.replaceStrings [ "--without-python" ] [ "" ] old.installPhase; + }); + libgit2 = pkgs.libgit2.overrideAttrs (attrs: { src = inputs.libgit2; version = inputs.libgit2.lastModifiedDate; diff --git a/src/libcmd/network-proxy.cc b/src/libcmd/network-proxy.cc index 4b7d2441f..47be311cd 100644 --- a/src/libcmd/network-proxy.cc +++ b/src/libcmd/network-proxy.cc @@ -1,7 +1,6 @@ #include "network-proxy.hh" #include -#include #include "environment-variables.hh" @@ -13,7 +12,9 @@ static StringSet getAllVariables() { StringSet variables = lowercaseVariables; for (const auto & variable : lowercaseVariables) { - variables.insert(boost::to_upper_copy(variable)); + std::string upperVariable; + std::transform(variable.begin(), variable.end(), upperVariable.begin(), [](unsigned char c) { return std::toupper(c); }); + variables.insert(std::move(upperVariable)); } return variables; } diff --git a/src/libexpr/package.nix b/src/libexpr/package.nix index 223b04042..799368ee9 100644 --- a/src/libexpr/package.nix +++ b/src/libexpr/package.nix @@ -70,19 +70,14 @@ mkDerivation (finalAttrs: { pkg-config ]; - buildInputs = [ - boost - ]; - propagatedBuildInputs = [ nix-util nix-store nix-fetchers + boost nlohmann_json ] ++ lib.optional enableGC boehmgc; - disallowedReferences = [ boost ]; - preConfigure = # "Inline" .version so it's not a symlink, and includes the suffix '' @@ -104,14 +99,6 @@ mkDerivation (finalAttrs: { enableParallelBuilding = true; - postInstall = - # Remove absolute path to boost libs that ends up in `Libs.private` - # by default, and would clash with out `disallowedReferences`. Part - # of the https://github.com/NixOS/nixpkgs/issues/45462 workaround. - '' - sed -i "$out/lib/pkgconfig/nix-expr.pc" -e 's, ${lib.getLib boost}[^ ]*,,g' - ''; - separateDebugInfo = !stdenv.hostPlatform.isStatic; # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 diff --git a/src/libstore/meson.build b/src/libstore/meson.build index d2a5acb18..2bc3f27e4 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -400,6 +400,6 @@ this_library = library( install_headers(headers, subdir : 'nix', preserve_path : true) -libraries_private = ['-lboost_container'] +libraries_private = [] subdir('meson-utils/export') diff --git a/src/libstore/package.nix b/src/libstore/package.nix index f27dac2f6..5af1a7815 100644 --- a/src/libstore/package.nix +++ b/src/libstore/package.nix @@ -86,8 +86,6 @@ mkDerivation (finalAttrs: { nlohmann_json ]; - disallowedReferences = [ boost ]; - preConfigure = # "Inline" .version so it's not a symlink, and includes the suffix '' @@ -112,14 +110,6 @@ mkDerivation (finalAttrs: { enableParallelBuilding = true; - postInstall = - # Remove absolute path to boost libs that ends up in `Libs.private` - # by default, and would clash with out `disallowedReferences`. Part - # of the https://github.com/NixOS/nixpkgs/issues/45462 workaround. - '' - sed -i "$out/lib/pkgconfig/nix-store.pc" -e 's, ${lib.getLib boost}[^ ]*,,g' - ''; - separateDebugInfo = !stdenv.hostPlatform.isStatic; # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 diff --git a/src/libutil/meson.build b/src/libutil/meson.build index 7a4dfaf50..5eee8b3b2 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -254,12 +254,7 @@ this_library = library( install_headers(headers, subdir : 'nix', preserve_path : true) -# Part of how we copy boost libraries to a separate installation to -# reduce closure size. These libraries will be copied to our `$out/bin`, -# and these `-l` flags will pick them up there. -# -# https://github.com/NixOS/nixpkgs/issues/45462 -libraries_private = ['-lboost_context', '-lboost_coroutine'] +libraries_private = [] if host_machine.system() == 'windows' # `libraries_private` cannot contain ad-hoc dependencies (from # `find_library), so we need to do this manually diff --git a/src/libutil/package.nix b/src/libutil/package.nix index 8ba6daa2a..ef5e251fb 100644 --- a/src/libutil/package.nix +++ b/src/libutil/package.nix @@ -65,7 +65,6 @@ mkMesonDerivation (finalAttrs: { ]; buildInputs = [ - boost brotli libsodium openssl @@ -73,37 +72,17 @@ mkMesonDerivation (finalAttrs: { ; propagatedBuildInputs = [ - boost.dev + boost libarchive nlohmann_json ]; - disallowedReferences = [ boost ]; - preConfigure = # TODO: change release process to add `pre` in `.version`, remove it before tagging, and restore after. '' chmod u+w ./.version echo ${version} > ../../.version - '' - # Copy some boost libraries so we don't get all of Boost in our - # closure. https://github.com/NixOS/nixpkgs/issues/45462 - + lib.optionalString (!stdenv.hostPlatform.isStatic) ('' - mkdir -p $out/lib - cp -pd ${boost}/lib/{libboost_context*,libboost_thread*,libboost_system*} $out/lib - rm -f $out/lib/*.a - '' + lib.optionalString stdenv.hostPlatform.isLinux '' - chmod u+w $out/lib/*.so.* - patchelf --set-rpath $out/lib:${stdenv.cc.cc.lib}/lib $out/lib/libboost_thread.so.* - '' + lib.optionalString stdenv.hostPlatform.isDarwin '' - for LIB in $out/lib/*.dylib; do - chmod u+w $LIB - install_name_tool -id $LIB $LIB - install_name_tool -delete_rpath ${boost}/lib/ $LIB || true - done - install_name_tool -change ${boost}/lib/libboost_system.dylib $out/lib/libboost_system.dylib $out/lib/libboost_thread.dylib - '' - ); + ''; mesonFlags = [ (lib.mesonEnable "cpuid" stdenv.hostPlatform.isx86_64) @@ -120,20 +99,6 @@ mkMesonDerivation (finalAttrs: { enableParallelBuilding = true; - postInstall = - # Remove absolute path to boost libs that ends up in `Libs.private` - # by default, and would clash with out `disallowedReferences`. Part - # of the https://github.com/NixOS/nixpkgs/issues/45462 workaround. - '' - sed -i "$out/lib/pkgconfig/nix-util.pc" -e 's, ${lib.getLib boost}[^ ]*,,g' - '' - + lib.optionalString stdenv.isDarwin '' - install_name_tool \ - -change ${boost}/lib/libboost_context.dylib \ - $out/lib/libboost_context.dylib \ - $out/lib/libnixutil.dylib - ''; - separateDebugInfo = !stdenv.hostPlatform.isStatic; # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 diff --git a/src/perl/package.nix b/src/perl/package.nix index e1a84924c..6b8487148 100644 --- a/src/perl/package.nix +++ b/src/perl/package.nix @@ -6,11 +6,6 @@ , ninja , pkg-config , nix-store -, curl -, bzip2 -, xz -, boost -, libsodium , darwin , versionSuffix ? "" }: @@ -45,14 +40,7 @@ perl.pkgs.toPerlModule (stdenv.mkDerivation (finalAttrs: { buildInputs = [ nix-store - curl - bzip2 - xz - perl - boost - ] - ++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium - ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security; + ]; # `perlPackages.Test2Harness` is marked broken for Darwin doCheck = !stdenv.isDarwin; From 92d3a06b252e0c373dc732eafbcb1fa40629f00e Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 17:30:31 -0400 Subject: [PATCH 13/36] Remove overrides of removed flags since unit tests broken out --- flake.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/flake.nix b/flake.nix index 04fc94a55..ba526a9b8 100644 --- a/flake.nix +++ b/flake.nix @@ -145,9 +145,7 @@ nix = final.nixComponents.nix; nix_noTests = final.nix.override { - doCheck = false; doInstallCheck = false; - installUnitTests = false; }; # See https://github.com/NixOS/nixpkgs/pull/214409 From 429d6ae2b59912a7588804853e57711eb00962b6 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 17:44:34 -0400 Subject: [PATCH 14/36] Add missing package.nix --- src/libexpr-c/package.nix | 94 +++++++++++++++++++++ src/libexpr-test-support/package.nix | 96 ++++++++++++++++++++++ src/libexpr-test/package.nix | 113 ++++++++++++++++++++++++++ src/libstore-c/package.nix | 94 +++++++++++++++++++++ src/libstore-test-support/package.nix | 96 ++++++++++++++++++++++ src/libstore-test/package.nix | 113 ++++++++++++++++++++++++++ src/libutil-c/package.nix | 5 -- src/libutil-test-support/package.nix | 7 +- 8 files changed, 607 insertions(+), 11 deletions(-) create mode 100644 src/libexpr-c/package.nix create mode 100644 src/libexpr-test-support/package.nix create mode 100644 src/libexpr-test/package.nix create mode 100644 src/libstore-c/package.nix create mode 100644 src/libstore-test-support/package.nix create mode 100644 src/libstore-test/package.nix diff --git a/src/libexpr-c/package.nix b/src/libexpr-c/package.nix new file mode 100644 index 000000000..ce86780c1 --- /dev/null +++ b/src/libexpr-c/package.nix @@ -0,0 +1,94 @@ +{ lib +, stdenv +, releaseTools + +, meson +, ninja +, pkg-config + +, nix-store-c +, nix-expr + +# Configuration Options + +, versionSuffix ? "" + +# Check test coverage of Nix. Probably want to use with at least +# one of `doCheck` or `doInstallCheck` enabled. +, withCoverageChecks ? false +}: + +let + inherit (lib) fileset; + + version = lib.fileContents ./.version + versionSuffix; + + mkDerivation = + if withCoverageChecks + then + # TODO support `finalAttrs` args function in + # `releaseTools.coverageAnalysis`. + argsFun: + releaseTools.coverageAnalysis (let args = argsFun args; in args) + else stdenv.mkDerivation; +in + +mkDerivation (finalAttrs: { + pname = "nix-expr-c"; + inherit version; + + src = fileset.toSource { + root = ./.; + fileset = fileset.unions [ + ./meson.build + ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + (fileset.fileFilter (file: file.hasExt "h") ./.) + ]; + }; + + outputs = [ "out" "dev" ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + propagatedBuildInputs = [ + nix-store-c + nix-expr + ]; + + preConfigure = + # "Inline" .version so it's not a symlink, and includes the suffix + '' + echo ${version} > .version + ''; + + mesonFlags = [ + ]; + + env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) { + LDFLAGS = "-fuse-ld=gold"; + }; + + enableParallelBuilding = true; + + separateDebugInfo = !stdenv.hostPlatform.isStatic; + + # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 + strictDeps = !withCoverageChecks; + + hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; + + meta = { + platforms = lib.platforms.unix ++ lib.platforms.windows; + }; + +} // lib.optionalAttrs withCoverageChecks { + lcovFilter = [ "*/boost/*" "*-tab.*" ]; + + hardeningDisable = [ "fortify" ]; +}) diff --git a/src/libexpr-test-support/package.nix b/src/libexpr-test-support/package.nix new file mode 100644 index 000000000..cbc852fa5 --- /dev/null +++ b/src/libexpr-test-support/package.nix @@ -0,0 +1,96 @@ +{ lib +, stdenv +, releaseTools + +, meson +, ninja +, pkg-config + +, nix-store-test-support +, nix-expr + +, rapidcheck + +# Configuration Options + +, versionSuffix ? "" + +# Check test coverage of Nix. Probably want to use with at least +# one of `doCheck` or `doInstallCheck` enabled. +, withCoverageChecks ? false +}: + +let + inherit (lib) fileset; + + version = lib.fileContents ./.version + versionSuffix; + + mkDerivation = + if withCoverageChecks + then + # TODO support `finalAttrs` args function in + # `releaseTools.coverageAnalysis`. + argsFun: + releaseTools.coverageAnalysis (let args = argsFun args; in args) + else stdenv.mkDerivation; +in + +mkDerivation (finalAttrs: { + pname = "nix-util-test-support"; + inherit version; + + src = fileset.toSource { + root = ./.; + fileset = fileset.unions [ + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; + }; + + outputs = [ "out" "dev" ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + propagatedBuildInputs = [ + nix-store-test-support + nix-expr + rapidcheck + ]; + + preConfigure = + # "Inline" .version so it's not a symlink, and includes the suffix + '' + echo ${version} > .version + ''; + + mesonFlags = [ + ]; + + env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) { + LDFLAGS = "-fuse-ld=gold"; + }; + + enableParallelBuilding = true; + + separateDebugInfo = !stdenv.hostPlatform.isStatic; + + # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 + strictDeps = !withCoverageChecks; + + hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; + + meta = { + platforms = lib.platforms.unix ++ lib.platforms.windows; + }; + +} // lib.optionalAttrs withCoverageChecks { + lcovFilter = [ "*/boost/*" "*-tab.*" ]; + + hardeningDisable = [ "fortify" ]; +}) diff --git a/src/libexpr-test/package.nix b/src/libexpr-test/package.nix new file mode 100644 index 000000000..7c8c9c4d1 --- /dev/null +++ b/src/libexpr-test/package.nix @@ -0,0 +1,113 @@ +{ lib +, stdenv +, releaseTools + +, meson +, ninja +, pkg-config + +, nix-expr +, nix-expr-c +, nix-expr-test-support + +, rapidcheck +, gtest +, runCommand + +# Configuration Options + +, versionSuffix ? "" + +# Check test coverage of Nix. Probably want to use with at least +# one of `doCheck` or `doInstallCheck` enabled. +, withCoverageChecks ? false +}: + +let + inherit (lib) fileset; + + version = lib.fileContents ./.version + versionSuffix; + + mkDerivation = + if withCoverageChecks + then + # TODO support `finalAttrs` args function in + # `releaseTools.coverageAnalysis`. + argsFun: + releaseTools.coverageAnalysis (let args = argsFun args; in args) + else stdenv.mkDerivation; +in + +mkDerivation (finalAttrs: { + pname = "nix-expr-test"; + inherit version; + + src = fileset.toSource { + root = ./.; + fileset = fileset.unions [ + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; + }; + + outputs = [ "out" "dev" ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + buildInputs = [ + nix-expr + nix-expr-c + nix-expr-test-support + rapidcheck + gtest + ]; + + preConfigure = + # "Inline" .version so it's not a symlink, and includes the suffix + '' + echo ${version} > .version + ''; + + mesonFlags = [ + ]; + + env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) { + LDFLAGS = "-fuse-ld=gold"; + }; + + enableParallelBuilding = true; + + separateDebugInfo = !stdenv.hostPlatform.isStatic; + + # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 + strictDeps = !withCoverageChecks; + + hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; + + passthru = { + tests = { + run = runCommand "${finalAttrs.pname}-run" { + } '' + PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" + export _NIX_TEST_UNIT_DATA=${./data} + nix-expr-test + touch $out + ''; + }; + }; + + meta = { + platforms = lib.platforms.unix ++ lib.platforms.windows; + }; + +} // lib.optionalAttrs withCoverageChecks { + lcovFilter = [ "*/boost/*" "*-tab.*" ]; + + hardeningDisable = [ "fortify" ]; +}) diff --git a/src/libstore-c/package.nix b/src/libstore-c/package.nix new file mode 100644 index 000000000..aedbad4a2 --- /dev/null +++ b/src/libstore-c/package.nix @@ -0,0 +1,94 @@ +{ lib +, stdenv +, releaseTools + +, meson +, ninja +, pkg-config + +, nix-util-c +, nix-store + +# Configuration Options + +, versionSuffix ? "" + +# Check test coverage of Nix. Probably want to use with at least +# one of `doCheck` or `doInstallCheck` enabled. +, withCoverageChecks ? false +}: + +let + inherit (lib) fileset; + + version = lib.fileContents ./.version + versionSuffix; + + mkDerivation = + if withCoverageChecks + then + # TODO support `finalAttrs` args function in + # `releaseTools.coverageAnalysis`. + argsFun: + releaseTools.coverageAnalysis (let args = argsFun args; in args) + else stdenv.mkDerivation; +in + +mkDerivation (finalAttrs: { + pname = "nix-store-c"; + inherit version; + + src = fileset.toSource { + root = ./.; + fileset = fileset.unions [ + ./meson.build + ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + (fileset.fileFilter (file: file.hasExt "h") ./.) + ]; + }; + + outputs = [ "out" "dev" ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + propagatedBuildInputs = [ + nix-util-c + nix-store + ]; + + preConfigure = + # "Inline" .version so it's not a symlink, and includes the suffix + '' + echo ${version} > .version + ''; + + mesonFlags = [ + ]; + + env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) { + LDFLAGS = "-fuse-ld=gold"; + }; + + enableParallelBuilding = true; + + separateDebugInfo = !stdenv.hostPlatform.isStatic; + + # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 + strictDeps = !withCoverageChecks; + + hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; + + meta = { + platforms = lib.platforms.unix ++ lib.platforms.windows; + }; + +} // lib.optionalAttrs withCoverageChecks { + lcovFilter = [ "*/boost/*" "*-tab.*" ]; + + hardeningDisable = [ "fortify" ]; +}) diff --git a/src/libstore-test-support/package.nix b/src/libstore-test-support/package.nix new file mode 100644 index 000000000..a28f54e2a --- /dev/null +++ b/src/libstore-test-support/package.nix @@ -0,0 +1,96 @@ +{ lib +, stdenv +, releaseTools + +, meson +, ninja +, pkg-config + +, nix-util-test-support +, nix-store + +, rapidcheck + +# Configuration Options + +, versionSuffix ? "" + +# Check test coverage of Nix. Probably want to use with at least +# one of `doCheck` or `doInstallCheck` enabled. +, withCoverageChecks ? false +}: + +let + inherit (lib) fileset; + + version = lib.fileContents ./.version + versionSuffix; + + mkDerivation = + if withCoverageChecks + then + # TODO support `finalAttrs` args function in + # `releaseTools.coverageAnalysis`. + argsFun: + releaseTools.coverageAnalysis (let args = argsFun args; in args) + else stdenv.mkDerivation; +in + +mkDerivation (finalAttrs: { + pname = "nix-store-test-support"; + inherit version; + + src = fileset.toSource { + root = ./.; + fileset = fileset.unions [ + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; + }; + + outputs = [ "out" "dev" ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + propagatedBuildInputs = [ + nix-util-test-support + nix-store + rapidcheck + ]; + + preConfigure = + # "Inline" .version so it's not a symlink, and includes the suffix + '' + echo ${version} > .version + ''; + + mesonFlags = [ + ]; + + env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) { + LDFLAGS = "-fuse-ld=gold"; + }; + + enableParallelBuilding = true; + + separateDebugInfo = !stdenv.hostPlatform.isStatic; + + # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 + strictDeps = !withCoverageChecks; + + hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; + + meta = { + platforms = lib.platforms.unix ++ lib.platforms.windows; + }; + +} // lib.optionalAttrs withCoverageChecks { + lcovFilter = [ "*/boost/*" "*-tab.*" ]; + + hardeningDisable = [ "fortify" ]; +}) diff --git a/src/libstore-test/package.nix b/src/libstore-test/package.nix new file mode 100644 index 000000000..b57adfea5 --- /dev/null +++ b/src/libstore-test/package.nix @@ -0,0 +1,113 @@ +{ lib +, stdenv +, releaseTools + +, meson +, ninja +, pkg-config + +, nix-store +, nix-store-c +, nix-store-test-support + +, rapidcheck +, gtest +, runCommand + +# Configuration Options + +, versionSuffix ? "" + +# Check test coverage of Nix. Probably want to use with at least +# one of `doCheck` or `doInstallCheck` enabled. +, withCoverageChecks ? false +}: + +let + inherit (lib) fileset; + + version = lib.fileContents ./.version + versionSuffix; + + mkDerivation = + if withCoverageChecks + then + # TODO support `finalAttrs` args function in + # `releaseTools.coverageAnalysis`. + argsFun: + releaseTools.coverageAnalysis (let args = argsFun args; in args) + else stdenv.mkDerivation; +in + +mkDerivation (finalAttrs: { + pname = "nix-store-test"; + inherit version; + + src = fileset.toSource { + root = ./.; + fileset = fileset.unions [ + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; + }; + + outputs = [ "out" "dev" ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + buildInputs = [ + nix-store + nix-store-c + nix-store-test-support + rapidcheck + gtest + ]; + + preConfigure = + # "Inline" .version so it's not a symlink, and includes the suffix + '' + echo ${version} > .version + ''; + + mesonFlags = [ + ]; + + env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) { + LDFLAGS = "-fuse-ld=gold"; + }; + + enableParallelBuilding = true; + + separateDebugInfo = !stdenv.hostPlatform.isStatic; + + # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 + strictDeps = !withCoverageChecks; + + hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; + + passthru = { + tests = { + run = runCommand "${finalAttrs.pname}-run" { + } '' + PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" + export _NIX_TEST_UNIT_DATA=${./data} + nix-store-test + touch $out + ''; + }; + }; + + meta = { + platforms = lib.platforms.unix ++ lib.platforms.windows; + }; + +} // lib.optionalAttrs withCoverageChecks { + lcovFilter = [ "*/boost/*" "*-tab.*" ]; + + hardeningDisable = [ "fortify" ]; +}) diff --git a/src/libutil-c/package.nix b/src/libutil-c/package.nix index 05a26c17e..37f2291b5 100644 --- a/src/libutil-c/package.nix +++ b/src/libutil-c/package.nix @@ -55,11 +55,6 @@ mkDerivation (finalAttrs: { pkg-config ]; - buildInputs = [ - nix-util - ] - ; - propagatedBuildInputs = [ nix-util ]; diff --git a/src/libutil-test-support/package.nix b/src/libutil-test-support/package.nix index 0be0a9945..c6a0f0183 100644 --- a/src/libutil-test-support/package.nix +++ b/src/libutil-test-support/package.nix @@ -56,14 +56,9 @@ mkDerivation (finalAttrs: { pkg-config ]; - buildInputs = [ - nix-util - rapidcheck - ] - ; - propagatedBuildInputs = [ nix-util + rapidcheck ]; preConfigure = From 46ec69a483576ce095f1fde14583f174cdee2e8c Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 18:09:32 -0400 Subject: [PATCH 15/36] Everything builds in the dev shell now --- flake.nix | 4 ++ packaging/components.nix | 8 +-- src/libexpr-c/package.nix | 2 +- src/libexpr-test/meson.build | 3 + src/libexpr/package.nix | 2 +- src/libfetchers-test/package.nix | 111 +++++++++++++++++++++++++++++++ src/libflake-test/package.nix | 111 +++++++++++++++++++++++++++++++ src/libstore-c/package.nix | 2 +- src/libstore-test/meson.build | 3 + 9 files changed, 238 insertions(+), 8 deletions(-) create mode 100644 src/libfetchers-test/package.nix create mode 100644 src/libflake-test/package.nix diff --git a/flake.nix b/flake.nix index ba526a9b8..fc46ef940 100644 --- a/flake.nix +++ b/flake.nix @@ -334,6 +334,10 @@ ++ lib.optional (stdenv.cc.isClang && stdenv.hostPlatform == stdenv.buildPlatform) pkgs.buildPackages.clang-tools; buildInputs = attrs.buildInputs or [] + ++ [ + pkgs.gtest + pkgs.rapidcheck + ] ++ lib.optional havePerl pkgs.perl ; }); diff --git a/packaging/components.nix b/packaging/components.nix index 97b989f1f..5576877cb 100644 --- a/packaging/components.nix +++ b/packaging/components.nix @@ -8,28 +8,26 @@ in nix = callPackage ../package.nix { }; nix-util = callPackage ../src/libutil/package.nix { }; + nix-util-c = callPackage ../src/libutil-c/package.nix { }; nix-util-test-support = callPackage ../src/libutil-test-support/package.nix { }; nix-util-test = callPackage ../src/libutil-test/package.nix { }; - nix-util-c = callPackage ../src/libutil-c/package.nix { }; nix-store = callPackage ../src/libstore/package.nix { }; + nix-store-c = callPackage ../src/libstore-c/package.nix { }; nix-store-test-support = callPackage ../src/libstore-test-support/package.nix { }; nix-store-test = callPackage ../src/libstore-test/package.nix { }; - nix-store-c = callPackage ../src/libstore-c/package.nix { }; nix-fetchers = callPackage ../src/libfetchers/package.nix { }; nix-fetchers-test = callPackage ../src/libfetchers-test/package.nix { }; - nix-fetchers-c = callPackage ../src/libfetchers-c/package.nix { }; nix-expr = callPackage ../src/libexpr/package.nix { }; + nix-expr-c = callPackage ../src/libexpr-c/package.nix { }; nix-expr-test-support = callPackage ../src/libexpr-test-support/package.nix { }; nix-expr-test = callPackage ../src/libexpr-test/package.nix { }; - nix-expr-c = callPackage ../src/libexpr-c/package.nix { }; nix-flake = callPackage ../src/libflake/package.nix { }; nix-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { }; - nix-external-api-docs = callPackage ../src/external-api-docs/package.nix { }; nix-perl-bindings = callPackage ../src/perl/package.nix { }; diff --git a/src/libexpr-c/package.nix b/src/libexpr-c/package.nix index ce86780c1..542be064d 100644 --- a/src/libexpr-c/package.nix +++ b/src/libexpr-c/package.nix @@ -41,7 +41,7 @@ mkDerivation (finalAttrs: { root = ./.; fileset = fileset.unions [ ./meson.build - ./meson.options + # ./meson.options (fileset.fileFilter (file: file.hasExt "cc") ./.) (fileset.fileFilter (file: file.hasExt "hh") ./.) (fileset.fileFilter (file: file.hasExt "h") ./.) diff --git a/src/libexpr-test/meson.build b/src/libexpr-test/meson.build index e5bb771e3..cc32b0a1a 100644 --- a/src/libexpr-test/meson.build +++ b/src/libexpr-test/meson.build @@ -39,6 +39,9 @@ deps_private += rapidcheck gtest = dependency('gtest', main : true) deps_private += gtest +gtest = dependency('gmock') +deps_private += gtest + add_project_arguments( # TODO(Qyriad): Yes this is how the autoconf+Make system did it. # It would be nice for our headers to be idempotent instead. diff --git a/src/libexpr/package.nix b/src/libexpr/package.nix index 799368ee9..14fbf0a06 100644 --- a/src/libexpr/package.nix +++ b/src/libexpr/package.nix @@ -85,7 +85,7 @@ mkDerivation (finalAttrs: { ''; mesonFlags = [ - (lib.mesonFeature "gc" enableGC) + (lib.mesonEnable "gc" enableGC) ]; env = { diff --git a/src/libfetchers-test/package.nix b/src/libfetchers-test/package.nix new file mode 100644 index 000000000..f4d3f3b73 --- /dev/null +++ b/src/libfetchers-test/package.nix @@ -0,0 +1,111 @@ +{ lib +, stdenv +, releaseTools + +, meson +, ninja +, pkg-config + +, nix-fetchers +, nix-store-test-support + +, rapidcheck +, gtest +, runCommand + +# Configuration Options + +, versionSuffix ? "" + +# Check test coverage of Nix. Probably want to use with at least +# one of `doCheck` or `doInstallCheck` enabled. +, withCoverageChecks ? false +}: + +let + inherit (lib) fileset; + + version = lib.fileContents ./.version + versionSuffix; + + mkDerivation = + if withCoverageChecks + then + # TODO support `finalAttrs` args function in + # `releaseTools.coverageAnalysis`. + argsFun: + releaseTools.coverageAnalysis (let args = argsFun args; in args) + else stdenv.mkDerivation; +in + +mkDerivation (finalAttrs: { + pname = "nix-fetchers-test"; + inherit version; + + src = fileset.toSource { + root = ./.; + fileset = fileset.unions [ + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; + }; + + outputs = [ "out" "dev" ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + buildInputs = [ + nix-fetchers + nix-store-test-support + rapidcheck + gtest + ]; + + preConfigure = + # "Inline" .version so it's not a symlink, and includes the suffix + '' + echo ${version} > .version + ''; + + mesonFlags = [ + ]; + + env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) { + LDFLAGS = "-fuse-ld=gold"; + }; + + enableParallelBuilding = true; + + separateDebugInfo = !stdenv.hostPlatform.isStatic; + + # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 + strictDeps = !withCoverageChecks; + + hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; + + passthru = { + tests = { + run = runCommand "${finalAttrs.pname}-run" { + } '' + PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" + export _NIX_TEST_UNIT_DATA=${./data} + nix-fetchers-test + touch $out + ''; + }; + }; + + meta = { + platforms = lib.platforms.unix ++ lib.platforms.windows; + }; + +} // lib.optionalAttrs withCoverageChecks { + lcovFilter = [ "*/boost/*" "*-tab.*" ]; + + hardeningDisable = [ "fortify" ]; +}) diff --git a/src/libflake-test/package.nix b/src/libflake-test/package.nix new file mode 100644 index 000000000..f03f58619 --- /dev/null +++ b/src/libflake-test/package.nix @@ -0,0 +1,111 @@ +{ lib +, stdenv +, releaseTools + +, meson +, ninja +, pkg-config + +, nix-flake +, nix-expr-test-support + +, rapidcheck +, gtest +, runCommand + +# Configuration Options + +, versionSuffix ? "" + +# Check test coverage of Nix. Probably want to use with at least +# one of `doCheck` or `doInstallCheck` enabled. +, withCoverageChecks ? false +}: + +let + inherit (lib) fileset; + + version = lib.fileContents ./.version + versionSuffix; + + mkDerivation = + if withCoverageChecks + then + # TODO support `finalAttrs` args function in + # `releaseTools.coverageAnalysis`. + argsFun: + releaseTools.coverageAnalysis (let args = argsFun args; in args) + else stdenv.mkDerivation; +in + +mkDerivation (finalAttrs: { + pname = "nix-flake-test"; + inherit version; + + src = fileset.toSource { + root = ./.; + fileset = fileset.unions [ + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; + }; + + outputs = [ "out" "dev" ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + ]; + + buildInputs = [ + nix-flake + nix-expr-test-support + rapidcheck + gtest + ]; + + preConfigure = + # "Inline" .version so it's not a symlink, and includes the suffix + '' + echo ${version} > .version + ''; + + mesonFlags = [ + ]; + + env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) { + LDFLAGS = "-fuse-ld=gold"; + }; + + enableParallelBuilding = true; + + separateDebugInfo = !stdenv.hostPlatform.isStatic; + + # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 + strictDeps = !withCoverageChecks; + + hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; + + passthru = { + tests = { + run = runCommand "${finalAttrs.pname}-run" { + } '' + PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" + export _NIX_TEST_UNIT_DATA=${./data} + nix-flake-test + touch $out + ''; + }; + }; + + meta = { + platforms = lib.platforms.unix ++ lib.platforms.windows; + }; + +} // lib.optionalAttrs withCoverageChecks { + lcovFilter = [ "*/boost/*" "*-tab.*" ]; + + hardeningDisable = [ "fortify" ]; +}) diff --git a/src/libstore-c/package.nix b/src/libstore-c/package.nix index aedbad4a2..2ed78a760 100644 --- a/src/libstore-c/package.nix +++ b/src/libstore-c/package.nix @@ -41,7 +41,7 @@ mkDerivation (finalAttrs: { root = ./.; fileset = fileset.unions [ ./meson.build - ./meson.options + # ./meson.options (fileset.fileFilter (file: file.hasExt "cc") ./.) (fileset.fileFilter (file: file.hasExt "hh") ./.) (fileset.fileFilter (file: file.hasExt "h") ./.) diff --git a/src/libstore-test/meson.build b/src/libstore-test/meson.build index cb561977c..2cdbfa7b5 100644 --- a/src/libstore-test/meson.build +++ b/src/libstore-test/meson.build @@ -36,6 +36,9 @@ deps_private += rapidcheck gtest = dependency('gtest', main : true) deps_private += gtest +gtest = dependency('gmock') +deps_private += gtest + add_project_arguments( # TODO(Qyriad): Yes this is how the autoconf+Make system did it. # It would be nice for our headers to be idempotent instead. From 2c184f694be1835a50b628c0a8d9ab860583ce0e Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 18:18:37 -0400 Subject: [PATCH 16/36] Ensure we have data dir for libexpr unit tests --- src/libexpr-test/data/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/libexpr-test/data/.gitkeep diff --git a/src/libexpr-test/data/.gitkeep b/src/libexpr-test/data/.gitkeep new file mode 100644 index 000000000..e69de29bb From 79e0ef88bf90a968c4867d28060354d1ea0f1d6d Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 18:24:49 -0400 Subject: [PATCH 17/36] Include missing components --- packaging/components.nix | 1 + packaging/hydra.nix | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/packaging/components.nix b/packaging/components.nix index 5576877cb..73f0d24e1 100644 --- a/packaging/components.nix +++ b/packaging/components.nix @@ -26,6 +26,7 @@ in nix-expr-test = callPackage ../src/libexpr-test/package.nix { }; nix-flake = callPackage ../src/libflake/package.nix { }; + nix-flake-test = callPackage ../src/libflake-test/package.nix { }; nix-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { }; nix-external-api-docs = callPackage ../src/external-api-docs/package.nix { }; diff --git a/packaging/hydra.nix b/packaging/hydra.nix index a1691ed38..8c212d2fb 100644 --- a/packaging/hydra.nix +++ b/packaging/hydra.nix @@ -40,7 +40,17 @@ let "nix-util-test-support" "nix-util-test" "nix-store" + "nix-store-c" + "nix-store-test-support" + "nix-store-test" "nix-fetchers" + "nix-fetcher-test" + "nix-expr" + "nix-expr-c" + "nix-expr-test-support" + "nix-expr-test" + "nix-flake" + "nix-flake-test" ]; in { From 6a0582d9fd258013362c435d96cc72d0e4b15320 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 18:28:13 -0400 Subject: [PATCH 18/36] Rename file to avoid reserved name --- .../deps-lists/meson.build | 0 .../diagnostics/meson.build | 0 .../export-all-symbols/meson.build | 0 .../export/meson.build | 0 .../subprojects/meson.build | 0 .../threads/meson.build | 0 meson.build | 4 ++-- src/libcmd/build-utils-meson | 1 + src/libcmd/meson-utils | 1 - src/libexpr-c/build-utils-meson | 1 + src/libexpr-c/meson-utils | 1 - src/libexpr-c/meson.build | 10 +++++----- src/libexpr-test-support/build-utils-meson | 1 + src/libexpr-test-support/meson-utils | 1 - src/libexpr-test-support/meson.build | 10 +++++----- src/libexpr-test/build-utils-meson | 1 + src/libexpr-test/meson-utils | 1 - src/libexpr-test/meson.build | 8 ++++---- src/libexpr/build-utils-meson | 1 + src/libexpr/meson-utils | 1 - src/libexpr/meson.build | 10 +++++----- src/libfetchers-test/build-utils-meson | 1 + src/libfetchers-test/meson-utils | 1 - src/libfetchers-test/meson.build | 8 ++++---- src/libfetchers/build-utils-meson | 1 + src/libfetchers/meson-utils | 1 - src/libfetchers/meson.build | 8 ++++---- src/libflake-test/build-utils-meson | 1 + src/libflake-test/meson-utils | 1 - src/libflake-test/meson.build | 8 ++++---- src/libflake/build-utils-meson | 1 + src/libflake/meson-utils | 1 - src/libflake/meson.build | 8 ++++---- src/libmain/build-utils-meson | 1 + src/libmain/meson-utils | 1 - src/libstore-c/build-utils-meson | 1 + src/libstore-c/meson-utils | 1 - src/libstore-c/meson.build | 10 +++++----- src/libstore-test-support/build-utils-meson | 1 + src/libstore-test-support/meson-utils | 1 - src/libstore-test-support/meson.build | 10 +++++----- src/libstore-test/build-utils-meson | 1 + src/libstore-test/meson-utils | 1 - src/libstore-test/meson.build | 8 ++++---- src/libstore/build-utils-meson | 1 + src/libstore/meson-utils | 1 - src/libstore/meson.build | 12 ++++++------ src/libutil-c/build-utils-meson | 1 + src/libutil-c/meson-utils | 1 - src/libutil-c/meson.build | 10 +++++----- src/libutil-test-support/build-utils-meson | 1 + src/libutil-test-support/meson-utils | 1 - src/libutil-test-support/meson.build | 10 +++++----- src/libutil-test/build-utils-meson | 1 + src/libutil-test/meson-utils | 1 - src/libutil-test/meson.build | 8 ++++---- src/libutil/build-utils-meson | 1 + src/libutil/meson-utils | 1 - src/libutil/meson.build | 12 ++++++------ 59 files changed, 95 insertions(+), 95 deletions(-) rename {meson-utils => build-utils-meson}/deps-lists/meson.build (100%) rename {meson-utils => build-utils-meson}/diagnostics/meson.build (100%) rename {meson-utils => build-utils-meson}/export-all-symbols/meson.build (100%) rename {meson-utils => build-utils-meson}/export/meson.build (100%) rename {meson-utils => build-utils-meson}/subprojects/meson.build (100%) rename {meson-utils => build-utils-meson}/threads/meson.build (100%) create mode 120000 src/libcmd/build-utils-meson delete mode 120000 src/libcmd/meson-utils create mode 120000 src/libexpr-c/build-utils-meson delete mode 120000 src/libexpr-c/meson-utils create mode 120000 src/libexpr-test-support/build-utils-meson delete mode 120000 src/libexpr-test-support/meson-utils create mode 120000 src/libexpr-test/build-utils-meson delete mode 120000 src/libexpr-test/meson-utils create mode 120000 src/libexpr/build-utils-meson delete mode 120000 src/libexpr/meson-utils create mode 120000 src/libfetchers-test/build-utils-meson delete mode 120000 src/libfetchers-test/meson-utils create mode 120000 src/libfetchers/build-utils-meson delete mode 120000 src/libfetchers/meson-utils create mode 120000 src/libflake-test/build-utils-meson delete mode 120000 src/libflake-test/meson-utils create mode 120000 src/libflake/build-utils-meson delete mode 120000 src/libflake/meson-utils create mode 120000 src/libmain/build-utils-meson delete mode 120000 src/libmain/meson-utils create mode 120000 src/libstore-c/build-utils-meson delete mode 120000 src/libstore-c/meson-utils create mode 120000 src/libstore-test-support/build-utils-meson delete mode 120000 src/libstore-test-support/meson-utils create mode 120000 src/libstore-test/build-utils-meson delete mode 120000 src/libstore-test/meson-utils create mode 120000 src/libstore/build-utils-meson delete mode 120000 src/libstore/meson-utils create mode 120000 src/libutil-c/build-utils-meson delete mode 120000 src/libutil-c/meson-utils create mode 120000 src/libutil-test-support/build-utils-meson delete mode 120000 src/libutil-test-support/meson-utils create mode 120000 src/libutil-test/build-utils-meson delete mode 120000 src/libutil-test/meson-utils create mode 120000 src/libutil/build-utils-meson delete mode 120000 src/libutil/meson-utils diff --git a/meson-utils/deps-lists/meson.build b/build-utils-meson/deps-lists/meson.build similarity index 100% rename from meson-utils/deps-lists/meson.build rename to build-utils-meson/deps-lists/meson.build diff --git a/meson-utils/diagnostics/meson.build b/build-utils-meson/diagnostics/meson.build similarity index 100% rename from meson-utils/diagnostics/meson.build rename to build-utils-meson/diagnostics/meson.build diff --git a/meson-utils/export-all-symbols/meson.build b/build-utils-meson/export-all-symbols/meson.build similarity index 100% rename from meson-utils/export-all-symbols/meson.build rename to build-utils-meson/export-all-symbols/meson.build diff --git a/meson-utils/export/meson.build b/build-utils-meson/export/meson.build similarity index 100% rename from meson-utils/export/meson.build rename to build-utils-meson/export/meson.build diff --git a/meson-utils/subprojects/meson.build b/build-utils-meson/subprojects/meson.build similarity index 100% rename from meson-utils/subprojects/meson.build rename to build-utils-meson/subprojects/meson.build diff --git a/meson-utils/threads/meson.build b/build-utils-meson/threads/meson.build similarity index 100% rename from meson-utils/threads/meson.build rename to build-utils-meson/threads/meson.build diff --git a/meson.build b/meson.build index fb38d7ef2..e969fc907 100644 --- a/meson.build +++ b/meson.build @@ -13,8 +13,8 @@ subproject('libexpr') subproject('libflake') # Docs -subproject('internal-api-docs') -subproject('external-api-docs') +#subproject('internal-api-docs') +#subproject('external-api-docs') # C wrappers subproject('libutil-c') diff --git a/src/libcmd/build-utils-meson b/src/libcmd/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libcmd/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libcmd/meson-utils b/src/libcmd/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libcmd/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libexpr-c/build-utils-meson b/src/libexpr-c/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libexpr-c/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libexpr-c/meson-utils b/src/libexpr-c/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libexpr-c/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libexpr-c/meson.build b/src/libexpr-c/meson.build index 477640240..3c5d9e6b7 100644 --- a/src/libexpr-c/meson.build +++ b/src/libexpr-c/meson.build @@ -14,7 +14,7 @@ project('nix-expr-c', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils/deps-lists') +subdir('build-utils-meson/deps-lists') configdata = configuration_data() @@ -27,7 +27,7 @@ deps_public_maybe_subproject = [ dependency('nix-util-c'), dependency('nix-store-c'), ] -subdir('meson-utils/subprojects') +subdir('build-utils-meson/subprojects') # TODO rename, because it will conflict with downstream projects configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) @@ -53,7 +53,7 @@ add_project_arguments( language : 'cpp', ) -subdir('meson-utils/diagnostics') +subdir('build-utils-meson/diagnostics') sources = files( 'nix_api_expr.cc', @@ -69,7 +69,7 @@ headers = [config_h] + files( 'nix_api_value.h', ) -subdir('meson-utils/export-all-symbols') +subdir('build-utils-meson/export-all-symbols') this_library = library( 'nixexprc', @@ -84,4 +84,4 @@ install_headers(headers, subdir : 'nix', preserve_path : true) libraries_private = [] -subdir('meson-utils/export') +subdir('build-utils-meson/export') diff --git a/src/libexpr-test-support/build-utils-meson b/src/libexpr-test-support/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libexpr-test-support/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libexpr-test-support/meson-utils b/src/libexpr-test-support/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libexpr-test-support/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libexpr-test-support/meson.build b/src/libexpr-test-support/meson.build index ad3108a61..d42b0532b 100644 --- a/src/libexpr-test-support/meson.build +++ b/src/libexpr-test-support/meson.build @@ -14,7 +14,7 @@ project('nix-expr-test-support', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils/deps-lists') +subdir('build-utils-meson/deps-lists') deps_private_maybe_subproject = [ ] @@ -25,7 +25,7 @@ deps_public_maybe_subproject = [ dependency('nix-store-test-support'), dependency('nix-expr'), ] -subdir('meson-utils/subprojects') +subdir('build-utils-meson/subprojects') rapidcheck = dependency('rapidcheck') deps_public += rapidcheck @@ -39,7 +39,7 @@ add_project_arguments( language : 'cpp', ) -subdir('meson-utils/diagnostics') +subdir('build-utils-meson/diagnostics') sources = files( 'tests/value/context.cc', @@ -53,7 +53,7 @@ headers = files( 'tests/value/context.hh', ) -subdir('meson-utils/export-all-symbols') +subdir('build-utils-meson/export-all-symbols') this_library = library( 'nix-expr-test-support', @@ -70,4 +70,4 @@ install_headers(headers, subdir : 'nix', preserve_path : true) libraries_private = [] -subdir('meson-utils/export') +subdir('build-utils-meson/export') diff --git a/src/libexpr-test/build-utils-meson b/src/libexpr-test/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libexpr-test/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libexpr-test/meson-utils b/src/libexpr-test/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libexpr-test/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libexpr-test/meson.build b/src/libexpr-test/meson.build index cc32b0a1a..f70fd0693 100644 --- a/src/libexpr-test/meson.build +++ b/src/libexpr-test/meson.build @@ -14,7 +14,7 @@ project('nix-expr-test', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils/deps-lists') +subdir('build-utils-meson/deps-lists') deps_private_maybe_subproject = [ ] @@ -29,9 +29,9 @@ deps_public_maybe_subproject = [ dependency('nix-expr-c'), dependency('nix-expr-test-support'), ] -subdir('meson-utils/subprojects') +subdir('build-utils-meson/subprojects') -subdir('meson-utils/export-all-symbols') +subdir('build-utils-meson/export-all-symbols') rapidcheck = dependency('rapidcheck') deps_private += rapidcheck @@ -54,7 +54,7 @@ add_project_arguments( language : 'cpp', ) -subdir('meson-utils/diagnostics') +subdir('build-utils-meson/diagnostics') sources = files( 'derived-path.cc', diff --git a/src/libexpr/build-utils-meson b/src/libexpr/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libexpr/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libexpr/meson-utils b/src/libexpr/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libexpr/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index d99f80486..fdf264604 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -14,7 +14,7 @@ project('nix-expr', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils/deps-lists') +subdir('build-utils-meson/deps-lists') configdata = configuration_data() @@ -25,9 +25,9 @@ deps_public_maybe_subproject = [ dependency('nix-store'), dependency('nix-fetchers'), ] -subdir('meson-utils/subprojects') +subdir('build-utils-meson/subprojects') -subdir('meson-utils/threads') +subdir('build-utils-meson/threads') boost = dependency( 'boost', @@ -69,7 +69,7 @@ add_project_arguments( language : 'cpp', ) -subdir('meson-utils/diagnostics') +subdir('build-utils-meson/diagnostics') parser_tab = custom_target( input : 'parser.y', @@ -201,4 +201,4 @@ install_headers(headers, subdir : 'nix', preserve_path : true) libraries_private = [] -subdir('meson-utils/export') +subdir('build-utils-meson/export') diff --git a/src/libfetchers-test/build-utils-meson b/src/libfetchers-test/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libfetchers-test/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libfetchers-test/meson-utils b/src/libfetchers-test/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libfetchers-test/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libfetchers-test/meson.build b/src/libfetchers-test/meson.build index 30056c64a..e7c5b7873 100644 --- a/src/libfetchers-test/meson.build +++ b/src/libfetchers-test/meson.build @@ -14,7 +14,7 @@ project('nix-fetchers-test', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils/deps-lists') +subdir('build-utils-meson/deps-lists') deps_private_maybe_subproject = [ ] @@ -27,9 +27,9 @@ deps_public_maybe_subproject = [ dependency('nix-store-test-support'), dependency('nix-fetchers'), ] -subdir('meson-utils/subprojects') +subdir('build-utils-meson/subprojects') -subdir('meson-utils/export-all-symbols') +subdir('build-utils-meson/export-all-symbols') rapidcheck = dependency('rapidcheck') deps_private += rapidcheck @@ -48,7 +48,7 @@ add_project_arguments( language : 'cpp', ) -subdir('meson-utils/diagnostics') +subdir('build-utils-meson/diagnostics') sources = files( 'public-key.cc', diff --git a/src/libfetchers/build-utils-meson b/src/libfetchers/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libfetchers/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libfetchers/meson-utils b/src/libfetchers/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libfetchers/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build index 16645bda3..257e15766 100644 --- a/src/libfetchers/meson.build +++ b/src/libfetchers/meson.build @@ -14,7 +14,7 @@ project('nix-fetchers', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils/deps-lists') +subdir('build-utils-meson/deps-lists') configdata = configuration_data() @@ -24,7 +24,7 @@ deps_public_maybe_subproject = [ dependency('nix-util'), dependency('nix-store'), ] -subdir('meson-utils/subprojects') +subdir('build-utils-meson/subprojects') nlohmann_json = dependency('nlohmann_json', version : '>= 3.9') deps_public += nlohmann_json @@ -41,7 +41,7 @@ add_project_arguments( language : 'cpp', ) -subdir('meson-utils/diagnostics') +subdir('build-utils-meson/diagnostics') sources = files( 'attrs.cc', @@ -89,4 +89,4 @@ install_headers(headers, subdir : 'nix', preserve_path : true) libraries_private = [] -subdir('meson-utils/export') +subdir('build-utils-meson/export') diff --git a/src/libflake-test/build-utils-meson b/src/libflake-test/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libflake-test/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libflake-test/meson-utils b/src/libflake-test/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libflake-test/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libflake-test/meson.build b/src/libflake-test/meson.build index b5f0c2fb4..dd3f658be 100644 --- a/src/libflake-test/meson.build +++ b/src/libflake-test/meson.build @@ -14,7 +14,7 @@ project('nix-flake-test', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils/deps-lists') +subdir('build-utils-meson/deps-lists') deps_private_maybe_subproject = [ ] @@ -30,9 +30,9 @@ deps_public_maybe_subproject = [ dependency('nix-expr-test-support'), dependency('nix-flake'), ] -subdir('meson-utils/subprojects') +subdir('build-utils-meson/subprojects') -subdir('meson-utils/export-all-symbols') +subdir('build-utils-meson/export-all-symbols') rapidcheck = dependency('rapidcheck') deps_private += rapidcheck @@ -52,7 +52,7 @@ add_project_arguments( language : 'cpp', ) -subdir('meson-utils/diagnostics') +subdir('build-utils-meson/diagnostics') sources = files( 'flakeref.cc', diff --git a/src/libflake/build-utils-meson b/src/libflake/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libflake/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libflake/meson-utils b/src/libflake/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libflake/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libflake/meson.build b/src/libflake/meson.build index 13541fc43..e43d21dd3 100644 --- a/src/libflake/meson.build +++ b/src/libflake/meson.build @@ -14,7 +14,7 @@ project('nix-flake', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils/deps-lists') +subdir('build-utils-meson/deps-lists') deps_private_maybe_subproject = [ ] @@ -24,7 +24,7 @@ deps_public_maybe_subproject = [ dependency('nix-fetchers'), dependency('nix-expr'), ] -subdir('meson-utils/subprojects') +subdir('build-utils-meson/subprojects') nlohmann_json = dependency('nlohmann_json', version : '>= 3.9') deps_public += nlohmann_json @@ -42,7 +42,7 @@ add_project_arguments( language : 'cpp', ) -subdir('meson-utils/diagnostics') +subdir('build-utils-meson/diagnostics') sources = files( 'flake-settings.cc', @@ -74,4 +74,4 @@ install_headers(headers, subdir : 'nix', preserve_path : true) libraries_private = [] -subdir('meson-utils/export') +subdir('build-utils-meson/export') diff --git a/src/libmain/build-utils-meson b/src/libmain/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libmain/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libmain/meson-utils b/src/libmain/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libmain/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libstore-c/build-utils-meson b/src/libstore-c/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libstore-c/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libstore-c/meson-utils b/src/libstore-c/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libstore-c/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libstore-c/meson.build b/src/libstore-c/meson.build index cd068fed2..4f2d77d9f 100644 --- a/src/libstore-c/meson.build +++ b/src/libstore-c/meson.build @@ -14,7 +14,7 @@ project('nix-store-c', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils/deps-lists') +subdir('build-utils-meson/deps-lists') configdata = configuration_data() @@ -25,7 +25,7 @@ deps_private_maybe_subproject = [ deps_public_maybe_subproject = [ dependency('nix-util-c'), ] -subdir('meson-utils/subprojects') +subdir('build-utils-meson/subprojects') # TODO rename, because it will conflict with downstream projects configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) @@ -49,7 +49,7 @@ add_project_arguments( language : 'cpp', ) -subdir('meson-utils/diagnostics') +subdir('build-utils-meson/diagnostics') sources = files( 'nix_api_store.cc', @@ -61,7 +61,7 @@ headers = [config_h] + files( 'nix_api_store.h', ) -subdir('meson-utils/export-all-symbols') +subdir('build-utils-meson/export-all-symbols') this_library = library( 'nixstorec', @@ -76,4 +76,4 @@ install_headers(headers, subdir : 'nix', preserve_path : true) libraries_private = [] -subdir('meson-utils/export') +subdir('build-utils-meson/export') diff --git a/src/libstore-test-support/build-utils-meson b/src/libstore-test-support/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libstore-test-support/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libstore-test-support/meson-utils b/src/libstore-test-support/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libstore-test-support/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libstore-test-support/meson.build b/src/libstore-test-support/meson.build index adf6f685e..e278bd3f8 100644 --- a/src/libstore-test-support/meson.build +++ b/src/libstore-test-support/meson.build @@ -14,7 +14,7 @@ project('nix-store-test-support', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils/deps-lists') +subdir('build-utils-meson/deps-lists') deps_private_maybe_subproject = [ ] @@ -23,7 +23,7 @@ deps_public_maybe_subproject = [ dependency('nix-util-test-support'), dependency('nix-store'), ] -subdir('meson-utils/subprojects') +subdir('build-utils-meson/subprojects') rapidcheck = dependency('rapidcheck') deps_public += rapidcheck @@ -36,7 +36,7 @@ add_project_arguments( language : 'cpp', ) -subdir('meson-utils/diagnostics') +subdir('build-utils-meson/diagnostics') sources = files( 'tests/derived-path.cc', @@ -55,7 +55,7 @@ headers = files( 'tests/protocol.hh', ) -subdir('meson-utils/export-all-symbols') +subdir('build-utils-meson/export-all-symbols') this_library = library( 'nix-store-test-support', @@ -72,4 +72,4 @@ install_headers(headers, subdir : 'nix', preserve_path : true) libraries_private = [] -subdir('meson-utils/export') +subdir('build-utils-meson/export') diff --git a/src/libstore-test/build-utils-meson b/src/libstore-test/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libstore-test/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libstore-test/meson-utils b/src/libstore-test/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libstore-test/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libstore-test/meson.build b/src/libstore-test/meson.build index 2cdbfa7b5..6599b2d96 100644 --- a/src/libstore-test/meson.build +++ b/src/libstore-test/meson.build @@ -14,7 +14,7 @@ project('nix-store-test', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils/deps-lists') +subdir('build-utils-meson/deps-lists') deps_private_maybe_subproject = [ ] @@ -26,9 +26,9 @@ deps_public_maybe_subproject = [ dependency('nix-store-c'), dependency('nix-store-test-support'), ] -subdir('meson-utils/subprojects') +subdir('build-utils-meson/subprojects') -subdir('meson-utils/export-all-symbols') +subdir('build-utils-meson/export-all-symbols') rapidcheck = dependency('rapidcheck') deps_private += rapidcheck @@ -49,7 +49,7 @@ add_project_arguments( language : 'cpp', ) -subdir('meson-utils/diagnostics') +subdir('build-utils-meson/diagnostics') sources = files( 'common-protocol.cc', diff --git a/src/libstore/build-utils-meson b/src/libstore/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libstore/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libstore/meson-utils b/src/libstore/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libstore/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libstore/meson.build b/src/libstore/meson.build index 2bc3f27e4..62137ef5f 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -14,7 +14,7 @@ project('nix-store', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils/deps-lists') +subdir('build-utils-meson/deps-lists') configdata = configuration_data() @@ -28,7 +28,7 @@ deps_private_maybe_subproject = [ deps_public_maybe_subproject = [ dependency('nix-util'), ] -subdir('meson-utils/subprojects') +subdir('build-utils-meson/subprojects') run_command('ln', '-s', meson.project_build_root() / '__nothing_link_target', @@ -67,7 +67,7 @@ has_acl_support = cxx.has_header('sys/xattr.h') \ and cxx.has_function('lremovexattr') configdata.set('HAVE_ACL_SUPPORT', has_acl_support.to_int()) -subdir('meson-utils/threads') +subdir('build-utils-meson/threads') boost = dependency( 'boost', @@ -153,7 +153,7 @@ add_project_arguments( language : 'cpp', ) -subdir('meson-utils/diagnostics') +subdir('build-utils-meson/diagnostics') sources = files( 'binary-cache-store.cc', @@ -385,7 +385,7 @@ foreach name, value : cpp_str_defines ] endforeach -subdir('meson-utils/export-all-symbols') +subdir('build-utils-meson/export-all-symbols') this_library = library( 'nixstore', @@ -402,4 +402,4 @@ install_headers(headers, subdir : 'nix', preserve_path : true) libraries_private = [] -subdir('meson-utils/export') +subdir('build-utils-meson/export') diff --git a/src/libutil-c/build-utils-meson b/src/libutil-c/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libutil-c/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libutil-c/meson-utils b/src/libutil-c/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libutil-c/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libutil-c/meson.build b/src/libutil-c/meson.build index 6c316784d..5e12186d2 100644 --- a/src/libutil-c/meson.build +++ b/src/libutil-c/meson.build @@ -14,7 +14,7 @@ project('nix-util-c', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils/deps-lists') +subdir('build-utils-meson/deps-lists') configdata = configuration_data() @@ -23,7 +23,7 @@ deps_private_maybe_subproject = [ ] deps_public_maybe_subproject = [ ] -subdir('meson-utils/subprojects') +subdir('build-utils-meson/subprojects') # TODO rename, because it will conflict with downstream projects configdata.set_quoted('PACKAGE_VERSION', meson.project_version()) @@ -45,7 +45,7 @@ add_project_arguments( language : 'cpp', ) -subdir('meson-utils/diagnostics') +subdir('build-utils-meson/diagnostics') sources = files( 'nix_api_util.cc', @@ -57,7 +57,7 @@ headers = [config_h] + files( 'nix_api_util.h', ) -subdir('meson-utils/export-all-symbols') +subdir('build-utils-meson/export-all-symbols') this_library = library( 'nixutilc', @@ -72,4 +72,4 @@ install_headers(headers, subdir : 'nix', preserve_path : true) libraries_private = [] -subdir('meson-utils/export') +subdir('build-utils-meson/export') diff --git a/src/libutil-test-support/build-utils-meson b/src/libutil-test-support/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libutil-test-support/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libutil-test-support/meson-utils b/src/libutil-test-support/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libutil-test-support/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libutil-test-support/meson.build b/src/libutil-test-support/meson.build index d63fabce5..a36aa2a00 100644 --- a/src/libutil-test-support/meson.build +++ b/src/libutil-test-support/meson.build @@ -14,14 +14,14 @@ project('nix-util-test-support', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils/deps-lists') +subdir('build-utils-meson/deps-lists') deps_private_maybe_subproject = [ ] deps_public_maybe_subproject = [ dependency('nix-util'), ] -subdir('meson-utils/subprojects') +subdir('build-utils-meson/subprojects') rapidcheck = dependency('rapidcheck') deps_public += rapidcheck @@ -33,7 +33,7 @@ add_project_arguments( language : 'cpp', ) -subdir('meson-utils/diagnostics') +subdir('build-utils-meson/diagnostics') sources = files( 'tests/hash.cc', @@ -49,7 +49,7 @@ headers = files( 'tests/string_callback.hh', ) -subdir('meson-utils/export-all-symbols') +subdir('build-utils-meson/export-all-symbols') this_library = library( 'nix-util-test-support', @@ -66,4 +66,4 @@ install_headers(headers, subdir : 'nix', preserve_path : true) libraries_private = [] -subdir('meson-utils/export') +subdir('build-utils-meson/export') diff --git a/src/libutil-test/build-utils-meson b/src/libutil-test/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libutil-test/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libutil-test/meson-utils b/src/libutil-test/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libutil-test/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libutil-test/meson.build b/src/libutil-test/meson.build index 43001ca68..b90148f21 100644 --- a/src/libutil-test/meson.build +++ b/src/libutil-test/meson.build @@ -14,7 +14,7 @@ project('nix-util-test', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils/deps-lists') +subdir('build-utils-meson/deps-lists') deps_private_maybe_subproject = [ ] @@ -23,9 +23,9 @@ deps_public_maybe_subproject = [ dependency('nix-util-c'), dependency('nix-util-test-support'), ] -subdir('meson-utils/subprojects') +subdir('build-utils-meson/subprojects') -subdir('meson-utils/export-all-symbols') +subdir('build-utils-meson/export-all-symbols') rapidcheck = dependency('rapidcheck') deps_private += rapidcheck @@ -41,7 +41,7 @@ add_project_arguments( language : 'cpp', ) -subdir('meson-utils/diagnostics') +subdir('build-utils-meson/diagnostics') sources = files( 'args.cc', diff --git a/src/libutil/build-utils-meson b/src/libutil/build-utils-meson new file mode 120000 index 000000000..5fff21bab --- /dev/null +++ b/src/libutil/build-utils-meson @@ -0,0 +1 @@ +../../build-utils-meson \ No newline at end of file diff --git a/src/libutil/meson-utils b/src/libutil/meson-utils deleted file mode 120000 index 41c67447e..000000000 --- a/src/libutil/meson-utils +++ /dev/null @@ -1 +0,0 @@ -../../meson-utils \ No newline at end of file diff --git a/src/libutil/meson.build b/src/libutil/meson.build index 5eee8b3b2..c87808067 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -14,7 +14,7 @@ project('nix-util', 'cpp', cxx = meson.get_compiler('cpp') -subdir('meson-utils/deps-lists') +subdir('build-utils-meson/deps-lists') configdata = configuration_data() @@ -22,7 +22,7 @@ deps_private_maybe_subproject = [ ] deps_public_maybe_subproject = [ ] -subdir('meson-utils/subprojects') +subdir('build-utils-meson/subprojects') # Check for each of these functions, and create a define like `#define # HAVE_LUTIMES 1`. The `#define` is unconditional, 0 for not found and 1 @@ -48,7 +48,7 @@ foreach funcspec : check_funcs configdata.set(define_name, define_value) endforeach -subdir('meson-utils/threads') +subdir('build-utils-meson/threads') if host_machine.system() == 'windows' socket = cxx.find_library('ws2_32') @@ -114,7 +114,7 @@ add_project_arguments( language : 'cpp', ) -subdir('meson-utils/diagnostics') +subdir('build-utils-meson/diagnostics') sources = files( 'archive.cc', @@ -241,7 +241,7 @@ else subdir('unix') endif -subdir('meson-utils/export-all-symbols') +subdir('build-utils-meson/export-all-symbols') this_library = library( 'nixutil', @@ -261,4 +261,4 @@ if host_machine.system() == 'windows' libraries_private += ['-lws2_32'] endif -subdir('meson-utils/export') +subdir('build-utils-meson/export') From 5ba9f6cec616b26994441a8cbd766e528cd99609 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 18:28:24 -0400 Subject: [PATCH 19/36] Fix typo --- packaging/hydra.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/hydra.nix b/packaging/hydra.nix index 8c212d2fb..244a4ad3f 100644 --- a/packaging/hydra.nix +++ b/packaging/hydra.nix @@ -44,7 +44,7 @@ let "nix-store-test-support" "nix-store-test" "nix-fetchers" - "nix-fetcher-test" + "nix-fetchers-test" "nix-expr" "nix-expr-c" "nix-expr-test-support" From 479befa76d6b6d78b9304716a108ecd8c5cbae6c Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 19:19:32 -0400 Subject: [PATCH 20/36] More fixes --- flake.nix | 1 + meson.build | 4 ++-- src/libexpr-c/package.nix | 4 +++- src/libexpr-test-support/package.nix | 4 +++- src/libexpr-test/meson.build | 10 ++-------- src/libexpr-test/package.nix | 4 +++- src/libexpr/{flake => }/call-flake.nix | 0 src/libexpr/eval.cc | 2 +- src/libexpr/local.mk | 2 +- src/libexpr/meson.build | 13 ++++++------- src/libexpr/package.nix | 19 ++++++++++++++++++- src/libexpr/primops/meson.build | 17 +++++++++++++++++ src/libfetchers-test/meson.build | 11 ++--------- src/libfetchers-test/package.nix | 4 +++- src/libfetchers/meson.build | 2 +- src/libfetchers/package.nix | 4 +++- src/libflake-test/meson.build | 15 ++------------- src/libflake-test/package.nix | 4 +++- src/libflake/meson.build | 3 --- src/libflake/package.nix | 4 +++- src/libstore-c/package.nix | 4 +++- src/libstore-test-support/package.nix | 4 +++- src/libstore-test/meson.build | 7 ++----- src/libstore-test/package.nix | 4 +++- src/libstore/package.nix | 4 +++- src/libutil-c/package.nix | 4 +++- src/libutil-test-support/package.nix | 4 +++- src/libutil-test/meson.build | 4 ++-- src/libutil-test/package.nix | 4 +++- src/libutil/package.nix | 2 ++ 30 files changed, 101 insertions(+), 67 deletions(-) rename src/libexpr/{flake => }/call-flake.nix (100%) create mode 100644 src/libexpr/primops/meson.build diff --git a/flake.nix b/flake.nix index fc46ef940..cfea7d386 100644 --- a/flake.nix +++ b/flake.nix @@ -324,6 +324,7 @@ ++ pkgs.nixComponents.nix-internal-api-docs.nativeBuildInputs ++ pkgs.nixComponents.nix-external-api-docs.nativeBuildInputs ++ [ + pkgs.buildPackages.cmake modular.pre-commit.settings.package (pkgs.writeScriptBin "pre-commit-hooks-install" modular.pre-commit.settings.installationScript) diff --git a/meson.build b/meson.build index e969fc907..fb38d7ef2 100644 --- a/meson.build +++ b/meson.build @@ -13,8 +13,8 @@ subproject('libexpr') subproject('libflake') # Docs -#subproject('internal-api-docs') -#subproject('external-api-docs') +subproject('internal-api-docs') +subproject('external-api-docs') # C wrappers subproject('libutil-c') diff --git a/src/libexpr-c/package.nix b/src/libexpr-c/package.nix index 542be064d..33412e218 100644 --- a/src/libexpr-c/package.nix +++ b/src/libexpr-c/package.nix @@ -62,9 +62,11 @@ mkDerivation (finalAttrs: { ]; preConfigure = - # "Inline" .version so it's not a symlink, and includes the suffix + # "Inline" .version so it's not a symlink, and includes the suffix. + # Do the meson utils, without modification. '' echo ${version} > .version + cp -r ${../../build-utils-meson} build-utils-meson ''; mesonFlags = [ diff --git a/src/libexpr-test-support/package.nix b/src/libexpr-test-support/package.nix index cbc852fa5..ecfb2bb09 100644 --- a/src/libexpr-test-support/package.nix +++ b/src/libexpr-test-support/package.nix @@ -64,9 +64,11 @@ mkDerivation (finalAttrs: { ]; preConfigure = - # "Inline" .version so it's not a symlink, and includes the suffix + # "Inline" .version so it's not a symlink, and includes the suffix. + # Do the meson utils, without modification. '' echo ${version} > .version + cp -r ${../../build-utils-meson} build-utils-meson ''; mesonFlags = [ diff --git a/src/libexpr-test/meson.build b/src/libexpr-test/meson.build index f70fd0693..04b60f6d6 100644 --- a/src/libexpr-test/meson.build +++ b/src/libexpr-test/meson.build @@ -17,18 +17,12 @@ cxx = meson.get_compiler('cpp') subdir('build-utils-meson/deps-lists') deps_private_maybe_subproject = [ -] -deps_public_maybe_subproject = [ - dependency('nix-util'), - dependency('nix-util-c'), - dependency('nix-util-test-support'), - dependency('nix-store'), - dependency('nix-store-c'), - dependency('nix-store-test-support'), dependency('nix-expr'), dependency('nix-expr-c'), dependency('nix-expr-test-support'), ] +deps_public_maybe_subproject = [ +] subdir('build-utils-meson/subprojects') subdir('build-utils-meson/export-all-symbols') diff --git a/src/libexpr-test/package.nix b/src/libexpr-test/package.nix index 7c8c9c4d1..12f4dd506 100644 --- a/src/libexpr-test/package.nix +++ b/src/libexpr-test/package.nix @@ -69,9 +69,11 @@ mkDerivation (finalAttrs: { ]; preConfigure = - # "Inline" .version so it's not a symlink, and includes the suffix + # "Inline" .version so it's not a symlink, and includes the suffix. + # Do the meson utils, without modification. '' echo ${version} > .version + cp -r ${../../build-utils-meson} build-utils-meson ''; mesonFlags = [ diff --git a/src/libexpr/flake/call-flake.nix b/src/libexpr/call-flake.nix similarity index 100% rename from src/libexpr/flake/call-flake.nix rename to src/libexpr/call-flake.nix diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index d2be00e55..48ed66883 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -293,7 +293,7 @@ EvalState::EvalState( )} , callFlakeInternal{internalFS->addFile( CanonPath("call-flake.nix"), - #include "flake/call-flake.nix.gen.hh" + #include "call-flake.nix.gen.hh" )} , store(store) , buildStore(buildStore ? buildStore : store) diff --git a/src/libexpr/local.mk b/src/libexpr/local.mk index 26958bf2c..68518e184 100644 --- a/src/libexpr/local.mk +++ b/src/libexpr/local.mk @@ -47,4 +47,4 @@ $(foreach i, $(wildcard src/libexpr/value/*.hh), \ $(d)/primops.cc: $(d)/imported-drv-to-derivation.nix.gen.hh -$(d)/eval.cc: $(d)/primops/derivation.nix.gen.hh $(d)/fetchurl.nix.gen.hh $(d)/flake/call-flake.nix.gen.hh +$(d)/eval.cc: $(d)/primops/derivation.nix.gen.hh $(d)/fetchurl.nix.gen.hh $(d)/call-flake.nix.gen.hh diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index fdf264604..04822d179 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -55,6 +55,9 @@ if bdw_gc.found() endif configdata.set('HAVE_BOEHMGC', bdw_gc.found().to_int()) +toml11 = dependency('toml11', version : '>=3.7.0', method : 'cmake') +deps_other += toml11 + config_h = configure_file( configuration : configdata, output : 'config-expr.hh', @@ -117,8 +120,7 @@ generated_headers = [] foreach header : [ 'imported-drv-to-derivation.nix', 'fetchurl.nix', - 'flake/call-flake.nix', - 'primops/derivation.nix', + 'call-flake.nix', ] generated_headers += custom_target( command : [ 'bash', '-c', '{ echo \'R"__NIX_STR(\' && cat @INPUT@ && echo \')__NIX_STR"\'; } > "$1"', '_ignored_argv0', '@OUTPUT@' ], @@ -142,11 +144,6 @@ sources = files( 'nixexpr.cc', 'paths.cc', 'primops.cc', - 'primops/context.cc', - 'primops/fetchClosure.cc', - 'primops/fetchMercurial.cc', - 'primops/fetchTree.cc', - 'primops/fromTOML.cc', 'print-ambiguous.cc', 'print.cc', 'search-path.cc', @@ -187,6 +184,8 @@ headers = [config_h] + files( 'value/context.hh', ) +subdir('primops') + this_library = library( 'nixexpr', sources, diff --git a/src/libexpr/package.nix b/src/libexpr/package.nix index 14fbf0a06..855d5057e 100644 --- a/src/libexpr/package.nix +++ b/src/libexpr/package.nix @@ -5,6 +5,9 @@ , meson , ninja , pkg-config +, bison +, flex +, cmake # for resolving toml11 dep , nix-util , nix-store @@ -12,6 +15,7 @@ , boost , boehmgc , nlohmann_json +, toml11 # Configuration Options @@ -57,8 +61,12 @@ mkDerivation (finalAttrs: { fileset = fileset.unions [ ./meson.build ./meson.options + ./primops/meson.build (fileset.fileFilter (file: file.hasExt "cc") ./.) (fileset.fileFilter (file: file.hasExt "hh") ./.) + ./lexer.l + ./parser.y + (fileset.fileFilter (file: file.hasExt "nix") ./.) ]; }; @@ -68,6 +76,13 @@ mkDerivation (finalAttrs: { meson ninja pkg-config + bison + flex + cmake + ]; + + buildInputs = [ + toml11 ]; propagatedBuildInputs = [ @@ -79,9 +94,11 @@ mkDerivation (finalAttrs: { ] ++ lib.optional enableGC boehmgc; preConfigure = - # "Inline" .version so it's not a symlink, and includes the suffix + # "Inline" .version so it's not a symlink, and includes the suffix. + # Do the meson utils, without modification. '' echo ${version} > .version + cp -r ${../../build-utils-meson} build-utils-meson ''; mesonFlags = [ diff --git a/src/libexpr/primops/meson.build b/src/libexpr/primops/meson.build new file mode 100644 index 000000000..96a1dd07e --- /dev/null +++ b/src/libexpr/primops/meson.build @@ -0,0 +1,17 @@ +foreach header : [ + 'derivation.nix', +] + generated_headers += custom_target( + command : [ 'bash', '-c', '{ echo \'R"__NIX_STR(\' && cat @INPUT@ && echo \')__NIX_STR"\'; } > "$1"', '_ignored_argv0', '@OUTPUT@' ], + input : header, + output : '@PLAINNAME@.gen.hh', + ) +endforeach + +sources += files( + 'context.cc', + 'fetchClosure.cc', + 'fetchMercurial.cc', + 'fetchTree.cc', + 'fromTOML.cc', +) diff --git a/src/libfetchers-test/meson.build b/src/libfetchers-test/meson.build index e7c5b7873..785754b34 100644 --- a/src/libfetchers-test/meson.build +++ b/src/libfetchers-test/meson.build @@ -17,16 +17,11 @@ cxx = meson.get_compiler('cpp') subdir('build-utils-meson/deps-lists') deps_private_maybe_subproject = [ -] -deps_public_maybe_subproject = [ - dependency('nix-util'), - dependency('nix-util-c'), - dependency('nix-util-test-support'), - dependency('nix-store'), - dependency('nix-store-c'), dependency('nix-store-test-support'), dependency('nix-fetchers'), ] +deps_public_maybe_subproject = [ +] subdir('build-utils-meson/subprojects') subdir('build-utils-meson/export-all-symbols') @@ -43,8 +38,6 @@ add_project_arguments( '-include', 'config-util.hh', '-include', 'config-store.hh', '-include', 'config-store.hh', - '-include', 'config-util.h', - '-include', 'config-store.h', language : 'cpp', ) diff --git a/src/libfetchers-test/package.nix b/src/libfetchers-test/package.nix index f4d3f3b73..78d8ab490 100644 --- a/src/libfetchers-test/package.nix +++ b/src/libfetchers-test/package.nix @@ -67,9 +67,11 @@ mkDerivation (finalAttrs: { ]; preConfigure = - # "Inline" .version so it's not a symlink, and includes the suffix + # "Inline" .version so it's not a symlink, and includes the suffix. + # Do the meson utils, without modification. '' echo ${version} > .version + cp -r ${../../build-utils-meson} build-utils-meson ''; mesonFlags = [ diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build index 257e15766..d5703bbb3 100644 --- a/src/libfetchers/meson.build +++ b/src/libfetchers/meson.build @@ -30,7 +30,7 @@ nlohmann_json = dependency('nlohmann_json', version : '>= 3.9') deps_public += nlohmann_json libgit2 = dependency('libgit2') -deps_public += libgit2 +deps_private += libgit2 add_project_arguments( # TODO(Qyriad): Yes this is how the autoconf+Make system did it. diff --git a/src/libfetchers/package.nix b/src/libfetchers/package.nix index d2560255e..0146f5aa5 100644 --- a/src/libfetchers/package.nix +++ b/src/libfetchers/package.nix @@ -69,9 +69,11 @@ mkDerivation (finalAttrs: { ]; preConfigure = - # "Inline" .version so its not a symlink, and includes the suffix + # "Inline" .version so it's not a symlink, and includes the suffix. + # Do the meson utils, without modification. '' echo ${version} > .version + cp -r ${../../build-utils-meson} build-utils-meson ''; env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) { diff --git a/src/libflake-test/meson.build b/src/libflake-test/meson.build index dd3f658be..b8221b2ad 100644 --- a/src/libflake-test/meson.build +++ b/src/libflake-test/meson.build @@ -17,19 +17,11 @@ cxx = meson.get_compiler('cpp') subdir('build-utils-meson/deps-lists') deps_private_maybe_subproject = [ -] -deps_public_maybe_subproject = [ - dependency('nix-util'), - dependency('nix-util-c'), - dependency('nix-util-test-support'), - dependency('nix-store'), - dependency('nix-store-c'), - dependency('nix-store-test-support'), - dependency('nix-expr'), - dependency('nix-expr-c'), dependency('nix-expr-test-support'), dependency('nix-flake'), ] +deps_public_maybe_subproject = [ +] subdir('build-utils-meson/subprojects') subdir('build-utils-meson/export-all-symbols') @@ -46,9 +38,6 @@ add_project_arguments( '-include', 'config-util.hh', '-include', 'config-store.hh', '-include', 'config-expr.hh', - '-include', 'config-util.h', - '-include', 'config-store.h', - '-include', 'config-expr.h', language : 'cpp', ) diff --git a/src/libflake-test/package.nix b/src/libflake-test/package.nix index f03f58619..4fb190706 100644 --- a/src/libflake-test/package.nix +++ b/src/libflake-test/package.nix @@ -67,9 +67,11 @@ mkDerivation (finalAttrs: { ]; preConfigure = - # "Inline" .version so it's not a symlink, and includes the suffix + # "Inline" .version so it's not a symlink, and includes the suffix. + # Do the meson utils, without modification. '' echo ${version} > .version + cp -r ${../../build-utils-meson} build-utils-meson ''; mesonFlags = [ diff --git a/src/libflake/meson.build b/src/libflake/meson.build index e43d21dd3..30f98dce6 100644 --- a/src/libflake/meson.build +++ b/src/libflake/meson.build @@ -29,9 +29,6 @@ subdir('build-utils-meson/subprojects') nlohmann_json = dependency('nlohmann_json', version : '>= 3.9') deps_public += nlohmann_json -libgit2 = dependency('libgit2') -deps_public += libgit2 - add_project_arguments( # TODO(Qyriad): Yes this is how the autoconf+Make system did it. # It would be nice for our headers to be idempotent instead. diff --git a/src/libflake/package.nix b/src/libflake/package.nix index 1280df7b7..523da4b78 100644 --- a/src/libflake/package.nix +++ b/src/libflake/package.nix @@ -69,9 +69,11 @@ mkDerivation (finalAttrs: { ]; preConfigure = - # "Inline" .version so its not a symlink, and includes the suffix + # "Inline" .version so it's not a symlink, and includes the suffix. + # Do the meson utils, without modification. '' echo ${version} > .version + cp -r ${../../build-utils-meson} build-utils-meson ''; env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) { diff --git a/src/libstore-c/package.nix b/src/libstore-c/package.nix index 2ed78a760..d0e81b1f9 100644 --- a/src/libstore-c/package.nix +++ b/src/libstore-c/package.nix @@ -62,9 +62,11 @@ mkDerivation (finalAttrs: { ]; preConfigure = - # "Inline" .version so it's not a symlink, and includes the suffix + # "Inline" .version so it's not a symlink, and includes the suffix. + # Do the meson utils, without modification. '' echo ${version} > .version + cp -r ${../../build-utils-meson} build-utils-meson ''; mesonFlags = [ diff --git a/src/libstore-test-support/package.nix b/src/libstore-test-support/package.nix index a28f54e2a..0f4ea73ba 100644 --- a/src/libstore-test-support/package.nix +++ b/src/libstore-test-support/package.nix @@ -64,9 +64,11 @@ mkDerivation (finalAttrs: { ]; preConfigure = - # "Inline" .version so it's not a symlink, and includes the suffix + # "Inline" .version so it's not a symlink, and includes the suffix. + # Do the meson utils, without modification. '' echo ${version} > .version + cp -r ${../../build-utils-meson} build-utils-meson ''; mesonFlags = [ diff --git a/src/libstore-test/meson.build b/src/libstore-test/meson.build index 6599b2d96..bfd827b01 100644 --- a/src/libstore-test/meson.build +++ b/src/libstore-test/meson.build @@ -17,15 +17,12 @@ cxx = meson.get_compiler('cpp') subdir('build-utils-meson/deps-lists') deps_private_maybe_subproject = [ -] -deps_public_maybe_subproject = [ - dependency('nix-util'), - dependency('nix-util-c'), - dependency('nix-util-test-support'), dependency('nix-store'), dependency('nix-store-c'), dependency('nix-store-test-support'), ] +deps_public_maybe_subproject = [ +] subdir('build-utils-meson/subprojects') subdir('build-utils-meson/export-all-symbols') diff --git a/src/libstore-test/package.nix b/src/libstore-test/package.nix index b57adfea5..0a49f1a05 100644 --- a/src/libstore-test/package.nix +++ b/src/libstore-test/package.nix @@ -69,9 +69,11 @@ mkDerivation (finalAttrs: { ]; preConfigure = - # "Inline" .version so it's not a symlink, and includes the suffix + # "Inline" .version so it's not a symlink, and includes the suffix. + # Do the meson utils, without modification. '' echo ${version} > .version + cp -r ${../../build-utils-meson} build-utils-meson ''; mesonFlags = [ diff --git a/src/libstore/package.nix b/src/libstore/package.nix index 5af1a7815..a08fabff7 100644 --- a/src/libstore/package.nix +++ b/src/libstore/package.nix @@ -87,9 +87,11 @@ mkDerivation (finalAttrs: { ]; preConfigure = - # "Inline" .version so it's not a symlink, and includes the suffix + # "Inline" .version so it's not a symlink, and includes the suffix. + # Do the meson utils, without modification. '' echo ${version} > .version + cp -r ${../../build-utils-meson} build-utils-meson ''; mesonFlags = [ diff --git a/src/libutil-c/package.nix b/src/libutil-c/package.nix index 37f2291b5..ba1dbe38a 100644 --- a/src/libutil-c/package.nix +++ b/src/libutil-c/package.nix @@ -60,9 +60,11 @@ mkDerivation (finalAttrs: { ]; preConfigure = - # "Inline" .version so it's not a symlink, and includes the suffix + # "Inline" .version so it's not a symlink, and includes the suffix. + # Do the meson utils, without modification. '' echo ${version} > .version + cp -r ${../../build-utils-meson} build-utils-meson ''; mesonFlags = [ diff --git a/src/libutil-test-support/package.nix b/src/libutil-test-support/package.nix index c6a0f0183..795159ebf 100644 --- a/src/libutil-test-support/package.nix +++ b/src/libutil-test-support/package.nix @@ -62,9 +62,11 @@ mkDerivation (finalAttrs: { ]; preConfigure = - # "Inline" .version so it's not a symlink, and includes the suffix + # "Inline" .version so it's not a symlink, and includes the suffix. + # Do the meson utils, without modification. '' echo ${version} > .version + cp -r ${../../build-utils-meson} build-utils-meson ''; mesonFlags = [ diff --git a/src/libutil-test/meson.build b/src/libutil-test/meson.build index b90148f21..19157cda3 100644 --- a/src/libutil-test/meson.build +++ b/src/libutil-test/meson.build @@ -17,12 +17,12 @@ cxx = meson.get_compiler('cpp') subdir('build-utils-meson/deps-lists') deps_private_maybe_subproject = [ -] -deps_public_maybe_subproject = [ dependency('nix-util'), dependency('nix-util-c'), dependency('nix-util-test-support'), ] +deps_public_maybe_subproject = [ +] subdir('build-utils-meson/subprojects') subdir('build-utils-meson/export-all-symbols') diff --git a/src/libutil-test/package.nix b/src/libutil-test/package.nix index 391f8d853..396e41f3d 100644 --- a/src/libutil-test/package.nix +++ b/src/libutil-test/package.nix @@ -69,9 +69,11 @@ mkDerivation (finalAttrs: { ]; preConfigure = - # "Inline" .version so it's not a symlink, and includes the suffix + # "Inline" .version so it's not a symlink, and includes the suffix. + # Do the meson utils, without modification. '' echo ${version} > .version + cp -r ${../../build-utils-meson} build-utils-meson ''; mesonFlags = [ diff --git a/src/libutil/package.nix b/src/libutil/package.nix index ef5e251fb..aff338d16 100644 --- a/src/libutil/package.nix +++ b/src/libutil/package.nix @@ -79,9 +79,11 @@ mkMesonDerivation (finalAttrs: { preConfigure = # TODO: change release process to add `pre` in `.version`, remove it before tagging, and restore after. + # Do the meson utils, without modification. '' chmod u+w ./.version echo ${version} > ../../.version + cp -r ${../../build-utils-meson} build-utils-meson ''; mesonFlags = [ From 17c843c5c536e6f9266003956a8251a7882ecccc Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 19:30:58 -0400 Subject: [PATCH 21/36] Fix more issues --- package.nix | 5 +---- packaging/dependencies.nix | 13 ++++++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/package.nix b/package.nix index 28d7e788f..da3a069fa 100644 --- a/package.nix +++ b/package.nix @@ -207,10 +207,7 @@ in { libsodium openssl sqlite - (toml11.overrideAttrs (old: { - # TODO change in Nixpkgs, Windows works fine. - meta.platforms = lib.platforms.all; - })) + toml11 xz ({ inherit readline editline; }.${readlineFlavor}) ] ++ lib.optionals enableMarkdown [ diff --git a/packaging/dependencies.nix b/packaging/dependencies.nix index b2349f02c..909a0a38e 100644 --- a/packaging/dependencies.nix +++ b/packaging/dependencies.nix @@ -10,6 +10,7 @@ stdenv, versionSuffix, }: + let inherit (pkgs) lib; @@ -52,7 +53,7 @@ scope: { enableLargeConfig = true; }; - # Hack until https://github.com/NixOS/nixpkgs/issues/45462 is fixed. + # TODO Hack until https://github.com/NixOS/nixpkgs/issues/45462 is fixed. boost = (pkgs.boost.override { extraB2Args = [ "--with-container" @@ -61,8 +62,8 @@ scope: { ]; }).overrideAttrs (old: { # Need to remove `--with-*` to use `--with-libraries=...` - buildPhase = pkgs.lib.replaceStrings [ "--without-python" ] [ "" ] old.buildPhase; - installPhase = pkgs.lib.replaceStrings [ "--without-python" ] [ "" ] old.installPhase; + buildPhase = lib.replaceStrings [ "--without-python" ] [ "" ] old.buildPhase; + installPhase = lib.replaceStrings [ "--without-python" ] [ "" ] old.installPhase; }); libgit2 = pkgs.libgit2.overrideAttrs (attrs: { @@ -96,5 +97,11 @@ scope: { ''; }); + # TODO change in Nixpkgs, Windows works fine. First commit of + # https://github.com/NixOS/nixpkgs/pull/322977 backported will fix. + toml11 = pkgs.toml11.overrideAttrs (old: { + meta.platforms = lib.platforms.all; + }); + mkMesonDerivation = f: stdenv.mkDerivation (lib.extends localSourceLayer f); } From 7312d13acc134f57a4b959f035cac6f661c469cd Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 19:35:54 -0400 Subject: [PATCH 22/36] Keep another test dir --- src/libflake-test/data/.gitkeep | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/libflake-test/data/.gitkeep diff --git a/src/libflake-test/data/.gitkeep b/src/libflake-test/data/.gitkeep new file mode 100644 index 000000000..e69de29bb From 874ff000d4f7e661e7e95d608f6ab7083f563d6a Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 27 Jun 2024 20:41:03 -0400 Subject: [PATCH 23/36] Fix format --- maintainers/flake-module.nix | 2 +- src/libcmd/network-proxy.cc | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index b78e5f63a..c0373dee4 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -15,7 +15,7 @@ excludes = [ # We don't want to format test data # ''tests/(?!nixos/).*\.nix'' - ''^src/[^/]*-test/[^/]*/data/.*$'' + ''^src/[^/]*-test/data/.*$'' # Don't format vendored code ''^doc/manual/redirects\.js$'' diff --git a/src/libcmd/network-proxy.cc b/src/libcmd/network-proxy.cc index 47be311cd..738bf6147 100644 --- a/src/libcmd/network-proxy.cc +++ b/src/libcmd/network-proxy.cc @@ -13,7 +13,8 @@ static StringSet getAllVariables() StringSet variables = lowercaseVariables; for (const auto & variable : lowercaseVariables) { std::string upperVariable; - std::transform(variable.begin(), variable.end(), upperVariable.begin(), [](unsigned char c) { return std::toupper(c); }); + std::transform( + variable.begin(), variable.end(), upperVariable.begin(), [](unsigned char c) { return std::toupper(c); }); variables.insert(std::move(upperVariable)); } return variables; From f7ce10dbc15635ebc652d4746c74e437a964881e Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 28 Jun 2024 14:26:04 -0400 Subject: [PATCH 24/36] Fix static build --- package.nix | 4 ++-- src/libstore/meson.build | 27 ++++++++++++++------------- src/libstore/package.nix | 7 +++++-- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/package.nix b/package.nix index da3a069fa..041786d47 100644 --- a/package.nix +++ b/package.nix @@ -33,7 +33,7 @@ , rapidcheck , sqlite , toml11 -, util-linux +, unixtools , xz , busybox-sandbox-shell ? null @@ -195,7 +195,7 @@ in { man # for testing `nix-* --help` ] ++ lib.optionals (doInstallCheck || enableManual) [ jq # Also for custom mdBook preprocessor. - ] ++ lib.optional stdenv.hostPlatform.isLinux util-linux + ] ++ lib.optional stdenv.hostPlatform.isStatic unixtools.hexdump ; buildInputs = lib.optionals doBuild [ diff --git a/src/libstore/meson.build b/src/libstore/meson.build index 62137ef5f..0686a591e 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -99,15 +99,6 @@ deps_public += nlohmann_json sqlite = dependency('sqlite3', 'sqlite', version : '>=3.6.19') deps_private += sqlite - -enable_embedded_sandbox_shell = get_option('embedded-sandbox-shell') -if enable_embedded_sandbox_shell - # This one goes in config.h - # The path to busybox is passed as a -D flag when compiling this_library. - # Idk why, ask the old buildsystem. - configdata.set('HAVE_EMBEDDED_SANDBOX_SHELL', 1) -endif - generated_headers = [] foreach header : [ 'schema.sql', @@ -122,7 +113,13 @@ foreach header : [ ) endforeach -if enable_embedded_sandbox_shell +busybox = find_program(get_option('sandbox-shell'), required : false) + +if get_option('embedded-sandbox-shell') + # This one goes in config.h + # The path to busybox is passed as a -D flag when compiling this_library. + # Idk why, ask the old buildsystem. + configdata.set('HAVE_EMBEDDED_SANDBOX_SHELL', 1) hexdump = find_program('hexdump', native : true) embedded_sandbox_shell_gen = custom_target( 'embedded-sandbox-shell.gen.hh', @@ -371,11 +368,15 @@ cpp_str_defines += { 'LSOF': lsof_path } -#if busybox.found() +if get_option('embedded-sandbox-shell') cpp_str_defines += { -# 'SANDBOX_SHELL': busybox.full_path() + 'SANDBOX_SHELL': '__embedded_sandbox_shell__' } -#endif +elif busybox.found() + cpp_str_defines += { + 'SANDBOX_SHELL': busybox.full_path() + } +endif cpp_args = [] diff --git a/src/libstore/package.nix b/src/libstore/package.nix index a08fabff7..d4859a411 100644 --- a/src/libstore/package.nix +++ b/src/libstore/package.nix @@ -5,6 +5,7 @@ , meson , ninja , pkg-config +, unixtools , nix-util , boost @@ -20,6 +21,8 @@ , versionSuffix ? "" +, embeddedSandboxShell ? stdenv.hostPlatform.isStatic + # Check test coverage of Nix. Probably want to use with at least # one of `doCheck` or `doInstallCheck` enabled. , withCoverageChecks ? false @@ -66,7 +69,7 @@ mkDerivation (finalAttrs: { meson ninja pkg-config - ]; + ] ++ lib.optional embeddedSandboxShell unixtools.hexdump; buildInputs = [ boost @@ -96,7 +99,7 @@ mkDerivation (finalAttrs: { mesonFlags = [ (lib.mesonEnable "seccomp-sandboxing" stdenv.hostPlatform.isLinux) - (lib.mesonBool "embedded-sandbox-shell" stdenv.hostPlatform.isStatic) + (lib.mesonBool "embedded-sandbox-shell" embeddedSandboxShell) ] ++ lib.optionals stdenv.hostPlatform.isLinux [ (lib.mesonOption "sandbox-shell" "${busybox-sandbox-shell}/bin/busybox") ]; From 912c517bc067f35caab5225822ab2fb8b3ccb1fb Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 28 Jun 2024 14:57:10 -0400 Subject: [PATCH 25/36] Fix build of unit tests --- src/libexpr-c/meson.build | 3 +++ src/libstore-c/meson.build | 3 +++ src/libstore-test/meson.build | 3 +++ src/libstore-test/package.nix | 13 ++++++++++--- src/libutil-c/meson.build | 3 +++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/libexpr-c/meson.build b/src/libexpr-c/meson.build index 3c5d9e6b7..fa970c3a2 100644 --- a/src/libexpr-c/meson.build +++ b/src/libexpr-c/meson.build @@ -69,6 +69,9 @@ headers = [config_h] + files( 'nix_api_value.h', ) +# TODO don't install this once tests don't use it. +headers += files('nix_api_expr_internal.h') + subdir('build-utils-meson/export-all-symbols') this_library = library( diff --git a/src/libstore-c/meson.build b/src/libstore-c/meson.build index 4f2d77d9f..93ce97960 100644 --- a/src/libstore-c/meson.build +++ b/src/libstore-c/meson.build @@ -61,6 +61,9 @@ headers = [config_h] + files( 'nix_api_store.h', ) +# TODO don't install this once tests don't use it. +headers += files('nix_api_store_internal.h') + subdir('build-utils-meson/export-all-symbols') this_library = library( diff --git a/src/libstore-test/meson.build b/src/libstore-test/meson.build index bfd827b01..6bf0a5028 100644 --- a/src/libstore-test/meson.build +++ b/src/libstore-test/meson.build @@ -27,6 +27,9 @@ subdir('build-utils-meson/subprojects') subdir('build-utils-meson/export-all-symbols') +sqlite = dependency('sqlite3', 'sqlite', version : '>=3.6.19') +deps_private += sqlite + rapidcheck = dependency('rapidcheck') deps_private += rapidcheck diff --git a/src/libstore-test/package.nix b/src/libstore-test/package.nix index 0a49f1a05..e37e64886 100644 --- a/src/libstore-test/package.nix +++ b/src/libstore-test/package.nix @@ -9,6 +9,7 @@ , nix-store , nix-store-c , nix-store-test-support +, sqlite , rapidcheck , gtest @@ -64,6 +65,7 @@ mkDerivation (finalAttrs: { nix-store nix-store-c nix-store-test-support + sqlite rapidcheck gtest ]; @@ -94,10 +96,15 @@ mkDerivation (finalAttrs: { passthru = { tests = { - run = runCommand "${finalAttrs.pname}-run" { - } '' + run = let + # Inline some drv files shared with the libexpr tests + data = runCommand "${finalAttrs.pname}-test-data" {} '' + cp -r --no-preserve=mode ${./data} $out + cp -r --remove-destination ${../../tests/functional/derivation}/* $out/derivation/ + ''; + in runCommand "${finalAttrs.pname}-run" {} '' PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" - export _NIX_TEST_UNIT_DATA=${./data} + export _NIX_TEST_UNIT_DATA=${data} nix-store-test touch $out ''; diff --git a/src/libutil-c/meson.build b/src/libutil-c/meson.build index 5e12186d2..2fa1bd424 100644 --- a/src/libutil-c/meson.build +++ b/src/libutil-c/meson.build @@ -57,6 +57,9 @@ headers = [config_h] + files( 'nix_api_util.h', ) +# TODO don't install this once tests don't use it. +headers += files('nix_api_util_internal.h') + subdir('build-utils-meson/export-all-symbols') this_library = library( From 513f6b971855947de8ac9a344319eace77e9c2ad Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 28 Jun 2024 17:02:23 -0400 Subject: [PATCH 26/36] meson: Prelink links to avoid missing C++ initializers This is the same as what the old build system did in 7eca8a16eaf74bc15a816e24005a65e5480d2a79, done for the same reasons. --- src/libexpr-c/meson.build | 1 + src/libexpr-test-support/meson.build | 1 + src/libexpr/meson.build | 1 + src/libfetchers/meson.build | 1 + src/libflake/meson.build | 1 + src/libstore-c/meson.build | 1 + src/libstore-test-support/meson.build | 1 + src/libstore/meson.build | 1 + src/libutil-c/meson.build | 1 + src/libutil-test-support/meson.build | 1 + src/libutil/meson.build | 1 + src/perl/lib/Nix/meson.build | 1 + 12 files changed, 12 insertions(+) diff --git a/src/libexpr-c/meson.build b/src/libexpr-c/meson.build index fa970c3a2..fb9ade28d 100644 --- a/src/libexpr-c/meson.build +++ b/src/libexpr-c/meson.build @@ -80,6 +80,7 @@ this_library = library( dependencies : deps_public + deps_private + deps_other, include_directories : include_dirs, link_args: linker_export_flags, + prelink : true, # For C++ static initializers install : true, ) diff --git a/src/libexpr-test-support/meson.build b/src/libexpr-test-support/meson.build index d42b0532b..705672204 100644 --- a/src/libexpr-test-support/meson.build +++ b/src/libexpr-test-support/meson.build @@ -63,6 +63,7 @@ this_library = library( # TODO: Remove `-lrapidcheck` when https://github.com/emil-e/rapidcheck/pull/326 # is available. See also ../libutil/build.meson link_args: linker_export_flags + ['-lrapidcheck'], + prelink : true, # For C++ static initializers install : true, ) diff --git a/src/libexpr/meson.build b/src/libexpr/meson.build index 04822d179..9fe7c17c4 100644 --- a/src/libexpr/meson.build +++ b/src/libexpr/meson.build @@ -193,6 +193,7 @@ this_library = library( lexer_tab, generated_headers, dependencies : deps_public + deps_private + deps_other, + prelink : true, # For C++ static initializers install : true, ) diff --git a/src/libfetchers/meson.build b/src/libfetchers/meson.build index d5703bbb3..c39fe99f3 100644 --- a/src/libfetchers/meson.build +++ b/src/libfetchers/meson.build @@ -82,6 +82,7 @@ this_library = library( 'nixfetchers', sources, dependencies : deps_public + deps_private + deps_other, + prelink : true, # For C++ static initializers install : true, ) diff --git a/src/libflake/meson.build b/src/libflake/meson.build index 30f98dce6..d3c3d3079 100644 --- a/src/libflake/meson.build +++ b/src/libflake/meson.build @@ -64,6 +64,7 @@ this_library = library( 'nixflake', sources, dependencies : deps_public + deps_private + deps_other, + prelink : true, # For C++ static initializers install : true, ) diff --git a/src/libstore-c/meson.build b/src/libstore-c/meson.build index 93ce97960..426f07a34 100644 --- a/src/libstore-c/meson.build +++ b/src/libstore-c/meson.build @@ -72,6 +72,7 @@ this_library = library( dependencies : deps_public + deps_private + deps_other, include_directories : include_dirs, link_args: linker_export_flags, + prelink : true, # For C++ static initializers install : true, ) diff --git a/src/libstore-test-support/meson.build b/src/libstore-test-support/meson.build index e278bd3f8..ddb067c1b 100644 --- a/src/libstore-test-support/meson.build +++ b/src/libstore-test-support/meson.build @@ -65,6 +65,7 @@ this_library = library( # TODO: Remove `-lrapidcheck` when https://github.com/emil-e/rapidcheck/pull/326 # is available. See also ../libutil/build.meson link_args: linker_export_flags + ['-lrapidcheck'], + prelink : true, # For C++ static initializers install : true, ) diff --git a/src/libstore/meson.build b/src/libstore/meson.build index 0686a591e..f94a454da 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -396,6 +396,7 @@ this_library = library( include_directories : include_dirs, cpp_args : cpp_args, link_args: linker_export_flags, + prelink : true, # For C++ static initializers install : true, ) diff --git a/src/libutil-c/meson.build b/src/libutil-c/meson.build index 2fa1bd424..3f0d96282 100644 --- a/src/libutil-c/meson.build +++ b/src/libutil-c/meson.build @@ -68,6 +68,7 @@ this_library = library( dependencies : deps_public + deps_private + deps_other, include_directories : include_dirs, link_args: linker_export_flags, + prelink : true, # For C++ static initializers install : true, ) diff --git a/src/libutil-test-support/meson.build b/src/libutil-test-support/meson.build index a36aa2a00..7d0e9c2fc 100644 --- a/src/libutil-test-support/meson.build +++ b/src/libutil-test-support/meson.build @@ -59,6 +59,7 @@ this_library = library( # TODO: Remove `-lrapidcheck` when https://github.com/emil-e/rapidcheck/pull/326 # is available. See also ../libutil/build.meson link_args: linker_export_flags + ['-lrapidcheck'], + prelink : true, # For C++ static initializers install : true, ) diff --git a/src/libutil/meson.build b/src/libutil/meson.build index c87808067..ac2b83536 100644 --- a/src/libutil/meson.build +++ b/src/libutil/meson.build @@ -249,6 +249,7 @@ this_library = library( dependencies : deps_public + deps_private + deps_other, include_directories : include_dirs, link_args: linker_export_flags, + prelink : true, # For C++ static initializers install : true, ) diff --git a/src/perl/lib/Nix/meson.build b/src/perl/lib/Nix/meson.build index 9a79245cd..256e66096 100644 --- a/src/perl/lib/Nix/meson.build +++ b/src/perl/lib/Nix/meson.build @@ -43,6 +43,7 @@ nix_perl_store_lib = library( 'Store', sources : nix_perl_store_cc, name_prefix : '', + prelink : true, # For C++ static initializers install : true, install_mode : 'rwxr-xr-x', install_dir : join_paths(nix_perl_install_dir, 'auto', 'Nix', 'Store'), From 3ad39d2afb50e42c6479c4007da10fde9262cc68 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 28 Jun 2024 17:17:20 -0400 Subject: [PATCH 27/36] Fix library name --- src/libfetchers/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libfetchers/package.nix b/src/libfetchers/package.nix index 0146f5aa5..681ffa112 100644 --- a/src/libfetchers/package.nix +++ b/src/libfetchers/package.nix @@ -38,7 +38,7 @@ let in mkDerivation (finalAttrs: { - pname = "nix-flake"; + pname = "nix-fetchers"; inherit version; src = fileset.toSource { From 496b4a9cd2d097569ab52804559355f014fee2e3 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 29 Jun 2024 10:31:08 -0400 Subject: [PATCH 28/36] Move around unit test dirs to match new names --- .gitignore | 10 +- doc/manual/src/contributing/testing.md | 4 +- maintainers/flake-module.nix | 120 +++++++++--------- meson.build | 16 +-- packaging/components.nix | 16 +-- packaging/hydra.nix | 10 +- src/internal-api-docs/doxygen.cfg.in | 16 +-- .../.version | 0 .../build-utils-meson | 0 .../meson.build | 0 .../package.nix | 0 .../tests/libexpr.hh | 0 .../tests/nix_api_expr.hh | 0 .../tests/value/context.cc | 0 .../tests/value/context.hh | 0 src/{libexpr-test => nix-expr-tests}/.version | 0 .../build-utils-meson | 0 .../data/.gitkeep | 0 .../derived-path.cc | 0 .../error_traces.cc | 0 src/{libexpr-test => nix-expr-tests}/eval.cc | 0 src/{libexpr-test => nix-expr-tests}/json.cc | 0 src/{libexpr-test => nix-expr-tests}/main.cc | 0 .../meson.build | 2 +- .../nix_api_expr.cc | 0 .../nix_api_external.cc | 0 .../nix_api_value.cc | 0 .../package.nix | 4 +- .../primops.cc | 0 .../search-path.cc | 0 .../trivial.cc | 0 .../value/context.cc | 0 .../value/print.cc | 0 .../value/value.cc | 0 .../.version | 0 .../build-utils-meson | 0 .../data/public-key/defaultType.json | 0 .../data/public-key/noRoundTrip.json | 0 .../data/public-key/simple.json | 0 .../meson.build | 2 +- .../package.nix | 4 +- .../public-key.cc | 0 .../.version | 0 .../build-utils-meson | 0 .../data/.gitkeep | 0 .../flakeref.cc | 0 .../meson.build | 2 +- .../package.nix | 4 +- .../url-name.cc | 0 .../.version | 0 .../build-utils-meson | 0 .../meson.build | 0 .../package.nix | 0 .../tests/derived-path.cc | 0 .../tests/derived-path.hh | 0 .../tests/libstore.hh | 0 .../tests/nix_api_store.hh | 0 .../tests/outputs-spec.cc | 0 .../tests/outputs-spec.hh | 0 .../tests/path.cc | 0 .../tests/path.hh | 0 .../tests/protocol.hh | 0 .../.version | 0 .../build-utils-meson | 0 .../common-protocol.cc | 0 .../content-address.cc | 0 .../data/common-protocol/content-address.bin | Bin .../data/common-protocol/drv-output.bin | Bin .../optional-content-address.bin | Bin .../common-protocol/optional-store-path.bin | Bin .../data/common-protocol/realisation.bin | Bin .../data/common-protocol/set.bin | Bin .../data/common-protocol/store-path.bin | Bin .../data/common-protocol/string.bin | Bin .../data/common-protocol/vector.bin | Bin .../advanced-attributes-defaults.drv | 0 .../advanced-attributes-defaults.json | 0 ...d-attributes-structured-attrs-defaults.drv | 0 ...-attributes-structured-attrs-defaults.json | 0 .../advanced-attributes-structured-attrs.drv | 0 .../advanced-attributes-structured-attrs.json | 0 .../data/derivation/advanced-attributes.drv | 0 .../derivation/bad-old-version-dyn-deps.drv | 0 .../data/derivation/bad-version.drv | 0 .../data/derivation/dynDerivationDeps.drv | 0 .../data/derivation/dynDerivationDeps.json | 0 .../data/derivation/output-caFixedFlat.json | 0 .../data/derivation/output-caFixedNAR.json | 0 .../data/derivation/output-caFixedText.json | 0 .../data/derivation/output-caFloating.json | 0 .../data/derivation/output-deferred.json | 0 .../data/derivation/output-impure.json | 0 .../derivation/output-inputAddressed.json | 0 .../data/derivation/simple.drv | 0 .../data/derivation/simple.json | 0 .../data/machines/bad_format | 0 .../data/machines/valid | 0 .../data/nar-info/impure.json | 0 .../data/nar-info/pure.json | 0 .../data/path-info/empty_impure.json | 0 .../data/path-info/empty_pure.json | 0 .../data/path-info/impure.json | 0 .../data/path-info/pure.json | 0 .../data/serve-protocol/build-options-2.1.bin | Bin .../data/serve-protocol/build-options-2.2.bin | Bin .../data/serve-protocol/build-options-2.3.bin | Bin .../data/serve-protocol/build-options-2.7.bin | Bin .../data/serve-protocol/build-result-2.2.bin | Bin .../data/serve-protocol/build-result-2.3.bin | Bin .../data/serve-protocol/build-result-2.6.bin | Bin .../data/serve-protocol/content-address.bin | Bin .../data/serve-protocol/drv-output.bin | Bin .../serve-protocol/handshake-to-client.bin | Bin .../optional-content-address.bin | Bin .../serve-protocol/optional-store-path.bin | Bin .../data/serve-protocol/realisation.bin | Bin .../data/serve-protocol/set.bin | Bin .../data/serve-protocol/store-path.bin | Bin .../data/serve-protocol/string.bin | Bin .../unkeyed-valid-path-info-2.3.bin | Bin .../unkeyed-valid-path-info-2.4.bin | Bin .../data/serve-protocol/vector.bin | Bin .../data/store-reference/auto.txt | 0 .../data/store-reference/auto_param.txt | 0 .../data/store-reference/local_1.txt | 0 .../data/store-reference/local_2.txt | 0 .../store-reference/local_shorthand_1.txt | 0 .../store-reference/local_shorthand_2.txt | 0 .../data/store-reference/ssh.txt | 0 .../data/store-reference/unix.txt | 0 .../data/store-reference/unix_shorthand.txt | 0 .../data/worker-protocol/build-mode.bin | Bin .../worker-protocol/build-result-1.27.bin | Bin .../worker-protocol/build-result-1.28.bin | Bin .../worker-protocol/build-result-1.29.bin | Bin .../worker-protocol/build-result-1.37.bin | Bin .../client-handshake-info_1_30.bin | 0 .../client-handshake-info_1_33.bin | Bin .../client-handshake-info_1_35.bin | Bin .../data/worker-protocol/content-address.bin | Bin .../worker-protocol/derived-path-1.29.bin | Bin .../worker-protocol/derived-path-1.30.bin | Bin .../data/worker-protocol/drv-output.bin | Bin .../worker-protocol/handshake-to-client.bin | Bin .../keyed-build-result-1.29.bin | Bin .../optional-content-address.bin | Bin .../worker-protocol/optional-store-path.bin | Bin .../worker-protocol/optional-trusted-flag.bin | Bin .../data/worker-protocol/realisation.bin | Bin .../data/worker-protocol/set.bin | Bin .../data/worker-protocol/store-path.bin | Bin .../data/worker-protocol/string.bin | Bin .../unkeyed-valid-path-info-1.15.bin | Bin .../worker-protocol/valid-path-info-1.15.bin | Bin .../worker-protocol/valid-path-info-1.16.bin | Bin .../data/worker-protocol/vector.bin | Bin .../derivation-advanced-attrs.cc | 0 .../derivation.cc | 0 .../derived-path.cc | 0 .../downstream-placeholder.cc | 0 .../machines.cc | 0 .../meson.build | 2 +- .../nar-info-disk-cache.cc | 0 .../nar-info.cc | 0 .../nix_api_store.cc | 0 .../outputs-spec.cc | 0 .../package.nix | 4 +- .../path-info.cc | 0 .../path.cc | 0 .../references.cc | 0 .../serve-protocol.cc | 0 .../store-reference.cc | 0 .../worker-protocol.cc | 0 .../.version | 0 .../build-utils-meson | 0 .../meson.build | 0 .../package.nix | 0 .../tests/characterization.hh | 0 .../tests/hash.cc | 0 .../tests/hash.hh | 0 .../tests/nix_api_util.hh | 0 .../tests/string_callback.cc | 0 .../tests/string_callback.hh | 0 src/{libutil-test => nix-util-tests}/.version | 0 src/{libutil-test => nix-util-tests}/args.cc | 0 .../build-utils-meson | 0 .../canon-path.cc | 0 .../chunked-vector.cc | 0 .../closure.cc | 0 .../compression.cc | 0 .../config.cc | 0 .../data/git/check-data.sh | 0 .../data/git/hello-world-blob.bin | Bin .../data/git/hello-world.bin | Bin .../data/git/tree.bin | Bin .../data/git/tree.txt | 0 .../file-content-address.cc | 0 src/{libutil-test => nix-util-tests}/git.cc | 2 +- src/{libutil-test => nix-util-tests}/hash.cc | 0 .../hilite.cc | 0 .../json-utils.cc | 0 .../logging.cc | 0 .../lru-cache.cc | 0 .../meson.build | 2 +- .../nix_api_util.cc | 0 .../package.nix | 4 +- src/{libutil-test => nix-util-tests}/pool.cc | 0 .../references.cc | 0 src/{libutil-test => nix-util-tests}/spawn.cc | 0 .../suggestions.cc | 0 src/{libutil-test => nix-util-tests}/tests.cc | 0 src/{libutil-test => nix-util-tests}/url.cc | 0 .../xml-writer.cc | 0 213 files changed, 112 insertions(+), 112 deletions(-) rename src/{libexpr-test-support => nix-expr-test-support}/.version (100%) rename src/{libexpr-test-support => nix-expr-test-support}/build-utils-meson (100%) rename src/{libexpr-test-support => nix-expr-test-support}/meson.build (100%) rename src/{libexpr-test-support => nix-expr-test-support}/package.nix (100%) rename src/{libexpr-test-support => nix-expr-test-support}/tests/libexpr.hh (100%) rename src/{libexpr-test-support => nix-expr-test-support}/tests/nix_api_expr.hh (100%) rename src/{libexpr-test-support => nix-expr-test-support}/tests/value/context.cc (100%) rename src/{libexpr-test-support => nix-expr-test-support}/tests/value/context.hh (100%) rename src/{libexpr-test => nix-expr-tests}/.version (100%) rename src/{libexpr-test => nix-expr-tests}/build-utils-meson (100%) rename src/{libexpr-test => nix-expr-tests}/data/.gitkeep (100%) rename src/{libexpr-test => nix-expr-tests}/derived-path.cc (100%) rename src/{libexpr-test => nix-expr-tests}/error_traces.cc (100%) rename src/{libexpr-test => nix-expr-tests}/eval.cc (100%) rename src/{libexpr-test => nix-expr-tests}/json.cc (100%) rename src/{libexpr-test => nix-expr-tests}/main.cc (100%) rename src/{libexpr-test => nix-expr-tests}/meson.build (98%) rename src/{libexpr-test => nix-expr-tests}/nix_api_expr.cc (100%) rename src/{libexpr-test => nix-expr-tests}/nix_api_external.cc (100%) rename src/{libexpr-test => nix-expr-tests}/nix_api_value.cc (100%) rename src/{libexpr-test => nix-expr-tests}/package.nix (97%) rename src/{libexpr-test => nix-expr-tests}/primops.cc (100%) rename src/{libexpr-test => nix-expr-tests}/search-path.cc (100%) rename src/{libexpr-test => nix-expr-tests}/trivial.cc (100%) rename src/{libexpr-test => nix-expr-tests}/value/context.cc (100%) rename src/{libexpr-test => nix-expr-tests}/value/print.cc (100%) rename src/{libexpr-test => nix-expr-tests}/value/value.cc (100%) rename src/{libfetchers-test => nix-fetchers-tests}/.version (100%) rename src/{libfetchers-test => nix-fetchers-tests}/build-utils-meson (100%) rename src/{libfetchers-test => nix-fetchers-tests}/data/public-key/defaultType.json (100%) rename src/{libfetchers-test => nix-fetchers-tests}/data/public-key/noRoundTrip.json (100%) rename src/{libfetchers-test => nix-fetchers-tests}/data/public-key/simple.json (100%) rename src/{libfetchers-test => nix-fetchers-tests}/meson.build (97%) rename src/{libfetchers-test => nix-fetchers-tests}/package.nix (97%) rename src/{libfetchers-test => nix-fetchers-tests}/public-key.cc (100%) rename src/{libflake-test => nix-flake-tests}/.version (100%) rename src/{libflake-test => nix-flake-tests}/build-utils-meson (100%) rename src/{libflake-test => nix-flake-tests}/data/.gitkeep (100%) rename src/{libflake-test => nix-flake-tests}/flakeref.cc (100%) rename src/{libflake-test => nix-flake-tests}/meson.build (97%) rename src/{libflake-test => nix-flake-tests}/package.nix (97%) rename src/{libflake-test => nix-flake-tests}/url-name.cc (100%) rename src/{libstore-test-support => nix-store-test-support}/.version (100%) rename src/{libstore-test-support => nix-store-test-support}/build-utils-meson (100%) rename src/{libstore-test-support => nix-store-test-support}/meson.build (100%) rename src/{libstore-test-support => nix-store-test-support}/package.nix (100%) rename src/{libstore-test-support => nix-store-test-support}/tests/derived-path.cc (100%) rename src/{libstore-test-support => nix-store-test-support}/tests/derived-path.hh (100%) rename src/{libstore-test-support => nix-store-test-support}/tests/libstore.hh (100%) rename src/{libstore-test-support => nix-store-test-support}/tests/nix_api_store.hh (100%) rename src/{libstore-test-support => nix-store-test-support}/tests/outputs-spec.cc (100%) rename src/{libstore-test-support => nix-store-test-support}/tests/outputs-spec.hh (100%) rename src/{libstore-test-support => nix-store-test-support}/tests/path.cc (100%) rename src/{libstore-test-support => nix-store-test-support}/tests/path.hh (100%) rename src/{libstore-test-support => nix-store-test-support}/tests/protocol.hh (100%) rename src/{libstore-test => nix-store-tests}/.version (100%) rename src/{libstore-test => nix-store-tests}/build-utils-meson (100%) rename src/{libstore-test => nix-store-tests}/common-protocol.cc (100%) rename src/{libstore-test => nix-store-tests}/content-address.cc (100%) rename src/{libstore-test => nix-store-tests}/data/common-protocol/content-address.bin (100%) rename src/{libstore-test => nix-store-tests}/data/common-protocol/drv-output.bin (100%) rename src/{libstore-test => nix-store-tests}/data/common-protocol/optional-content-address.bin (100%) rename src/{libstore-test => nix-store-tests}/data/common-protocol/optional-store-path.bin (100%) rename src/{libstore-test => nix-store-tests}/data/common-protocol/realisation.bin (100%) rename src/{libstore-test => nix-store-tests}/data/common-protocol/set.bin (100%) rename src/{libstore-test => nix-store-tests}/data/common-protocol/store-path.bin (100%) rename src/{libstore-test => nix-store-tests}/data/common-protocol/string.bin (100%) rename src/{libstore-test => nix-store-tests}/data/common-protocol/vector.bin (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/advanced-attributes-defaults.drv (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/advanced-attributes-defaults.json (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/advanced-attributes-structured-attrs-defaults.drv (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/advanced-attributes-structured-attrs-defaults.json (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/advanced-attributes-structured-attrs.drv (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/advanced-attributes-structured-attrs.json (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/advanced-attributes.drv (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/bad-old-version-dyn-deps.drv (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/bad-version.drv (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/dynDerivationDeps.drv (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/dynDerivationDeps.json (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/output-caFixedFlat.json (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/output-caFixedNAR.json (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/output-caFixedText.json (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/output-caFloating.json (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/output-deferred.json (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/output-impure.json (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/output-inputAddressed.json (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/simple.drv (100%) rename src/{libstore-test => nix-store-tests}/data/derivation/simple.json (100%) rename src/{libstore-test => nix-store-tests}/data/machines/bad_format (100%) rename src/{libstore-test => nix-store-tests}/data/machines/valid (100%) rename src/{libstore-test => nix-store-tests}/data/nar-info/impure.json (100%) rename src/{libstore-test => nix-store-tests}/data/nar-info/pure.json (100%) rename src/{libstore-test => nix-store-tests}/data/path-info/empty_impure.json (100%) rename src/{libstore-test => nix-store-tests}/data/path-info/empty_pure.json (100%) rename src/{libstore-test => nix-store-tests}/data/path-info/impure.json (100%) rename src/{libstore-test => nix-store-tests}/data/path-info/pure.json (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/build-options-2.1.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/build-options-2.2.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/build-options-2.3.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/build-options-2.7.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/build-result-2.2.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/build-result-2.3.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/build-result-2.6.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/content-address.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/drv-output.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/handshake-to-client.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/optional-content-address.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/optional-store-path.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/realisation.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/set.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/store-path.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/string.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/unkeyed-valid-path-info-2.3.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/unkeyed-valid-path-info-2.4.bin (100%) rename src/{libstore-test => nix-store-tests}/data/serve-protocol/vector.bin (100%) rename src/{libstore-test => nix-store-tests}/data/store-reference/auto.txt (100%) rename src/{libstore-test => nix-store-tests}/data/store-reference/auto_param.txt (100%) rename src/{libstore-test => nix-store-tests}/data/store-reference/local_1.txt (100%) rename src/{libstore-test => nix-store-tests}/data/store-reference/local_2.txt (100%) rename src/{libstore-test => nix-store-tests}/data/store-reference/local_shorthand_1.txt (100%) rename src/{libstore-test => nix-store-tests}/data/store-reference/local_shorthand_2.txt (100%) rename src/{libstore-test => nix-store-tests}/data/store-reference/ssh.txt (100%) rename src/{libstore-test => nix-store-tests}/data/store-reference/unix.txt (100%) rename src/{libstore-test => nix-store-tests}/data/store-reference/unix_shorthand.txt (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/build-mode.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/build-result-1.27.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/build-result-1.28.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/build-result-1.29.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/build-result-1.37.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/client-handshake-info_1_30.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/client-handshake-info_1_33.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/client-handshake-info_1_35.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/content-address.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/derived-path-1.29.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/derived-path-1.30.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/drv-output.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/handshake-to-client.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/keyed-build-result-1.29.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/optional-content-address.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/optional-store-path.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/optional-trusted-flag.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/realisation.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/set.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/store-path.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/string.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/unkeyed-valid-path-info-1.15.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/valid-path-info-1.15.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/valid-path-info-1.16.bin (100%) rename src/{libstore-test => nix-store-tests}/data/worker-protocol/vector.bin (100%) rename src/{libstore-test => nix-store-tests}/derivation-advanced-attrs.cc (100%) rename src/{libstore-test => nix-store-tests}/derivation.cc (100%) rename src/{libstore-test => nix-store-tests}/derived-path.cc (100%) rename src/{libstore-test => nix-store-tests}/downstream-placeholder.cc (100%) rename src/{libstore-test => nix-store-tests}/machines.cc (100%) rename src/{libstore-test => nix-store-tests}/meson.build (98%) rename src/{libstore-test => nix-store-tests}/nar-info-disk-cache.cc (100%) rename src/{libstore-test => nix-store-tests}/nar-info.cc (100%) rename src/{libstore-test => nix-store-tests}/nix_api_store.cc (100%) rename src/{libstore-test => nix-store-tests}/outputs-spec.cc (100%) rename src/{libstore-test => nix-store-tests}/package.nix (98%) rename src/{libstore-test => nix-store-tests}/path-info.cc (100%) rename src/{libstore-test => nix-store-tests}/path.cc (100%) rename src/{libstore-test => nix-store-tests}/references.cc (100%) rename src/{libstore-test => nix-store-tests}/serve-protocol.cc (100%) rename src/{libstore-test => nix-store-tests}/store-reference.cc (100%) rename src/{libstore-test => nix-store-tests}/worker-protocol.cc (100%) rename src/{libutil-test-support => nix-util-test-support}/.version (100%) rename src/{libutil-test-support => nix-util-test-support}/build-utils-meson (100%) rename src/{libutil-test-support => nix-util-test-support}/meson.build (100%) rename src/{libutil-test-support => nix-util-test-support}/package.nix (100%) rename src/{libutil-test-support => nix-util-test-support}/tests/characterization.hh (100%) rename src/{libutil-test-support => nix-util-test-support}/tests/hash.cc (100%) rename src/{libutil-test-support => nix-util-test-support}/tests/hash.hh (100%) rename src/{libutil-test-support => nix-util-test-support}/tests/nix_api_util.hh (100%) rename src/{libutil-test-support => nix-util-test-support}/tests/string_callback.cc (100%) rename src/{libutil-test-support => nix-util-test-support}/tests/string_callback.hh (100%) rename src/{libutil-test => nix-util-tests}/.version (100%) rename src/{libutil-test => nix-util-tests}/args.cc (100%) rename src/{libutil-test => nix-util-tests}/build-utils-meson (100%) rename src/{libutil-test => nix-util-tests}/canon-path.cc (100%) rename src/{libutil-test => nix-util-tests}/chunked-vector.cc (100%) rename src/{libutil-test => nix-util-tests}/closure.cc (100%) rename src/{libutil-test => nix-util-tests}/compression.cc (100%) rename src/{libutil-test => nix-util-tests}/config.cc (100%) rename src/{libutil-test => nix-util-tests}/data/git/check-data.sh (100%) rename src/{libutil-test => nix-util-tests}/data/git/hello-world-blob.bin (100%) rename src/{libutil-test => nix-util-tests}/data/git/hello-world.bin (100%) rename src/{libutil-test => nix-util-tests}/data/git/tree.bin (100%) rename src/{libutil-test => nix-util-tests}/data/git/tree.txt (100%) rename src/{libutil-test => nix-util-tests}/file-content-address.cc (100%) rename src/{libutil-test => nix-util-tests}/git.cc (99%) rename src/{libutil-test => nix-util-tests}/hash.cc (100%) rename src/{libutil-test => nix-util-tests}/hilite.cc (100%) rename src/{libutil-test => nix-util-tests}/json-utils.cc (100%) rename src/{libutil-test => nix-util-tests}/logging.cc (100%) rename src/{libutil-test => nix-util-tests}/lru-cache.cc (100%) rename src/{libutil-test => nix-util-tests}/meson.build (98%) rename src/{libutil-test => nix-util-tests}/nix_api_util.cc (100%) rename src/{libutil-test => nix-util-tests}/package.nix (97%) rename src/{libutil-test => nix-util-tests}/pool.cc (100%) rename src/{libutil-test => nix-util-tests}/references.cc (100%) rename src/{libutil-test => nix-util-tests}/spawn.cc (100%) rename src/{libutil-test => nix-util-tests}/suggestions.cc (100%) rename src/{libutil-test => nix-util-tests}/tests.cc (100%) rename src/{libutil-test => nix-util-tests}/url.cc (100%) rename src/{libutil-test => nix-util-tests}/xml-writer.cc (100%) diff --git a/.gitignore b/.gitignore index 838cac335..fdfd744e5 100644 --- a/.gitignore +++ b/.gitignore @@ -49,22 +49,22 @@ perl/Makefile.config /src/libexpr/parser-tab.output /src/libexpr/nix.tbl /src/libexpr/tests -/src/libexpr-test/libnixexpr-tests +/src/nix-expr-tests/libnixexpr-tests # /src/libfetchers -/src/libfetchers-test/libnixfetchers-tests +/src/nix-fetchers-tests/libnixfetchers-tests # /src/libflake -/src/libflake-test/libnixflake-tests +/src/nix-flake-tests/libnixflake-tests # /src/libstore/ *.gen.* /src/libstore/tests -/src/libstore-test/libnixstore-tests +/src/nix-store-tests/libnixstore-tests # /src/libutil/ /src/libutil/tests -/src/libutil-test/libnixutil-tests +/src/nix-util-tests/libnixutil-tests /src/nix/nix diff --git a/doc/manual/src/contributing/testing.md b/doc/manual/src/contributing/testing.md index ed9c25f7a..399174de5 100644 --- a/doc/manual/src/contributing/testing.md +++ b/doc/manual/src/contributing/testing.md @@ -60,10 +60,10 @@ The unit tests are defined using the [googletest] and [rapidcheck] frameworks. > ``` The tests for each Nix library (`libnixexpr`, `libnixstore`, etc..) live inside a directory `src/${library_name_without-nix}-test`. -Given an interface (header) and implementation pair in the original library, say, `src/libexpr/value/context.{hh,cc}`, we write tests for it in `src/libexpr-test/value/context.cc`, and (possibly) declare/define additional interfaces for testing purposes in `src/libexpr-test-support/tests/value/context.{hh,cc}`. +Given an interface (header) and implementation pair in the original library, say, `src/libexpr/value/context.{hh,cc}`, we write tests for it in `src/nix-expr-tests/value/context.cc`, and (possibly) declare/define additional interfaces for testing purposes in `src/nix-expr-test-support/tests/value/context.{hh,cc}`. Data for unit tests is stored in a `data` subdir of the directory for each unit test executable. -For example, `libnixstore` code is in `src/libstore`, and its test data is in `src/libstore-test/data`. +For example, `libnixstore` code is in `src/libstore`, and its test data is in `src/nix-store-tests/data`. The path to the `src/${library_name_without-nix}-test/data` directory is passed to the unit test executable with the environment variable `_NIX_TEST_UNIT_DATA`. Note that each executable only gets the data for its tests. diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index c0373dee4..a39a70890 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -429,65 +429,65 @@ ''^tests/nixos/ca-fd-leak/sender\.c'' ''^tests/nixos/ca-fd-leak/smuggler\.c'' ''^tests/nixos/user-sandboxing/attacker\.c'' - ''^src/libexpr-test-support/tests/libexpr\.hh'' - ''^src/libexpr-test-support/tests/value/context\.cc'' - ''^src/libexpr-test-support/tests/value/context\.hh'' - ''^src/libexpr-test/derived-path\.cc'' - ''^src/libexpr-test/error_traces\.cc'' - ''^src/libexpr-test/eval\.cc'' - ''^src/libexpr-test/json\.cc'' - ''^src/libexpr-test/main\.cc'' - ''^src/libexpr-test/primops\.cc'' - ''^src/libexpr-test/search-path\.cc'' - ''^src/libexpr-test/trivial\.cc'' - ''^src/libexpr-test/value/context\.cc'' - ''^src/libexpr-test/value/print\.cc'' - ''^src/libfetchers-test/public-key\.cc'' - ''^src/libflake-test/flakeref\.cc'' - ''^src/libflake-test/url-name\.cc'' - ''^src/libstore-test-support/tests/derived-path\.cc'' - ''^src/libstore-test-support/tests/derived-path\.hh'' - ''^src/libstore-test-support/tests/nix_api_store\.hh'' - ''^src/libstore-test-support/tests/outputs-spec\.cc'' - ''^src/libstore-test-support/tests/outputs-spec\.hh'' - ''^src/libstore-test-support/tests/path\.cc'' - ''^src/libstore-test-support/tests/path\.hh'' - ''^src/libstore-test-support/tests/protocol\.hh'' - ''^src/libstore-test/common-protocol\.cc'' - ''^src/libstore-test/content-address\.cc'' - ''^src/libstore-test/derivation\.cc'' - ''^src/libstore-test/derived-path\.cc'' - ''^src/libstore-test/downstream-placeholder\.cc'' - ''^src/libstore-test/machines\.cc'' - ''^src/libstore-test/nar-info-disk-cache\.cc'' - ''^src/libstore-test/nar-info\.cc'' - ''^src/libstore-test/outputs-spec\.cc'' - ''^src/libstore-test/path-info\.cc'' - ''^src/libstore-test/path\.cc'' - ''^src/libstore-test/serve-protocol\.cc'' - ''^src/libstore-test/worker-protocol\.cc'' - ''^src/libutil-test-support/tests/characterization\.hh'' - ''^src/libutil-test-support/tests/hash\.cc'' - ''^src/libutil-test-support/tests/hash\.hh'' - ''^src/libutil-test/args\.cc'' - ''^src/libutil-test/canon-path\.cc'' - ''^src/libutil-test/chunked-vector\.cc'' - ''^src/libutil-test/closure\.cc'' - ''^src/libutil-test/compression\.cc'' - ''^src/libutil-test/config\.cc'' - ''^src/libutil-test/file-content-address\.cc'' - ''^src/libutil-test/git\.cc'' - ''^src/libutil-test/hash\.cc'' - ''^src/libutil-test/hilite\.cc'' - ''^src/libutil-test/json-utils\.cc'' - ''^src/libutil-test/logging\.cc'' - ''^src/libutil-test/lru-cache\.cc'' - ''^src/libutil-test/pool\.cc'' - ''^src/libutil-test/references\.cc'' - ''^src/libutil-test/suggestions\.cc'' - ''^src/libutil-test/tests\.cc'' - ''^src/libutil-test/url\.cc'' - ''^src/libutil-test/xml-writer\.cc'' + ''^src/nix-expr-test-support/tests/libexpr\.hh'' + ''^src/nix-expr-test-support/tests/value/context\.cc'' + ''^src/nix-expr-test-support/tests/value/context\.hh'' + ''^src/nix-expr-tests/derived-path\.cc'' + ''^src/nix-expr-tests/error_traces\.cc'' + ''^src/nix-expr-tests/eval\.cc'' + ''^src/nix-expr-tests/json\.cc'' + ''^src/nix-expr-tests/main\.cc'' + ''^src/nix-expr-tests/primops\.cc'' + ''^src/nix-expr-tests/search-path\.cc'' + ''^src/nix-expr-tests/trivial\.cc'' + ''^src/nix-expr-tests/value/context\.cc'' + ''^src/nix-expr-tests/value/print\.cc'' + ''^src/nix-fetchers-tests/public-key\.cc'' + ''^src/nix-flake-tests/flakeref\.cc'' + ''^src/nix-flake-tests/url-name\.cc'' + ''^src/nix-store-test-support/tests/derived-path\.cc'' + ''^src/nix-store-test-support/tests/derived-path\.hh'' + ''^src/nix-store-test-support/tests/nix_api_store\.hh'' + ''^src/nix-store-test-support/tests/outputs-spec\.cc'' + ''^src/nix-store-test-support/tests/outputs-spec\.hh'' + ''^src/nix-store-test-support/tests/path\.cc'' + ''^src/nix-store-test-support/tests/path\.hh'' + ''^src/nix-store-test-support/tests/protocol\.hh'' + ''^src/nix-store-tests/common-protocol\.cc'' + ''^src/nix-store-tests/content-address\.cc'' + ''^src/nix-store-tests/derivation\.cc'' + ''^src/nix-store-tests/derived-path\.cc'' + ''^src/nix-store-tests/downstream-placeholder\.cc'' + ''^src/nix-store-tests/machines\.cc'' + ''^src/nix-store-tests/nar-info-disk-cache\.cc'' + ''^src/nix-store-tests/nar-info\.cc'' + ''^src/nix-store-tests/outputs-spec\.cc'' + ''^src/nix-store-tests/path-info\.cc'' + ''^src/nix-store-tests/path\.cc'' + ''^src/nix-store-tests/serve-protocol\.cc'' + ''^src/nix-store-tests/worker-protocol\.cc'' + ''^src/nix-util-test-support/tests/characterization\.hh'' + ''^src/nix-util-test-support/tests/hash\.cc'' + ''^src/nix-util-test-support/tests/hash\.hh'' + ''^src/nix-util-tests/args\.cc'' + ''^src/nix-util-tests/canon-path\.cc'' + ''^src/nix-util-tests/chunked-vector\.cc'' + ''^src/nix-util-tests/closure\.cc'' + ''^src/nix-util-tests/compression\.cc'' + ''^src/nix-util-tests/config\.cc'' + ''^src/nix-util-tests/file-content-address\.cc'' + ''^src/nix-util-tests/git\.cc'' + ''^src/nix-util-tests/hash\.cc'' + ''^src/nix-util-tests/hilite\.cc'' + ''^src/nix-util-tests/json-utils\.cc'' + ''^src/nix-util-tests/logging\.cc'' + ''^src/nix-util-tests/lru-cache\.cc'' + ''^src/nix-util-tests/pool\.cc'' + ''^src/nix-util-tests/references\.cc'' + ''^src/nix-util-tests/suggestions\.cc'' + ''^src/nix-util-tests/tests\.cc'' + ''^src/nix-util-tests/url\.cc'' + ''^src/nix-util-tests/xml-writer\.cc'' ]; }; shellcheck = { @@ -666,7 +666,7 @@ ''^tests/functional/user-envs\.sh$'' ''^tests/functional/why-depends\.sh$'' ''^tests/functional/zstd\.sh$'' - ''^src/libutil-test/data/git/check-data\.sh$'' + ''^src/nix-util-tests/data/git/check-data\.sh$'' ]; }; # TODO: nixfmt, https://github.com/NixOS/nixfmt/issues/153 diff --git a/meson.build b/meson.build index fb38d7ef2..1690bb50a 100644 --- a/meson.build +++ b/meson.build @@ -25,11 +25,11 @@ subproject('libexpr-c') subproject('perl') # Testing -subproject('libutil-test-support') -subproject('libutil-test') -subproject('libstore-test-support') -subproject('libstore-test') -subproject('libfetchers-test') -subproject('libexpr-test-support') -subproject('libexpr-test') -subproject('libflake-test') +subproject('nix-util-test-support') +subproject('nix-util-tests') +subproject('nix-store-test-support') +subproject('nix-store-tests') +subproject('nix-fetchers-tests') +subproject('nix-expr-test-support') +subproject('nix-expr-tests') +subproject('nix-flake-tests') diff --git a/packaging/components.nix b/packaging/components.nix index 73f0d24e1..db50d6b22 100644 --- a/packaging/components.nix +++ b/packaging/components.nix @@ -9,24 +9,24 @@ in nix-util = callPackage ../src/libutil/package.nix { }; nix-util-c = callPackage ../src/libutil-c/package.nix { }; - nix-util-test-support = callPackage ../src/libutil-test-support/package.nix { }; - nix-util-test = callPackage ../src/libutil-test/package.nix { }; + nix-util-test-support = callPackage ../src/nix-util-test-support/package.nix { }; + nix-util-tests = callPackage ../src/nix-util-tests/package.nix { }; nix-store = callPackage ../src/libstore/package.nix { }; nix-store-c = callPackage ../src/libstore-c/package.nix { }; - nix-store-test-support = callPackage ../src/libstore-test-support/package.nix { }; - nix-store-test = callPackage ../src/libstore-test/package.nix { }; + nix-store-test-support = callPackage ../src/nix-store-test-support/package.nix { }; + nix-store-tests = callPackage ../src/nix-store-tests/package.nix { }; nix-fetchers = callPackage ../src/libfetchers/package.nix { }; - nix-fetchers-test = callPackage ../src/libfetchers-test/package.nix { }; + nix-fetchers-tests = callPackage ../src/nix-fetchers-tests/package.nix { }; nix-expr = callPackage ../src/libexpr/package.nix { }; nix-expr-c = callPackage ../src/libexpr-c/package.nix { }; - nix-expr-test-support = callPackage ../src/libexpr-test-support/package.nix { }; - nix-expr-test = callPackage ../src/libexpr-test/package.nix { }; + nix-expr-test-support = callPackage ../src/nix-expr-test-support/package.nix { }; + nix-expr-tests = callPackage ../src/nix-expr-tests/package.nix { }; nix-flake = callPackage ../src/libflake/package.nix { }; - nix-flake-test = callPackage ../src/libflake-test/package.nix { }; + nix-flake-tests = callPackage ../src/nix-flake-tests/package.nix { }; nix-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { }; nix-external-api-docs = callPackage ../src/external-api-docs/package.nix { }; diff --git a/packaging/hydra.nix b/packaging/hydra.nix index 244a4ad3f..97f2c59b7 100644 --- a/packaging/hydra.nix +++ b/packaging/hydra.nix @@ -38,19 +38,19 @@ let "nix-util" "nix-util-c" "nix-util-test-support" - "nix-util-test" + "nix-util-tests" "nix-store" "nix-store-c" "nix-store-test-support" - "nix-store-test" + "nix-store-tests" "nix-fetchers" - "nix-fetchers-test" + "nix-fetchers-tests" "nix-expr" "nix-expr-c" "nix-expr-test-support" - "nix-expr-test" + "nix-expr-tests" "nix-flake" - "nix-flake-test" + "nix-flake-tests" ]; in { diff --git a/src/internal-api-docs/doxygen.cfg.in b/src/internal-api-docs/doxygen.cfg.in index 395e43fe1..f1ef75b38 100644 --- a/src/internal-api-docs/doxygen.cfg.in +++ b/src/internal-api-docs/doxygen.cfg.in @@ -41,21 +41,21 @@ INPUT = \ @src@/libcmd \ @src@/libexpr \ @src@/libexpr/flake \ - @src@/libexpr-test \ - @src@/libexpr-test/value \ - @src@/libexpr-test-support/test \ - @src@/libexpr-test-support/test/value \ + @src@/nix-expr-tests \ + @src@/nix-expr-tests/value \ + @src@/nix-expr-test-support/test \ + @src@/nix-expr-test-support/test/value \ @src@/libexpr/value \ @src@/libfetchers \ @src@/libmain \ @src@/libstore \ @src@/libstore/build \ @src@/libstore/builtins \ - @src@/libstore-test \ - @src@/libstore-test-support/test \ + @src@/nix-store-tests \ + @src@/nix-store-test-support/test \ @src@/libutil \ - @src@/libutil-test \ - @src@/libutil-test-support/test \ + @src@/nix-util-tests \ + @src@/nix-util-test-support/test \ @src@/nix \ @src@/nix-env \ @src@/nix-store diff --git a/src/libexpr-test-support/.version b/src/nix-expr-test-support/.version similarity index 100% rename from src/libexpr-test-support/.version rename to src/nix-expr-test-support/.version diff --git a/src/libexpr-test-support/build-utils-meson b/src/nix-expr-test-support/build-utils-meson similarity index 100% rename from src/libexpr-test-support/build-utils-meson rename to src/nix-expr-test-support/build-utils-meson diff --git a/src/libexpr-test-support/meson.build b/src/nix-expr-test-support/meson.build similarity index 100% rename from src/libexpr-test-support/meson.build rename to src/nix-expr-test-support/meson.build diff --git a/src/libexpr-test-support/package.nix b/src/nix-expr-test-support/package.nix similarity index 100% rename from src/libexpr-test-support/package.nix rename to src/nix-expr-test-support/package.nix diff --git a/src/libexpr-test-support/tests/libexpr.hh b/src/nix-expr-test-support/tests/libexpr.hh similarity index 100% rename from src/libexpr-test-support/tests/libexpr.hh rename to src/nix-expr-test-support/tests/libexpr.hh diff --git a/src/libexpr-test-support/tests/nix_api_expr.hh b/src/nix-expr-test-support/tests/nix_api_expr.hh similarity index 100% rename from src/libexpr-test-support/tests/nix_api_expr.hh rename to src/nix-expr-test-support/tests/nix_api_expr.hh diff --git a/src/libexpr-test-support/tests/value/context.cc b/src/nix-expr-test-support/tests/value/context.cc similarity index 100% rename from src/libexpr-test-support/tests/value/context.cc rename to src/nix-expr-test-support/tests/value/context.cc diff --git a/src/libexpr-test-support/tests/value/context.hh b/src/nix-expr-test-support/tests/value/context.hh similarity index 100% rename from src/libexpr-test-support/tests/value/context.hh rename to src/nix-expr-test-support/tests/value/context.hh diff --git a/src/libexpr-test/.version b/src/nix-expr-tests/.version similarity index 100% rename from src/libexpr-test/.version rename to src/nix-expr-tests/.version diff --git a/src/libexpr-test/build-utils-meson b/src/nix-expr-tests/build-utils-meson similarity index 100% rename from src/libexpr-test/build-utils-meson rename to src/nix-expr-tests/build-utils-meson diff --git a/src/libexpr-test/data/.gitkeep b/src/nix-expr-tests/data/.gitkeep similarity index 100% rename from src/libexpr-test/data/.gitkeep rename to src/nix-expr-tests/data/.gitkeep diff --git a/src/libexpr-test/derived-path.cc b/src/nix-expr-tests/derived-path.cc similarity index 100% rename from src/libexpr-test/derived-path.cc rename to src/nix-expr-tests/derived-path.cc diff --git a/src/libexpr-test/error_traces.cc b/src/nix-expr-tests/error_traces.cc similarity index 100% rename from src/libexpr-test/error_traces.cc rename to src/nix-expr-tests/error_traces.cc diff --git a/src/libexpr-test/eval.cc b/src/nix-expr-tests/eval.cc similarity index 100% rename from src/libexpr-test/eval.cc rename to src/nix-expr-tests/eval.cc diff --git a/src/libexpr-test/json.cc b/src/nix-expr-tests/json.cc similarity index 100% rename from src/libexpr-test/json.cc rename to src/nix-expr-tests/json.cc diff --git a/src/libexpr-test/main.cc b/src/nix-expr-tests/main.cc similarity index 100% rename from src/libexpr-test/main.cc rename to src/nix-expr-tests/main.cc diff --git a/src/libexpr-test/meson.build b/src/nix-expr-tests/meson.build similarity index 98% rename from src/libexpr-test/meson.build rename to src/nix-expr-tests/meson.build index 04b60f6d6..04b5ae66f 100644 --- a/src/libexpr-test/meson.build +++ b/src/nix-expr-tests/meson.build @@ -1,4 +1,4 @@ -project('nix-expr-test', 'cpp', +project('nix-expr-tests', 'cpp', version : files('.version'), default_options : [ 'cpp_std=c++2a', diff --git a/src/libexpr-test/nix_api_expr.cc b/src/nix-expr-tests/nix_api_expr.cc similarity index 100% rename from src/libexpr-test/nix_api_expr.cc rename to src/nix-expr-tests/nix_api_expr.cc diff --git a/src/libexpr-test/nix_api_external.cc b/src/nix-expr-tests/nix_api_external.cc similarity index 100% rename from src/libexpr-test/nix_api_external.cc rename to src/nix-expr-tests/nix_api_external.cc diff --git a/src/libexpr-test/nix_api_value.cc b/src/nix-expr-tests/nix_api_value.cc similarity index 100% rename from src/libexpr-test/nix_api_value.cc rename to src/nix-expr-tests/nix_api_value.cc diff --git a/src/libexpr-test/package.nix b/src/nix-expr-tests/package.nix similarity index 97% rename from src/libexpr-test/package.nix rename to src/nix-expr-tests/package.nix index 12f4dd506..679b6fb2a 100644 --- a/src/libexpr-test/package.nix +++ b/src/nix-expr-tests/package.nix @@ -39,7 +39,7 @@ let in mkDerivation (finalAttrs: { - pname = "nix-expr-test"; + pname = "nix-expr-tests"; inherit version; src = fileset.toSource { @@ -98,7 +98,7 @@ mkDerivation (finalAttrs: { } '' PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" export _NIX_TEST_UNIT_DATA=${./data} - nix-expr-test + nix-expr-tests touch $out ''; }; diff --git a/src/libexpr-test/primops.cc b/src/nix-expr-tests/primops.cc similarity index 100% rename from src/libexpr-test/primops.cc rename to src/nix-expr-tests/primops.cc diff --git a/src/libexpr-test/search-path.cc b/src/nix-expr-tests/search-path.cc similarity index 100% rename from src/libexpr-test/search-path.cc rename to src/nix-expr-tests/search-path.cc diff --git a/src/libexpr-test/trivial.cc b/src/nix-expr-tests/trivial.cc similarity index 100% rename from src/libexpr-test/trivial.cc rename to src/nix-expr-tests/trivial.cc diff --git a/src/libexpr-test/value/context.cc b/src/nix-expr-tests/value/context.cc similarity index 100% rename from src/libexpr-test/value/context.cc rename to src/nix-expr-tests/value/context.cc diff --git a/src/libexpr-test/value/print.cc b/src/nix-expr-tests/value/print.cc similarity index 100% rename from src/libexpr-test/value/print.cc rename to src/nix-expr-tests/value/print.cc diff --git a/src/libexpr-test/value/value.cc b/src/nix-expr-tests/value/value.cc similarity index 100% rename from src/libexpr-test/value/value.cc rename to src/nix-expr-tests/value/value.cc diff --git a/src/libfetchers-test/.version b/src/nix-fetchers-tests/.version similarity index 100% rename from src/libfetchers-test/.version rename to src/nix-fetchers-tests/.version diff --git a/src/libfetchers-test/build-utils-meson b/src/nix-fetchers-tests/build-utils-meson similarity index 100% rename from src/libfetchers-test/build-utils-meson rename to src/nix-fetchers-tests/build-utils-meson diff --git a/src/libfetchers-test/data/public-key/defaultType.json b/src/nix-fetchers-tests/data/public-key/defaultType.json similarity index 100% rename from src/libfetchers-test/data/public-key/defaultType.json rename to src/nix-fetchers-tests/data/public-key/defaultType.json diff --git a/src/libfetchers-test/data/public-key/noRoundTrip.json b/src/nix-fetchers-tests/data/public-key/noRoundTrip.json similarity index 100% rename from src/libfetchers-test/data/public-key/noRoundTrip.json rename to src/nix-fetchers-tests/data/public-key/noRoundTrip.json diff --git a/src/libfetchers-test/data/public-key/simple.json b/src/nix-fetchers-tests/data/public-key/simple.json similarity index 100% rename from src/libfetchers-test/data/public-key/simple.json rename to src/nix-fetchers-tests/data/public-key/simple.json diff --git a/src/libfetchers-test/meson.build b/src/nix-fetchers-tests/meson.build similarity index 97% rename from src/libfetchers-test/meson.build rename to src/nix-fetchers-tests/meson.build index 785754b34..c4f18e278 100644 --- a/src/libfetchers-test/meson.build +++ b/src/nix-fetchers-tests/meson.build @@ -1,4 +1,4 @@ -project('nix-fetchers-test', 'cpp', +project('nix-fetchers-tests', 'cpp', version : files('.version'), default_options : [ 'cpp_std=c++2a', diff --git a/src/libfetchers-test/package.nix b/src/nix-fetchers-tests/package.nix similarity index 97% rename from src/libfetchers-test/package.nix rename to src/nix-fetchers-tests/package.nix index 78d8ab490..5cf18ce33 100644 --- a/src/libfetchers-test/package.nix +++ b/src/nix-fetchers-tests/package.nix @@ -38,7 +38,7 @@ let in mkDerivation (finalAttrs: { - pname = "nix-fetchers-test"; + pname = "nix-fetchers-tests"; inherit version; src = fileset.toSource { @@ -96,7 +96,7 @@ mkDerivation (finalAttrs: { } '' PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" export _NIX_TEST_UNIT_DATA=${./data} - nix-fetchers-test + nix-fetchers-tests touch $out ''; }; diff --git a/src/libfetchers-test/public-key.cc b/src/nix-fetchers-tests/public-key.cc similarity index 100% rename from src/libfetchers-test/public-key.cc rename to src/nix-fetchers-tests/public-key.cc diff --git a/src/libflake-test/.version b/src/nix-flake-tests/.version similarity index 100% rename from src/libflake-test/.version rename to src/nix-flake-tests/.version diff --git a/src/libflake-test/build-utils-meson b/src/nix-flake-tests/build-utils-meson similarity index 100% rename from src/libflake-test/build-utils-meson rename to src/nix-flake-tests/build-utils-meson diff --git a/src/libflake-test/data/.gitkeep b/src/nix-flake-tests/data/.gitkeep similarity index 100% rename from src/libflake-test/data/.gitkeep rename to src/nix-flake-tests/data/.gitkeep diff --git a/src/libflake-test/flakeref.cc b/src/nix-flake-tests/flakeref.cc similarity index 100% rename from src/libflake-test/flakeref.cc rename to src/nix-flake-tests/flakeref.cc diff --git a/src/libflake-test/meson.build b/src/nix-flake-tests/meson.build similarity index 97% rename from src/libflake-test/meson.build rename to src/nix-flake-tests/meson.build index b8221b2ad..5afba2fec 100644 --- a/src/libflake-test/meson.build +++ b/src/nix-flake-tests/meson.build @@ -1,4 +1,4 @@ -project('nix-flake-test', 'cpp', +project('nix-flake-tests', 'cpp', version : files('.version'), default_options : [ 'cpp_std=c++2a', diff --git a/src/libflake-test/package.nix b/src/nix-flake-tests/package.nix similarity index 97% rename from src/libflake-test/package.nix rename to src/nix-flake-tests/package.nix index 4fb190706..21af753ae 100644 --- a/src/libflake-test/package.nix +++ b/src/nix-flake-tests/package.nix @@ -38,7 +38,7 @@ let in mkDerivation (finalAttrs: { - pname = "nix-flake-test"; + pname = "nix-flake-tests"; inherit version; src = fileset.toSource { @@ -96,7 +96,7 @@ mkDerivation (finalAttrs: { } '' PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" export _NIX_TEST_UNIT_DATA=${./data} - nix-flake-test + nix-flake-tests touch $out ''; }; diff --git a/src/libflake-test/url-name.cc b/src/nix-flake-tests/url-name.cc similarity index 100% rename from src/libflake-test/url-name.cc rename to src/nix-flake-tests/url-name.cc diff --git a/src/libstore-test-support/.version b/src/nix-store-test-support/.version similarity index 100% rename from src/libstore-test-support/.version rename to src/nix-store-test-support/.version diff --git a/src/libstore-test-support/build-utils-meson b/src/nix-store-test-support/build-utils-meson similarity index 100% rename from src/libstore-test-support/build-utils-meson rename to src/nix-store-test-support/build-utils-meson diff --git a/src/libstore-test-support/meson.build b/src/nix-store-test-support/meson.build similarity index 100% rename from src/libstore-test-support/meson.build rename to src/nix-store-test-support/meson.build diff --git a/src/libstore-test-support/package.nix b/src/nix-store-test-support/package.nix similarity index 100% rename from src/libstore-test-support/package.nix rename to src/nix-store-test-support/package.nix diff --git a/src/libstore-test-support/tests/derived-path.cc b/src/nix-store-test-support/tests/derived-path.cc similarity index 100% rename from src/libstore-test-support/tests/derived-path.cc rename to src/nix-store-test-support/tests/derived-path.cc diff --git a/src/libstore-test-support/tests/derived-path.hh b/src/nix-store-test-support/tests/derived-path.hh similarity index 100% rename from src/libstore-test-support/tests/derived-path.hh rename to src/nix-store-test-support/tests/derived-path.hh diff --git a/src/libstore-test-support/tests/libstore.hh b/src/nix-store-test-support/tests/libstore.hh similarity index 100% rename from src/libstore-test-support/tests/libstore.hh rename to src/nix-store-test-support/tests/libstore.hh diff --git a/src/libstore-test-support/tests/nix_api_store.hh b/src/nix-store-test-support/tests/nix_api_store.hh similarity index 100% rename from src/libstore-test-support/tests/nix_api_store.hh rename to src/nix-store-test-support/tests/nix_api_store.hh diff --git a/src/libstore-test-support/tests/outputs-spec.cc b/src/nix-store-test-support/tests/outputs-spec.cc similarity index 100% rename from src/libstore-test-support/tests/outputs-spec.cc rename to src/nix-store-test-support/tests/outputs-spec.cc diff --git a/src/libstore-test-support/tests/outputs-spec.hh b/src/nix-store-test-support/tests/outputs-spec.hh similarity index 100% rename from src/libstore-test-support/tests/outputs-spec.hh rename to src/nix-store-test-support/tests/outputs-spec.hh diff --git a/src/libstore-test-support/tests/path.cc b/src/nix-store-test-support/tests/path.cc similarity index 100% rename from src/libstore-test-support/tests/path.cc rename to src/nix-store-test-support/tests/path.cc diff --git a/src/libstore-test-support/tests/path.hh b/src/nix-store-test-support/tests/path.hh similarity index 100% rename from src/libstore-test-support/tests/path.hh rename to src/nix-store-test-support/tests/path.hh diff --git a/src/libstore-test-support/tests/protocol.hh b/src/nix-store-test-support/tests/protocol.hh similarity index 100% rename from src/libstore-test-support/tests/protocol.hh rename to src/nix-store-test-support/tests/protocol.hh diff --git a/src/libstore-test/.version b/src/nix-store-tests/.version similarity index 100% rename from src/libstore-test/.version rename to src/nix-store-tests/.version diff --git a/src/libstore-test/build-utils-meson b/src/nix-store-tests/build-utils-meson similarity index 100% rename from src/libstore-test/build-utils-meson rename to src/nix-store-tests/build-utils-meson diff --git a/src/libstore-test/common-protocol.cc b/src/nix-store-tests/common-protocol.cc similarity index 100% rename from src/libstore-test/common-protocol.cc rename to src/nix-store-tests/common-protocol.cc diff --git a/src/libstore-test/content-address.cc b/src/nix-store-tests/content-address.cc similarity index 100% rename from src/libstore-test/content-address.cc rename to src/nix-store-tests/content-address.cc diff --git a/src/libstore-test/data/common-protocol/content-address.bin b/src/nix-store-tests/data/common-protocol/content-address.bin similarity index 100% rename from src/libstore-test/data/common-protocol/content-address.bin rename to src/nix-store-tests/data/common-protocol/content-address.bin diff --git a/src/libstore-test/data/common-protocol/drv-output.bin b/src/nix-store-tests/data/common-protocol/drv-output.bin similarity index 100% rename from src/libstore-test/data/common-protocol/drv-output.bin rename to src/nix-store-tests/data/common-protocol/drv-output.bin diff --git a/src/libstore-test/data/common-protocol/optional-content-address.bin b/src/nix-store-tests/data/common-protocol/optional-content-address.bin similarity index 100% rename from src/libstore-test/data/common-protocol/optional-content-address.bin rename to src/nix-store-tests/data/common-protocol/optional-content-address.bin diff --git a/src/libstore-test/data/common-protocol/optional-store-path.bin b/src/nix-store-tests/data/common-protocol/optional-store-path.bin similarity index 100% rename from src/libstore-test/data/common-protocol/optional-store-path.bin rename to src/nix-store-tests/data/common-protocol/optional-store-path.bin diff --git a/src/libstore-test/data/common-protocol/realisation.bin b/src/nix-store-tests/data/common-protocol/realisation.bin similarity index 100% rename from src/libstore-test/data/common-protocol/realisation.bin rename to src/nix-store-tests/data/common-protocol/realisation.bin diff --git a/src/libstore-test/data/common-protocol/set.bin b/src/nix-store-tests/data/common-protocol/set.bin similarity index 100% rename from src/libstore-test/data/common-protocol/set.bin rename to src/nix-store-tests/data/common-protocol/set.bin diff --git a/src/libstore-test/data/common-protocol/store-path.bin b/src/nix-store-tests/data/common-protocol/store-path.bin similarity index 100% rename from src/libstore-test/data/common-protocol/store-path.bin rename to src/nix-store-tests/data/common-protocol/store-path.bin diff --git a/src/libstore-test/data/common-protocol/string.bin b/src/nix-store-tests/data/common-protocol/string.bin similarity index 100% rename from src/libstore-test/data/common-protocol/string.bin rename to src/nix-store-tests/data/common-protocol/string.bin diff --git a/src/libstore-test/data/common-protocol/vector.bin b/src/nix-store-tests/data/common-protocol/vector.bin similarity index 100% rename from src/libstore-test/data/common-protocol/vector.bin rename to src/nix-store-tests/data/common-protocol/vector.bin diff --git a/src/libstore-test/data/derivation/advanced-attributes-defaults.drv b/src/nix-store-tests/data/derivation/advanced-attributes-defaults.drv similarity index 100% rename from src/libstore-test/data/derivation/advanced-attributes-defaults.drv rename to src/nix-store-tests/data/derivation/advanced-attributes-defaults.drv diff --git a/src/libstore-test/data/derivation/advanced-attributes-defaults.json b/src/nix-store-tests/data/derivation/advanced-attributes-defaults.json similarity index 100% rename from src/libstore-test/data/derivation/advanced-attributes-defaults.json rename to src/nix-store-tests/data/derivation/advanced-attributes-defaults.json diff --git a/src/libstore-test/data/derivation/advanced-attributes-structured-attrs-defaults.drv b/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs-defaults.drv similarity index 100% rename from src/libstore-test/data/derivation/advanced-attributes-structured-attrs-defaults.drv rename to src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs-defaults.drv diff --git a/src/libstore-test/data/derivation/advanced-attributes-structured-attrs-defaults.json b/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs-defaults.json similarity index 100% rename from src/libstore-test/data/derivation/advanced-attributes-structured-attrs-defaults.json rename to src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs-defaults.json diff --git a/src/libstore-test/data/derivation/advanced-attributes-structured-attrs.drv b/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs.drv similarity index 100% rename from src/libstore-test/data/derivation/advanced-attributes-structured-attrs.drv rename to src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs.drv diff --git a/src/libstore-test/data/derivation/advanced-attributes-structured-attrs.json b/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs.json similarity index 100% rename from src/libstore-test/data/derivation/advanced-attributes-structured-attrs.json rename to src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs.json diff --git a/src/libstore-test/data/derivation/advanced-attributes.drv b/src/nix-store-tests/data/derivation/advanced-attributes.drv similarity index 100% rename from src/libstore-test/data/derivation/advanced-attributes.drv rename to src/nix-store-tests/data/derivation/advanced-attributes.drv diff --git a/src/libstore-test/data/derivation/bad-old-version-dyn-deps.drv b/src/nix-store-tests/data/derivation/bad-old-version-dyn-deps.drv similarity index 100% rename from src/libstore-test/data/derivation/bad-old-version-dyn-deps.drv rename to src/nix-store-tests/data/derivation/bad-old-version-dyn-deps.drv diff --git a/src/libstore-test/data/derivation/bad-version.drv b/src/nix-store-tests/data/derivation/bad-version.drv similarity index 100% rename from src/libstore-test/data/derivation/bad-version.drv rename to src/nix-store-tests/data/derivation/bad-version.drv diff --git a/src/libstore-test/data/derivation/dynDerivationDeps.drv b/src/nix-store-tests/data/derivation/dynDerivationDeps.drv similarity index 100% rename from src/libstore-test/data/derivation/dynDerivationDeps.drv rename to src/nix-store-tests/data/derivation/dynDerivationDeps.drv diff --git a/src/libstore-test/data/derivation/dynDerivationDeps.json b/src/nix-store-tests/data/derivation/dynDerivationDeps.json similarity index 100% rename from src/libstore-test/data/derivation/dynDerivationDeps.json rename to src/nix-store-tests/data/derivation/dynDerivationDeps.json diff --git a/src/libstore-test/data/derivation/output-caFixedFlat.json b/src/nix-store-tests/data/derivation/output-caFixedFlat.json similarity index 100% rename from src/libstore-test/data/derivation/output-caFixedFlat.json rename to src/nix-store-tests/data/derivation/output-caFixedFlat.json diff --git a/src/libstore-test/data/derivation/output-caFixedNAR.json b/src/nix-store-tests/data/derivation/output-caFixedNAR.json similarity index 100% rename from src/libstore-test/data/derivation/output-caFixedNAR.json rename to src/nix-store-tests/data/derivation/output-caFixedNAR.json diff --git a/src/libstore-test/data/derivation/output-caFixedText.json b/src/nix-store-tests/data/derivation/output-caFixedText.json similarity index 100% rename from src/libstore-test/data/derivation/output-caFixedText.json rename to src/nix-store-tests/data/derivation/output-caFixedText.json diff --git a/src/libstore-test/data/derivation/output-caFloating.json b/src/nix-store-tests/data/derivation/output-caFloating.json similarity index 100% rename from src/libstore-test/data/derivation/output-caFloating.json rename to src/nix-store-tests/data/derivation/output-caFloating.json diff --git a/src/libstore-test/data/derivation/output-deferred.json b/src/nix-store-tests/data/derivation/output-deferred.json similarity index 100% rename from src/libstore-test/data/derivation/output-deferred.json rename to src/nix-store-tests/data/derivation/output-deferred.json diff --git a/src/libstore-test/data/derivation/output-impure.json b/src/nix-store-tests/data/derivation/output-impure.json similarity index 100% rename from src/libstore-test/data/derivation/output-impure.json rename to src/nix-store-tests/data/derivation/output-impure.json diff --git a/src/libstore-test/data/derivation/output-inputAddressed.json b/src/nix-store-tests/data/derivation/output-inputAddressed.json similarity index 100% rename from src/libstore-test/data/derivation/output-inputAddressed.json rename to src/nix-store-tests/data/derivation/output-inputAddressed.json diff --git a/src/libstore-test/data/derivation/simple.drv b/src/nix-store-tests/data/derivation/simple.drv similarity index 100% rename from src/libstore-test/data/derivation/simple.drv rename to src/nix-store-tests/data/derivation/simple.drv diff --git a/src/libstore-test/data/derivation/simple.json b/src/nix-store-tests/data/derivation/simple.json similarity index 100% rename from src/libstore-test/data/derivation/simple.json rename to src/nix-store-tests/data/derivation/simple.json diff --git a/src/libstore-test/data/machines/bad_format b/src/nix-store-tests/data/machines/bad_format similarity index 100% rename from src/libstore-test/data/machines/bad_format rename to src/nix-store-tests/data/machines/bad_format diff --git a/src/libstore-test/data/machines/valid b/src/nix-store-tests/data/machines/valid similarity index 100% rename from src/libstore-test/data/machines/valid rename to src/nix-store-tests/data/machines/valid diff --git a/src/libstore-test/data/nar-info/impure.json b/src/nix-store-tests/data/nar-info/impure.json similarity index 100% rename from src/libstore-test/data/nar-info/impure.json rename to src/nix-store-tests/data/nar-info/impure.json diff --git a/src/libstore-test/data/nar-info/pure.json b/src/nix-store-tests/data/nar-info/pure.json similarity index 100% rename from src/libstore-test/data/nar-info/pure.json rename to src/nix-store-tests/data/nar-info/pure.json diff --git a/src/libstore-test/data/path-info/empty_impure.json b/src/nix-store-tests/data/path-info/empty_impure.json similarity index 100% rename from src/libstore-test/data/path-info/empty_impure.json rename to src/nix-store-tests/data/path-info/empty_impure.json diff --git a/src/libstore-test/data/path-info/empty_pure.json b/src/nix-store-tests/data/path-info/empty_pure.json similarity index 100% rename from src/libstore-test/data/path-info/empty_pure.json rename to src/nix-store-tests/data/path-info/empty_pure.json diff --git a/src/libstore-test/data/path-info/impure.json b/src/nix-store-tests/data/path-info/impure.json similarity index 100% rename from src/libstore-test/data/path-info/impure.json rename to src/nix-store-tests/data/path-info/impure.json diff --git a/src/libstore-test/data/path-info/pure.json b/src/nix-store-tests/data/path-info/pure.json similarity index 100% rename from src/libstore-test/data/path-info/pure.json rename to src/nix-store-tests/data/path-info/pure.json diff --git a/src/libstore-test/data/serve-protocol/build-options-2.1.bin b/src/nix-store-tests/data/serve-protocol/build-options-2.1.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/build-options-2.1.bin rename to src/nix-store-tests/data/serve-protocol/build-options-2.1.bin diff --git a/src/libstore-test/data/serve-protocol/build-options-2.2.bin b/src/nix-store-tests/data/serve-protocol/build-options-2.2.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/build-options-2.2.bin rename to src/nix-store-tests/data/serve-protocol/build-options-2.2.bin diff --git a/src/libstore-test/data/serve-protocol/build-options-2.3.bin b/src/nix-store-tests/data/serve-protocol/build-options-2.3.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/build-options-2.3.bin rename to src/nix-store-tests/data/serve-protocol/build-options-2.3.bin diff --git a/src/libstore-test/data/serve-protocol/build-options-2.7.bin b/src/nix-store-tests/data/serve-protocol/build-options-2.7.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/build-options-2.7.bin rename to src/nix-store-tests/data/serve-protocol/build-options-2.7.bin diff --git a/src/libstore-test/data/serve-protocol/build-result-2.2.bin b/src/nix-store-tests/data/serve-protocol/build-result-2.2.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/build-result-2.2.bin rename to src/nix-store-tests/data/serve-protocol/build-result-2.2.bin diff --git a/src/libstore-test/data/serve-protocol/build-result-2.3.bin b/src/nix-store-tests/data/serve-protocol/build-result-2.3.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/build-result-2.3.bin rename to src/nix-store-tests/data/serve-protocol/build-result-2.3.bin diff --git a/src/libstore-test/data/serve-protocol/build-result-2.6.bin b/src/nix-store-tests/data/serve-protocol/build-result-2.6.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/build-result-2.6.bin rename to src/nix-store-tests/data/serve-protocol/build-result-2.6.bin diff --git a/src/libstore-test/data/serve-protocol/content-address.bin b/src/nix-store-tests/data/serve-protocol/content-address.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/content-address.bin rename to src/nix-store-tests/data/serve-protocol/content-address.bin diff --git a/src/libstore-test/data/serve-protocol/drv-output.bin b/src/nix-store-tests/data/serve-protocol/drv-output.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/drv-output.bin rename to src/nix-store-tests/data/serve-protocol/drv-output.bin diff --git a/src/libstore-test/data/serve-protocol/handshake-to-client.bin b/src/nix-store-tests/data/serve-protocol/handshake-to-client.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/handshake-to-client.bin rename to src/nix-store-tests/data/serve-protocol/handshake-to-client.bin diff --git a/src/libstore-test/data/serve-protocol/optional-content-address.bin b/src/nix-store-tests/data/serve-protocol/optional-content-address.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/optional-content-address.bin rename to src/nix-store-tests/data/serve-protocol/optional-content-address.bin diff --git a/src/libstore-test/data/serve-protocol/optional-store-path.bin b/src/nix-store-tests/data/serve-protocol/optional-store-path.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/optional-store-path.bin rename to src/nix-store-tests/data/serve-protocol/optional-store-path.bin diff --git a/src/libstore-test/data/serve-protocol/realisation.bin b/src/nix-store-tests/data/serve-protocol/realisation.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/realisation.bin rename to src/nix-store-tests/data/serve-protocol/realisation.bin diff --git a/src/libstore-test/data/serve-protocol/set.bin b/src/nix-store-tests/data/serve-protocol/set.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/set.bin rename to src/nix-store-tests/data/serve-protocol/set.bin diff --git a/src/libstore-test/data/serve-protocol/store-path.bin b/src/nix-store-tests/data/serve-protocol/store-path.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/store-path.bin rename to src/nix-store-tests/data/serve-protocol/store-path.bin diff --git a/src/libstore-test/data/serve-protocol/string.bin b/src/nix-store-tests/data/serve-protocol/string.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/string.bin rename to src/nix-store-tests/data/serve-protocol/string.bin diff --git a/src/libstore-test/data/serve-protocol/unkeyed-valid-path-info-2.3.bin b/src/nix-store-tests/data/serve-protocol/unkeyed-valid-path-info-2.3.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/unkeyed-valid-path-info-2.3.bin rename to src/nix-store-tests/data/serve-protocol/unkeyed-valid-path-info-2.3.bin diff --git a/src/libstore-test/data/serve-protocol/unkeyed-valid-path-info-2.4.bin b/src/nix-store-tests/data/serve-protocol/unkeyed-valid-path-info-2.4.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/unkeyed-valid-path-info-2.4.bin rename to src/nix-store-tests/data/serve-protocol/unkeyed-valid-path-info-2.4.bin diff --git a/src/libstore-test/data/serve-protocol/vector.bin b/src/nix-store-tests/data/serve-protocol/vector.bin similarity index 100% rename from src/libstore-test/data/serve-protocol/vector.bin rename to src/nix-store-tests/data/serve-protocol/vector.bin diff --git a/src/libstore-test/data/store-reference/auto.txt b/src/nix-store-tests/data/store-reference/auto.txt similarity index 100% rename from src/libstore-test/data/store-reference/auto.txt rename to src/nix-store-tests/data/store-reference/auto.txt diff --git a/src/libstore-test/data/store-reference/auto_param.txt b/src/nix-store-tests/data/store-reference/auto_param.txt similarity index 100% rename from src/libstore-test/data/store-reference/auto_param.txt rename to src/nix-store-tests/data/store-reference/auto_param.txt diff --git a/src/libstore-test/data/store-reference/local_1.txt b/src/nix-store-tests/data/store-reference/local_1.txt similarity index 100% rename from src/libstore-test/data/store-reference/local_1.txt rename to src/nix-store-tests/data/store-reference/local_1.txt diff --git a/src/libstore-test/data/store-reference/local_2.txt b/src/nix-store-tests/data/store-reference/local_2.txt similarity index 100% rename from src/libstore-test/data/store-reference/local_2.txt rename to src/nix-store-tests/data/store-reference/local_2.txt diff --git a/src/libstore-test/data/store-reference/local_shorthand_1.txt b/src/nix-store-tests/data/store-reference/local_shorthand_1.txt similarity index 100% rename from src/libstore-test/data/store-reference/local_shorthand_1.txt rename to src/nix-store-tests/data/store-reference/local_shorthand_1.txt diff --git a/src/libstore-test/data/store-reference/local_shorthand_2.txt b/src/nix-store-tests/data/store-reference/local_shorthand_2.txt similarity index 100% rename from src/libstore-test/data/store-reference/local_shorthand_2.txt rename to src/nix-store-tests/data/store-reference/local_shorthand_2.txt diff --git a/src/libstore-test/data/store-reference/ssh.txt b/src/nix-store-tests/data/store-reference/ssh.txt similarity index 100% rename from src/libstore-test/data/store-reference/ssh.txt rename to src/nix-store-tests/data/store-reference/ssh.txt diff --git a/src/libstore-test/data/store-reference/unix.txt b/src/nix-store-tests/data/store-reference/unix.txt similarity index 100% rename from src/libstore-test/data/store-reference/unix.txt rename to src/nix-store-tests/data/store-reference/unix.txt diff --git a/src/libstore-test/data/store-reference/unix_shorthand.txt b/src/nix-store-tests/data/store-reference/unix_shorthand.txt similarity index 100% rename from src/libstore-test/data/store-reference/unix_shorthand.txt rename to src/nix-store-tests/data/store-reference/unix_shorthand.txt diff --git a/src/libstore-test/data/worker-protocol/build-mode.bin b/src/nix-store-tests/data/worker-protocol/build-mode.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/build-mode.bin rename to src/nix-store-tests/data/worker-protocol/build-mode.bin diff --git a/src/libstore-test/data/worker-protocol/build-result-1.27.bin b/src/nix-store-tests/data/worker-protocol/build-result-1.27.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/build-result-1.27.bin rename to src/nix-store-tests/data/worker-protocol/build-result-1.27.bin diff --git a/src/libstore-test/data/worker-protocol/build-result-1.28.bin b/src/nix-store-tests/data/worker-protocol/build-result-1.28.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/build-result-1.28.bin rename to src/nix-store-tests/data/worker-protocol/build-result-1.28.bin diff --git a/src/libstore-test/data/worker-protocol/build-result-1.29.bin b/src/nix-store-tests/data/worker-protocol/build-result-1.29.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/build-result-1.29.bin rename to src/nix-store-tests/data/worker-protocol/build-result-1.29.bin diff --git a/src/libstore-test/data/worker-protocol/build-result-1.37.bin b/src/nix-store-tests/data/worker-protocol/build-result-1.37.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/build-result-1.37.bin rename to src/nix-store-tests/data/worker-protocol/build-result-1.37.bin diff --git a/src/libstore-test/data/worker-protocol/client-handshake-info_1_30.bin b/src/nix-store-tests/data/worker-protocol/client-handshake-info_1_30.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/client-handshake-info_1_30.bin rename to src/nix-store-tests/data/worker-protocol/client-handshake-info_1_30.bin diff --git a/src/libstore-test/data/worker-protocol/client-handshake-info_1_33.bin b/src/nix-store-tests/data/worker-protocol/client-handshake-info_1_33.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/client-handshake-info_1_33.bin rename to src/nix-store-tests/data/worker-protocol/client-handshake-info_1_33.bin diff --git a/src/libstore-test/data/worker-protocol/client-handshake-info_1_35.bin b/src/nix-store-tests/data/worker-protocol/client-handshake-info_1_35.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/client-handshake-info_1_35.bin rename to src/nix-store-tests/data/worker-protocol/client-handshake-info_1_35.bin diff --git a/src/libstore-test/data/worker-protocol/content-address.bin b/src/nix-store-tests/data/worker-protocol/content-address.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/content-address.bin rename to src/nix-store-tests/data/worker-protocol/content-address.bin diff --git a/src/libstore-test/data/worker-protocol/derived-path-1.29.bin b/src/nix-store-tests/data/worker-protocol/derived-path-1.29.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/derived-path-1.29.bin rename to src/nix-store-tests/data/worker-protocol/derived-path-1.29.bin diff --git a/src/libstore-test/data/worker-protocol/derived-path-1.30.bin b/src/nix-store-tests/data/worker-protocol/derived-path-1.30.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/derived-path-1.30.bin rename to src/nix-store-tests/data/worker-protocol/derived-path-1.30.bin diff --git a/src/libstore-test/data/worker-protocol/drv-output.bin b/src/nix-store-tests/data/worker-protocol/drv-output.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/drv-output.bin rename to src/nix-store-tests/data/worker-protocol/drv-output.bin diff --git a/src/libstore-test/data/worker-protocol/handshake-to-client.bin b/src/nix-store-tests/data/worker-protocol/handshake-to-client.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/handshake-to-client.bin rename to src/nix-store-tests/data/worker-protocol/handshake-to-client.bin diff --git a/src/libstore-test/data/worker-protocol/keyed-build-result-1.29.bin b/src/nix-store-tests/data/worker-protocol/keyed-build-result-1.29.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/keyed-build-result-1.29.bin rename to src/nix-store-tests/data/worker-protocol/keyed-build-result-1.29.bin diff --git a/src/libstore-test/data/worker-protocol/optional-content-address.bin b/src/nix-store-tests/data/worker-protocol/optional-content-address.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/optional-content-address.bin rename to src/nix-store-tests/data/worker-protocol/optional-content-address.bin diff --git a/src/libstore-test/data/worker-protocol/optional-store-path.bin b/src/nix-store-tests/data/worker-protocol/optional-store-path.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/optional-store-path.bin rename to src/nix-store-tests/data/worker-protocol/optional-store-path.bin diff --git a/src/libstore-test/data/worker-protocol/optional-trusted-flag.bin b/src/nix-store-tests/data/worker-protocol/optional-trusted-flag.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/optional-trusted-flag.bin rename to src/nix-store-tests/data/worker-protocol/optional-trusted-flag.bin diff --git a/src/libstore-test/data/worker-protocol/realisation.bin b/src/nix-store-tests/data/worker-protocol/realisation.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/realisation.bin rename to src/nix-store-tests/data/worker-protocol/realisation.bin diff --git a/src/libstore-test/data/worker-protocol/set.bin b/src/nix-store-tests/data/worker-protocol/set.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/set.bin rename to src/nix-store-tests/data/worker-protocol/set.bin diff --git a/src/libstore-test/data/worker-protocol/store-path.bin b/src/nix-store-tests/data/worker-protocol/store-path.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/store-path.bin rename to src/nix-store-tests/data/worker-protocol/store-path.bin diff --git a/src/libstore-test/data/worker-protocol/string.bin b/src/nix-store-tests/data/worker-protocol/string.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/string.bin rename to src/nix-store-tests/data/worker-protocol/string.bin diff --git a/src/libstore-test/data/worker-protocol/unkeyed-valid-path-info-1.15.bin b/src/nix-store-tests/data/worker-protocol/unkeyed-valid-path-info-1.15.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/unkeyed-valid-path-info-1.15.bin rename to src/nix-store-tests/data/worker-protocol/unkeyed-valid-path-info-1.15.bin diff --git a/src/libstore-test/data/worker-protocol/valid-path-info-1.15.bin b/src/nix-store-tests/data/worker-protocol/valid-path-info-1.15.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/valid-path-info-1.15.bin rename to src/nix-store-tests/data/worker-protocol/valid-path-info-1.15.bin diff --git a/src/libstore-test/data/worker-protocol/valid-path-info-1.16.bin b/src/nix-store-tests/data/worker-protocol/valid-path-info-1.16.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/valid-path-info-1.16.bin rename to src/nix-store-tests/data/worker-protocol/valid-path-info-1.16.bin diff --git a/src/libstore-test/data/worker-protocol/vector.bin b/src/nix-store-tests/data/worker-protocol/vector.bin similarity index 100% rename from src/libstore-test/data/worker-protocol/vector.bin rename to src/nix-store-tests/data/worker-protocol/vector.bin diff --git a/src/libstore-test/derivation-advanced-attrs.cc b/src/nix-store-tests/derivation-advanced-attrs.cc similarity index 100% rename from src/libstore-test/derivation-advanced-attrs.cc rename to src/nix-store-tests/derivation-advanced-attrs.cc diff --git a/src/libstore-test/derivation.cc b/src/nix-store-tests/derivation.cc similarity index 100% rename from src/libstore-test/derivation.cc rename to src/nix-store-tests/derivation.cc diff --git a/src/libstore-test/derived-path.cc b/src/nix-store-tests/derived-path.cc similarity index 100% rename from src/libstore-test/derived-path.cc rename to src/nix-store-tests/derived-path.cc diff --git a/src/libstore-test/downstream-placeholder.cc b/src/nix-store-tests/downstream-placeholder.cc similarity index 100% rename from src/libstore-test/downstream-placeholder.cc rename to src/nix-store-tests/downstream-placeholder.cc diff --git a/src/libstore-test/machines.cc b/src/nix-store-tests/machines.cc similarity index 100% rename from src/libstore-test/machines.cc rename to src/nix-store-tests/machines.cc diff --git a/src/libstore-test/meson.build b/src/nix-store-tests/meson.build similarity index 98% rename from src/libstore-test/meson.build rename to src/nix-store-tests/meson.build index 6bf0a5028..2fde70d3b 100644 --- a/src/libstore-test/meson.build +++ b/src/nix-store-tests/meson.build @@ -1,4 +1,4 @@ -project('nix-store-test', 'cpp', +project('nix-store-tests', 'cpp', version : files('.version'), default_options : [ 'cpp_std=c++2a', diff --git a/src/libstore-test/nar-info-disk-cache.cc b/src/nix-store-tests/nar-info-disk-cache.cc similarity index 100% rename from src/libstore-test/nar-info-disk-cache.cc rename to src/nix-store-tests/nar-info-disk-cache.cc diff --git a/src/libstore-test/nar-info.cc b/src/nix-store-tests/nar-info.cc similarity index 100% rename from src/libstore-test/nar-info.cc rename to src/nix-store-tests/nar-info.cc diff --git a/src/libstore-test/nix_api_store.cc b/src/nix-store-tests/nix_api_store.cc similarity index 100% rename from src/libstore-test/nix_api_store.cc rename to src/nix-store-tests/nix_api_store.cc diff --git a/src/libstore-test/outputs-spec.cc b/src/nix-store-tests/outputs-spec.cc similarity index 100% rename from src/libstore-test/outputs-spec.cc rename to src/nix-store-tests/outputs-spec.cc diff --git a/src/libstore-test/package.nix b/src/nix-store-tests/package.nix similarity index 98% rename from src/libstore-test/package.nix rename to src/nix-store-tests/package.nix index e37e64886..dc987b3c6 100644 --- a/src/libstore-test/package.nix +++ b/src/nix-store-tests/package.nix @@ -40,7 +40,7 @@ let in mkDerivation (finalAttrs: { - pname = "nix-store-test"; + pname = "nix-store-tests"; inherit version; src = fileset.toSource { @@ -105,7 +105,7 @@ mkDerivation (finalAttrs: { in runCommand "${finalAttrs.pname}-run" {} '' PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" export _NIX_TEST_UNIT_DATA=${data} - nix-store-test + nix-store-tests touch $out ''; }; diff --git a/src/libstore-test/path-info.cc b/src/nix-store-tests/path-info.cc similarity index 100% rename from src/libstore-test/path-info.cc rename to src/nix-store-tests/path-info.cc diff --git a/src/libstore-test/path.cc b/src/nix-store-tests/path.cc similarity index 100% rename from src/libstore-test/path.cc rename to src/nix-store-tests/path.cc diff --git a/src/libstore-test/references.cc b/src/nix-store-tests/references.cc similarity index 100% rename from src/libstore-test/references.cc rename to src/nix-store-tests/references.cc diff --git a/src/libstore-test/serve-protocol.cc b/src/nix-store-tests/serve-protocol.cc similarity index 100% rename from src/libstore-test/serve-protocol.cc rename to src/nix-store-tests/serve-protocol.cc diff --git a/src/libstore-test/store-reference.cc b/src/nix-store-tests/store-reference.cc similarity index 100% rename from src/libstore-test/store-reference.cc rename to src/nix-store-tests/store-reference.cc diff --git a/src/libstore-test/worker-protocol.cc b/src/nix-store-tests/worker-protocol.cc similarity index 100% rename from src/libstore-test/worker-protocol.cc rename to src/nix-store-tests/worker-protocol.cc diff --git a/src/libutil-test-support/.version b/src/nix-util-test-support/.version similarity index 100% rename from src/libutil-test-support/.version rename to src/nix-util-test-support/.version diff --git a/src/libutil-test-support/build-utils-meson b/src/nix-util-test-support/build-utils-meson similarity index 100% rename from src/libutil-test-support/build-utils-meson rename to src/nix-util-test-support/build-utils-meson diff --git a/src/libutil-test-support/meson.build b/src/nix-util-test-support/meson.build similarity index 100% rename from src/libutil-test-support/meson.build rename to src/nix-util-test-support/meson.build diff --git a/src/libutil-test-support/package.nix b/src/nix-util-test-support/package.nix similarity index 100% rename from src/libutil-test-support/package.nix rename to src/nix-util-test-support/package.nix diff --git a/src/libutil-test-support/tests/characterization.hh b/src/nix-util-test-support/tests/characterization.hh similarity index 100% rename from src/libutil-test-support/tests/characterization.hh rename to src/nix-util-test-support/tests/characterization.hh diff --git a/src/libutil-test-support/tests/hash.cc b/src/nix-util-test-support/tests/hash.cc similarity index 100% rename from src/libutil-test-support/tests/hash.cc rename to src/nix-util-test-support/tests/hash.cc diff --git a/src/libutil-test-support/tests/hash.hh b/src/nix-util-test-support/tests/hash.hh similarity index 100% rename from src/libutil-test-support/tests/hash.hh rename to src/nix-util-test-support/tests/hash.hh diff --git a/src/libutil-test-support/tests/nix_api_util.hh b/src/nix-util-test-support/tests/nix_api_util.hh similarity index 100% rename from src/libutil-test-support/tests/nix_api_util.hh rename to src/nix-util-test-support/tests/nix_api_util.hh diff --git a/src/libutil-test-support/tests/string_callback.cc b/src/nix-util-test-support/tests/string_callback.cc similarity index 100% rename from src/libutil-test-support/tests/string_callback.cc rename to src/nix-util-test-support/tests/string_callback.cc diff --git a/src/libutil-test-support/tests/string_callback.hh b/src/nix-util-test-support/tests/string_callback.hh similarity index 100% rename from src/libutil-test-support/tests/string_callback.hh rename to src/nix-util-test-support/tests/string_callback.hh diff --git a/src/libutil-test/.version b/src/nix-util-tests/.version similarity index 100% rename from src/libutil-test/.version rename to src/nix-util-tests/.version diff --git a/src/libutil-test/args.cc b/src/nix-util-tests/args.cc similarity index 100% rename from src/libutil-test/args.cc rename to src/nix-util-tests/args.cc diff --git a/src/libutil-test/build-utils-meson b/src/nix-util-tests/build-utils-meson similarity index 100% rename from src/libutil-test/build-utils-meson rename to src/nix-util-tests/build-utils-meson diff --git a/src/libutil-test/canon-path.cc b/src/nix-util-tests/canon-path.cc similarity index 100% rename from src/libutil-test/canon-path.cc rename to src/nix-util-tests/canon-path.cc diff --git a/src/libutil-test/chunked-vector.cc b/src/nix-util-tests/chunked-vector.cc similarity index 100% rename from src/libutil-test/chunked-vector.cc rename to src/nix-util-tests/chunked-vector.cc diff --git a/src/libutil-test/closure.cc b/src/nix-util-tests/closure.cc similarity index 100% rename from src/libutil-test/closure.cc rename to src/nix-util-tests/closure.cc diff --git a/src/libutil-test/compression.cc b/src/nix-util-tests/compression.cc similarity index 100% rename from src/libutil-test/compression.cc rename to src/nix-util-tests/compression.cc diff --git a/src/libutil-test/config.cc b/src/nix-util-tests/config.cc similarity index 100% rename from src/libutil-test/config.cc rename to src/nix-util-tests/config.cc diff --git a/src/libutil-test/data/git/check-data.sh b/src/nix-util-tests/data/git/check-data.sh similarity index 100% rename from src/libutil-test/data/git/check-data.sh rename to src/nix-util-tests/data/git/check-data.sh diff --git a/src/libutil-test/data/git/hello-world-blob.bin b/src/nix-util-tests/data/git/hello-world-blob.bin similarity index 100% rename from src/libutil-test/data/git/hello-world-blob.bin rename to src/nix-util-tests/data/git/hello-world-blob.bin diff --git a/src/libutil-test/data/git/hello-world.bin b/src/nix-util-tests/data/git/hello-world.bin similarity index 100% rename from src/libutil-test/data/git/hello-world.bin rename to src/nix-util-tests/data/git/hello-world.bin diff --git a/src/libutil-test/data/git/tree.bin b/src/nix-util-tests/data/git/tree.bin similarity index 100% rename from src/libutil-test/data/git/tree.bin rename to src/nix-util-tests/data/git/tree.bin diff --git a/src/libutil-test/data/git/tree.txt b/src/nix-util-tests/data/git/tree.txt similarity index 100% rename from src/libutil-test/data/git/tree.txt rename to src/nix-util-tests/data/git/tree.txt diff --git a/src/libutil-test/file-content-address.cc b/src/nix-util-tests/file-content-address.cc similarity index 100% rename from src/libutil-test/file-content-address.cc rename to src/nix-util-tests/file-content-address.cc diff --git a/src/libutil-test/git.cc b/src/nix-util-tests/git.cc similarity index 99% rename from src/libutil-test/git.cc rename to src/nix-util-tests/git.cc index 7c360d7c5..24d24a791 100644 --- a/src/libutil-test/git.cc +++ b/src/nix-util-tests/git.cc @@ -88,7 +88,7 @@ TEST_F(GitTest, blob_write) { /** * This data is for "shallow" tree tests. However, we use "real" hashes * so that we can check our test data in a small shell script test test - * (`src/libutil-test/data/git/check-data.sh`). + * (`src/nix-util-tests/data/git/check-data.sh`). */ const static Tree tree = { { diff --git a/src/libutil-test/hash.cc b/src/nix-util-tests/hash.cc similarity index 100% rename from src/libutil-test/hash.cc rename to src/nix-util-tests/hash.cc diff --git a/src/libutil-test/hilite.cc b/src/nix-util-tests/hilite.cc similarity index 100% rename from src/libutil-test/hilite.cc rename to src/nix-util-tests/hilite.cc diff --git a/src/libutil-test/json-utils.cc b/src/nix-util-tests/json-utils.cc similarity index 100% rename from src/libutil-test/json-utils.cc rename to src/nix-util-tests/json-utils.cc diff --git a/src/libutil-test/logging.cc b/src/nix-util-tests/logging.cc similarity index 100% rename from src/libutil-test/logging.cc rename to src/nix-util-tests/logging.cc diff --git a/src/libutil-test/lru-cache.cc b/src/nix-util-tests/lru-cache.cc similarity index 100% rename from src/libutil-test/lru-cache.cc rename to src/nix-util-tests/lru-cache.cc diff --git a/src/libutil-test/meson.build b/src/nix-util-tests/meson.build similarity index 98% rename from src/libutil-test/meson.build rename to src/nix-util-tests/meson.build index 19157cda3..67ae48f53 100644 --- a/src/libutil-test/meson.build +++ b/src/nix-util-tests/meson.build @@ -1,4 +1,4 @@ -project('nix-util-test', 'cpp', +project('nix-util-tests', 'cpp', version : files('.version'), default_options : [ 'cpp_std=c++2a', diff --git a/src/libutil-test/nix_api_util.cc b/src/nix-util-tests/nix_api_util.cc similarity index 100% rename from src/libutil-test/nix_api_util.cc rename to src/nix-util-tests/nix_api_util.cc diff --git a/src/libutil-test/package.nix b/src/nix-util-tests/package.nix similarity index 97% rename from src/libutil-test/package.nix rename to src/nix-util-tests/package.nix index 396e41f3d..9df8153b6 100644 --- a/src/libutil-test/package.nix +++ b/src/nix-util-tests/package.nix @@ -39,7 +39,7 @@ let in mkDerivation (finalAttrs: { - pname = "nix-util-test"; + pname = "nix-util-tests"; inherit version; src = fileset.toSource { @@ -98,7 +98,7 @@ mkDerivation (finalAttrs: { } '' PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" export _NIX_TEST_UNIT_DATA=${./data} - nix-util-test + nix-util-tests touch $out ''; }; diff --git a/src/libutil-test/pool.cc b/src/nix-util-tests/pool.cc similarity index 100% rename from src/libutil-test/pool.cc rename to src/nix-util-tests/pool.cc diff --git a/src/libutil-test/references.cc b/src/nix-util-tests/references.cc similarity index 100% rename from src/libutil-test/references.cc rename to src/nix-util-tests/references.cc diff --git a/src/libutil-test/spawn.cc b/src/nix-util-tests/spawn.cc similarity index 100% rename from src/libutil-test/spawn.cc rename to src/nix-util-tests/spawn.cc diff --git a/src/libutil-test/suggestions.cc b/src/nix-util-tests/suggestions.cc similarity index 100% rename from src/libutil-test/suggestions.cc rename to src/nix-util-tests/suggestions.cc diff --git a/src/libutil-test/tests.cc b/src/nix-util-tests/tests.cc similarity index 100% rename from src/libutil-test/tests.cc rename to src/nix-util-tests/tests.cc diff --git a/src/libutil-test/url.cc b/src/nix-util-tests/url.cc similarity index 100% rename from src/libutil-test/url.cc rename to src/nix-util-tests/url.cc diff --git a/src/libutil-test/xml-writer.cc b/src/nix-util-tests/xml-writer.cc similarity index 100% rename from src/libutil-test/xml-writer.cc rename to src/nix-util-tests/xml-writer.cc From 224c6c32560665f5514a46ebcddde644604b5c87 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 29 Jun 2024 10:39:36 -0400 Subject: [PATCH 29/36] Fix test symlinks --- .../data/derivation/advanced-attributes-defaults.drv | 2 +- .../advanced-attributes-structured-attrs-defaults.drv | 2 +- .../data/derivation/advanced-attributes-structured-attrs.drv | 2 +- src/nix-store-tests/data/derivation/advanced-attributes.drv | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/nix-store-tests/data/derivation/advanced-attributes-defaults.drv b/src/nix-store-tests/data/derivation/advanced-attributes-defaults.drv index 353090ad8..f8f30ac32 120000 --- a/src/nix-store-tests/data/derivation/advanced-attributes-defaults.drv +++ b/src/nix-store-tests/data/derivation/advanced-attributes-defaults.drv @@ -1 +1 @@ -../../../../functional/derivation/advanced-attributes-defaults.drv \ No newline at end of file +../../../../tests/functional/derivation/advanced-attributes-defaults.drv \ No newline at end of file diff --git a/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs-defaults.drv b/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs-defaults.drv index 11713da12..837e9a0e4 120000 --- a/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs-defaults.drv +++ b/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs-defaults.drv @@ -1 +1 @@ -../../../../functional/derivation/advanced-attributes-structured-attrs-defaults.drv \ No newline at end of file +../../../../tests/functional/derivation/advanced-attributes-structured-attrs-defaults.drv \ No newline at end of file diff --git a/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs.drv b/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs.drv index 962f8ea3f..e08bb5737 120000 --- a/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs.drv +++ b/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs.drv @@ -1 +1 @@ -../../../../functional/derivation/advanced-attributes-structured-attrs.drv \ No newline at end of file +../../../../tests/functional/derivation/advanced-attributes-structured-attrs.drv \ No newline at end of file diff --git a/src/nix-store-tests/data/derivation/advanced-attributes.drv b/src/nix-store-tests/data/derivation/advanced-attributes.drv index 2a53a05ca..1dc394a0a 120000 --- a/src/nix-store-tests/data/derivation/advanced-attributes.drv +++ b/src/nix-store-tests/data/derivation/advanced-attributes.drv @@ -1 +1 @@ -../../../../functional/derivation/advanced-attributes.drv \ No newline at end of file +../../../../tests/functional/derivation/advanced-attributes.drv \ No newline at end of file From 11dab30be9917e169d6f18e8a46999a0d62dda71 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 29 Jun 2024 10:59:05 -0400 Subject: [PATCH 30/36] Update docs on the unit tests --- doc/manual/src/contributing/testing.md | 23 ++++++++++++++++++++--- src/nix-expr-tests/meson.build | 9 ++++++++- src/nix-fetchers-tests/meson.build | 9 ++++++++- src/nix-flake-tests/meson.build | 9 ++++++++- src/nix-store-tests/meson.build | 9 ++++++++- src/nix-util-tests/meson.build | 9 ++++++++- 6 files changed, 60 insertions(+), 8 deletions(-) diff --git a/doc/manual/src/contributing/testing.md b/doc/manual/src/contributing/testing.md index 399174de5..a96ba997b 100644 --- a/doc/manual/src/contributing/testing.md +++ b/doc/manual/src/contributing/testing.md @@ -76,8 +76,25 @@ there is no risk of any build-system wildcards for the library accidentally pick ### Running tests -You can run the whole testsuite with `make check`, or the tests for a specific component with `make libfoo-tests_RUN`. -Finer-grained filtering is also possible using the [--gtest_filter](https://google.github.io/googletest/advanced.html#running-a-subset-of-the-tests) command-line option, or the `GTEST_FILTER` environment variable, e.g. `GTEST_FILTER='ErrorTraceTest.*' make check`. +You can run the whole testsuite with `meson test` from the Meson build directory, or the tests for a specific component with `meson test nix-store-tests`. +A environment variables that Google Test accepts are also worth knowing: + +1. [`GTEST_FILTER`](https://google.github.io/googletest/advanced.html#running-a-subset-of-the-tests) + + This is used for finer-grained filtering of which tests to run. + + +2. [`GTEST_BRIEF`](https://google.github.io/googletest/advanced.html#suppressing-test-passes) + + This is used to avoid logging passing tests. + +Putting the two together, one might run + +```bash +GTEST_BREIF=1 GTEST_FILTER='ErrorTraceTest.*' meson test nix-expr-tests -v +``` + +for short but comprensive output. ### Characterisation testing { #characaterisation-testing-unit } @@ -86,7 +103,7 @@ See [functional characterisation testing](#characterisation-testing-functional) Like with the functional characterisation, `_NIX_TEST_ACCEPT=1` is also used. For example: ```shell-session -$ _NIX_TEST_ACCEPT=1 make libstore-tests_RUN +$ _NIX_TEST_ACCEPT=1 meson test nix-store-tests -v ... [ SKIPPED ] WorkerProtoTest.string_read [ SKIPPED ] WorkerProtoTest.string_write diff --git a/src/nix-expr-tests/meson.build b/src/nix-expr-tests/meson.build index 04b5ae66f..71865b59f 100644 --- a/src/nix-expr-tests/meson.build +++ b/src/nix-expr-tests/meson.build @@ -81,4 +81,11 @@ this_exe = executable( install : true, ) -test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data']) +test( + meson.project_name(), + this_exe, + env : { + '_NIX_TEST_UNIT_DATA': meson.current_source_dir() / 'data', + }, + protocol : 'gtest', +) diff --git a/src/nix-fetchers-tests/meson.build b/src/nix-fetchers-tests/meson.build index c4f18e278..b4bc77a97 100644 --- a/src/nix-fetchers-tests/meson.build +++ b/src/nix-fetchers-tests/meson.build @@ -61,4 +61,11 @@ this_exe = executable( install : true, ) -test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data']) +test( + meson.project_name(), + this_exe, + env : { + '_NIX_TEST_UNIT_DATA': meson.current_source_dir() / 'data', + }, + protocol : 'gtest', +) diff --git a/src/nix-flake-tests/meson.build b/src/nix-flake-tests/meson.build index 5afba2fec..2d6bbca0f 100644 --- a/src/nix-flake-tests/meson.build +++ b/src/nix-flake-tests/meson.build @@ -62,4 +62,11 @@ this_exe = executable( install : true, ) -test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data']) +test( + meson.project_name(), + this_exe, + env : { + '_NIX_TEST_UNIT_DATA': meson.current_source_dir() / 'data', + }, + protocol : 'gtest', +) diff --git a/src/nix-store-tests/meson.build b/src/nix-store-tests/meson.build index 2fde70d3b..90e7d3047 100644 --- a/src/nix-store-tests/meson.build +++ b/src/nix-store-tests/meson.build @@ -85,4 +85,11 @@ this_exe = executable( install : true, ) -test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data']) +test( + meson.project_name(), + this_exe, + env : { + '_NIX_TEST_UNIT_DATA': meson.current_source_dir() / 'data', + }, + protocol : 'gtest', +) diff --git a/src/nix-util-tests/meson.build b/src/nix-util-tests/meson.build index 67ae48f53..4f055cabd 100644 --- a/src/nix-util-tests/meson.build +++ b/src/nix-util-tests/meson.build @@ -81,4 +81,11 @@ this_exe = executable( install : true, ) -test(meson.project_name(), this_exe, env : ['_NIX_TEST_UNIT_DATA=' + meson.current_source_dir() + '/data']) +test( + meson.project_name(), + this_exe, + env : { + '_NIX_TEST_UNIT_DATA': meson.current_source_dir() / 'data', + }, + protocol : 'gtest', +) From 4727d5c3c5a0c04bdf07219a167a2818a9914bcd Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 29 Jun 2024 11:18:33 -0400 Subject: [PATCH 31/36] Fix format blacklist --- maintainers/flake-module.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index a39a70890..007ef034f 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -15,7 +15,7 @@ excludes = [ # We don't want to format test data # ''tests/(?!nixos/).*\.nix'' - ''^src/[^/]*-test/data/.*$'' + ''^src/[^/]*-tests/data/.*$'' # Don't format vendored code ''^doc/manual/redirects\.js$'' From 4d6bc61b8d3d0278e656bcfae61489abcf40c4a8 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 1 Jul 2024 14:36:46 -0400 Subject: [PATCH 32/36] Fix things --- src/libexpr-c/package.nix | 49 ++++++++------------- src/libexpr/package.nix | 55 +++++++++--------------- src/libfetchers/package.nix | 45 +++++++------------- src/libflake/package.nix | 45 +++++++------------- src/libstore-c/package.nix | 49 ++++++++------------- src/libstore/package.nix | 59 ++++++++++---------------- src/libutil-c/package.nix | 49 ++++++++------------- src/libutil/package.nix | 28 +++--------- src/nix-expr-test-support/package.nix | 47 +++++++------------- src/nix-expr-tests/package.nix | 47 +++++++------------- src/nix-fetchers-tests/package.nix | 47 +++++++------------- src/nix-flake-tests/package.nix | 47 +++++++------------- src/nix-store-test-support/package.nix | 47 +++++++------------- src/nix-store-tests/package.nix | 47 +++++++------------- src/nix-util-test-support/package.nix | 47 +++++++------------- src/nix-util-tests/package.nix | 47 +++++++------------- 16 files changed, 258 insertions(+), 497 deletions(-) diff --git a/src/libexpr-c/package.nix b/src/libexpr-c/package.nix index 33412e218..81e42cf6a 100644 --- a/src/libexpr-c/package.nix +++ b/src/libexpr-c/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -12,41 +13,30 @@ # Configuration Options , versionSuffix ? "" - -# Check test coverage of Nix. Probably want to use with at least -# one of `doCheck` or `doInstallCheck` enabled. -, withCoverageChecks ? false }: let inherit (lib) fileset; version = lib.fileContents ./.version + versionSuffix; - - mkDerivation = - if withCoverageChecks - then - # TODO support `finalAttrs` args function in - # `releaseTools.coverageAnalysis`. - argsFun: - releaseTools.coverageAnalysis (let args = argsFun args; in args) - else stdenv.mkDerivation; in -mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-expr-c"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - # ./meson.options - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - (fileset.fileFilter (file: file.hasExt "h") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + (fileset.fileFilter (file: file.hasExt "h") ./.) + ]; outputs = [ "out" "dev" ]; @@ -65,8 +55,8 @@ mkDerivation (finalAttrs: { # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. '' - echo ${version} > .version - cp -r ${../../build-utils-meson} build-utils-meson + chmod u+w ./.version + echo ${version} > ../../.version ''; mesonFlags = [ @@ -80,8 +70,7 @@ mkDerivation (finalAttrs: { separateDebugInfo = !stdenv.hostPlatform.isStatic; - # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -89,8 +78,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/libexpr/package.nix b/src/libexpr/package.nix index 855d5057e..d4296bc07 100644 --- a/src/libexpr/package.nix +++ b/src/libexpr/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -21,10 +22,6 @@ , versionSuffix ? "" -# Check test coverage of Nix. Probably want to use with at least -# one of `doCheck` or `doInstallCheck` enabled. -, withCoverageChecks ? false - # Whether to use garbage collection for the Nix language evaluator. # # If it is disabled, we just leak memory, but this is not as bad as it @@ -41,34 +38,27 @@ let inherit (lib) fileset; version = lib.fileContents ./.version + versionSuffix; - - mkDerivation = - if withCoverageChecks - then - # TODO support `finalAttrs` args function in - # `releaseTools.coverageAnalysis`. - argsFun: - releaseTools.coverageAnalysis (let args = argsFun args; in args) - else stdenv.mkDerivation; in -mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-expr"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - ./meson.options - ./primops/meson.build - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - ./lexer.l - ./parser.y - (fileset.fileFilter (file: file.hasExt "nix") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + ./meson.options + ./primops/meson.build + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ./lexer.l + ./parser.y + (fileset.fileFilter (file: file.hasExt "nix") ./.) + ]; outputs = [ "out" "dev" ]; @@ -97,8 +87,8 @@ mkDerivation (finalAttrs: { # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. '' - echo ${version} > .version - cp -r ${../../build-utils-meson} build-utils-meson + chmod u+w ./.version + echo ${version} > ../../.version ''; mesonFlags = [ @@ -118,8 +108,7 @@ mkDerivation (finalAttrs: { separateDebugInfo = !stdenv.hostPlatform.isStatic; - # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -127,8 +116,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/libfetchers/package.nix b/src/libfetchers/package.nix index 681ffa112..7786a4f35 100644 --- a/src/libfetchers/package.nix +++ b/src/libfetchers/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -15,40 +16,28 @@ # Configuration Options , versionSuffix ? "" - -# Check test coverage of Nix. Probably want to use with with at least -# one of `doCheck` or `doInstallCheck` enabled. -, withCoverageChecks ? false - }: let inherit (lib) fileset; version = lib.fileContents ./.version + versionSuffix; - - mkDerivation = - if withCoverageChecks - then - # TODO support `finalAttrs` args function in - # `releaseTools.coverageAnalysis`. - argsFun: - releaseTools.coverageAnalysis (let args = argsFun args; in args) - else stdenv.mkDerivation; in -mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-fetchers"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -72,8 +61,8 @@ mkDerivation (finalAttrs: { # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. '' - echo ${version} > .version - cp -r ${../../build-utils-meson} build-utils-meson + chmod u+w ./.version + echo ${version} > ../../.version ''; env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) { @@ -86,7 +75,7 @@ mkDerivation (finalAttrs: { # TODO `releaseTools.coverageAnalysis` in Nixpkgs needs to be updated # to work with `strictDeps`. - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -94,8 +83,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*-tab.*" ]; - - hardeningDisable = ["fortify"]; }) diff --git a/src/libflake/package.nix b/src/libflake/package.nix index 523da4b78..f0609d5d5 100644 --- a/src/libflake/package.nix +++ b/src/libflake/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -17,40 +18,28 @@ # Configuration Options , versionSuffix ? "" - -# Check test coverage of Nix. Probably want to use with with at least -# one of `doCheck` or `doInstallCheck` enabled. -, withCoverageChecks ? false - }: let inherit (lib) fileset; version = lib.fileContents ./.version + versionSuffix; - - mkDerivation = - if withCoverageChecks - then - # TODO support `finalAttrs` args function in - # `releaseTools.coverageAnalysis`. - argsFun: - releaseTools.coverageAnalysis (let args = argsFun args; in args) - else stdenv.mkDerivation; in -mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-flake"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -72,8 +61,8 @@ mkDerivation (finalAttrs: { # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. '' - echo ${version} > .version - cp -r ${../../build-utils-meson} build-utils-meson + chmod u+w ./.version + echo ${version} > ../../.version ''; env = lib.optionalAttrs (stdenv.isLinux && !(stdenv.hostPlatform.isStatic && stdenv.system == "aarch64-linux")) { @@ -86,7 +75,7 @@ mkDerivation (finalAttrs: { # TODO `releaseTools.coverageAnalysis` in Nixpkgs needs to be updated # to work with `strictDeps`. - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -94,8 +83,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*-tab.*" ]; - - hardeningDisable = ["fortify"]; }) diff --git a/src/libstore-c/package.nix b/src/libstore-c/package.nix index d0e81b1f9..c14cf955d 100644 --- a/src/libstore-c/package.nix +++ b/src/libstore-c/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -12,41 +13,30 @@ # Configuration Options , versionSuffix ? "" - -# Check test coverage of Nix. Probably want to use with at least -# one of `doCheck` or `doInstallCheck` enabled. -, withCoverageChecks ? false }: let inherit (lib) fileset; version = lib.fileContents ./.version + versionSuffix; - - mkDerivation = - if withCoverageChecks - then - # TODO support `finalAttrs` args function in - # `releaseTools.coverageAnalysis`. - argsFun: - releaseTools.coverageAnalysis (let args = argsFun args; in args) - else stdenv.mkDerivation; in -mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-store-c"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - # ./meson.options - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - (fileset.fileFilter (file: file.hasExt "h") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + (fileset.fileFilter (file: file.hasExt "h") ./.) + ]; outputs = [ "out" "dev" ]; @@ -65,8 +55,8 @@ mkDerivation (finalAttrs: { # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. '' - echo ${version} > .version - cp -r ${../../build-utils-meson} build-utils-meson + chmod u+w ./.version + echo ${version} > ../../.version ''; mesonFlags = [ @@ -80,8 +70,7 @@ mkDerivation (finalAttrs: { separateDebugInfo = !stdenv.hostPlatform.isStatic; - # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -89,8 +78,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/libstore/package.nix b/src/libstore/package.nix index d4859a411..df92b5b28 100644 --- a/src/libstore/package.nix +++ b/src/libstore/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -22,46 +23,35 @@ , versionSuffix ? "" , embeddedSandboxShell ? stdenv.hostPlatform.isStatic - -# Check test coverage of Nix. Probably want to use with at least -# one of `doCheck` or `doInstallCheck` enabled. -, withCoverageChecks ? false }: let inherit (lib) fileset; version = lib.fileContents ./.version + versionSuffix; - - mkDerivation = - if withCoverageChecks - then - # TODO support `finalAttrs` args function in - # `releaseTools.coverageAnalysis`. - argsFun: - releaseTools.coverageAnalysis (let args = argsFun args; in args) - else stdenv.mkDerivation; in -mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-store"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - ./meson.options - ./linux/meson.build - ./unix/meson.build - ./windows/meson.build - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - (fileset.fileFilter (file: file.hasExt "sb") ./.) - (fileset.fileFilter (file: file.hasExt "md") ./.) - (fileset.fileFilter (file: file.hasExt "sql") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + ./meson.options + ./linux/meson.build + ./unix/meson.build + ./windows/meson.build + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + (fileset.fileFilter (file: file.hasExt "sb") ./.) + (fileset.fileFilter (file: file.hasExt "md") ./.) + (fileset.fileFilter (file: file.hasExt "sql") ./.) + ]; outputs = [ "out" "dev" ]; @@ -93,8 +83,8 @@ mkDerivation (finalAttrs: { # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. '' - echo ${version} > .version - cp -r ${../../build-utils-meson} build-utils-meson + chmod u+w ./.version + echo ${version} > ../../.version ''; mesonFlags = [ @@ -117,8 +107,7 @@ mkDerivation (finalAttrs: { separateDebugInfo = !stdenv.hostPlatform.isStatic; - # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -126,8 +115,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/libutil-c/package.nix b/src/libutil-c/package.nix index ba1dbe38a..f92cb036c 100644 --- a/src/libutil-c/package.nix +++ b/src/libutil-c/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -11,41 +12,30 @@ # Configuration Options , versionSuffix ? "" - -# Check test coverage of Nix. Probably want to use with at least -# one of `doCheck` or `doInstallCheck` enabled. -, withCoverageChecks ? false }: let inherit (lib) fileset; version = lib.fileContents ./.version + versionSuffix; - - mkDerivation = - if withCoverageChecks - then - # TODO support `finalAttrs` args function in - # `releaseTools.coverageAnalysis`. - argsFun: - releaseTools.coverageAnalysis (let args = argsFun args; in args) - else stdenv.mkDerivation; in -mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-util-c"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - ./meson.options - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - (fileset.fileFilter (file: file.hasExt "h") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + (fileset.fileFilter (file: file.hasExt "h") ./.) + ]; outputs = [ "out" "dev" ]; @@ -63,8 +53,8 @@ mkDerivation (finalAttrs: { # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. '' - echo ${version} > .version - cp -r ${../../build-utils-meson} build-utils-meson + chmod u+w ./.version + echo ${version} > ../../.version ''; mesonFlags = [ @@ -78,8 +68,7 @@ mkDerivation (finalAttrs: { separateDebugInfo = !stdenv.hostPlatform.isStatic; - # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -87,8 +76,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/libutil/package.nix b/src/libutil/package.nix index aff338d16..74d4d7853 100644 --- a/src/libutil/package.nix +++ b/src/libutil/package.nix @@ -18,25 +18,12 @@ # Configuration Options , versionSuffix ? "" - -# Check test coverage of Nix. Probably want to use with at least -# one of `doCheck` or `doInstallCheck` enabled. -, withCoverageChecks ? false }: let inherit (lib) fileset; version = lib.fileContents ./.version + versionSuffix; - - mkDerivation = - if withCoverageChecks - then - # TODO support `finalAttrs` args function in - # `releaseTools.coverageAnalysis`. - argsFun: - releaseTools.coverageAnalysis (let args = argsFun args; in args) - else stdenv.mkDerivation; in mkMesonDerivation (finalAttrs: { @@ -45,6 +32,8 @@ mkMesonDerivation (finalAttrs: { workDir = ./.; fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson ../../.version ./.version ./meson.build @@ -78,12 +67,14 @@ mkMesonDerivation (finalAttrs: { ]; preConfigure = - # TODO: change release process to add `pre` in `.version`, remove it before tagging, and restore after. + # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. + # + # TODO: change release process to add `pre` in `.version`, remove it + # before tagging, and restore after. '' chmod u+w ./.version echo ${version} > ../../.version - cp -r ${../../build-utils-meson} build-utils-meson ''; mesonFlags = [ @@ -103,8 +94,7 @@ mkMesonDerivation (finalAttrs: { separateDebugInfo = !stdenv.hostPlatform.isStatic; - # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -112,8 +102,4 @@ mkMesonDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/nix-expr-test-support/package.nix b/src/nix-expr-test-support/package.nix index ecfb2bb09..aec0e7663 100644 --- a/src/nix-expr-test-support/package.nix +++ b/src/nix-expr-test-support/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -14,40 +15,29 @@ # Configuration Options , versionSuffix ? "" - -# Check test coverage of Nix. Probably want to use with at least -# one of `doCheck` or `doInstallCheck` enabled. -, withCoverageChecks ? false }: let inherit (lib) fileset; version = lib.fileContents ./.version + versionSuffix; - - mkDerivation = - if withCoverageChecks - then - # TODO support `finalAttrs` args function in - # `releaseTools.coverageAnalysis`. - argsFun: - releaseTools.coverageAnalysis (let args = argsFun args; in args) - else stdenv.mkDerivation; in -mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-util-test-support"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - # ./meson.options - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -67,8 +57,8 @@ mkDerivation (finalAttrs: { # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. '' - echo ${version} > .version - cp -r ${../../build-utils-meson} build-utils-meson + chmod u+w ./.version + echo ${version} > ../../.version ''; mesonFlags = [ @@ -82,8 +72,7 @@ mkDerivation (finalAttrs: { separateDebugInfo = !stdenv.hostPlatform.isStatic; - # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -91,8 +80,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/nix-expr-tests/package.nix b/src/nix-expr-tests/package.nix index 679b6fb2a..ddd79fd55 100644 --- a/src/nix-expr-tests/package.nix +++ b/src/nix-expr-tests/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -17,40 +18,29 @@ # Configuration Options , versionSuffix ? "" - -# Check test coverage of Nix. Probably want to use with at least -# one of `doCheck` or `doInstallCheck` enabled. -, withCoverageChecks ? false }: let inherit (lib) fileset; version = lib.fileContents ./.version + versionSuffix; - - mkDerivation = - if withCoverageChecks - then - # TODO support `finalAttrs` args function in - # `releaseTools.coverageAnalysis`. - argsFun: - releaseTools.coverageAnalysis (let args = argsFun args; in args) - else stdenv.mkDerivation; in -mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-expr-tests"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - # ./meson.options - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -72,8 +62,8 @@ mkDerivation (finalAttrs: { # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. '' - echo ${version} > .version - cp -r ${../../build-utils-meson} build-utils-meson + chmod u+w ./.version + echo ${version} > ../../.version ''; mesonFlags = [ @@ -87,8 +77,7 @@ mkDerivation (finalAttrs: { separateDebugInfo = !stdenv.hostPlatform.isStatic; - # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -108,8 +97,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/nix-fetchers-tests/package.nix b/src/nix-fetchers-tests/package.nix index 5cf18ce33..759743a8b 100644 --- a/src/nix-fetchers-tests/package.nix +++ b/src/nix-fetchers-tests/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -16,40 +17,29 @@ # Configuration Options , versionSuffix ? "" - -# Check test coverage of Nix. Probably want to use with at least -# one of `doCheck` or `doInstallCheck` enabled. -, withCoverageChecks ? false }: let inherit (lib) fileset; version = lib.fileContents ./.version + versionSuffix; - - mkDerivation = - if withCoverageChecks - then - # TODO support `finalAttrs` args function in - # `releaseTools.coverageAnalysis`. - argsFun: - releaseTools.coverageAnalysis (let args = argsFun args; in args) - else stdenv.mkDerivation; in -mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-fetchers-tests"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - # ./meson.options - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -70,8 +60,8 @@ mkDerivation (finalAttrs: { # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. '' - echo ${version} > .version - cp -r ${../../build-utils-meson} build-utils-meson + chmod u+w ./.version + echo ${version} > ../../.version ''; mesonFlags = [ @@ -85,8 +75,7 @@ mkDerivation (finalAttrs: { separateDebugInfo = !stdenv.hostPlatform.isStatic; - # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -106,8 +95,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/nix-flake-tests/package.nix b/src/nix-flake-tests/package.nix index 21af753ae..a7783593a 100644 --- a/src/nix-flake-tests/package.nix +++ b/src/nix-flake-tests/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -16,40 +17,29 @@ # Configuration Options , versionSuffix ? "" - -# Check test coverage of Nix. Probably want to use with at least -# one of `doCheck` or `doInstallCheck` enabled. -, withCoverageChecks ? false }: let inherit (lib) fileset; version = lib.fileContents ./.version + versionSuffix; - - mkDerivation = - if withCoverageChecks - then - # TODO support `finalAttrs` args function in - # `releaseTools.coverageAnalysis`. - argsFun: - releaseTools.coverageAnalysis (let args = argsFun args; in args) - else stdenv.mkDerivation; in -mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-flake-tests"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - # ./meson.options - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -70,8 +60,8 @@ mkDerivation (finalAttrs: { # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. '' - echo ${version} > .version - cp -r ${../../build-utils-meson} build-utils-meson + chmod u+w ./.version + echo ${version} > ../../.version ''; mesonFlags = [ @@ -85,8 +75,7 @@ mkDerivation (finalAttrs: { separateDebugInfo = !stdenv.hostPlatform.isStatic; - # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -106,8 +95,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/nix-store-test-support/package.nix b/src/nix-store-test-support/package.nix index 0f4ea73ba..250f29b86 100644 --- a/src/nix-store-test-support/package.nix +++ b/src/nix-store-test-support/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -14,40 +15,29 @@ # Configuration Options , versionSuffix ? "" - -# Check test coverage of Nix. Probably want to use with at least -# one of `doCheck` or `doInstallCheck` enabled. -, withCoverageChecks ? false }: let inherit (lib) fileset; version = lib.fileContents ./.version + versionSuffix; - - mkDerivation = - if withCoverageChecks - then - # TODO support `finalAttrs` args function in - # `releaseTools.coverageAnalysis`. - argsFun: - releaseTools.coverageAnalysis (let args = argsFun args; in args) - else stdenv.mkDerivation; in -mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-store-test-support"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - # ./meson.options - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -67,8 +57,8 @@ mkDerivation (finalAttrs: { # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. '' - echo ${version} > .version - cp -r ${../../build-utils-meson} build-utils-meson + chmod u+w ./.version + echo ${version} > ../../.version ''; mesonFlags = [ @@ -82,8 +72,7 @@ mkDerivation (finalAttrs: { separateDebugInfo = !stdenv.hostPlatform.isStatic; - # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -91,8 +80,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/nix-store-tests/package.nix b/src/nix-store-tests/package.nix index dc987b3c6..e6750771f 100644 --- a/src/nix-store-tests/package.nix +++ b/src/nix-store-tests/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -18,40 +19,29 @@ # Configuration Options , versionSuffix ? "" - -# Check test coverage of Nix. Probably want to use with at least -# one of `doCheck` or `doInstallCheck` enabled. -, withCoverageChecks ? false }: let inherit (lib) fileset; version = lib.fileContents ./.version + versionSuffix; - - mkDerivation = - if withCoverageChecks - then - # TODO support `finalAttrs` args function in - # `releaseTools.coverageAnalysis`. - argsFun: - releaseTools.coverageAnalysis (let args = argsFun args; in args) - else stdenv.mkDerivation; in -mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-store-tests"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - # ./meson.options - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -74,8 +64,8 @@ mkDerivation (finalAttrs: { # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. '' - echo ${version} > .version - cp -r ${../../build-utils-meson} build-utils-meson + chmod u+w ./.version + echo ${version} > ../../.version ''; mesonFlags = [ @@ -89,8 +79,7 @@ mkDerivation (finalAttrs: { separateDebugInfo = !stdenv.hostPlatform.isStatic; - # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -115,8 +104,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/nix-util-test-support/package.nix b/src/nix-util-test-support/package.nix index 795159ebf..42a56d58f 100644 --- a/src/nix-util-test-support/package.nix +++ b/src/nix-util-test-support/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -13,40 +14,29 @@ # Configuration Options , versionSuffix ? "" - -# Check test coverage of Nix. Probably want to use with at least -# one of `doCheck` or `doInstallCheck` enabled. -, withCoverageChecks ? false }: let inherit (lib) fileset; version = lib.fileContents ./.version + versionSuffix; - - mkDerivation = - if withCoverageChecks - then - # TODO support `finalAttrs` args function in - # `releaseTools.coverageAnalysis`. - argsFun: - releaseTools.coverageAnalysis (let args = argsFun args; in args) - else stdenv.mkDerivation; in -mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-util-test-support"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - # ./meson.options - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -65,8 +55,8 @@ mkDerivation (finalAttrs: { # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. '' - echo ${version} > .version - cp -r ${../../build-utils-meson} build-utils-meson + chmod u+w ./.version + echo ${version} > ../../.version ''; mesonFlags = [ @@ -80,8 +70,7 @@ mkDerivation (finalAttrs: { separateDebugInfo = !stdenv.hostPlatform.isStatic; - # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -89,8 +78,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) diff --git a/src/nix-util-tests/package.nix b/src/nix-util-tests/package.nix index 9df8153b6..2491d8722 100644 --- a/src/nix-util-tests/package.nix +++ b/src/nix-util-tests/package.nix @@ -1,5 +1,6 @@ { lib , stdenv +, mkMesonDerivation , releaseTools , meson @@ -17,40 +18,29 @@ # Configuration Options , versionSuffix ? "" - -# Check test coverage of Nix. Probably want to use with at least -# one of `doCheck` or `doInstallCheck` enabled. -, withCoverageChecks ? false }: let inherit (lib) fileset; version = lib.fileContents ./.version + versionSuffix; - - mkDerivation = - if withCoverageChecks - then - # TODO support `finalAttrs` args function in - # `releaseTools.coverageAnalysis`. - argsFun: - releaseTools.coverageAnalysis (let args = argsFun args; in args) - else stdenv.mkDerivation; in -mkDerivation (finalAttrs: { +mkMesonDerivation (finalAttrs: { pname = "nix-util-tests"; inherit version; - src = fileset.toSource { - root = ./.; - fileset = fileset.unions [ - ./meson.build - # ./meson.options - (fileset.fileFilter (file: file.hasExt "cc") ./.) - (fileset.fileFilter (file: file.hasExt "hh") ./.) - ]; - }; + workDir = ./.; + fileset = fileset.unions [ + ../../build-utils-meson + ./build-utils-meson + ../../.version + ./.version + ./meson.build + # ./meson.options + (fileset.fileFilter (file: file.hasExt "cc") ./.) + (fileset.fileFilter (file: file.hasExt "hh") ./.) + ]; outputs = [ "out" "dev" ]; @@ -72,8 +62,8 @@ mkDerivation (finalAttrs: { # "Inline" .version so it's not a symlink, and includes the suffix. # Do the meson utils, without modification. '' - echo ${version} > .version - cp -r ${../../build-utils-meson} build-utils-meson + chmod u+w ./.version + echo ${version} > ../../.version ''; mesonFlags = [ @@ -87,8 +77,7 @@ mkDerivation (finalAttrs: { separateDebugInfo = !stdenv.hostPlatform.isStatic; - # TODO Always true after https://github.com/NixOS/nixpkgs/issues/318564 - strictDeps = !withCoverageChecks; + strictDeps = true; hardeningDisable = lib.optional stdenv.hostPlatform.isStatic "pie"; @@ -108,8 +97,4 @@ mkDerivation (finalAttrs: { platforms = lib.platforms.unix ++ lib.platforms.windows; }; -} // lib.optionalAttrs withCoverageChecks { - lcovFilter = [ "*/boost/*" "*-tab.*" ]; - - hardeningDisable = [ "fortify" ]; }) From 11946817f0858115f8afbfacd5b65d47552d37a7 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 1 Jul 2024 14:31:04 -0400 Subject: [PATCH 33/36] fileset for store unit test data --- src/nix-store-tests/package.nix | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/nix-store-tests/package.nix b/src/nix-store-tests/package.nix index e6750771f..243b9f149 100644 --- a/src/nix-store-tests/package.nix +++ b/src/nix-store-tests/package.nix @@ -86,14 +86,18 @@ mkMesonDerivation (finalAttrs: { passthru = { tests = { run = let - # Inline some drv files shared with the libexpr tests - data = runCommand "${finalAttrs.pname}-test-data" {} '' - cp -r --no-preserve=mode ${./data} $out - cp -r --remove-destination ${../../tests/functional/derivation}/* $out/derivation/ - ''; + # Some data is shared with the functional tests: they create it, + # we consume it. + data = lib.fileset.toSource { + root = ../..; + fileset = lib.fileset.unions [ + ./data + ../../tests/functional/derivation + ]; + }; in runCommand "${finalAttrs.pname}-run" {} '' PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" - export _NIX_TEST_UNIT_DATA=${data} + export _NIX_TEST_UNIT_DATA=${data + "/src/nix-store-test/data"} nix-store-tests touch $out ''; From 451f8a8c19e2ab95999553f5bf3a1fb056877933 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 1 Jul 2024 00:25:57 -0400 Subject: [PATCH 34/36] Put back files for now We'll revert this sometime later --- .gitignore | 10 +- maintainers/flake-module.nix | 122 +++++++++--------- packaging/components.nix | 16 +-- src/nix-expr-test-support | 1 + src/nix-expr-test-support/.version | 1 - src/nix-expr-test-support/build-utils-meson | 1 - src/nix-expr-tests | 1 + src/nix-expr-tests/.version | 1 - src/nix-expr-tests/build-utils-meson | 1 - src/nix-fetchers-tests | 1 + src/nix-fetchers-tests/.version | 1 - src/nix-fetchers-tests/build-utils-meson | 1 - src/nix-flake-tests | 1 + src/nix-flake-tests/.version | 1 - src/nix-flake-tests/build-utils-meson | 1 - src/nix-store-test-support | 1 + src/nix-store-test-support/.version | 1 - src/nix-store-test-support/build-utils-meson | 1 - src/nix-store-tests | 1 + src/nix-store-tests/.version | 1 - src/nix-store-tests/build-utils-meson | 1 - .../advanced-attributes-defaults.drv | 1 - ...d-attributes-structured-attrs-defaults.drv | 1 - .../advanced-attributes-structured-attrs.drv | 1 - .../data/derivation/advanced-attributes.drv | 1 - src/nix-util-test-support | 1 + src/nix-util-test-support/.version | 1 - src/nix-util-test-support/build-utils-meson | 1 - src/nix-util-tests | 1 + src/nix-util-tests/.version | 1 - src/nix-util-tests/build-utils-meson | 1 - tests/unit/libexpr-support/.version | 1 + tests/unit/libexpr-support/build-utils-meson | 1 + .../unit/libexpr-support}/meson.build | 0 .../unit/libexpr-support}/package.nix | 6 +- .../unit/libexpr-support}/tests/libexpr.hh | 0 .../libexpr-support}/tests/nix_api_expr.hh | 0 .../libexpr-support}/tests/value/context.cc | 0 .../libexpr-support}/tests/value/context.hh | 0 tests/unit/libexpr/.version | 1 + tests/unit/libexpr/build-utils-meson | 1 + .../unit/libexpr}/data/.gitkeep | 0 .../unit/libexpr}/derived-path.cc | 0 .../unit/libexpr}/error_traces.cc | 0 .../unit/libexpr}/eval.cc | 0 .../unit/libexpr}/json.cc | 0 .../unit/libexpr}/main.cc | 0 .../unit/libexpr}/meson.build | 0 .../unit/libexpr}/nix_api_expr.cc | 0 .../unit/libexpr}/nix_api_external.cc | 0 .../unit/libexpr}/nix_api_value.cc | 0 .../unit/libexpr}/package.nix | 6 +- .../unit/libexpr}/primops.cc | 0 .../unit/libexpr}/search-path.cc | 0 .../unit/libexpr}/trivial.cc | 0 .../unit/libexpr}/value/context.cc | 0 .../unit/libexpr}/value/print.cc | 0 .../unit/libexpr}/value/value.cc | 0 tests/unit/libfetchers/.version | 1 + tests/unit/libfetchers/build-utils-meson | 1 + .../data/public-key/defaultType.json | 0 .../data/public-key/noRoundTrip.json | 0 .../libfetchers}/data/public-key/simple.json | 0 .../unit/libfetchers}/meson.build | 0 .../unit/libfetchers}/package.nix | 6 +- .../unit/libfetchers}/public-key.cc | 0 tests/unit/libflake/.version | 1 + tests/unit/libflake/build-utils-meson | 1 + .../unit/libflake}/data/.gitkeep | 0 .../unit/libflake}/flakeref.cc | 0 .../unit/libflake}/meson.build | 0 .../unit/libflake}/package.nix | 6 +- .../unit/libflake}/url-name.cc | 0 tests/unit/libstore-support/.version | 1 + tests/unit/libstore-support/build-utils-meson | 1 + .../unit/libstore-support}/meson.build | 0 .../unit/libstore-support}/package.nix | 6 +- .../libstore-support}/tests/derived-path.cc | 0 .../libstore-support}/tests/derived-path.hh | 0 .../unit/libstore-support}/tests/libstore.hh | 0 .../libstore-support}/tests/nix_api_store.hh | 0 .../libstore-support}/tests/outputs-spec.cc | 0 .../libstore-support}/tests/outputs-spec.hh | 0 .../unit/libstore-support}/tests/path.cc | 0 .../unit/libstore-support}/tests/path.hh | 0 .../unit/libstore-support}/tests/protocol.hh | 0 tests/unit/libstore/.version | 1 + tests/unit/libstore/build-utils-meson | 1 + .../unit/libstore}/common-protocol.cc | 0 .../unit/libstore}/content-address.cc | 0 .../data/common-protocol/content-address.bin | Bin .../data/common-protocol/drv-output.bin | Bin .../optional-content-address.bin | Bin .../common-protocol/optional-store-path.bin | Bin .../data/common-protocol/realisation.bin | Bin .../libstore}/data/common-protocol/set.bin | Bin .../data/common-protocol/store-path.bin | Bin .../libstore}/data/common-protocol/string.bin | Bin .../libstore}/data/common-protocol/vector.bin | Bin .../advanced-attributes-defaults.drv | 1 + .../advanced-attributes-defaults.json | 0 ...d-attributes-structured-attrs-defaults.drv | 1 + ...-attributes-structured-attrs-defaults.json | 0 .../advanced-attributes-structured-attrs.drv | 1 + .../advanced-attributes-structured-attrs.json | 0 .../data/derivation/advanced-attributes.drv | 1 + .../derivation/bad-old-version-dyn-deps.drv | 0 .../libstore}/data/derivation/bad-version.drv | 0 .../data/derivation/dynDerivationDeps.drv | 0 .../data/derivation/dynDerivationDeps.json | 0 .../data/derivation/output-caFixedFlat.json | 0 .../data/derivation/output-caFixedNAR.json | 0 .../data/derivation/output-caFixedText.json | 0 .../data/derivation/output-caFloating.json | 0 .../data/derivation/output-deferred.json | 0 .../data/derivation/output-impure.json | 0 .../derivation/output-inputAddressed.json | 0 .../unit/libstore}/data/derivation/simple.drv | 0 .../libstore}/data/derivation/simple.json | 0 .../unit/libstore}/data/machines/bad_format | 0 .../unit/libstore}/data/machines/valid | 0 .../unit/libstore}/data/nar-info/impure.json | 0 .../unit/libstore}/data/nar-info/pure.json | 0 .../data/path-info/empty_impure.json | 0 .../libstore}/data/path-info/empty_pure.json | 0 .../unit/libstore}/data/path-info/impure.json | 0 .../unit/libstore}/data/path-info/pure.json | 0 .../data/serve-protocol/build-options-2.1.bin | Bin .../data/serve-protocol/build-options-2.2.bin | Bin .../data/serve-protocol/build-options-2.3.bin | Bin .../data/serve-protocol/build-options-2.7.bin | Bin .../data/serve-protocol/build-result-2.2.bin | Bin .../data/serve-protocol/build-result-2.3.bin | Bin .../data/serve-protocol/build-result-2.6.bin | Bin .../data/serve-protocol/content-address.bin | Bin .../data/serve-protocol/drv-output.bin | Bin .../serve-protocol/handshake-to-client.bin | Bin .../optional-content-address.bin | Bin .../serve-protocol/optional-store-path.bin | Bin .../data/serve-protocol/realisation.bin | Bin .../libstore}/data/serve-protocol/set.bin | Bin .../data/serve-protocol/store-path.bin | Bin .../libstore}/data/serve-protocol/string.bin | Bin .../unkeyed-valid-path-info-2.3.bin | Bin .../unkeyed-valid-path-info-2.4.bin | Bin .../libstore}/data/serve-protocol/vector.bin | Bin .../libstore}/data/store-reference/auto.txt | 0 .../data/store-reference/auto_param.txt | 0 .../data/store-reference/local_1.txt | 0 .../data/store-reference/local_2.txt | 0 .../store-reference/local_shorthand_1.txt | 0 .../store-reference/local_shorthand_2.txt | 0 .../libstore}/data/store-reference/ssh.txt | 0 .../libstore}/data/store-reference/unix.txt | 0 .../data/store-reference/unix_shorthand.txt | 0 .../data/worker-protocol/build-mode.bin | Bin .../worker-protocol/build-result-1.27.bin | Bin .../worker-protocol/build-result-1.28.bin | Bin .../worker-protocol/build-result-1.29.bin | Bin .../worker-protocol/build-result-1.37.bin | Bin .../client-handshake-info_1_30.bin | 0 .../client-handshake-info_1_33.bin | Bin .../client-handshake-info_1_35.bin | Bin .../data/worker-protocol/content-address.bin | Bin .../worker-protocol/derived-path-1.29.bin | Bin .../worker-protocol/derived-path-1.30.bin | Bin .../data/worker-protocol/drv-output.bin | Bin .../worker-protocol/handshake-to-client.bin | Bin .../keyed-build-result-1.29.bin | Bin .../optional-content-address.bin | Bin .../worker-protocol/optional-store-path.bin | Bin .../worker-protocol/optional-trusted-flag.bin | Bin .../data/worker-protocol/realisation.bin | Bin .../libstore}/data/worker-protocol/set.bin | Bin .../data/worker-protocol/store-path.bin | Bin .../libstore}/data/worker-protocol/string.bin | Bin .../unkeyed-valid-path-info-1.15.bin | Bin .../worker-protocol/valid-path-info-1.15.bin | Bin .../worker-protocol/valid-path-info-1.16.bin | Bin .../libstore}/data/worker-protocol/vector.bin | Bin .../libstore}/derivation-advanced-attrs.cc | 0 .../unit/libstore}/derivation.cc | 0 .../unit/libstore}/derived-path.cc | 0 .../unit/libstore}/downstream-placeholder.cc | 0 .../unit/libstore}/machines.cc | 0 .../unit/libstore}/meson.build | 0 .../unit/libstore}/nar-info-disk-cache.cc | 0 .../unit/libstore}/nar-info.cc | 0 .../unit/libstore}/nix_api_store.cc | 0 .../unit/libstore}/outputs-spec.cc | 0 .../unit/libstore}/package.nix | 10 +- .../unit/libstore}/path-info.cc | 0 .../unit/libstore}/path.cc | 0 .../unit/libstore}/references.cc | 0 .../unit/libstore}/serve-protocol.cc | 0 .../unit/libstore}/store-reference.cc | 0 .../unit/libstore}/worker-protocol.cc | 0 tests/unit/libutil-support/.version | 1 + tests/unit/libutil-support/build-utils-meson | 1 + .../unit/libutil-support}/meson.build | 0 .../unit/libutil-support}/package.nix | 6 +- .../tests/characterization.hh | 0 .../unit/libutil-support}/tests/hash.cc | 0 .../unit/libutil-support}/tests/hash.hh | 0 .../libutil-support}/tests/nix_api_util.hh | 0 .../libutil-support}/tests/string_callback.cc | 0 .../libutil-support}/tests/string_callback.hh | 0 tests/unit/libutil/.version | 1 + .../unit/libutil}/args.cc | 0 tests/unit/libutil/build-utils-meson | 1 + .../unit/libutil}/canon-path.cc | 0 .../unit/libutil}/chunked-vector.cc | 0 .../unit/libutil}/closure.cc | 0 .../unit/libutil}/compression.cc | 0 .../unit/libutil}/config.cc | 0 .../unit/libutil}/data/git/check-data.sh | 0 .../libutil}/data/git/hello-world-blob.bin | Bin .../unit/libutil}/data/git/hello-world.bin | Bin .../unit/libutil}/data/git/tree.bin | Bin .../unit/libutil}/data/git/tree.txt | 0 .../unit/libutil}/file-content-address.cc | 0 .../unit/libutil}/git.cc | 2 +- .../unit/libutil}/hash.cc | 0 .../unit/libutil}/hilite.cc | 0 .../unit/libutil}/json-utils.cc | 0 .../unit/libutil}/logging.cc | 0 .../unit/libutil}/lru-cache.cc | 0 .../unit/libutil}/meson.build | 0 .../unit/libutil}/nix_api_util.cc | 0 .../unit/libutil}/package.nix | 6 +- .../unit/libutil}/pool.cc | 0 .../unit/libutil}/references.cc | 0 .../unit/libutil}/spawn.cc | 0 .../unit/libutil}/suggestions.cc | 0 .../unit/libutil}/tests.cc | 0 .../unit/libutil}/url.cc | 0 .../unit/libutil}/xml-writer.cc | 0 237 files changed, 129 insertions(+), 121 deletions(-) create mode 120000 src/nix-expr-test-support delete mode 120000 src/nix-expr-test-support/.version delete mode 120000 src/nix-expr-test-support/build-utils-meson create mode 120000 src/nix-expr-tests delete mode 120000 src/nix-expr-tests/.version delete mode 120000 src/nix-expr-tests/build-utils-meson create mode 120000 src/nix-fetchers-tests delete mode 120000 src/nix-fetchers-tests/.version delete mode 120000 src/nix-fetchers-tests/build-utils-meson create mode 120000 src/nix-flake-tests delete mode 120000 src/nix-flake-tests/.version delete mode 120000 src/nix-flake-tests/build-utils-meson create mode 120000 src/nix-store-test-support delete mode 120000 src/nix-store-test-support/.version delete mode 120000 src/nix-store-test-support/build-utils-meson create mode 120000 src/nix-store-tests delete mode 120000 src/nix-store-tests/.version delete mode 120000 src/nix-store-tests/build-utils-meson delete mode 120000 src/nix-store-tests/data/derivation/advanced-attributes-defaults.drv delete mode 120000 src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs-defaults.drv delete mode 120000 src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs.drv delete mode 120000 src/nix-store-tests/data/derivation/advanced-attributes.drv create mode 120000 src/nix-util-test-support delete mode 120000 src/nix-util-test-support/.version delete mode 120000 src/nix-util-test-support/build-utils-meson create mode 120000 src/nix-util-tests delete mode 120000 src/nix-util-tests/.version delete mode 120000 src/nix-util-tests/build-utils-meson create mode 120000 tests/unit/libexpr-support/.version create mode 120000 tests/unit/libexpr-support/build-utils-meson rename {src/nix-expr-test-support => tests/unit/libexpr-support}/meson.build (100%) rename {src/nix-expr-test-support => tests/unit/libexpr-support}/package.nix (93%) rename {src/nix-expr-test-support => tests/unit/libexpr-support}/tests/libexpr.hh (100%) rename {src/nix-expr-test-support => tests/unit/libexpr-support}/tests/nix_api_expr.hh (100%) rename {src/nix-expr-test-support => tests/unit/libexpr-support}/tests/value/context.cc (100%) rename {src/nix-expr-test-support => tests/unit/libexpr-support}/tests/value/context.hh (100%) create mode 120000 tests/unit/libexpr/.version create mode 120000 tests/unit/libexpr/build-utils-meson rename {src/nix-expr-tests => tests/unit/libexpr}/data/.gitkeep (100%) rename {src/nix-expr-tests => tests/unit/libexpr}/derived-path.cc (100%) rename {src/nix-expr-tests => tests/unit/libexpr}/error_traces.cc (100%) rename {src/nix-expr-tests => tests/unit/libexpr}/eval.cc (100%) rename {src/nix-expr-tests => tests/unit/libexpr}/json.cc (100%) rename {src/nix-expr-tests => tests/unit/libexpr}/main.cc (100%) rename {src/nix-expr-tests => tests/unit/libexpr}/meson.build (100%) rename {src/nix-expr-tests => tests/unit/libexpr}/nix_api_expr.cc (100%) rename {src/nix-expr-tests => tests/unit/libexpr}/nix_api_external.cc (100%) rename {src/nix-expr-tests => tests/unit/libexpr}/nix_api_value.cc (100%) rename {src/nix-expr-tests => tests/unit/libexpr}/package.nix (94%) rename {src/nix-expr-tests => tests/unit/libexpr}/primops.cc (100%) rename {src/nix-expr-tests => tests/unit/libexpr}/search-path.cc (100%) rename {src/nix-expr-tests => tests/unit/libexpr}/trivial.cc (100%) rename {src/nix-expr-tests => tests/unit/libexpr}/value/context.cc (100%) rename {src/nix-expr-tests => tests/unit/libexpr}/value/print.cc (100%) rename {src/nix-expr-tests => tests/unit/libexpr}/value/value.cc (100%) create mode 120000 tests/unit/libfetchers/.version create mode 120000 tests/unit/libfetchers/build-utils-meson rename {src/nix-fetchers-tests => tests/unit/libfetchers}/data/public-key/defaultType.json (100%) rename {src/nix-fetchers-tests => tests/unit/libfetchers}/data/public-key/noRoundTrip.json (100%) rename {src/nix-fetchers-tests => tests/unit/libfetchers}/data/public-key/simple.json (100%) rename {src/nix-fetchers-tests => tests/unit/libfetchers}/meson.build (100%) rename {src/nix-fetchers-tests => tests/unit/libfetchers}/package.nix (94%) rename {src/nix-fetchers-tests => tests/unit/libfetchers}/public-key.cc (100%) create mode 120000 tests/unit/libflake/.version create mode 120000 tests/unit/libflake/build-utils-meson rename {src/nix-flake-tests => tests/unit/libflake}/data/.gitkeep (100%) rename {src/nix-flake-tests => tests/unit/libflake}/flakeref.cc (100%) rename {src/nix-flake-tests => tests/unit/libflake}/meson.build (100%) rename {src/nix-flake-tests => tests/unit/libflake}/package.nix (94%) rename {src/nix-flake-tests => tests/unit/libflake}/url-name.cc (100%) create mode 120000 tests/unit/libstore-support/.version create mode 120000 tests/unit/libstore-support/build-utils-meson rename {src/nix-store-test-support => tests/unit/libstore-support}/meson.build (100%) rename {src/nix-store-test-support => tests/unit/libstore-support}/package.nix (93%) rename {src/nix-store-test-support => tests/unit/libstore-support}/tests/derived-path.cc (100%) rename {src/nix-store-test-support => tests/unit/libstore-support}/tests/derived-path.hh (100%) rename {src/nix-store-test-support => tests/unit/libstore-support}/tests/libstore.hh (100%) rename {src/nix-store-test-support => tests/unit/libstore-support}/tests/nix_api_store.hh (100%) rename {src/nix-store-test-support => tests/unit/libstore-support}/tests/outputs-spec.cc (100%) rename {src/nix-store-test-support => tests/unit/libstore-support}/tests/outputs-spec.hh (100%) rename {src/nix-store-test-support => tests/unit/libstore-support}/tests/path.cc (100%) rename {src/nix-store-test-support => tests/unit/libstore-support}/tests/path.hh (100%) rename {src/nix-store-test-support => tests/unit/libstore-support}/tests/protocol.hh (100%) create mode 120000 tests/unit/libstore/.version create mode 120000 tests/unit/libstore/build-utils-meson rename {src/nix-store-tests => tests/unit/libstore}/common-protocol.cc (100%) rename {src/nix-store-tests => tests/unit/libstore}/content-address.cc (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/common-protocol/content-address.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/common-protocol/drv-output.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/common-protocol/optional-content-address.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/common-protocol/optional-store-path.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/common-protocol/realisation.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/common-protocol/set.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/common-protocol/store-path.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/common-protocol/string.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/common-protocol/vector.bin (100%) create mode 120000 tests/unit/libstore/data/derivation/advanced-attributes-defaults.drv rename {src/nix-store-tests => tests/unit/libstore}/data/derivation/advanced-attributes-defaults.json (100%) create mode 120000 tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs-defaults.drv rename {src/nix-store-tests => tests/unit/libstore}/data/derivation/advanced-attributes-structured-attrs-defaults.json (100%) create mode 120000 tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs.drv rename {src/nix-store-tests => tests/unit/libstore}/data/derivation/advanced-attributes-structured-attrs.json (100%) create mode 120000 tests/unit/libstore/data/derivation/advanced-attributes.drv rename {src/nix-store-tests => tests/unit/libstore}/data/derivation/bad-old-version-dyn-deps.drv (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/derivation/bad-version.drv (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/derivation/dynDerivationDeps.drv (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/derivation/dynDerivationDeps.json (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/derivation/output-caFixedFlat.json (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/derivation/output-caFixedNAR.json (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/derivation/output-caFixedText.json (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/derivation/output-caFloating.json (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/derivation/output-deferred.json (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/derivation/output-impure.json (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/derivation/output-inputAddressed.json (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/derivation/simple.drv (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/derivation/simple.json (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/machines/bad_format (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/machines/valid (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/nar-info/impure.json (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/nar-info/pure.json (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/path-info/empty_impure.json (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/path-info/empty_pure.json (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/path-info/impure.json (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/path-info/pure.json (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/build-options-2.1.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/build-options-2.2.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/build-options-2.3.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/build-options-2.7.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/build-result-2.2.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/build-result-2.3.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/build-result-2.6.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/content-address.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/drv-output.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/handshake-to-client.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/optional-content-address.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/optional-store-path.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/realisation.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/set.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/store-path.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/string.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/unkeyed-valid-path-info-2.3.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/unkeyed-valid-path-info-2.4.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/serve-protocol/vector.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/store-reference/auto.txt (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/store-reference/auto_param.txt (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/store-reference/local_1.txt (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/store-reference/local_2.txt (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/store-reference/local_shorthand_1.txt (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/store-reference/local_shorthand_2.txt (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/store-reference/ssh.txt (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/store-reference/unix.txt (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/store-reference/unix_shorthand.txt (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/build-mode.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/build-result-1.27.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/build-result-1.28.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/build-result-1.29.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/build-result-1.37.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/client-handshake-info_1_30.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/client-handshake-info_1_33.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/client-handshake-info_1_35.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/content-address.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/derived-path-1.29.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/derived-path-1.30.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/drv-output.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/handshake-to-client.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/keyed-build-result-1.29.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/optional-content-address.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/optional-store-path.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/optional-trusted-flag.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/realisation.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/set.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/store-path.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/string.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/unkeyed-valid-path-info-1.15.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/valid-path-info-1.15.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/valid-path-info-1.16.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/data/worker-protocol/vector.bin (100%) rename {src/nix-store-tests => tests/unit/libstore}/derivation-advanced-attrs.cc (100%) rename {src/nix-store-tests => tests/unit/libstore}/derivation.cc (100%) rename {src/nix-store-tests => tests/unit/libstore}/derived-path.cc (100%) rename {src/nix-store-tests => tests/unit/libstore}/downstream-placeholder.cc (100%) rename {src/nix-store-tests => tests/unit/libstore}/machines.cc (100%) rename {src/nix-store-tests => tests/unit/libstore}/meson.build (100%) rename {src/nix-store-tests => tests/unit/libstore}/nar-info-disk-cache.cc (100%) rename {src/nix-store-tests => tests/unit/libstore}/nar-info.cc (100%) rename {src/nix-store-tests => tests/unit/libstore}/nix_api_store.cc (100%) rename {src/nix-store-tests => tests/unit/libstore}/outputs-spec.cc (100%) rename {src/nix-store-tests => tests/unit/libstore}/package.nix (90%) rename {src/nix-store-tests => tests/unit/libstore}/path-info.cc (100%) rename {src/nix-store-tests => tests/unit/libstore}/path.cc (100%) rename {src/nix-store-tests => tests/unit/libstore}/references.cc (100%) rename {src/nix-store-tests => tests/unit/libstore}/serve-protocol.cc (100%) rename {src/nix-store-tests => tests/unit/libstore}/store-reference.cc (100%) rename {src/nix-store-tests => tests/unit/libstore}/worker-protocol.cc (100%) create mode 120000 tests/unit/libutil-support/.version create mode 120000 tests/unit/libutil-support/build-utils-meson rename {src/nix-util-test-support => tests/unit/libutil-support}/meson.build (100%) rename {src/nix-util-test-support => tests/unit/libutil-support}/package.nix (93%) rename {src/nix-util-test-support => tests/unit/libutil-support}/tests/characterization.hh (100%) rename {src/nix-util-test-support => tests/unit/libutil-support}/tests/hash.cc (100%) rename {src/nix-util-test-support => tests/unit/libutil-support}/tests/hash.hh (100%) rename {src/nix-util-test-support => tests/unit/libutil-support}/tests/nix_api_util.hh (100%) rename {src/nix-util-test-support => tests/unit/libutil-support}/tests/string_callback.cc (100%) rename {src/nix-util-test-support => tests/unit/libutil-support}/tests/string_callback.hh (100%) create mode 120000 tests/unit/libutil/.version rename {src/nix-util-tests => tests/unit/libutil}/args.cc (100%) create mode 120000 tests/unit/libutil/build-utils-meson rename {src/nix-util-tests => tests/unit/libutil}/canon-path.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/chunked-vector.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/closure.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/compression.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/config.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/data/git/check-data.sh (100%) rename {src/nix-util-tests => tests/unit/libutil}/data/git/hello-world-blob.bin (100%) rename {src/nix-util-tests => tests/unit/libutil}/data/git/hello-world.bin (100%) rename {src/nix-util-tests => tests/unit/libutil}/data/git/tree.bin (100%) rename {src/nix-util-tests => tests/unit/libutil}/data/git/tree.txt (100%) rename {src/nix-util-tests => tests/unit/libutil}/file-content-address.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/git.cc (99%) rename {src/nix-util-tests => tests/unit/libutil}/hash.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/hilite.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/json-utils.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/logging.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/lru-cache.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/meson.build (100%) rename {src/nix-util-tests => tests/unit/libutil}/nix_api_util.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/package.nix (94%) rename {src/nix-util-tests => tests/unit/libutil}/pool.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/references.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/spawn.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/suggestions.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/tests.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/url.cc (100%) rename {src/nix-util-tests => tests/unit/libutil}/xml-writer.cc (100%) diff --git a/.gitignore b/.gitignore index fdfd744e5..a17b627f4 100644 --- a/.gitignore +++ b/.gitignore @@ -49,22 +49,22 @@ perl/Makefile.config /src/libexpr/parser-tab.output /src/libexpr/nix.tbl /src/libexpr/tests -/src/nix-expr-tests/libnixexpr-tests +/tests/unit/libexpr/libnixexpr-tests # /src/libfetchers -/src/nix-fetchers-tests/libnixfetchers-tests +/tests/unit/libfetchers/libnixfetchers-tests # /src/libflake -/src/nix-flake-tests/libnixflake-tests +/tests/unit/libflake/libnixflake-tests # /src/libstore/ *.gen.* /src/libstore/tests -/src/nix-store-tests/libnixstore-tests +/tests/unit/libstore/libnixstore-tests # /src/libutil/ /src/libutil/tests -/src/nix-util-tests/libnixutil-tests +/tests/unit/libutil/libnixutil-tests /src/nix/nix diff --git a/maintainers/flake-module.nix b/maintainers/flake-module.nix index 007ef034f..8f95e788b 100644 --- a/maintainers/flake-module.nix +++ b/maintainers/flake-module.nix @@ -15,7 +15,7 @@ excludes = [ # We don't want to format test data # ''tests/(?!nixos/).*\.nix'' - ''^src/[^/]*-tests/data/.*$'' + ''^tests/unit/[^/]*/data/.*$'' # Don't format vendored code ''^doc/manual/redirects\.js$'' @@ -429,65 +429,65 @@ ''^tests/nixos/ca-fd-leak/sender\.c'' ''^tests/nixos/ca-fd-leak/smuggler\.c'' ''^tests/nixos/user-sandboxing/attacker\.c'' - ''^src/nix-expr-test-support/tests/libexpr\.hh'' - ''^src/nix-expr-test-support/tests/value/context\.cc'' - ''^src/nix-expr-test-support/tests/value/context\.hh'' - ''^src/nix-expr-tests/derived-path\.cc'' - ''^src/nix-expr-tests/error_traces\.cc'' - ''^src/nix-expr-tests/eval\.cc'' - ''^src/nix-expr-tests/json\.cc'' - ''^src/nix-expr-tests/main\.cc'' - ''^src/nix-expr-tests/primops\.cc'' - ''^src/nix-expr-tests/search-path\.cc'' - ''^src/nix-expr-tests/trivial\.cc'' - ''^src/nix-expr-tests/value/context\.cc'' - ''^src/nix-expr-tests/value/print\.cc'' - ''^src/nix-fetchers-tests/public-key\.cc'' - ''^src/nix-flake-tests/flakeref\.cc'' - ''^src/nix-flake-tests/url-name\.cc'' - ''^src/nix-store-test-support/tests/derived-path\.cc'' - ''^src/nix-store-test-support/tests/derived-path\.hh'' - ''^src/nix-store-test-support/tests/nix_api_store\.hh'' - ''^src/nix-store-test-support/tests/outputs-spec\.cc'' - ''^src/nix-store-test-support/tests/outputs-spec\.hh'' - ''^src/nix-store-test-support/tests/path\.cc'' - ''^src/nix-store-test-support/tests/path\.hh'' - ''^src/nix-store-test-support/tests/protocol\.hh'' - ''^src/nix-store-tests/common-protocol\.cc'' - ''^src/nix-store-tests/content-address\.cc'' - ''^src/nix-store-tests/derivation\.cc'' - ''^src/nix-store-tests/derived-path\.cc'' - ''^src/nix-store-tests/downstream-placeholder\.cc'' - ''^src/nix-store-tests/machines\.cc'' - ''^src/nix-store-tests/nar-info-disk-cache\.cc'' - ''^src/nix-store-tests/nar-info\.cc'' - ''^src/nix-store-tests/outputs-spec\.cc'' - ''^src/nix-store-tests/path-info\.cc'' - ''^src/nix-store-tests/path\.cc'' - ''^src/nix-store-tests/serve-protocol\.cc'' - ''^src/nix-store-tests/worker-protocol\.cc'' - ''^src/nix-util-test-support/tests/characterization\.hh'' - ''^src/nix-util-test-support/tests/hash\.cc'' - ''^src/nix-util-test-support/tests/hash\.hh'' - ''^src/nix-util-tests/args\.cc'' - ''^src/nix-util-tests/canon-path\.cc'' - ''^src/nix-util-tests/chunked-vector\.cc'' - ''^src/nix-util-tests/closure\.cc'' - ''^src/nix-util-tests/compression\.cc'' - ''^src/nix-util-tests/config\.cc'' - ''^src/nix-util-tests/file-content-address\.cc'' - ''^src/nix-util-tests/git\.cc'' - ''^src/nix-util-tests/hash\.cc'' - ''^src/nix-util-tests/hilite\.cc'' - ''^src/nix-util-tests/json-utils\.cc'' - ''^src/nix-util-tests/logging\.cc'' - ''^src/nix-util-tests/lru-cache\.cc'' - ''^src/nix-util-tests/pool\.cc'' - ''^src/nix-util-tests/references\.cc'' - ''^src/nix-util-tests/suggestions\.cc'' - ''^src/nix-util-tests/tests\.cc'' - ''^src/nix-util-tests/url\.cc'' - ''^src/nix-util-tests/xml-writer\.cc'' + ''^tests/unit/libexpr-support/tests/libexpr\.hh'' + ''^tests/unit/libexpr-support/tests/value/context\.cc'' + ''^tests/unit/libexpr-support/tests/value/context\.hh'' + ''^tests/unit/libexpr/derived-path\.cc'' + ''^tests/unit/libexpr/error_traces\.cc'' + ''^tests/unit/libexpr/eval\.cc'' + ''^tests/unit/libexpr/json\.cc'' + ''^tests/unit/libexpr/main\.cc'' + ''^tests/unit/libexpr/primops\.cc'' + ''^tests/unit/libexpr/search-path\.cc'' + ''^tests/unit/libexpr/trivial\.cc'' + ''^tests/unit/libexpr/value/context\.cc'' + ''^tests/unit/libexpr/value/print\.cc'' + ''^tests/unit/libfetchers/public-key\.cc'' + ''^tests/unit/libflake/flakeref\.cc'' + ''^tests/unit/libflake/url-name\.cc'' + ''^tests/unit/libstore-support/tests/derived-path\.cc'' + ''^tests/unit/libstore-support/tests/derived-path\.hh'' + ''^tests/unit/libstore-support/tests/nix_api_store\.hh'' + ''^tests/unit/libstore-support/tests/outputs-spec\.cc'' + ''^tests/unit/libstore-support/tests/outputs-spec\.hh'' + ''^tests/unit/libstore-support/tests/path\.cc'' + ''^tests/unit/libstore-support/tests/path\.hh'' + ''^tests/unit/libstore-support/tests/protocol\.hh'' + ''^tests/unit/libstore/common-protocol\.cc'' + ''^tests/unit/libstore/content-address\.cc'' + ''^tests/unit/libstore/derivation\.cc'' + ''^tests/unit/libstore/derived-path\.cc'' + ''^tests/unit/libstore/downstream-placeholder\.cc'' + ''^tests/unit/libstore/machines\.cc'' + ''^tests/unit/libstore/nar-info-disk-cache\.cc'' + ''^tests/unit/libstore/nar-info\.cc'' + ''^tests/unit/libstore/outputs-spec\.cc'' + ''^tests/unit/libstore/path-info\.cc'' + ''^tests/unit/libstore/path\.cc'' + ''^tests/unit/libstore/serve-protocol\.cc'' + ''^tests/unit/libstore/worker-protocol\.cc'' + ''^tests/unit/libutil-support/tests/characterization\.hh'' + ''^tests/unit/libutil-support/tests/hash\.cc'' + ''^tests/unit/libutil-support/tests/hash\.hh'' + ''^tests/unit/libutil/args\.cc'' + ''^tests/unit/libutil/canon-path\.cc'' + ''^tests/unit/libutil/chunked-vector\.cc'' + ''^tests/unit/libutil/closure\.cc'' + ''^tests/unit/libutil/compression\.cc'' + ''^tests/unit/libutil/config\.cc'' + ''^tests/unit/libutil/file-content-address\.cc'' + ''^tests/unit/libutil/git\.cc'' + ''^tests/unit/libutil/hash\.cc'' + ''^tests/unit/libutil/hilite\.cc'' + ''^tests/unit/libutil/json-utils\.cc'' + ''^tests/unit/libutil/logging\.cc'' + ''^tests/unit/libutil/lru-cache\.cc'' + ''^tests/unit/libutil/pool\.cc'' + ''^tests/unit/libutil/references\.cc'' + ''^tests/unit/libutil/suggestions\.cc'' + ''^tests/unit/libutil/tests\.cc'' + ''^tests/unit/libutil/url\.cc'' + ''^tests/unit/libutil/xml-writer\.cc'' ]; }; shellcheck = { @@ -666,7 +666,7 @@ ''^tests/functional/user-envs\.sh$'' ''^tests/functional/why-depends\.sh$'' ''^tests/functional/zstd\.sh$'' - ''^src/nix-util-tests/data/git/check-data\.sh$'' + ''^tests/unit/libutil/data/git/check-data\.sh$'' ]; }; # TODO: nixfmt, https://github.com/NixOS/nixfmt/issues/153 diff --git a/packaging/components.nix b/packaging/components.nix index db50d6b22..e9e95c028 100644 --- a/packaging/components.nix +++ b/packaging/components.nix @@ -9,24 +9,24 @@ in nix-util = callPackage ../src/libutil/package.nix { }; nix-util-c = callPackage ../src/libutil-c/package.nix { }; - nix-util-test-support = callPackage ../src/nix-util-test-support/package.nix { }; - nix-util-tests = callPackage ../src/nix-util-tests/package.nix { }; + nix-util-test-support = callPackage ../tests/unit/libutil-support/package.nix { }; + nix-util-tests = callPackage ../tests/unit/libutil/package.nix { }; nix-store = callPackage ../src/libstore/package.nix { }; nix-store-c = callPackage ../src/libstore-c/package.nix { }; - nix-store-test-support = callPackage ../src/nix-store-test-support/package.nix { }; - nix-store-tests = callPackage ../src/nix-store-tests/package.nix { }; + nix-store-test-support = callPackage ../tests/unit/libstore-support/package.nix { }; + nix-store-tests = callPackage ../tests/unit/libstore/package.nix { }; nix-fetchers = callPackage ../src/libfetchers/package.nix { }; - nix-fetchers-tests = callPackage ../src/nix-fetchers-tests/package.nix { }; + nix-fetchers-tests = callPackage ../tests/unit/libfetchers/package.nix { }; nix-expr = callPackage ../src/libexpr/package.nix { }; nix-expr-c = callPackage ../src/libexpr-c/package.nix { }; - nix-expr-test-support = callPackage ../src/nix-expr-test-support/package.nix { }; - nix-expr-tests = callPackage ../src/nix-expr-tests/package.nix { }; + nix-expr-test-support = callPackage ../tests/unit/libexpr-support/package.nix { }; + nix-expr-tests = callPackage ../tests/unit/libexpr/package.nix { }; nix-flake = callPackage ../src/libflake/package.nix { }; - nix-flake-tests = callPackage ../src/nix-flake-tests/package.nix { }; + nix-flake-tests = callPackage ../tests/unit/libflake/package.nix { }; nix-internal-api-docs = callPackage ../src/internal-api-docs/package.nix { }; nix-external-api-docs = callPackage ../src/external-api-docs/package.nix { }; diff --git a/src/nix-expr-test-support b/src/nix-expr-test-support new file mode 120000 index 000000000..427b80dff --- /dev/null +++ b/src/nix-expr-test-support @@ -0,0 +1 @@ +../tests/unit/libexpr-support \ No newline at end of file diff --git a/src/nix-expr-test-support/.version b/src/nix-expr-test-support/.version deleted file mode 120000 index b7badcd0c..000000000 --- a/src/nix-expr-test-support/.version +++ /dev/null @@ -1 +0,0 @@ -../../.version \ No newline at end of file diff --git a/src/nix-expr-test-support/build-utils-meson b/src/nix-expr-test-support/build-utils-meson deleted file mode 120000 index 5fff21bab..000000000 --- a/src/nix-expr-test-support/build-utils-meson +++ /dev/null @@ -1 +0,0 @@ -../../build-utils-meson \ No newline at end of file diff --git a/src/nix-expr-tests b/src/nix-expr-tests new file mode 120000 index 000000000..3af7110d3 --- /dev/null +++ b/src/nix-expr-tests @@ -0,0 +1 @@ +../tests/unit/libexpr \ No newline at end of file diff --git a/src/nix-expr-tests/.version b/src/nix-expr-tests/.version deleted file mode 120000 index b7badcd0c..000000000 --- a/src/nix-expr-tests/.version +++ /dev/null @@ -1 +0,0 @@ -../../.version \ No newline at end of file diff --git a/src/nix-expr-tests/build-utils-meson b/src/nix-expr-tests/build-utils-meson deleted file mode 120000 index 5fff21bab..000000000 --- a/src/nix-expr-tests/build-utils-meson +++ /dev/null @@ -1 +0,0 @@ -../../build-utils-meson \ No newline at end of file diff --git a/src/nix-fetchers-tests b/src/nix-fetchers-tests new file mode 120000 index 000000000..80e4b68ae --- /dev/null +++ b/src/nix-fetchers-tests @@ -0,0 +1 @@ +../tests/unit/libfetchers \ No newline at end of file diff --git a/src/nix-fetchers-tests/.version b/src/nix-fetchers-tests/.version deleted file mode 120000 index b7badcd0c..000000000 --- a/src/nix-fetchers-tests/.version +++ /dev/null @@ -1 +0,0 @@ -../../.version \ No newline at end of file diff --git a/src/nix-fetchers-tests/build-utils-meson b/src/nix-fetchers-tests/build-utils-meson deleted file mode 120000 index 5fff21bab..000000000 --- a/src/nix-fetchers-tests/build-utils-meson +++ /dev/null @@ -1 +0,0 @@ -../../build-utils-meson \ No newline at end of file diff --git a/src/nix-flake-tests b/src/nix-flake-tests new file mode 120000 index 000000000..bb2d49400 --- /dev/null +++ b/src/nix-flake-tests @@ -0,0 +1 @@ +../tests/unit/libflake \ No newline at end of file diff --git a/src/nix-flake-tests/.version b/src/nix-flake-tests/.version deleted file mode 120000 index b7badcd0c..000000000 --- a/src/nix-flake-tests/.version +++ /dev/null @@ -1 +0,0 @@ -../../.version \ No newline at end of file diff --git a/src/nix-flake-tests/build-utils-meson b/src/nix-flake-tests/build-utils-meson deleted file mode 120000 index 5fff21bab..000000000 --- a/src/nix-flake-tests/build-utils-meson +++ /dev/null @@ -1 +0,0 @@ -../../build-utils-meson \ No newline at end of file diff --git a/src/nix-store-test-support b/src/nix-store-test-support new file mode 120000 index 000000000..af4befd90 --- /dev/null +++ b/src/nix-store-test-support @@ -0,0 +1 @@ +../tests/unit/libstore-support \ No newline at end of file diff --git a/src/nix-store-test-support/.version b/src/nix-store-test-support/.version deleted file mode 120000 index b7badcd0c..000000000 --- a/src/nix-store-test-support/.version +++ /dev/null @@ -1 +0,0 @@ -../../.version \ No newline at end of file diff --git a/src/nix-store-test-support/build-utils-meson b/src/nix-store-test-support/build-utils-meson deleted file mode 120000 index 5fff21bab..000000000 --- a/src/nix-store-test-support/build-utils-meson +++ /dev/null @@ -1 +0,0 @@ -../../build-utils-meson \ No newline at end of file diff --git a/src/nix-store-tests b/src/nix-store-tests new file mode 120000 index 000000000..fc9b910af --- /dev/null +++ b/src/nix-store-tests @@ -0,0 +1 @@ +../tests/unit/libstore \ No newline at end of file diff --git a/src/nix-store-tests/.version b/src/nix-store-tests/.version deleted file mode 120000 index b7badcd0c..000000000 --- a/src/nix-store-tests/.version +++ /dev/null @@ -1 +0,0 @@ -../../.version \ No newline at end of file diff --git a/src/nix-store-tests/build-utils-meson b/src/nix-store-tests/build-utils-meson deleted file mode 120000 index 5fff21bab..000000000 --- a/src/nix-store-tests/build-utils-meson +++ /dev/null @@ -1 +0,0 @@ -../../build-utils-meson \ No newline at end of file diff --git a/src/nix-store-tests/data/derivation/advanced-attributes-defaults.drv b/src/nix-store-tests/data/derivation/advanced-attributes-defaults.drv deleted file mode 120000 index f8f30ac32..000000000 --- a/src/nix-store-tests/data/derivation/advanced-attributes-defaults.drv +++ /dev/null @@ -1 +0,0 @@ -../../../../tests/functional/derivation/advanced-attributes-defaults.drv \ No newline at end of file diff --git a/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs-defaults.drv b/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs-defaults.drv deleted file mode 120000 index 837e9a0e4..000000000 --- a/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs-defaults.drv +++ /dev/null @@ -1 +0,0 @@ -../../../../tests/functional/derivation/advanced-attributes-structured-attrs-defaults.drv \ No newline at end of file diff --git a/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs.drv b/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs.drv deleted file mode 120000 index e08bb5737..000000000 --- a/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs.drv +++ /dev/null @@ -1 +0,0 @@ -../../../../tests/functional/derivation/advanced-attributes-structured-attrs.drv \ No newline at end of file diff --git a/src/nix-store-tests/data/derivation/advanced-attributes.drv b/src/nix-store-tests/data/derivation/advanced-attributes.drv deleted file mode 120000 index 1dc394a0a..000000000 --- a/src/nix-store-tests/data/derivation/advanced-attributes.drv +++ /dev/null @@ -1 +0,0 @@ -../../../../tests/functional/derivation/advanced-attributes.drv \ No newline at end of file diff --git a/src/nix-util-test-support b/src/nix-util-test-support new file mode 120000 index 000000000..4b25930eb --- /dev/null +++ b/src/nix-util-test-support @@ -0,0 +1 @@ +../tests/unit/libutil-support \ No newline at end of file diff --git a/src/nix-util-test-support/.version b/src/nix-util-test-support/.version deleted file mode 120000 index b7badcd0c..000000000 --- a/src/nix-util-test-support/.version +++ /dev/null @@ -1 +0,0 @@ -../../.version \ No newline at end of file diff --git a/src/nix-util-test-support/build-utils-meson b/src/nix-util-test-support/build-utils-meson deleted file mode 120000 index 5fff21bab..000000000 --- a/src/nix-util-test-support/build-utils-meson +++ /dev/null @@ -1 +0,0 @@ -../../build-utils-meson \ No newline at end of file diff --git a/src/nix-util-tests b/src/nix-util-tests new file mode 120000 index 000000000..e1138411a --- /dev/null +++ b/src/nix-util-tests @@ -0,0 +1 @@ +../tests/unit/libutil \ No newline at end of file diff --git a/src/nix-util-tests/.version b/src/nix-util-tests/.version deleted file mode 120000 index b7badcd0c..000000000 --- a/src/nix-util-tests/.version +++ /dev/null @@ -1 +0,0 @@ -../../.version \ No newline at end of file diff --git a/src/nix-util-tests/build-utils-meson b/src/nix-util-tests/build-utils-meson deleted file mode 120000 index 5fff21bab..000000000 --- a/src/nix-util-tests/build-utils-meson +++ /dev/null @@ -1 +0,0 @@ -../../build-utils-meson \ No newline at end of file diff --git a/tests/unit/libexpr-support/.version b/tests/unit/libexpr-support/.version new file mode 120000 index 000000000..0df9915bf --- /dev/null +++ b/tests/unit/libexpr-support/.version @@ -0,0 +1 @@ +../../../.version \ No newline at end of file diff --git a/tests/unit/libexpr-support/build-utils-meson b/tests/unit/libexpr-support/build-utils-meson new file mode 120000 index 000000000..f2d8e8a50 --- /dev/null +++ b/tests/unit/libexpr-support/build-utils-meson @@ -0,0 +1 @@ +../../../build-utils-meson/ \ No newline at end of file diff --git a/src/nix-expr-test-support/meson.build b/tests/unit/libexpr-support/meson.build similarity index 100% rename from src/nix-expr-test-support/meson.build rename to tests/unit/libexpr-support/meson.build diff --git a/src/nix-expr-test-support/package.nix b/tests/unit/libexpr-support/package.nix similarity index 93% rename from src/nix-expr-test-support/package.nix rename to tests/unit/libexpr-support/package.nix index aec0e7663..f32cf2615 100644 --- a/src/nix-expr-test-support/package.nix +++ b/tests/unit/libexpr-support/package.nix @@ -29,9 +29,9 @@ mkMesonDerivation (finalAttrs: { workDir = ./.; fileset = fileset.unions [ - ../../build-utils-meson + ../../../build-utils-meson ./build-utils-meson - ../../.version + ../../../.version ./.version ./meson.build # ./meson.options @@ -58,7 +58,7 @@ mkMesonDerivation (finalAttrs: { # Do the meson utils, without modification. '' chmod u+w ./.version - echo ${version} > ../../.version + echo ${version} > ../../../.version ''; mesonFlags = [ diff --git a/src/nix-expr-test-support/tests/libexpr.hh b/tests/unit/libexpr-support/tests/libexpr.hh similarity index 100% rename from src/nix-expr-test-support/tests/libexpr.hh rename to tests/unit/libexpr-support/tests/libexpr.hh diff --git a/src/nix-expr-test-support/tests/nix_api_expr.hh b/tests/unit/libexpr-support/tests/nix_api_expr.hh similarity index 100% rename from src/nix-expr-test-support/tests/nix_api_expr.hh rename to tests/unit/libexpr-support/tests/nix_api_expr.hh diff --git a/src/nix-expr-test-support/tests/value/context.cc b/tests/unit/libexpr-support/tests/value/context.cc similarity index 100% rename from src/nix-expr-test-support/tests/value/context.cc rename to tests/unit/libexpr-support/tests/value/context.cc diff --git a/src/nix-expr-test-support/tests/value/context.hh b/tests/unit/libexpr-support/tests/value/context.hh similarity index 100% rename from src/nix-expr-test-support/tests/value/context.hh rename to tests/unit/libexpr-support/tests/value/context.hh diff --git a/tests/unit/libexpr/.version b/tests/unit/libexpr/.version new file mode 120000 index 000000000..0df9915bf --- /dev/null +++ b/tests/unit/libexpr/.version @@ -0,0 +1 @@ +../../../.version \ No newline at end of file diff --git a/tests/unit/libexpr/build-utils-meson b/tests/unit/libexpr/build-utils-meson new file mode 120000 index 000000000..f2d8e8a50 --- /dev/null +++ b/tests/unit/libexpr/build-utils-meson @@ -0,0 +1 @@ +../../../build-utils-meson/ \ No newline at end of file diff --git a/src/nix-expr-tests/data/.gitkeep b/tests/unit/libexpr/data/.gitkeep similarity index 100% rename from src/nix-expr-tests/data/.gitkeep rename to tests/unit/libexpr/data/.gitkeep diff --git a/src/nix-expr-tests/derived-path.cc b/tests/unit/libexpr/derived-path.cc similarity index 100% rename from src/nix-expr-tests/derived-path.cc rename to tests/unit/libexpr/derived-path.cc diff --git a/src/nix-expr-tests/error_traces.cc b/tests/unit/libexpr/error_traces.cc similarity index 100% rename from src/nix-expr-tests/error_traces.cc rename to tests/unit/libexpr/error_traces.cc diff --git a/src/nix-expr-tests/eval.cc b/tests/unit/libexpr/eval.cc similarity index 100% rename from src/nix-expr-tests/eval.cc rename to tests/unit/libexpr/eval.cc diff --git a/src/nix-expr-tests/json.cc b/tests/unit/libexpr/json.cc similarity index 100% rename from src/nix-expr-tests/json.cc rename to tests/unit/libexpr/json.cc diff --git a/src/nix-expr-tests/main.cc b/tests/unit/libexpr/main.cc similarity index 100% rename from src/nix-expr-tests/main.cc rename to tests/unit/libexpr/main.cc diff --git a/src/nix-expr-tests/meson.build b/tests/unit/libexpr/meson.build similarity index 100% rename from src/nix-expr-tests/meson.build rename to tests/unit/libexpr/meson.build diff --git a/src/nix-expr-tests/nix_api_expr.cc b/tests/unit/libexpr/nix_api_expr.cc similarity index 100% rename from src/nix-expr-tests/nix_api_expr.cc rename to tests/unit/libexpr/nix_api_expr.cc diff --git a/src/nix-expr-tests/nix_api_external.cc b/tests/unit/libexpr/nix_api_external.cc similarity index 100% rename from src/nix-expr-tests/nix_api_external.cc rename to tests/unit/libexpr/nix_api_external.cc diff --git a/src/nix-expr-tests/nix_api_value.cc b/tests/unit/libexpr/nix_api_value.cc similarity index 100% rename from src/nix-expr-tests/nix_api_value.cc rename to tests/unit/libexpr/nix_api_value.cc diff --git a/src/nix-expr-tests/package.nix b/tests/unit/libexpr/package.nix similarity index 94% rename from src/nix-expr-tests/package.nix rename to tests/unit/libexpr/package.nix index ddd79fd55..1667dc77e 100644 --- a/src/nix-expr-tests/package.nix +++ b/tests/unit/libexpr/package.nix @@ -32,9 +32,9 @@ mkMesonDerivation (finalAttrs: { workDir = ./.; fileset = fileset.unions [ - ../../build-utils-meson + ../../../build-utils-meson ./build-utils-meson - ../../.version + ../../../.version ./.version ./meson.build # ./meson.options @@ -63,7 +63,7 @@ mkMesonDerivation (finalAttrs: { # Do the meson utils, without modification. '' chmod u+w ./.version - echo ${version} > ../../.version + echo ${version} > ../../../.version ''; mesonFlags = [ diff --git a/src/nix-expr-tests/primops.cc b/tests/unit/libexpr/primops.cc similarity index 100% rename from src/nix-expr-tests/primops.cc rename to tests/unit/libexpr/primops.cc diff --git a/src/nix-expr-tests/search-path.cc b/tests/unit/libexpr/search-path.cc similarity index 100% rename from src/nix-expr-tests/search-path.cc rename to tests/unit/libexpr/search-path.cc diff --git a/src/nix-expr-tests/trivial.cc b/tests/unit/libexpr/trivial.cc similarity index 100% rename from src/nix-expr-tests/trivial.cc rename to tests/unit/libexpr/trivial.cc diff --git a/src/nix-expr-tests/value/context.cc b/tests/unit/libexpr/value/context.cc similarity index 100% rename from src/nix-expr-tests/value/context.cc rename to tests/unit/libexpr/value/context.cc diff --git a/src/nix-expr-tests/value/print.cc b/tests/unit/libexpr/value/print.cc similarity index 100% rename from src/nix-expr-tests/value/print.cc rename to tests/unit/libexpr/value/print.cc diff --git a/src/nix-expr-tests/value/value.cc b/tests/unit/libexpr/value/value.cc similarity index 100% rename from src/nix-expr-tests/value/value.cc rename to tests/unit/libexpr/value/value.cc diff --git a/tests/unit/libfetchers/.version b/tests/unit/libfetchers/.version new file mode 120000 index 000000000..0df9915bf --- /dev/null +++ b/tests/unit/libfetchers/.version @@ -0,0 +1 @@ +../../../.version \ No newline at end of file diff --git a/tests/unit/libfetchers/build-utils-meson b/tests/unit/libfetchers/build-utils-meson new file mode 120000 index 000000000..f2d8e8a50 --- /dev/null +++ b/tests/unit/libfetchers/build-utils-meson @@ -0,0 +1 @@ +../../../build-utils-meson/ \ No newline at end of file diff --git a/src/nix-fetchers-tests/data/public-key/defaultType.json b/tests/unit/libfetchers/data/public-key/defaultType.json similarity index 100% rename from src/nix-fetchers-tests/data/public-key/defaultType.json rename to tests/unit/libfetchers/data/public-key/defaultType.json diff --git a/src/nix-fetchers-tests/data/public-key/noRoundTrip.json b/tests/unit/libfetchers/data/public-key/noRoundTrip.json similarity index 100% rename from src/nix-fetchers-tests/data/public-key/noRoundTrip.json rename to tests/unit/libfetchers/data/public-key/noRoundTrip.json diff --git a/src/nix-fetchers-tests/data/public-key/simple.json b/tests/unit/libfetchers/data/public-key/simple.json similarity index 100% rename from src/nix-fetchers-tests/data/public-key/simple.json rename to tests/unit/libfetchers/data/public-key/simple.json diff --git a/src/nix-fetchers-tests/meson.build b/tests/unit/libfetchers/meson.build similarity index 100% rename from src/nix-fetchers-tests/meson.build rename to tests/unit/libfetchers/meson.build diff --git a/src/nix-fetchers-tests/package.nix b/tests/unit/libfetchers/package.nix similarity index 94% rename from src/nix-fetchers-tests/package.nix rename to tests/unit/libfetchers/package.nix index 759743a8b..e9daacaeb 100644 --- a/src/nix-fetchers-tests/package.nix +++ b/tests/unit/libfetchers/package.nix @@ -31,9 +31,9 @@ mkMesonDerivation (finalAttrs: { workDir = ./.; fileset = fileset.unions [ - ../../build-utils-meson + ../../../build-utils-meson ./build-utils-meson - ../../.version + ../../../.version ./.version ./meson.build # ./meson.options @@ -61,7 +61,7 @@ mkMesonDerivation (finalAttrs: { # Do the meson utils, without modification. '' chmod u+w ./.version - echo ${version} > ../../.version + echo ${version} > ../../../.version ''; mesonFlags = [ diff --git a/src/nix-fetchers-tests/public-key.cc b/tests/unit/libfetchers/public-key.cc similarity index 100% rename from src/nix-fetchers-tests/public-key.cc rename to tests/unit/libfetchers/public-key.cc diff --git a/tests/unit/libflake/.version b/tests/unit/libflake/.version new file mode 120000 index 000000000..0df9915bf --- /dev/null +++ b/tests/unit/libflake/.version @@ -0,0 +1 @@ +../../../.version \ No newline at end of file diff --git a/tests/unit/libflake/build-utils-meson b/tests/unit/libflake/build-utils-meson new file mode 120000 index 000000000..f2d8e8a50 --- /dev/null +++ b/tests/unit/libflake/build-utils-meson @@ -0,0 +1 @@ +../../../build-utils-meson/ \ No newline at end of file diff --git a/src/nix-flake-tests/data/.gitkeep b/tests/unit/libflake/data/.gitkeep similarity index 100% rename from src/nix-flake-tests/data/.gitkeep rename to tests/unit/libflake/data/.gitkeep diff --git a/src/nix-flake-tests/flakeref.cc b/tests/unit/libflake/flakeref.cc similarity index 100% rename from src/nix-flake-tests/flakeref.cc rename to tests/unit/libflake/flakeref.cc diff --git a/src/nix-flake-tests/meson.build b/tests/unit/libflake/meson.build similarity index 100% rename from src/nix-flake-tests/meson.build rename to tests/unit/libflake/meson.build diff --git a/src/nix-flake-tests/package.nix b/tests/unit/libflake/package.nix similarity index 94% rename from src/nix-flake-tests/package.nix rename to tests/unit/libflake/package.nix index a7783593a..c2bcc8eb8 100644 --- a/src/nix-flake-tests/package.nix +++ b/tests/unit/libflake/package.nix @@ -31,9 +31,9 @@ mkMesonDerivation (finalAttrs: { workDir = ./.; fileset = fileset.unions [ - ../../build-utils-meson + ../../../build-utils-meson ./build-utils-meson - ../../.version + ../../../.version ./.version ./meson.build # ./meson.options @@ -61,7 +61,7 @@ mkMesonDerivation (finalAttrs: { # Do the meson utils, without modification. '' chmod u+w ./.version - echo ${version} > ../../.version + echo ${version} > ../../../.version ''; mesonFlags = [ diff --git a/src/nix-flake-tests/url-name.cc b/tests/unit/libflake/url-name.cc similarity index 100% rename from src/nix-flake-tests/url-name.cc rename to tests/unit/libflake/url-name.cc diff --git a/tests/unit/libstore-support/.version b/tests/unit/libstore-support/.version new file mode 120000 index 000000000..0df9915bf --- /dev/null +++ b/tests/unit/libstore-support/.version @@ -0,0 +1 @@ +../../../.version \ No newline at end of file diff --git a/tests/unit/libstore-support/build-utils-meson b/tests/unit/libstore-support/build-utils-meson new file mode 120000 index 000000000..f2d8e8a50 --- /dev/null +++ b/tests/unit/libstore-support/build-utils-meson @@ -0,0 +1 @@ +../../../build-utils-meson/ \ No newline at end of file diff --git a/src/nix-store-test-support/meson.build b/tests/unit/libstore-support/meson.build similarity index 100% rename from src/nix-store-test-support/meson.build rename to tests/unit/libstore-support/meson.build diff --git a/src/nix-store-test-support/package.nix b/tests/unit/libstore-support/package.nix similarity index 93% rename from src/nix-store-test-support/package.nix rename to tests/unit/libstore-support/package.nix index 250f29b86..f3a5bfc82 100644 --- a/src/nix-store-test-support/package.nix +++ b/tests/unit/libstore-support/package.nix @@ -29,9 +29,9 @@ mkMesonDerivation (finalAttrs: { workDir = ./.; fileset = fileset.unions [ - ../../build-utils-meson + ../../../build-utils-meson ./build-utils-meson - ../../.version + ../../../.version ./.version ./meson.build # ./meson.options @@ -58,7 +58,7 @@ mkMesonDerivation (finalAttrs: { # Do the meson utils, without modification. '' chmod u+w ./.version - echo ${version} > ../../.version + echo ${version} > ../../../.version ''; mesonFlags = [ diff --git a/src/nix-store-test-support/tests/derived-path.cc b/tests/unit/libstore-support/tests/derived-path.cc similarity index 100% rename from src/nix-store-test-support/tests/derived-path.cc rename to tests/unit/libstore-support/tests/derived-path.cc diff --git a/src/nix-store-test-support/tests/derived-path.hh b/tests/unit/libstore-support/tests/derived-path.hh similarity index 100% rename from src/nix-store-test-support/tests/derived-path.hh rename to tests/unit/libstore-support/tests/derived-path.hh diff --git a/src/nix-store-test-support/tests/libstore.hh b/tests/unit/libstore-support/tests/libstore.hh similarity index 100% rename from src/nix-store-test-support/tests/libstore.hh rename to tests/unit/libstore-support/tests/libstore.hh diff --git a/src/nix-store-test-support/tests/nix_api_store.hh b/tests/unit/libstore-support/tests/nix_api_store.hh similarity index 100% rename from src/nix-store-test-support/tests/nix_api_store.hh rename to tests/unit/libstore-support/tests/nix_api_store.hh diff --git a/src/nix-store-test-support/tests/outputs-spec.cc b/tests/unit/libstore-support/tests/outputs-spec.cc similarity index 100% rename from src/nix-store-test-support/tests/outputs-spec.cc rename to tests/unit/libstore-support/tests/outputs-spec.cc diff --git a/src/nix-store-test-support/tests/outputs-spec.hh b/tests/unit/libstore-support/tests/outputs-spec.hh similarity index 100% rename from src/nix-store-test-support/tests/outputs-spec.hh rename to tests/unit/libstore-support/tests/outputs-spec.hh diff --git a/src/nix-store-test-support/tests/path.cc b/tests/unit/libstore-support/tests/path.cc similarity index 100% rename from src/nix-store-test-support/tests/path.cc rename to tests/unit/libstore-support/tests/path.cc diff --git a/src/nix-store-test-support/tests/path.hh b/tests/unit/libstore-support/tests/path.hh similarity index 100% rename from src/nix-store-test-support/tests/path.hh rename to tests/unit/libstore-support/tests/path.hh diff --git a/src/nix-store-test-support/tests/protocol.hh b/tests/unit/libstore-support/tests/protocol.hh similarity index 100% rename from src/nix-store-test-support/tests/protocol.hh rename to tests/unit/libstore-support/tests/protocol.hh diff --git a/tests/unit/libstore/.version b/tests/unit/libstore/.version new file mode 120000 index 000000000..0df9915bf --- /dev/null +++ b/tests/unit/libstore/.version @@ -0,0 +1 @@ +../../../.version \ No newline at end of file diff --git a/tests/unit/libstore/build-utils-meson b/tests/unit/libstore/build-utils-meson new file mode 120000 index 000000000..f2d8e8a50 --- /dev/null +++ b/tests/unit/libstore/build-utils-meson @@ -0,0 +1 @@ +../../../build-utils-meson/ \ No newline at end of file diff --git a/src/nix-store-tests/common-protocol.cc b/tests/unit/libstore/common-protocol.cc similarity index 100% rename from src/nix-store-tests/common-protocol.cc rename to tests/unit/libstore/common-protocol.cc diff --git a/src/nix-store-tests/content-address.cc b/tests/unit/libstore/content-address.cc similarity index 100% rename from src/nix-store-tests/content-address.cc rename to tests/unit/libstore/content-address.cc diff --git a/src/nix-store-tests/data/common-protocol/content-address.bin b/tests/unit/libstore/data/common-protocol/content-address.bin similarity index 100% rename from src/nix-store-tests/data/common-protocol/content-address.bin rename to tests/unit/libstore/data/common-protocol/content-address.bin diff --git a/src/nix-store-tests/data/common-protocol/drv-output.bin b/tests/unit/libstore/data/common-protocol/drv-output.bin similarity index 100% rename from src/nix-store-tests/data/common-protocol/drv-output.bin rename to tests/unit/libstore/data/common-protocol/drv-output.bin diff --git a/src/nix-store-tests/data/common-protocol/optional-content-address.bin b/tests/unit/libstore/data/common-protocol/optional-content-address.bin similarity index 100% rename from src/nix-store-tests/data/common-protocol/optional-content-address.bin rename to tests/unit/libstore/data/common-protocol/optional-content-address.bin diff --git a/src/nix-store-tests/data/common-protocol/optional-store-path.bin b/tests/unit/libstore/data/common-protocol/optional-store-path.bin similarity index 100% rename from src/nix-store-tests/data/common-protocol/optional-store-path.bin rename to tests/unit/libstore/data/common-protocol/optional-store-path.bin diff --git a/src/nix-store-tests/data/common-protocol/realisation.bin b/tests/unit/libstore/data/common-protocol/realisation.bin similarity index 100% rename from src/nix-store-tests/data/common-protocol/realisation.bin rename to tests/unit/libstore/data/common-protocol/realisation.bin diff --git a/src/nix-store-tests/data/common-protocol/set.bin b/tests/unit/libstore/data/common-protocol/set.bin similarity index 100% rename from src/nix-store-tests/data/common-protocol/set.bin rename to tests/unit/libstore/data/common-protocol/set.bin diff --git a/src/nix-store-tests/data/common-protocol/store-path.bin b/tests/unit/libstore/data/common-protocol/store-path.bin similarity index 100% rename from src/nix-store-tests/data/common-protocol/store-path.bin rename to tests/unit/libstore/data/common-protocol/store-path.bin diff --git a/src/nix-store-tests/data/common-protocol/string.bin b/tests/unit/libstore/data/common-protocol/string.bin similarity index 100% rename from src/nix-store-tests/data/common-protocol/string.bin rename to tests/unit/libstore/data/common-protocol/string.bin diff --git a/src/nix-store-tests/data/common-protocol/vector.bin b/tests/unit/libstore/data/common-protocol/vector.bin similarity index 100% rename from src/nix-store-tests/data/common-protocol/vector.bin rename to tests/unit/libstore/data/common-protocol/vector.bin diff --git a/tests/unit/libstore/data/derivation/advanced-attributes-defaults.drv b/tests/unit/libstore/data/derivation/advanced-attributes-defaults.drv new file mode 120000 index 000000000..353090ad8 --- /dev/null +++ b/tests/unit/libstore/data/derivation/advanced-attributes-defaults.drv @@ -0,0 +1 @@ +../../../../functional/derivation/advanced-attributes-defaults.drv \ No newline at end of file diff --git a/src/nix-store-tests/data/derivation/advanced-attributes-defaults.json b/tests/unit/libstore/data/derivation/advanced-attributes-defaults.json similarity index 100% rename from src/nix-store-tests/data/derivation/advanced-attributes-defaults.json rename to tests/unit/libstore/data/derivation/advanced-attributes-defaults.json diff --git a/tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs-defaults.drv b/tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs-defaults.drv new file mode 120000 index 000000000..11713da12 --- /dev/null +++ b/tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs-defaults.drv @@ -0,0 +1 @@ +../../../../functional/derivation/advanced-attributes-structured-attrs-defaults.drv \ No newline at end of file diff --git a/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs-defaults.json b/tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs-defaults.json similarity index 100% rename from src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs-defaults.json rename to tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs-defaults.json diff --git a/tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs.drv b/tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs.drv new file mode 120000 index 000000000..962f8ea3f --- /dev/null +++ b/tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs.drv @@ -0,0 +1 @@ +../../../../functional/derivation/advanced-attributes-structured-attrs.drv \ No newline at end of file diff --git a/src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs.json b/tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs.json similarity index 100% rename from src/nix-store-tests/data/derivation/advanced-attributes-structured-attrs.json rename to tests/unit/libstore/data/derivation/advanced-attributes-structured-attrs.json diff --git a/tests/unit/libstore/data/derivation/advanced-attributes.drv b/tests/unit/libstore/data/derivation/advanced-attributes.drv new file mode 120000 index 000000000..2a53a05ca --- /dev/null +++ b/tests/unit/libstore/data/derivation/advanced-attributes.drv @@ -0,0 +1 @@ +../../../../functional/derivation/advanced-attributes.drv \ No newline at end of file diff --git a/src/nix-store-tests/data/derivation/bad-old-version-dyn-deps.drv b/tests/unit/libstore/data/derivation/bad-old-version-dyn-deps.drv similarity index 100% rename from src/nix-store-tests/data/derivation/bad-old-version-dyn-deps.drv rename to tests/unit/libstore/data/derivation/bad-old-version-dyn-deps.drv diff --git a/src/nix-store-tests/data/derivation/bad-version.drv b/tests/unit/libstore/data/derivation/bad-version.drv similarity index 100% rename from src/nix-store-tests/data/derivation/bad-version.drv rename to tests/unit/libstore/data/derivation/bad-version.drv diff --git a/src/nix-store-tests/data/derivation/dynDerivationDeps.drv b/tests/unit/libstore/data/derivation/dynDerivationDeps.drv similarity index 100% rename from src/nix-store-tests/data/derivation/dynDerivationDeps.drv rename to tests/unit/libstore/data/derivation/dynDerivationDeps.drv diff --git a/src/nix-store-tests/data/derivation/dynDerivationDeps.json b/tests/unit/libstore/data/derivation/dynDerivationDeps.json similarity index 100% rename from src/nix-store-tests/data/derivation/dynDerivationDeps.json rename to tests/unit/libstore/data/derivation/dynDerivationDeps.json diff --git a/src/nix-store-tests/data/derivation/output-caFixedFlat.json b/tests/unit/libstore/data/derivation/output-caFixedFlat.json similarity index 100% rename from src/nix-store-tests/data/derivation/output-caFixedFlat.json rename to tests/unit/libstore/data/derivation/output-caFixedFlat.json diff --git a/src/nix-store-tests/data/derivation/output-caFixedNAR.json b/tests/unit/libstore/data/derivation/output-caFixedNAR.json similarity index 100% rename from src/nix-store-tests/data/derivation/output-caFixedNAR.json rename to tests/unit/libstore/data/derivation/output-caFixedNAR.json diff --git a/src/nix-store-tests/data/derivation/output-caFixedText.json b/tests/unit/libstore/data/derivation/output-caFixedText.json similarity index 100% rename from src/nix-store-tests/data/derivation/output-caFixedText.json rename to tests/unit/libstore/data/derivation/output-caFixedText.json diff --git a/src/nix-store-tests/data/derivation/output-caFloating.json b/tests/unit/libstore/data/derivation/output-caFloating.json similarity index 100% rename from src/nix-store-tests/data/derivation/output-caFloating.json rename to tests/unit/libstore/data/derivation/output-caFloating.json diff --git a/src/nix-store-tests/data/derivation/output-deferred.json b/tests/unit/libstore/data/derivation/output-deferred.json similarity index 100% rename from src/nix-store-tests/data/derivation/output-deferred.json rename to tests/unit/libstore/data/derivation/output-deferred.json diff --git a/src/nix-store-tests/data/derivation/output-impure.json b/tests/unit/libstore/data/derivation/output-impure.json similarity index 100% rename from src/nix-store-tests/data/derivation/output-impure.json rename to tests/unit/libstore/data/derivation/output-impure.json diff --git a/src/nix-store-tests/data/derivation/output-inputAddressed.json b/tests/unit/libstore/data/derivation/output-inputAddressed.json similarity index 100% rename from src/nix-store-tests/data/derivation/output-inputAddressed.json rename to tests/unit/libstore/data/derivation/output-inputAddressed.json diff --git a/src/nix-store-tests/data/derivation/simple.drv b/tests/unit/libstore/data/derivation/simple.drv similarity index 100% rename from src/nix-store-tests/data/derivation/simple.drv rename to tests/unit/libstore/data/derivation/simple.drv diff --git a/src/nix-store-tests/data/derivation/simple.json b/tests/unit/libstore/data/derivation/simple.json similarity index 100% rename from src/nix-store-tests/data/derivation/simple.json rename to tests/unit/libstore/data/derivation/simple.json diff --git a/src/nix-store-tests/data/machines/bad_format b/tests/unit/libstore/data/machines/bad_format similarity index 100% rename from src/nix-store-tests/data/machines/bad_format rename to tests/unit/libstore/data/machines/bad_format diff --git a/src/nix-store-tests/data/machines/valid b/tests/unit/libstore/data/machines/valid similarity index 100% rename from src/nix-store-tests/data/machines/valid rename to tests/unit/libstore/data/machines/valid diff --git a/src/nix-store-tests/data/nar-info/impure.json b/tests/unit/libstore/data/nar-info/impure.json similarity index 100% rename from src/nix-store-tests/data/nar-info/impure.json rename to tests/unit/libstore/data/nar-info/impure.json diff --git a/src/nix-store-tests/data/nar-info/pure.json b/tests/unit/libstore/data/nar-info/pure.json similarity index 100% rename from src/nix-store-tests/data/nar-info/pure.json rename to tests/unit/libstore/data/nar-info/pure.json diff --git a/src/nix-store-tests/data/path-info/empty_impure.json b/tests/unit/libstore/data/path-info/empty_impure.json similarity index 100% rename from src/nix-store-tests/data/path-info/empty_impure.json rename to tests/unit/libstore/data/path-info/empty_impure.json diff --git a/src/nix-store-tests/data/path-info/empty_pure.json b/tests/unit/libstore/data/path-info/empty_pure.json similarity index 100% rename from src/nix-store-tests/data/path-info/empty_pure.json rename to tests/unit/libstore/data/path-info/empty_pure.json diff --git a/src/nix-store-tests/data/path-info/impure.json b/tests/unit/libstore/data/path-info/impure.json similarity index 100% rename from src/nix-store-tests/data/path-info/impure.json rename to tests/unit/libstore/data/path-info/impure.json diff --git a/src/nix-store-tests/data/path-info/pure.json b/tests/unit/libstore/data/path-info/pure.json similarity index 100% rename from src/nix-store-tests/data/path-info/pure.json rename to tests/unit/libstore/data/path-info/pure.json diff --git a/src/nix-store-tests/data/serve-protocol/build-options-2.1.bin b/tests/unit/libstore/data/serve-protocol/build-options-2.1.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/build-options-2.1.bin rename to tests/unit/libstore/data/serve-protocol/build-options-2.1.bin diff --git a/src/nix-store-tests/data/serve-protocol/build-options-2.2.bin b/tests/unit/libstore/data/serve-protocol/build-options-2.2.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/build-options-2.2.bin rename to tests/unit/libstore/data/serve-protocol/build-options-2.2.bin diff --git a/src/nix-store-tests/data/serve-protocol/build-options-2.3.bin b/tests/unit/libstore/data/serve-protocol/build-options-2.3.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/build-options-2.3.bin rename to tests/unit/libstore/data/serve-protocol/build-options-2.3.bin diff --git a/src/nix-store-tests/data/serve-protocol/build-options-2.7.bin b/tests/unit/libstore/data/serve-protocol/build-options-2.7.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/build-options-2.7.bin rename to tests/unit/libstore/data/serve-protocol/build-options-2.7.bin diff --git a/src/nix-store-tests/data/serve-protocol/build-result-2.2.bin b/tests/unit/libstore/data/serve-protocol/build-result-2.2.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/build-result-2.2.bin rename to tests/unit/libstore/data/serve-protocol/build-result-2.2.bin diff --git a/src/nix-store-tests/data/serve-protocol/build-result-2.3.bin b/tests/unit/libstore/data/serve-protocol/build-result-2.3.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/build-result-2.3.bin rename to tests/unit/libstore/data/serve-protocol/build-result-2.3.bin diff --git a/src/nix-store-tests/data/serve-protocol/build-result-2.6.bin b/tests/unit/libstore/data/serve-protocol/build-result-2.6.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/build-result-2.6.bin rename to tests/unit/libstore/data/serve-protocol/build-result-2.6.bin diff --git a/src/nix-store-tests/data/serve-protocol/content-address.bin b/tests/unit/libstore/data/serve-protocol/content-address.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/content-address.bin rename to tests/unit/libstore/data/serve-protocol/content-address.bin diff --git a/src/nix-store-tests/data/serve-protocol/drv-output.bin b/tests/unit/libstore/data/serve-protocol/drv-output.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/drv-output.bin rename to tests/unit/libstore/data/serve-protocol/drv-output.bin diff --git a/src/nix-store-tests/data/serve-protocol/handshake-to-client.bin b/tests/unit/libstore/data/serve-protocol/handshake-to-client.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/handshake-to-client.bin rename to tests/unit/libstore/data/serve-protocol/handshake-to-client.bin diff --git a/src/nix-store-tests/data/serve-protocol/optional-content-address.bin b/tests/unit/libstore/data/serve-protocol/optional-content-address.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/optional-content-address.bin rename to tests/unit/libstore/data/serve-protocol/optional-content-address.bin diff --git a/src/nix-store-tests/data/serve-protocol/optional-store-path.bin b/tests/unit/libstore/data/serve-protocol/optional-store-path.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/optional-store-path.bin rename to tests/unit/libstore/data/serve-protocol/optional-store-path.bin diff --git a/src/nix-store-tests/data/serve-protocol/realisation.bin b/tests/unit/libstore/data/serve-protocol/realisation.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/realisation.bin rename to tests/unit/libstore/data/serve-protocol/realisation.bin diff --git a/src/nix-store-tests/data/serve-protocol/set.bin b/tests/unit/libstore/data/serve-protocol/set.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/set.bin rename to tests/unit/libstore/data/serve-protocol/set.bin diff --git a/src/nix-store-tests/data/serve-protocol/store-path.bin b/tests/unit/libstore/data/serve-protocol/store-path.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/store-path.bin rename to tests/unit/libstore/data/serve-protocol/store-path.bin diff --git a/src/nix-store-tests/data/serve-protocol/string.bin b/tests/unit/libstore/data/serve-protocol/string.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/string.bin rename to tests/unit/libstore/data/serve-protocol/string.bin diff --git a/src/nix-store-tests/data/serve-protocol/unkeyed-valid-path-info-2.3.bin b/tests/unit/libstore/data/serve-protocol/unkeyed-valid-path-info-2.3.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/unkeyed-valid-path-info-2.3.bin rename to tests/unit/libstore/data/serve-protocol/unkeyed-valid-path-info-2.3.bin diff --git a/src/nix-store-tests/data/serve-protocol/unkeyed-valid-path-info-2.4.bin b/tests/unit/libstore/data/serve-protocol/unkeyed-valid-path-info-2.4.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/unkeyed-valid-path-info-2.4.bin rename to tests/unit/libstore/data/serve-protocol/unkeyed-valid-path-info-2.4.bin diff --git a/src/nix-store-tests/data/serve-protocol/vector.bin b/tests/unit/libstore/data/serve-protocol/vector.bin similarity index 100% rename from src/nix-store-tests/data/serve-protocol/vector.bin rename to tests/unit/libstore/data/serve-protocol/vector.bin diff --git a/src/nix-store-tests/data/store-reference/auto.txt b/tests/unit/libstore/data/store-reference/auto.txt similarity index 100% rename from src/nix-store-tests/data/store-reference/auto.txt rename to tests/unit/libstore/data/store-reference/auto.txt diff --git a/src/nix-store-tests/data/store-reference/auto_param.txt b/tests/unit/libstore/data/store-reference/auto_param.txt similarity index 100% rename from src/nix-store-tests/data/store-reference/auto_param.txt rename to tests/unit/libstore/data/store-reference/auto_param.txt diff --git a/src/nix-store-tests/data/store-reference/local_1.txt b/tests/unit/libstore/data/store-reference/local_1.txt similarity index 100% rename from src/nix-store-tests/data/store-reference/local_1.txt rename to tests/unit/libstore/data/store-reference/local_1.txt diff --git a/src/nix-store-tests/data/store-reference/local_2.txt b/tests/unit/libstore/data/store-reference/local_2.txt similarity index 100% rename from src/nix-store-tests/data/store-reference/local_2.txt rename to tests/unit/libstore/data/store-reference/local_2.txt diff --git a/src/nix-store-tests/data/store-reference/local_shorthand_1.txt b/tests/unit/libstore/data/store-reference/local_shorthand_1.txt similarity index 100% rename from src/nix-store-tests/data/store-reference/local_shorthand_1.txt rename to tests/unit/libstore/data/store-reference/local_shorthand_1.txt diff --git a/src/nix-store-tests/data/store-reference/local_shorthand_2.txt b/tests/unit/libstore/data/store-reference/local_shorthand_2.txt similarity index 100% rename from src/nix-store-tests/data/store-reference/local_shorthand_2.txt rename to tests/unit/libstore/data/store-reference/local_shorthand_2.txt diff --git a/src/nix-store-tests/data/store-reference/ssh.txt b/tests/unit/libstore/data/store-reference/ssh.txt similarity index 100% rename from src/nix-store-tests/data/store-reference/ssh.txt rename to tests/unit/libstore/data/store-reference/ssh.txt diff --git a/src/nix-store-tests/data/store-reference/unix.txt b/tests/unit/libstore/data/store-reference/unix.txt similarity index 100% rename from src/nix-store-tests/data/store-reference/unix.txt rename to tests/unit/libstore/data/store-reference/unix.txt diff --git a/src/nix-store-tests/data/store-reference/unix_shorthand.txt b/tests/unit/libstore/data/store-reference/unix_shorthand.txt similarity index 100% rename from src/nix-store-tests/data/store-reference/unix_shorthand.txt rename to tests/unit/libstore/data/store-reference/unix_shorthand.txt diff --git a/src/nix-store-tests/data/worker-protocol/build-mode.bin b/tests/unit/libstore/data/worker-protocol/build-mode.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/build-mode.bin rename to tests/unit/libstore/data/worker-protocol/build-mode.bin diff --git a/src/nix-store-tests/data/worker-protocol/build-result-1.27.bin b/tests/unit/libstore/data/worker-protocol/build-result-1.27.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/build-result-1.27.bin rename to tests/unit/libstore/data/worker-protocol/build-result-1.27.bin diff --git a/src/nix-store-tests/data/worker-protocol/build-result-1.28.bin b/tests/unit/libstore/data/worker-protocol/build-result-1.28.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/build-result-1.28.bin rename to tests/unit/libstore/data/worker-protocol/build-result-1.28.bin diff --git a/src/nix-store-tests/data/worker-protocol/build-result-1.29.bin b/tests/unit/libstore/data/worker-protocol/build-result-1.29.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/build-result-1.29.bin rename to tests/unit/libstore/data/worker-protocol/build-result-1.29.bin diff --git a/src/nix-store-tests/data/worker-protocol/build-result-1.37.bin b/tests/unit/libstore/data/worker-protocol/build-result-1.37.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/build-result-1.37.bin rename to tests/unit/libstore/data/worker-protocol/build-result-1.37.bin diff --git a/src/nix-store-tests/data/worker-protocol/client-handshake-info_1_30.bin b/tests/unit/libstore/data/worker-protocol/client-handshake-info_1_30.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/client-handshake-info_1_30.bin rename to tests/unit/libstore/data/worker-protocol/client-handshake-info_1_30.bin diff --git a/src/nix-store-tests/data/worker-protocol/client-handshake-info_1_33.bin b/tests/unit/libstore/data/worker-protocol/client-handshake-info_1_33.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/client-handshake-info_1_33.bin rename to tests/unit/libstore/data/worker-protocol/client-handshake-info_1_33.bin diff --git a/src/nix-store-tests/data/worker-protocol/client-handshake-info_1_35.bin b/tests/unit/libstore/data/worker-protocol/client-handshake-info_1_35.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/client-handshake-info_1_35.bin rename to tests/unit/libstore/data/worker-protocol/client-handshake-info_1_35.bin diff --git a/src/nix-store-tests/data/worker-protocol/content-address.bin b/tests/unit/libstore/data/worker-protocol/content-address.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/content-address.bin rename to tests/unit/libstore/data/worker-protocol/content-address.bin diff --git a/src/nix-store-tests/data/worker-protocol/derived-path-1.29.bin b/tests/unit/libstore/data/worker-protocol/derived-path-1.29.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/derived-path-1.29.bin rename to tests/unit/libstore/data/worker-protocol/derived-path-1.29.bin diff --git a/src/nix-store-tests/data/worker-protocol/derived-path-1.30.bin b/tests/unit/libstore/data/worker-protocol/derived-path-1.30.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/derived-path-1.30.bin rename to tests/unit/libstore/data/worker-protocol/derived-path-1.30.bin diff --git a/src/nix-store-tests/data/worker-protocol/drv-output.bin b/tests/unit/libstore/data/worker-protocol/drv-output.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/drv-output.bin rename to tests/unit/libstore/data/worker-protocol/drv-output.bin diff --git a/src/nix-store-tests/data/worker-protocol/handshake-to-client.bin b/tests/unit/libstore/data/worker-protocol/handshake-to-client.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/handshake-to-client.bin rename to tests/unit/libstore/data/worker-protocol/handshake-to-client.bin diff --git a/src/nix-store-tests/data/worker-protocol/keyed-build-result-1.29.bin b/tests/unit/libstore/data/worker-protocol/keyed-build-result-1.29.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/keyed-build-result-1.29.bin rename to tests/unit/libstore/data/worker-protocol/keyed-build-result-1.29.bin diff --git a/src/nix-store-tests/data/worker-protocol/optional-content-address.bin b/tests/unit/libstore/data/worker-protocol/optional-content-address.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/optional-content-address.bin rename to tests/unit/libstore/data/worker-protocol/optional-content-address.bin diff --git a/src/nix-store-tests/data/worker-protocol/optional-store-path.bin b/tests/unit/libstore/data/worker-protocol/optional-store-path.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/optional-store-path.bin rename to tests/unit/libstore/data/worker-protocol/optional-store-path.bin diff --git a/src/nix-store-tests/data/worker-protocol/optional-trusted-flag.bin b/tests/unit/libstore/data/worker-protocol/optional-trusted-flag.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/optional-trusted-flag.bin rename to tests/unit/libstore/data/worker-protocol/optional-trusted-flag.bin diff --git a/src/nix-store-tests/data/worker-protocol/realisation.bin b/tests/unit/libstore/data/worker-protocol/realisation.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/realisation.bin rename to tests/unit/libstore/data/worker-protocol/realisation.bin diff --git a/src/nix-store-tests/data/worker-protocol/set.bin b/tests/unit/libstore/data/worker-protocol/set.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/set.bin rename to tests/unit/libstore/data/worker-protocol/set.bin diff --git a/src/nix-store-tests/data/worker-protocol/store-path.bin b/tests/unit/libstore/data/worker-protocol/store-path.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/store-path.bin rename to tests/unit/libstore/data/worker-protocol/store-path.bin diff --git a/src/nix-store-tests/data/worker-protocol/string.bin b/tests/unit/libstore/data/worker-protocol/string.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/string.bin rename to tests/unit/libstore/data/worker-protocol/string.bin diff --git a/src/nix-store-tests/data/worker-protocol/unkeyed-valid-path-info-1.15.bin b/tests/unit/libstore/data/worker-protocol/unkeyed-valid-path-info-1.15.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/unkeyed-valid-path-info-1.15.bin rename to tests/unit/libstore/data/worker-protocol/unkeyed-valid-path-info-1.15.bin diff --git a/src/nix-store-tests/data/worker-protocol/valid-path-info-1.15.bin b/tests/unit/libstore/data/worker-protocol/valid-path-info-1.15.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/valid-path-info-1.15.bin rename to tests/unit/libstore/data/worker-protocol/valid-path-info-1.15.bin diff --git a/src/nix-store-tests/data/worker-protocol/valid-path-info-1.16.bin b/tests/unit/libstore/data/worker-protocol/valid-path-info-1.16.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/valid-path-info-1.16.bin rename to tests/unit/libstore/data/worker-protocol/valid-path-info-1.16.bin diff --git a/src/nix-store-tests/data/worker-protocol/vector.bin b/tests/unit/libstore/data/worker-protocol/vector.bin similarity index 100% rename from src/nix-store-tests/data/worker-protocol/vector.bin rename to tests/unit/libstore/data/worker-protocol/vector.bin diff --git a/src/nix-store-tests/derivation-advanced-attrs.cc b/tests/unit/libstore/derivation-advanced-attrs.cc similarity index 100% rename from src/nix-store-tests/derivation-advanced-attrs.cc rename to tests/unit/libstore/derivation-advanced-attrs.cc diff --git a/src/nix-store-tests/derivation.cc b/tests/unit/libstore/derivation.cc similarity index 100% rename from src/nix-store-tests/derivation.cc rename to tests/unit/libstore/derivation.cc diff --git a/src/nix-store-tests/derived-path.cc b/tests/unit/libstore/derived-path.cc similarity index 100% rename from src/nix-store-tests/derived-path.cc rename to tests/unit/libstore/derived-path.cc diff --git a/src/nix-store-tests/downstream-placeholder.cc b/tests/unit/libstore/downstream-placeholder.cc similarity index 100% rename from src/nix-store-tests/downstream-placeholder.cc rename to tests/unit/libstore/downstream-placeholder.cc diff --git a/src/nix-store-tests/machines.cc b/tests/unit/libstore/machines.cc similarity index 100% rename from src/nix-store-tests/machines.cc rename to tests/unit/libstore/machines.cc diff --git a/src/nix-store-tests/meson.build b/tests/unit/libstore/meson.build similarity index 100% rename from src/nix-store-tests/meson.build rename to tests/unit/libstore/meson.build diff --git a/src/nix-store-tests/nar-info-disk-cache.cc b/tests/unit/libstore/nar-info-disk-cache.cc similarity index 100% rename from src/nix-store-tests/nar-info-disk-cache.cc rename to tests/unit/libstore/nar-info-disk-cache.cc diff --git a/src/nix-store-tests/nar-info.cc b/tests/unit/libstore/nar-info.cc similarity index 100% rename from src/nix-store-tests/nar-info.cc rename to tests/unit/libstore/nar-info.cc diff --git a/src/nix-store-tests/nix_api_store.cc b/tests/unit/libstore/nix_api_store.cc similarity index 100% rename from src/nix-store-tests/nix_api_store.cc rename to tests/unit/libstore/nix_api_store.cc diff --git a/src/nix-store-tests/outputs-spec.cc b/tests/unit/libstore/outputs-spec.cc similarity index 100% rename from src/nix-store-tests/outputs-spec.cc rename to tests/unit/libstore/outputs-spec.cc diff --git a/src/nix-store-tests/package.nix b/tests/unit/libstore/package.nix similarity index 90% rename from src/nix-store-tests/package.nix rename to tests/unit/libstore/package.nix index 243b9f149..663e8ba43 100644 --- a/src/nix-store-tests/package.nix +++ b/tests/unit/libstore/package.nix @@ -33,9 +33,9 @@ mkMesonDerivation (finalAttrs: { workDir = ./.; fileset = fileset.unions [ - ../../build-utils-meson + ../../../build-utils-meson ./build-utils-meson - ../../.version + ../../../.version ./.version ./meson.build # ./meson.options @@ -65,7 +65,7 @@ mkMesonDerivation (finalAttrs: { # Do the meson utils, without modification. '' chmod u+w ./.version - echo ${version} > ../../.version + echo ${version} > ../../../.version ''; mesonFlags = [ @@ -92,12 +92,12 @@ mkMesonDerivation (finalAttrs: { root = ../..; fileset = lib.fileset.unions [ ./data - ../../tests/functional/derivation + ../../functional/derivation ]; }; in runCommand "${finalAttrs.pname}-run" {} '' PATH="${lib.makeBinPath [ finalAttrs.finalPackage ]}:$PATH" - export _NIX_TEST_UNIT_DATA=${data + "/src/nix-store-test/data"} + export _NIX_TEST_UNIT_DATA=${data + "/unit/libstore/data"} nix-store-tests touch $out ''; diff --git a/src/nix-store-tests/path-info.cc b/tests/unit/libstore/path-info.cc similarity index 100% rename from src/nix-store-tests/path-info.cc rename to tests/unit/libstore/path-info.cc diff --git a/src/nix-store-tests/path.cc b/tests/unit/libstore/path.cc similarity index 100% rename from src/nix-store-tests/path.cc rename to tests/unit/libstore/path.cc diff --git a/src/nix-store-tests/references.cc b/tests/unit/libstore/references.cc similarity index 100% rename from src/nix-store-tests/references.cc rename to tests/unit/libstore/references.cc diff --git a/src/nix-store-tests/serve-protocol.cc b/tests/unit/libstore/serve-protocol.cc similarity index 100% rename from src/nix-store-tests/serve-protocol.cc rename to tests/unit/libstore/serve-protocol.cc diff --git a/src/nix-store-tests/store-reference.cc b/tests/unit/libstore/store-reference.cc similarity index 100% rename from src/nix-store-tests/store-reference.cc rename to tests/unit/libstore/store-reference.cc diff --git a/src/nix-store-tests/worker-protocol.cc b/tests/unit/libstore/worker-protocol.cc similarity index 100% rename from src/nix-store-tests/worker-protocol.cc rename to tests/unit/libstore/worker-protocol.cc diff --git a/tests/unit/libutil-support/.version b/tests/unit/libutil-support/.version new file mode 120000 index 000000000..0df9915bf --- /dev/null +++ b/tests/unit/libutil-support/.version @@ -0,0 +1 @@ +../../../.version \ No newline at end of file diff --git a/tests/unit/libutil-support/build-utils-meson b/tests/unit/libutil-support/build-utils-meson new file mode 120000 index 000000000..f2d8e8a50 --- /dev/null +++ b/tests/unit/libutil-support/build-utils-meson @@ -0,0 +1 @@ +../../../build-utils-meson/ \ No newline at end of file diff --git a/src/nix-util-test-support/meson.build b/tests/unit/libutil-support/meson.build similarity index 100% rename from src/nix-util-test-support/meson.build rename to tests/unit/libutil-support/meson.build diff --git a/src/nix-util-test-support/package.nix b/tests/unit/libutil-support/package.nix similarity index 93% rename from src/nix-util-test-support/package.nix rename to tests/unit/libutil-support/package.nix index 42a56d58f..431fe91c6 100644 --- a/src/nix-util-test-support/package.nix +++ b/tests/unit/libutil-support/package.nix @@ -28,9 +28,9 @@ mkMesonDerivation (finalAttrs: { workDir = ./.; fileset = fileset.unions [ - ../../build-utils-meson + ../../../build-utils-meson ./build-utils-meson - ../../.version + ../../../.version ./.version ./meson.build # ./meson.options @@ -56,7 +56,7 @@ mkMesonDerivation (finalAttrs: { # Do the meson utils, without modification. '' chmod u+w ./.version - echo ${version} > ../../.version + echo ${version} > ../../../.version ''; mesonFlags = [ diff --git a/src/nix-util-test-support/tests/characterization.hh b/tests/unit/libutil-support/tests/characterization.hh similarity index 100% rename from src/nix-util-test-support/tests/characterization.hh rename to tests/unit/libutil-support/tests/characterization.hh diff --git a/src/nix-util-test-support/tests/hash.cc b/tests/unit/libutil-support/tests/hash.cc similarity index 100% rename from src/nix-util-test-support/tests/hash.cc rename to tests/unit/libutil-support/tests/hash.cc diff --git a/src/nix-util-test-support/tests/hash.hh b/tests/unit/libutil-support/tests/hash.hh similarity index 100% rename from src/nix-util-test-support/tests/hash.hh rename to tests/unit/libutil-support/tests/hash.hh diff --git a/src/nix-util-test-support/tests/nix_api_util.hh b/tests/unit/libutil-support/tests/nix_api_util.hh similarity index 100% rename from src/nix-util-test-support/tests/nix_api_util.hh rename to tests/unit/libutil-support/tests/nix_api_util.hh diff --git a/src/nix-util-test-support/tests/string_callback.cc b/tests/unit/libutil-support/tests/string_callback.cc similarity index 100% rename from src/nix-util-test-support/tests/string_callback.cc rename to tests/unit/libutil-support/tests/string_callback.cc diff --git a/src/nix-util-test-support/tests/string_callback.hh b/tests/unit/libutil-support/tests/string_callback.hh similarity index 100% rename from src/nix-util-test-support/tests/string_callback.hh rename to tests/unit/libutil-support/tests/string_callback.hh diff --git a/tests/unit/libutil/.version b/tests/unit/libutil/.version new file mode 120000 index 000000000..0df9915bf --- /dev/null +++ b/tests/unit/libutil/.version @@ -0,0 +1 @@ +../../../.version \ No newline at end of file diff --git a/src/nix-util-tests/args.cc b/tests/unit/libutil/args.cc similarity index 100% rename from src/nix-util-tests/args.cc rename to tests/unit/libutil/args.cc diff --git a/tests/unit/libutil/build-utils-meson b/tests/unit/libutil/build-utils-meson new file mode 120000 index 000000000..f2d8e8a50 --- /dev/null +++ b/tests/unit/libutil/build-utils-meson @@ -0,0 +1 @@ +../../../build-utils-meson/ \ No newline at end of file diff --git a/src/nix-util-tests/canon-path.cc b/tests/unit/libutil/canon-path.cc similarity index 100% rename from src/nix-util-tests/canon-path.cc rename to tests/unit/libutil/canon-path.cc diff --git a/src/nix-util-tests/chunked-vector.cc b/tests/unit/libutil/chunked-vector.cc similarity index 100% rename from src/nix-util-tests/chunked-vector.cc rename to tests/unit/libutil/chunked-vector.cc diff --git a/src/nix-util-tests/closure.cc b/tests/unit/libutil/closure.cc similarity index 100% rename from src/nix-util-tests/closure.cc rename to tests/unit/libutil/closure.cc diff --git a/src/nix-util-tests/compression.cc b/tests/unit/libutil/compression.cc similarity index 100% rename from src/nix-util-tests/compression.cc rename to tests/unit/libutil/compression.cc diff --git a/src/nix-util-tests/config.cc b/tests/unit/libutil/config.cc similarity index 100% rename from src/nix-util-tests/config.cc rename to tests/unit/libutil/config.cc diff --git a/src/nix-util-tests/data/git/check-data.sh b/tests/unit/libutil/data/git/check-data.sh similarity index 100% rename from src/nix-util-tests/data/git/check-data.sh rename to tests/unit/libutil/data/git/check-data.sh diff --git a/src/nix-util-tests/data/git/hello-world-blob.bin b/tests/unit/libutil/data/git/hello-world-blob.bin similarity index 100% rename from src/nix-util-tests/data/git/hello-world-blob.bin rename to tests/unit/libutil/data/git/hello-world-blob.bin diff --git a/src/nix-util-tests/data/git/hello-world.bin b/tests/unit/libutil/data/git/hello-world.bin similarity index 100% rename from src/nix-util-tests/data/git/hello-world.bin rename to tests/unit/libutil/data/git/hello-world.bin diff --git a/src/nix-util-tests/data/git/tree.bin b/tests/unit/libutil/data/git/tree.bin similarity index 100% rename from src/nix-util-tests/data/git/tree.bin rename to tests/unit/libutil/data/git/tree.bin diff --git a/src/nix-util-tests/data/git/tree.txt b/tests/unit/libutil/data/git/tree.txt similarity index 100% rename from src/nix-util-tests/data/git/tree.txt rename to tests/unit/libutil/data/git/tree.txt diff --git a/src/nix-util-tests/file-content-address.cc b/tests/unit/libutil/file-content-address.cc similarity index 100% rename from src/nix-util-tests/file-content-address.cc rename to tests/unit/libutil/file-content-address.cc diff --git a/src/nix-util-tests/git.cc b/tests/unit/libutil/git.cc similarity index 99% rename from src/nix-util-tests/git.cc rename to tests/unit/libutil/git.cc index 24d24a791..ff934c117 100644 --- a/src/nix-util-tests/git.cc +++ b/tests/unit/libutil/git.cc @@ -88,7 +88,7 @@ TEST_F(GitTest, blob_write) { /** * This data is for "shallow" tree tests. However, we use "real" hashes * so that we can check our test data in a small shell script test test - * (`src/nix-util-tests/data/git/check-data.sh`). + * (`tests/unit/libutil/data/git/check-data.sh`). */ const static Tree tree = { { diff --git a/src/nix-util-tests/hash.cc b/tests/unit/libutil/hash.cc similarity index 100% rename from src/nix-util-tests/hash.cc rename to tests/unit/libutil/hash.cc diff --git a/src/nix-util-tests/hilite.cc b/tests/unit/libutil/hilite.cc similarity index 100% rename from src/nix-util-tests/hilite.cc rename to tests/unit/libutil/hilite.cc diff --git a/src/nix-util-tests/json-utils.cc b/tests/unit/libutil/json-utils.cc similarity index 100% rename from src/nix-util-tests/json-utils.cc rename to tests/unit/libutil/json-utils.cc diff --git a/src/nix-util-tests/logging.cc b/tests/unit/libutil/logging.cc similarity index 100% rename from src/nix-util-tests/logging.cc rename to tests/unit/libutil/logging.cc diff --git a/src/nix-util-tests/lru-cache.cc b/tests/unit/libutil/lru-cache.cc similarity index 100% rename from src/nix-util-tests/lru-cache.cc rename to tests/unit/libutil/lru-cache.cc diff --git a/src/nix-util-tests/meson.build b/tests/unit/libutil/meson.build similarity index 100% rename from src/nix-util-tests/meson.build rename to tests/unit/libutil/meson.build diff --git a/src/nix-util-tests/nix_api_util.cc b/tests/unit/libutil/nix_api_util.cc similarity index 100% rename from src/nix-util-tests/nix_api_util.cc rename to tests/unit/libutil/nix_api_util.cc diff --git a/src/nix-util-tests/package.nix b/tests/unit/libutil/package.nix similarity index 94% rename from src/nix-util-tests/package.nix rename to tests/unit/libutil/package.nix index 2491d8722..6bfa571d8 100644 --- a/src/nix-util-tests/package.nix +++ b/tests/unit/libutil/package.nix @@ -32,9 +32,9 @@ mkMesonDerivation (finalAttrs: { workDir = ./.; fileset = fileset.unions [ - ../../build-utils-meson + ../../../build-utils-meson ./build-utils-meson - ../../.version + ../../../.version ./.version ./meson.build # ./meson.options @@ -63,7 +63,7 @@ mkMesonDerivation (finalAttrs: { # Do the meson utils, without modification. '' chmod u+w ./.version - echo ${version} > ../../.version + echo ${version} > ../../../.version ''; mesonFlags = [ diff --git a/src/nix-util-tests/pool.cc b/tests/unit/libutil/pool.cc similarity index 100% rename from src/nix-util-tests/pool.cc rename to tests/unit/libutil/pool.cc diff --git a/src/nix-util-tests/references.cc b/tests/unit/libutil/references.cc similarity index 100% rename from src/nix-util-tests/references.cc rename to tests/unit/libutil/references.cc diff --git a/src/nix-util-tests/spawn.cc b/tests/unit/libutil/spawn.cc similarity index 100% rename from src/nix-util-tests/spawn.cc rename to tests/unit/libutil/spawn.cc diff --git a/src/nix-util-tests/suggestions.cc b/tests/unit/libutil/suggestions.cc similarity index 100% rename from src/nix-util-tests/suggestions.cc rename to tests/unit/libutil/suggestions.cc diff --git a/src/nix-util-tests/tests.cc b/tests/unit/libutil/tests.cc similarity index 100% rename from src/nix-util-tests/tests.cc rename to tests/unit/libutil/tests.cc diff --git a/src/nix-util-tests/url.cc b/tests/unit/libutil/url.cc similarity index 100% rename from src/nix-util-tests/url.cc rename to tests/unit/libutil/url.cc diff --git a/src/nix-util-tests/xml-writer.cc b/tests/unit/libutil/xml-writer.cc similarity index 100% rename from src/nix-util-tests/xml-writer.cc rename to tests/unit/libutil/xml-writer.cc From b0bc2a97bfe007fbc32f584ed9de5e7cb75a521c Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 1 Jul 2024 14:40:34 -0400 Subject: [PATCH 35/36] Put unit tests back in old build system for now --- Makefile | 19 ++++++++++++ Makefile.config.in | 1 + configure.ac | 22 ++++++++++++++ package.nix | 33 +++++++++++++++++++- tests/unit/libexpr-support/local.mk | 23 ++++++++++++++ tests/unit/libexpr/local.mk | 45 ++++++++++++++++++++++++++++ tests/unit/libfetchers/local.mk | 37 +++++++++++++++++++++++ tests/unit/libflake/local.mk | 43 ++++++++++++++++++++++++++ tests/unit/libstore-support/local.mk | 21 +++++++++++++ tests/unit/libstore/local.mk | 38 +++++++++++++++++++++++ tests/unit/libutil-support/local.mk | 19 ++++++++++++ tests/unit/libutil/local.mk | 37 +++++++++++++++++++++++ 12 files changed, 337 insertions(+), 1 deletion(-) create mode 100644 tests/unit/libexpr-support/local.mk create mode 100644 tests/unit/libexpr/local.mk create mode 100644 tests/unit/libfetchers/local.mk create mode 100644 tests/unit/libflake/local.mk create mode 100644 tests/unit/libstore-support/local.mk create mode 100644 tests/unit/libstore/local.mk create mode 100644 tests/unit/libutil-support/local.mk create mode 100644 tests/unit/libutil/local.mk diff --git a/Makefile b/Makefile index a65cdbd40..bb64a104e 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,18 @@ makefiles += \ endif endif +ifeq ($(ENABLE_UNIT_TESTS), yes) +makefiles += \ + tests/unit/libutil/local.mk \ + tests/unit/libutil-support/local.mk \ + tests/unit/libstore/local.mk \ + tests/unit/libstore-support/local.mk \ + tests/unit/libfetchers/local.mk \ + tests/unit/libexpr/local.mk \ + tests/unit/libexpr-support/local.mk \ + tests/unit/libflake/local.mk +endif + ifeq ($(ENABLE_FUNCTIONAL_TESTS), yes) ifdef HOST_UNIX makefiles += \ @@ -91,6 +103,13 @@ include mk/lib.mk # These must be defined after `mk/lib.mk`. Otherwise the first rule # incorrectly becomes the default target. +ifneq ($(ENABLE_UNIT_TESTS), yes) +.PHONY: check +check: + @echo "Unit tests are disabled. Configure without '--disable-unit-tests', or avoid calling 'make check'." + @exit 1 +endif + ifneq ($(ENABLE_FUNCTIONAL_TESTS), yes) .PHONY: installcheck installcheck: diff --git a/Makefile.config.in b/Makefile.config.in index e131484f6..3100d2073 100644 --- a/Makefile.config.in +++ b/Makefile.config.in @@ -12,6 +12,7 @@ ENABLE_BUILD = @ENABLE_BUILD@ ENABLE_DOC_GEN = @ENABLE_DOC_GEN@ ENABLE_FUNCTIONAL_TESTS = @ENABLE_FUNCTIONAL_TESTS@ ENABLE_S3 = @ENABLE_S3@ +ENABLE_UNIT_TESTS = @ENABLE_UNIT_TESTS@ GTEST_LIBS = @GTEST_LIBS@ HAVE_LIBCPUID = @HAVE_LIBCPUID@ HAVE_SECCOMP = @HAVE_SECCOMP@ diff --git a/configure.ac b/configure.ac index b9f190166..4f66a3efc 100644 --- a/configure.ac +++ b/configure.ac @@ -141,6 +141,18 @@ AC_ARG_ENABLE(build, AS_HELP_STRING([--disable-build],[Do not build nix]), ENABLE_BUILD=$enableval, ENABLE_BUILD=yes) AC_SUBST(ENABLE_BUILD) +# Building without unit tests is useful for bootstrapping with a smaller footprint +# or running the tests in a separate derivation. Otherwise, we do compile and +# run them. + +AC_ARG_ENABLE(unit-tests, AS_HELP_STRING([--disable-unit-tests],[Do not build the tests]), + ENABLE_UNIT_TESTS=$enableval, ENABLE_UNIT_TESTS=$ENABLE_BUILD) +AC_SUBST(ENABLE_UNIT_TESTS) + +AS_IF( + [test "$ENABLE_BUILD" == "no" && test "$ENABLE_UNIT_TESTS" == "yes"], + [AC_MSG_ERROR([Cannot enable unit tests when building overall is disabled. Please do not pass '--enable-unit-tests' or do not pass '--disable-build'.])]) + AC_ARG_ENABLE(functional-tests, AS_HELP_STRING([--disable-functional-tests],[Do not build the tests]), ENABLE_FUNCTIONAL_TESTS=$enableval, ENABLE_FUNCTIONAL_TESTS=yes) AC_SUBST(ENABLE_FUNCTIONAL_TESTS) @@ -353,6 +365,16 @@ if test "$gc" = yes; then CFLAGS="$old_CFLAGS" fi +AS_IF([test "$ENABLE_UNIT_TESTS" == "yes"],[ + +# Look for gtest. +PKG_CHECK_MODULES([GTEST], [gtest_main gmock_main]) + +# Look for rapidcheck. +PKG_CHECK_MODULES([RAPIDCHECK], [rapidcheck rapidcheck_gtest]) + +]) + # Look for nlohmann/json. PKG_CHECK_MODULES([NLOHMANN_JSON], [nlohmann_json >= 3.9]) diff --git a/package.nix b/package.nix index 041786d47..c3e565399 100644 --- a/package.nix +++ b/package.nix @@ -52,6 +52,10 @@ # Whether to build Nix. Useful to skip for tasks like testing existing pre-built versions of Nix , doBuild ? true +# Run the unit tests as part of the build. See `installUnitTests` for an +# alternative to this. +, doCheck ? __forDefaults.canRunInstalled + # Run the functional tests as part of the build. , doInstallCheck ? test-client != null || __forDefaults.canRunInstalled @@ -84,6 +88,11 @@ # - readline , readlineFlavor ? if stdenv.hostPlatform.isWindows then "readline" else "editline" +# Whether to install unit tests. This is useful when cross compiling +# since we cannot run them natively during the build, but can do so +# later. +, installUnitTests ? doBuild && !__forDefaults.canExecuteHost + # For running the functional tests against a pre-built Nix. Probably # want to use in conjunction with `doBuild = false;`. , test-daemon ? null @@ -109,7 +118,7 @@ let # things which should instead be gotten via `finalAttrs` in order to # work with overriding. attrs = { - inherit doBuild doInstallCheck; + inherit doBuild doCheck doInstallCheck; }; mkDerivation = @@ -125,11 +134,16 @@ in mkDerivation (finalAttrs: let inherit (finalAttrs) + doCheck doInstallCheck ; doBuild = !finalAttrs.dontBuild; + # Either running the unit tests during the build, or installing them + # to be run later, requiresthe unit tests to be built. + buildUnitTests = doCheck || installUnitTests; + in { inherit pname version; @@ -163,6 +177,8 @@ in { ./scripts/local.mk ] ++ lib.optionals enableManual [ ./doc/manual + ] ++ lib.optionals buildUnitTests [ + ./tests/unit ] ++ lib.optionals doInstallCheck [ ./tests/functional ])); @@ -175,6 +191,8 @@ in { # If we are doing just build or just docs, the one thing will use # "out". We only need additional outputs if we are doing both. ++ lib.optional (doBuild && enableManual) "doc" + ++ lib.optional installUnitTests "check" + ++ lib.optional doCheck "testresults" ; nativeBuildInputs = [ @@ -212,6 +230,9 @@ in { ({ inherit readline editline; }.${readlineFlavor}) ] ++ lib.optionals enableMarkdown [ lowdown + ] ++ lib.optionals buildUnitTests [ + gtest + rapidcheck ] ++ lib.optional stdenv.isLinux libseccomp ++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid # There have been issues building these dependencies @@ -228,16 +249,22 @@ in { ] ++ lib.optional enableGC boehmgc; dontBuild = !attrs.doBuild; + doCheck = attrs.doCheck; configureFlags = [ (lib.enableFeature doBuild "build") + (lib.enableFeature buildUnitTests "unit-tests") (lib.enableFeature doInstallCheck "functional-tests") (lib.enableFeature enableManual "doc-gen") (lib.enableFeature enableGC "gc") (lib.enableFeature enableMarkdown "markdown") + (lib.enableFeature installUnitTests "install-unit-tests") (lib.withFeatureAs true "readline-flavor" readlineFlavor) ] ++ lib.optionals (!forDevShell) [ "--sysconfdir=/etc" + ] ++ lib.optionals installUnitTests [ + "--with-check-bin-dir=${builtins.placeholder "check"}/bin" + "--with-check-lib-dir=${builtins.placeholder "check"}/lib" ] ++ lib.optionals (doBuild) [ "--with-boost=${boost}/lib" ] ++ lib.optionals (doBuild && stdenv.isLinux) [ @@ -318,6 +345,10 @@ in { platforms = lib.platforms.unix ++ lib.platforms.windows; mainProgram = "nix"; broken = !(lib.all (a: a) [ + # We cannot run or install unit tests if we don't build them or + # Nix proper (which they depend on). + (installUnitTests -> doBuild) + (doCheck -> doBuild) # The build process for the manual currently requires extracting # data from the Nix executable we are trying to document. (enableManual -> doBuild) diff --git a/tests/unit/libexpr-support/local.mk b/tests/unit/libexpr-support/local.mk new file mode 100644 index 000000000..0501de33c --- /dev/null +++ b/tests/unit/libexpr-support/local.mk @@ -0,0 +1,23 @@ +libraries += libexpr-test-support + +libexpr-test-support_NAME = libnixexpr-test-support + +libexpr-test-support_DIR := $(d) + +ifeq ($(INSTALL_UNIT_TESTS), yes) + libexpr-test-support_INSTALL_DIR := $(checklibdir) +else + libexpr-test-support_INSTALL_DIR := +endif + +libexpr-test-support_SOURCES := \ + $(wildcard $(d)/tests/*.cc) \ + $(wildcard $(d)/tests/value/*.cc) + +libexpr-test-support_CXXFLAGS += $(libexpr-tests_EXTRA_INCLUDES) + +libexpr-test-support_LIBS = \ + libstore-test-support libutil-test-support \ + libexpr libstore libutil + +libexpr-test-support_LDFLAGS := $(THREAD_LDFLAGS) -lrapidcheck diff --git a/tests/unit/libexpr/local.mk b/tests/unit/libexpr/local.mk new file mode 100644 index 000000000..1617e2823 --- /dev/null +++ b/tests/unit/libexpr/local.mk @@ -0,0 +1,45 @@ +check: libexpr-tests_RUN + +programs += libexpr-tests + +libexpr-tests_NAME := libnixexpr-tests + +libexpr-tests_ENV := _NIX_TEST_UNIT_DATA=$(d)/data GTEST_OUTPUT=xml:$$testresults/libexpr-tests.xml + +libexpr-tests_DIR := $(d) + +ifeq ($(INSTALL_UNIT_TESTS), yes) + libexpr-tests_INSTALL_DIR := $(checkbindir) +else + libexpr-tests_INSTALL_DIR := +endif + +libexpr-tests_SOURCES := \ + $(wildcard $(d)/*.cc) \ + $(wildcard $(d)/value/*.cc) \ + $(wildcard $(d)/flake/*.cc) + +libexpr-tests_EXTRA_INCLUDES = \ + -I tests/unit/libexpr-support \ + -I tests/unit/libstore-support \ + -I tests/unit/libutil-support \ + $(INCLUDE_libexpr) \ + $(INCLUDE_libexprc) \ + $(INCLUDE_libfetchers) \ + $(INCLUDE_libstore) \ + $(INCLUDE_libstorec) \ + $(INCLUDE_libutil) \ + $(INCLUDE_libutilc) + +libexpr-tests_CXXFLAGS += $(libexpr-tests_EXTRA_INCLUDES) + +libexpr-tests_LIBS = \ + libexpr-test-support libstore-test-support libutil-test-support \ + libexpr libexprc libfetchers libstore libstorec libutil libutilc + +libexpr-tests_LDFLAGS := -lrapidcheck $(GTEST_LIBS) -lgmock + +ifdef HOST_WINDOWS + # Increase the default reserved stack size to 65 MB so Nix doesn't run out of space + libexpr-tests_LDFLAGS += -Wl,--stack,$(shell echo $$((65 * 1024 * 1024))) +endif diff --git a/tests/unit/libfetchers/local.mk b/tests/unit/libfetchers/local.mk new file mode 100644 index 000000000..286a59030 --- /dev/null +++ b/tests/unit/libfetchers/local.mk @@ -0,0 +1,37 @@ +check: libfetchers-tests_RUN + +programs += libfetchers-tests + +libfetchers-tests_NAME = libnixfetchers-tests + +libfetchers-tests_ENV := _NIX_TEST_UNIT_DATA=$(d)/data GTEST_OUTPUT=xml:$$testresults/libfetchers-tests.xml + +libfetchers-tests_DIR := $(d) + +ifeq ($(INSTALL_UNIT_TESTS), yes) + libfetchers-tests_INSTALL_DIR := $(checkbindir) +else + libfetchers-tests_INSTALL_DIR := +endif + +libfetchers-tests_SOURCES := $(wildcard $(d)/*.cc) + +libfetchers-tests_EXTRA_INCLUDES = \ + -I tests/unit/libstore-support \ + -I tests/unit/libutil-support \ + $(INCLUDE_libfetchers) \ + $(INCLUDE_libstore) \ + $(INCLUDE_libutil) + +libfetchers-tests_CXXFLAGS += $(libfetchers-tests_EXTRA_INCLUDES) + +libfetchers-tests_LIBS = \ + libstore-test-support libutil-test-support \ + libfetchers libstore libutil + +libfetchers-tests_LDFLAGS := -lrapidcheck $(GTEST_LIBS) + +ifdef HOST_WINDOWS + # Increase the default reserved stack size to 65 MB so Nix doesn't run out of space + libfetchers-tests_LDFLAGS += -Wl,--stack,$(shell echo $$((65 * 1024 * 1024))) +endif diff --git a/tests/unit/libflake/local.mk b/tests/unit/libflake/local.mk new file mode 100644 index 000000000..590bcf7c0 --- /dev/null +++ b/tests/unit/libflake/local.mk @@ -0,0 +1,43 @@ +check: libflake-tests_RUN + +programs += libflake-tests + +libflake-tests_NAME := libnixflake-tests + +libflake-tests_ENV := _NIX_TEST_UNIT_DATA=$(d)/data GTEST_OUTPUT=xml:$$testresults/libflake-tests.xml + +libflake-tests_DIR := $(d) + +ifeq ($(INSTALL_UNIT_TESTS), yes) + libflake-tests_INSTALL_DIR := $(checkbindir) +else + libflake-tests_INSTALL_DIR := +endif + +libflake-tests_SOURCES := \ + $(wildcard $(d)/*.cc) \ + $(wildcard $(d)/value/*.cc) \ + $(wildcard $(d)/flake/*.cc) + +libflake-tests_EXTRA_INCLUDES = \ + -I tests/unit/libflake-support \ + -I tests/unit/libstore-support \ + -I tests/unit/libutil-support \ + $(INCLUDE_libflake) \ + $(INCLUDE_libexpr) \ + $(INCLUDE_libfetchers) \ + $(INCLUDE_libstore) \ + $(INCLUDE_libutil) \ + +libflake-tests_CXXFLAGS += $(libflake-tests_EXTRA_INCLUDES) + +libflake-tests_LIBS = \ + libexpr-test-support libstore-test-support libutil-test-support \ + libflake libexpr libfetchers libstore libutil + +libflake-tests_LDFLAGS := -lrapidcheck $(GTEST_LIBS) -lgmock + +ifdef HOST_WINDOWS + # Increase the default reserved stack size to 65 MB so Nix doesn't run out of space + libflake-tests_LDFLAGS += -Wl,--stack,$(shell echo $$((65 * 1024 * 1024))) +endif diff --git a/tests/unit/libstore-support/local.mk b/tests/unit/libstore-support/local.mk new file mode 100644 index 000000000..56dedd825 --- /dev/null +++ b/tests/unit/libstore-support/local.mk @@ -0,0 +1,21 @@ +libraries += libstore-test-support + +libstore-test-support_NAME = libnixstore-test-support + +libstore-test-support_DIR := $(d) + +ifeq ($(INSTALL_UNIT_TESTS), yes) + libstore-test-support_INSTALL_DIR := $(checklibdir) +else + libstore-test-support_INSTALL_DIR := +endif + +libstore-test-support_SOURCES := $(wildcard $(d)/tests/*.cc) + +libstore-test-support_CXXFLAGS += $(libstore-tests_EXTRA_INCLUDES) + +libstore-test-support_LIBS = \ + libutil-test-support \ + libstore libutil + +libstore-test-support_LDFLAGS := $(THREAD_LDFLAGS) -lrapidcheck diff --git a/tests/unit/libstore/local.mk b/tests/unit/libstore/local.mk new file mode 100644 index 000000000..8d3d6b0af --- /dev/null +++ b/tests/unit/libstore/local.mk @@ -0,0 +1,38 @@ +check: libstore-tests_RUN + +programs += libstore-tests + +libstore-tests_NAME = libnixstore-tests + +libstore-tests_ENV := _NIX_TEST_UNIT_DATA=$(d)/data GTEST_OUTPUT=xml:$$testresults/libstore-tests.xml + +libstore-tests_DIR := $(d) + +ifeq ($(INSTALL_UNIT_TESTS), yes) + libstore-tests_INSTALL_DIR := $(checkbindir) +else + libstore-tests_INSTALL_DIR := +endif + +libstore-tests_SOURCES := $(wildcard $(d)/*.cc) + +libstore-tests_EXTRA_INCLUDES = \ + -I tests/unit/libstore-support \ + -I tests/unit/libutil-support \ + $(INCLUDE_libstore) \ + $(INCLUDE_libstorec) \ + $(INCLUDE_libutil) \ + $(INCLUDE_libutilc) + +libstore-tests_CXXFLAGS += $(libstore-tests_EXTRA_INCLUDES) + +libstore-tests_LIBS = \ + libstore-test-support libutil-test-support \ + libstore libstorec libutil libutilc + +libstore-tests_LDFLAGS := -lrapidcheck $(GTEST_LIBS) + +ifdef HOST_WINDOWS + # Increase the default reserved stack size to 65 MB so Nix doesn't run out of space + libstore-tests_LDFLAGS += -Wl,--stack,$(shell echo $$((65 * 1024 * 1024))) +endif diff --git a/tests/unit/libutil-support/local.mk b/tests/unit/libutil-support/local.mk new file mode 100644 index 000000000..5f7835c9f --- /dev/null +++ b/tests/unit/libutil-support/local.mk @@ -0,0 +1,19 @@ +libraries += libutil-test-support + +libutil-test-support_NAME = libnixutil-test-support + +libutil-test-support_DIR := $(d) + +ifeq ($(INSTALL_UNIT_TESTS), yes) + libutil-test-support_INSTALL_DIR := $(checklibdir) +else + libutil-test-support_INSTALL_DIR := +endif + +libutil-test-support_SOURCES := $(wildcard $(d)/tests/*.cc) + +libutil-test-support_CXXFLAGS += $(libutil-tests_EXTRA_INCLUDES) + +libutil-test-support_LIBS = libutil + +libutil-test-support_LDFLAGS := $(THREAD_LDFLAGS) -lrapidcheck diff --git a/tests/unit/libutil/local.mk b/tests/unit/libutil/local.mk new file mode 100644 index 000000000..404f35cf1 --- /dev/null +++ b/tests/unit/libutil/local.mk @@ -0,0 +1,37 @@ +check: libutil-tests_RUN + +programs += libutil-tests + +libutil-tests_NAME = libnixutil-tests + +libutil-tests_ENV := _NIX_TEST_UNIT_DATA=$(d)/data GTEST_OUTPUT=xml:$$testresults/libutil-tests.xml + +libutil-tests_DIR := $(d) + +ifeq ($(INSTALL_UNIT_TESTS), yes) + libutil-tests_INSTALL_DIR := $(checkbindir) +else + libutil-tests_INSTALL_DIR := +endif + +libutil-tests_SOURCES := $(wildcard $(d)/*.cc) + +libutil-tests_EXTRA_INCLUDES = \ + -I tests/unit/libutil-support \ + $(INCLUDE_libutil) \ + $(INCLUDE_libutilc) + +libutil-tests_CXXFLAGS += $(libutil-tests_EXTRA_INCLUDES) + +libutil-tests_LIBS = libutil-test-support libutil libutilc + +libutil-tests_LDFLAGS := -lrapidcheck $(GTEST_LIBS) + +ifdef HOST_WINDOWS + # Increase the default reserved stack size to 65 MB so Nix doesn't run out of space + libutil-tests_LDFLAGS += -Wl,--stack,$(shell echo $$((65 * 1024 * 1024))) +endif + +check: $(d)/data/git/check-data.sh.test + +$(eval $(call run-test,$(d)/data/git/check-data.sh)) From e4056b9afdf732068a309e9cac959190a640f055 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 4 Jul 2024 17:48:27 -0400 Subject: [PATCH 36/36] Apply suggestions from code review Co-authored-by: Robert Hensing --- build-utils-meson/deps-lists/meson.build | 2 +- build-utils-meson/diagnostics/meson.build | 3 --- src/libexpr-c/meson.build | 2 +- src/libexpr-c/package.nix | 1 - src/libstore-c/meson.build | 2 +- src/libstore/meson.build | 3 ++- tests/unit/libexpr/meson.build | 3 +-- 7 files changed, 6 insertions(+), 10 deletions(-) diff --git a/build-utils-meson/deps-lists/meson.build b/build-utils-meson/deps-lists/meson.build index 89fbfdb36..237eac545 100644 --- a/build-utils-meson/deps-lists/meson.build +++ b/build-utils-meson/deps-lists/meson.build @@ -20,7 +20,7 @@ deps_private = [ ] # C library, whose public interface --- including public but not private # dependencies --- will also likewise soon be stable. # -# N.B. For distributions that care about "ABI" stablity and not just +# N.B. For distributions that care about "ABI" stability and not just # "API" stability, the private dependencies also matter as they can # potentially affect the public ABI. deps_public = [ ] diff --git a/build-utils-meson/diagnostics/meson.build b/build-utils-meson/diagnostics/meson.build index eb0c636c0..2b79f6566 100644 --- a/build-utils-meson/diagnostics/meson.build +++ b/build-utils-meson/diagnostics/meson.build @@ -9,8 +9,5 @@ add_project_arguments( # Enable assertions in libstdc++ by default. Harmless on libc++. Benchmarked # at ~1% overhead in `nix search`. # - # FIXME: remove when we get meson 1.4.0 which will default this to on for us: - # https://mesonbuild.com/Release-notes-for-1-4-0.html#ndebug-setting-now-controls-c-stdlib-assertions - '-D_GLIBCXX_ASSERTIONS=1', language : 'cpp', ) diff --git a/src/libexpr-c/meson.build b/src/libexpr-c/meson.build index fb9ade28d..2a2669b3e 100644 --- a/src/libexpr-c/meson.build +++ b/src/libexpr-c/meson.build @@ -69,7 +69,7 @@ headers = [config_h] + files( 'nix_api_value.h', ) -# TODO don't install this once tests don't use it. +# TODO move this header to libexpr, maybe don't use it in tests? headers += files('nix_api_expr_internal.h') subdir('build-utils-meson/export-all-symbols') diff --git a/src/libexpr-c/package.nix b/src/libexpr-c/package.nix index 81e42cf6a..b445a8187 100644 --- a/src/libexpr-c/package.nix +++ b/src/libexpr-c/package.nix @@ -1,7 +1,6 @@ { lib , stdenv , mkMesonDerivation -, releaseTools , meson , ninja diff --git a/src/libstore-c/meson.build b/src/libstore-c/meson.build index 426f07a34..917de4cda 100644 --- a/src/libstore-c/meson.build +++ b/src/libstore-c/meson.build @@ -61,7 +61,7 @@ headers = [config_h] + files( 'nix_api_store.h', ) -# TODO don't install this once tests don't use it. +# TODO don't install this once tests don't use it and/or move the header into `libstore`, non-`c` headers += files('nix_api_store_internal.h') subdir('build-utils-meson/export-all-symbols') diff --git a/src/libstore/meson.build b/src/libstore/meson.build index f94a454da..7444cba20 100644 --- a/src/libstore/meson.build +++ b/src/libstore/meson.build @@ -118,7 +118,8 @@ busybox = find_program(get_option('sandbox-shell'), required : false) if get_option('embedded-sandbox-shell') # This one goes in config.h # The path to busybox is passed as a -D flag when compiling this_library. - # Idk why, ask the old buildsystem. + # This solution is inherited from the old make buildsystem + # TODO: do this differently? configdata.set('HAVE_EMBEDDED_SANDBOX_SHELL', 1) hexdump = find_program('hexdump', native : true) embedded_sandbox_shell_gen = custom_target( diff --git a/tests/unit/libexpr/meson.build b/tests/unit/libexpr/meson.build index 71865b59f..a7b22f7f1 100644 --- a/tests/unit/libexpr/meson.build +++ b/tests/unit/libexpr/meson.build @@ -30,7 +30,7 @@ subdir('build-utils-meson/export-all-symbols') rapidcheck = dependency('rapidcheck') deps_private += rapidcheck -gtest = dependency('gtest', main : true) +gtest = dependency('gtest') deps_private += gtest gtest = dependency('gmock') @@ -77,7 +77,6 @@ this_exe = executable( include_directories : include_dirs, # TODO: -lrapidcheck, see ../libutil-support/build.meson link_args: linker_export_flags + ['-lrapidcheck'], - # get main from gtest install : true, )