Merge pull request #230191 from Artturin/cleanuptests1

tests.rustCustomSysroot: remove unmaintained and broken by upstream test
This commit is contained in:
Weijia Wang 2023-05-06 22:01:47 +03:00 committed by GitHub
commit d3d531c5c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 66 deletions

View file

@ -10,23 +10,23 @@ stdenv.mkDerivation {
NIX_DEBUG=1 $CC -v
NIX_DEBUG=1 $CXX -v
printf "checking whether compiler builds valid C binaries... " >&2
printf "checking whether compiler builds valid C binaries...\n " >&2
$CC -o cc-check ${./cc-main.c}
./cc-check
printf "checking whether compiler builds valid 32bit C binaries... " >&2
printf "checking whether compiler builds valid 32bit C binaries...\n " >&2
$CC -m32 -o c32-check ${./cc-main.c}
./c32-check
printf "checking whether compiler builds valid 64bit C binaries... " >&2
printf "checking whether compiler builds valid 64bit C binaries...\n " >&2
$CC -m64 -o c64-check ${./cc-main.c}
./c64-check
printf "checking whether compiler builds valid 32bit C++ binaries... " >&2
printf "checking whether compiler builds valid 32bit C++ binaries...\n " >&2
$CXX -m32 -o cxx32-check ${./cxx-main.cc}
./cxx32-check
printf "checking whether compiler builds valid 64bit C++ binaries... " >&2
printf "checking whether compiler builds valid 64bit C++ binaries...\n " >&2
$CXX -m64 -o cxx64-check ${./cxx-main.cc}
./cxx64-check

View file

@ -53,7 +53,6 @@ with pkgs;
pkg-config = recurseIntoAttrs (callPackage ../top-level/pkg-config/tests.nix { });
rustCustomSysroot = callPackage ./rust-sysroot {};
buildRustCrate = callPackage ../build-support/rust/build-rust-crate/test { };
importCargoLock = callPackage ../build-support/rust/test/import-cargo-lock { };

View file

@ -1,60 +0,0 @@
{ lib, rust, rustPlatform, fetchFromGitHub }:
let
mkBlogOsTest = target: rustPlatform.buildRustPackage rec {
name = "blog_os-sysroot-test";
src = fetchFromGitHub {
owner = "phil-opp";
repo = "blog_os";
rev = "4e38e7ddf8dd021c3cd7e4609dfa01afb827797b";
sha256 = "0k9ipm9ddm1bad7bs7368wzzp6xwrhyfzfpckdax54l4ffqwljcg";
};
cargoSha256 = "1x8iwgy1irgfkv2yjkxm6479nwbrk82b0c80jm7y4kw0s32r01lg";
inherit target;
RUSTFLAGS = "-C link-arg=-nostartfiles";
# Tests don't work for `no_std`. See https://os.phil-opp.com/testing/
doCheck = false;
meta = with lib; {
description = "Test for using custom sysroots with buildRustPackage";
maintainers = with maintainers; [ aaronjanse ];
platforms = lib.platforms.x86_64;
};
};
# The book uses rust-lld for linking, but rust-lld is not currently packaged for NixOS.
# The justification in the book for using rust-lld suggests that gcc can still be used for testing:
# > Instead of using the platform's default linker (which might not support Linux targets),
# > we use the cross platform LLD linker that is shipped with Rust for linking our kernel.
# https://github.com/phil-opp/blog_os/blame/7212ffaa8383122b1eb07fe1854814f99d2e1af4/blog/content/second-edition/posts/02-minimal-rust-kernel/index.md#L157
targetContents = {
"llvm-target" = "x86_64-unknown-none";
"data-layout" = "e-m:e-i64:64-f80:128-n8:16:32:64-S128";
"arch" = "x86_64";
"target-endian" = "little";
"target-pointer-width" = "64";
"target-c-int-width" = "32";
"os" = "none";
"executables" = true;
"linker-flavor" = "gcc";
"panic-strategy" = "abort";
"disable-redzone" = true;
"features" = "-mmx,-sse,+soft-float";
};
in {
blogOS-targetByFile = mkBlogOsTest (builtins.toFile "x86_64-blog_os.json" (builtins.toJSON targetContents));
blogOS-targetByNix = let
plat = lib.systems.elaborate { config = "x86_64-none"; } // {
rustc = {
config = "x86_64-blog_os";
platform = targetContents;
};
};
in mkBlogOsTest (rust.toRustTargetSpec plat);
}