mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-08 10:48:06 +09:00

This changes the build to always enable JIT - but to only enable it at run-time, when required. This keeps the runtime closure small without JIT, but allows enabling it without a rebuild. We can do this, because JIT is actually built as a shared module, which is loaded at run-time. We put it into a -jit output and only link it into the environment when requested. Under the hood, this uses withPackages and adds the "JIT package" - thus, to be able to use withPackages on top of that, we also need to be able to apply withPackages repeatedly. This cuts down the number of NixOS tests in half, because we don't need to run it for every version with and without JIT anymore. There really is no point in running everything with llvmjit.so in place, when the queries are not making use of it anyway. Also, we only need to build each extension once and not twice, further reducing the number of rebuilds required for PRs touching postgresql.
49 lines
1.2 KiB
Nix
49 lines
1.2 KiB
Nix
{
|
|
pkgs,
|
|
makeTest,
|
|
genTests,
|
|
}:
|
|
|
|
let
|
|
inherit (pkgs) lib;
|
|
|
|
makeTestFor =
|
|
package:
|
|
makeTest {
|
|
name = "wal2json-${package.name}";
|
|
meta.maintainers = with pkgs.lib.maintainers; [ euank ];
|
|
|
|
nodes.machine = {
|
|
services.postgresql = {
|
|
inherit package;
|
|
enable = true;
|
|
extensions = with package.pkgs; [ wal2json ];
|
|
settings = {
|
|
wal_level = "logical";
|
|
max_replication_slots = "10";
|
|
max_wal_senders = "10";
|
|
};
|
|
};
|
|
};
|
|
|
|
testScript = ''
|
|
machine.wait_for_unit("postgresql")
|
|
machine.succeed(
|
|
"sudo -u postgres psql -qAt -f ${./wal2json/example2.sql} postgres > /tmp/example2.out"
|
|
)
|
|
machine.succeed(
|
|
"diff ${./wal2json/example2.out} /tmp/example2.out"
|
|
)
|
|
machine.succeed(
|
|
"sudo -u postgres psql -qAt -f ${./wal2json/example3.sql} postgres > /tmp/example3.out"
|
|
)
|
|
machine.succeed(
|
|
"diff ${./wal2json/example3.out} /tmp/example3.out"
|
|
)
|
|
'';
|
|
};
|
|
in
|
|
genTests {
|
|
inherit makeTestFor;
|
|
filter = _: p: !p.pkgs.wal2json.meta.broken;
|
|
}
|