ripasso-cursive: cosmetic changes (#361736)
[NixPkgs.git] / pkgs / by-name / ky / kyua / package.nix
blobc3d4b7fc49b1f8e46bc196dae303d0b6101b0835
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   atf,
6   autoreconfHook,
7   lutok,
8   pkg-config,
9   sqlite,
10   unstableGitUpdater,
13 let
14   # Avoid an infinite recursion (because ATF uses Kyua for testing).
15   atf' = atf.overrideAttrs (_: {
16     doInstallCheck = false;
17   });
19 stdenv.mkDerivation (finalAttrs: {
20   pname = "kyua";
21   version = "0.13-unstable-2024-01-22"; # Match the commit used in FreeBSD’s port.
23   src = fetchFromGitHub {
24     owner = "freebsd";
25     repo = "kyua";
26     rev = "c85354e09ad93a902c9e8a701c042c045ec2a5b7";
27     hash = "sha256-fZ0WFgOTj8Gw8IT5O8DnuaNyZscKpg6B94m+l5UoZGc";
28   };
30   setupHooks = ./kyua-check-hook.sh;
32   postPatch =
33     ''
34       # Fix a linking error on Darwin. Embedding an archive in an archive isn’t portable.
35       substituteInPlace cli/Makefile.am.inc \
36         --replace-fail 'libcli_a_LIBADD = libutils.a' "" \
37         --replace-fail 'CLI_LIBS = ' 'CLI_LIBS = libutils.a '
38     ''
39     # These tests fail on Darwin or are unreliable.
40     + lib.optionalString (finalAttrs.doInstallCheck && stdenv.hostPlatform.isDarwin) ''
41       sed -i utils/process/Makefile.am.inc -e '/executor_pid_test/d'
42       substituteInPlace utils/process/Kyuafile \
43         --replace-fail 'atf_test_program{name="executor_pid_test"}' ""
44       substituteInPlace engine/atf_test.cpp \
45         --replace-fail 'ATF_ADD_TEST_CASE(tcs, test__body_only__crashes);' ""
46       substituteInPlace engine/scheduler_test.cpp \
47         --replace-fail 'ATF_ADD_TEST_CASE(tcs, integration__stacktrace);' ""
48       substituteInPlace utils/stacktrace_test.cpp \
49         --replace-fail 'ATF_ADD_TEST_CASE(tcs, unlimit_core_size);' ""
50       substituteInPlace utils/process/isolation_test.cpp \
51         --replace-fail 'ATF_ADD_TEST_CASE(tcs, isolate_child__enable_core_dumps);' ""
52       substituteInPlace utils/process/operations_test.cpp \
53         --replace-fail 'ATF_ADD_TEST_CASE(tcs, terminate_self_with__termsig_and_core);' ""
54       substituteInPlace utils/process/status_test.cpp \
55         --replace-fail 'ATF_ADD_TEST_CASE(tcs, integration__coredump);' ""
56       substituteInPlace integration/cmd_test_test.sh \
57         --replace-fail 'atf_add_test_case premature_exit' ""
58     ''
59     # fchflags and UF_NOUNLINK are not supported on Linux. Other tests also fail.
60     + lib.optionalString (finalAttrs.doInstallCheck && stdenv.hostPlatform.isLinux) ''
61       sed -i utils/process/Makefile.am.inc -e '/executor_pid_test/d'
62       substituteInPlace utils/process/Kyuafile \
63         --replace-fail 'atf_test_program{name="executor_pid_test"}' ""
64       substituteInPlace engine/atf_test.cpp \
65         --replace-fail 'ATF_ADD_TEST_CASE(tcs, test__body_only__crashes);' ""
66       substituteInPlace utils/stacktrace_test.cpp \
67         --replace-fail 'ATF_ADD_TEST_CASE(tcs, dump_stacktrace__ok);' "" \
68         --replace-fail 'ATF_ADD_TEST_CASE(tcs, dump_stacktrace_if_available__append);' "" \
69         --replace-fail 'ATF_ADD_TEST_CASE(tcs, find_core__found__long);' "" \
70         --replace-fail 'ATF_ADD_TEST_CASE(tcs, find_core__found__short);' "" \
71         --replace-fail 'ATF_ADD_TEST_CASE(tcs, unlimit_core_size__hard_is_zero);' ""
72       substituteInPlace integration/cmd_test_test.sh \
73         --replace-fail 'atf_add_test_case premature_exit' ""
74     '';
76   strictDeps = true;
78   buildInputs = [
79     lutok
80     sqlite
81   ];
83   nativeBuildInputs = [
84     atf'
85     autoreconfHook
86     pkg-config
87   ];
89   enableParallelBuilding = true;
91   makeFlags = [
92     # Kyua isn’t compatible with C++17, which is the default on current clang and GCC.
93     "CXXFLAGS=-std=c++11"
94   ];
96   doInstallCheck = true;
98   installCheckInputs = [ atf' ];
99   nativeInstallCheckInputs = [ sqlite ];
101   installCheckPhase = ''
102     runHook preInstallCheck
103     HOME=$TMPDIR PATH=$out/bin:$PATH kyua test
104     runHook postInstallCheck
105   '';
107   passthru.updateScript = unstableGitUpdater { tagPrefix = "kyua-"; };
109   __structuredAttrs = true;
111   meta = {
112     description = "Testing framework for infrastructure software";
113     homepage = "https://github.com/freebsd/kyua/";
114     changelog = "https://github.com/freebsd/kyua/blob/master/NEWS.md";
115     license = lib.licenses.bsd3;
116     mainProgram = "kyua";
117     maintainers = with lib.maintainers; [ reckenrode ];
118     platforms = lib.platforms.unix;
119   };