From e8c67697a225d7074aa710f9f0ab2f7194d4a6fc Mon Sep 17 00:00:00 2001 From: Duncan Steele Date: Mon, 23 Dec 2024 12:11:57 +0000 Subject: [PATCH] objfw: move passthru test to its own file --- pkgs/by-name/ob/objfw/package.nix | 39 +---------------- pkgs/by-name/ob/objfw/test-build-and-run.nix | 44 ++++++++++++++++++++ 2 files changed, 45 insertions(+), 38 deletions(-) create mode 100644 pkgs/by-name/ob/objfw/test-build-and-run.nix diff --git a/pkgs/by-name/ob/objfw/package.nix b/pkgs/by-name/ob/objfw/package.nix index 6dd746184f351..f315d4c0a9f83 100644 --- a/pkgs/by-name/ob/objfw/package.nix +++ b/pkgs/by-name/ob/objfw/package.nix @@ -33,44 +33,7 @@ clangStdenv.mkDerivation (finalAttrs: { doCheck = true; passthru.tests = { - build-hello-world = clangStdenv.mkDerivation { - name = "ObjFW test"; - buildInputs = [ objfw ]; - - src = writeTextDir "helloworld.m" '' - #import - int main() { - OFLog(@"Hello world from objc"); - return 0; - } - ''; - - buildPhase = '' - runHook preBuild - clang -o testbinary \ - -x objective-c -Xclang \ - -fobjc-runtime=objfw \ - -funwind-tables \ - -fconstant-string-class=OFConstantString \ - -Xclang -fno-constant-cfstrings \ - helloworld.m \ - -lobjfw -lobjfwrt - runHook postBuild - ''; - - checkPhase = '' - runHook preCheck - ./testbinary - runHook postCheck - ''; - doCheck = true; - - installPhase = '' - runHook preInstall - touch $out - runHook postInstall - ''; - }; + build-hello-world = (import ./test-build-and-run.nix) { inherit clangStdenv objfw writeTextDir; }; }; meta = { diff --git a/pkgs/by-name/ob/objfw/test-build-and-run.nix b/pkgs/by-name/ob/objfw/test-build-and-run.nix new file mode 100644 index 0000000000000..f2b74ca1196ef --- /dev/null +++ b/pkgs/by-name/ob/objfw/test-build-and-run.nix @@ -0,0 +1,44 @@ +{ + clangStdenv, + objfw, + writeTextDir, +}: + +clangStdenv.mkDerivation { + name = "ObjFW test"; + buildInputs = [ objfw ]; + + src = writeTextDir "helloworld.m" '' + #import + int main() { + OFLog(@"Hello world from objc"); + return 0; + } + ''; + + buildPhase = '' + runHook preBuild + clang -o testbinary \ + -x objective-c -Xclang \ + -fobjc-runtime=objfw \ + -funwind-tables \ + -fconstant-string-class=OFConstantString \ + -Xclang -fno-constant-cfstrings \ + helloworld.m \ + -lobjfw -lobjfwrt + runHook postBuild + ''; + + checkPhase = '' + runHook preCheck + ./testbinary + runHook postCheck + ''; + doCheck = true; + + installPhase = '' + runHook preInstall + touch $out + runHook postInstall + ''; +}