From 5820092cde24ebd2c8d2d17f2671534225736201 Mon Sep 17 00:00:00 2001 From: Aleksi Hannula Date: Fri, 7 Aug 2026 19:22:46 +0300 Subject: [PATCH] minimal-bootstrap.gcc*: Add GCC wrapper test --- .../linux/minimal-bootstrap/default.nix | 2 +- .../linux/minimal-bootstrap/gcc/wrapper.nix | 26 ++++++++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/minimal-bootstrap/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/default.nix index b0fad7145a70..087c0c18637d 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/default.nix @@ -462,7 +462,7 @@ lib.makeScope echo ${gcc46.tests.get-version} echo ${gcc46-cxx.tests.hello-world} echo ${gcc10.tests.hello-world} - echo ${gcc-latest-unwrapped.tests.hello-world} + echo ${gcc-latest.tests.hello-world} '' + (lib.strings.optionalString (hostPlatform.libc == "glibc") '' echo ${gcc-glibc.tests.hello-world} diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gcc/wrapper.nix b/pkgs/os-specific/linux/minimal-bootstrap/gcc/wrapper.nix index 69c0d0f93add..d735b54205b0 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gcc/wrapper.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gcc/wrapper.nix @@ -5,6 +5,7 @@ xz, bash-build, gnused, + buildPlatform, targetPlatform, libc, libgcc, @@ -25,7 +26,30 @@ bash-build.runCommand "${pname}-${gcc-unwrapped.version}" version = gcc-unwrapped.version; meta = gcc-unwrapped.meta; nativeBuildInputs = [ gnused ]; - passthru.unwrapped = gcc-unwrapped; + passthru = { + unwrapped = gcc-unwrapped; + tests.hello-world = + result: + bash-build.runCommand "${pname}-simple-program-${gcc-unwrapped.version}" + { + nativeBuildInputs = [ + binutils + result + ]; + } + '' + cat <> test.c + #include + int main() { + printf("Hello World!\n"); + return 0; + } + EOF + ${targetPlatform.config}-gcc -o test test.c + ${lib.optionalString (buildPlatform.canExecute targetPlatform) "./test"} + mkdir $out + ''; + }; } '' if [[ -z '${dynamicLinkerGlob}' ]]; then