wrapper-manager-fds/tests: init derivation for tests

This is to make checking with flakes a bit easier. Though, there are
much better ways to integrate this even with just the nix-command
experimental feature.
This commit is contained in:
Gabriel Arazas 2024-07-13 17:00:06 +08:00
parent 1ba01aa5a8
commit 0f1df5e447
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360
3 changed files with 34 additions and 8 deletions

View File

@ -1,9 +1,19 @@
{ branch ? "nixos-stable" }:
let let
sources = import ../npins; sources = import ../npins;
pkgs = import sources.${branch} { }; in
{ pkgs ? import sources.nixos-unstable { } }:
let
lib = import ./lib { inherit pkgs; };
in in
{ {
lib = import ./lib { inherit pkgs; }; inherit lib;
libTestPkg =
pkgs.runCommand "wrapper-manager-fds-lib-test" {
testData = builtins.toJSON lib;
passAsFile = [ "testData" ];
nativeBuildInputs = with pkgs; [ yajsv jq ];
} ''
yajsv -s "${./lib/tests.schema.json}" "$testDataPath" && touch $out || jq . "$testDataPath"
'';
} }

View File

@ -0,0 +1,16 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "wrapper-manager-fds Nix test object",
"type": "object",
"patternProperties": {
"^\\w+$": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 0,
"maxItems": 0
},
"required": true
}
}

View File

@ -3,22 +3,22 @@
lib.runTests { lib.runTests {
testsUtilsGetBin = { testsUtilsGetBin = {
expr = self.utils.getBin [ expr = self.utils.getBin [
../modules ../../lib
../../modules ../../modules
]; ];
expected = [ expected = [
(lib.getBin ../modules) (lib.getBin ../../lib)
(lib.getBin ../../modules) (lib.getBin ../../modules)
]; ];
}; };
testsUtilsGetLibexec = { testsUtilsGetLibexec = {
expr = self.utils.getLibexec [ expr = self.utils.getLibexec [
../modules ../../lib
../../modules ../../modules
]; ];
expected = [ expected = [
"${../modules}/libexec" "${../../lib}/libexec"
"${../../modules}/libexec" "${../../modules}/libexec"
]; ];
}; };