Skip to content

Commit

Permalink
tests: unskip empty_cross and future_util_multi_version
Browse files Browse the repository at this point in the history
  • Loading branch information
Kranzes committed Jun 11, 2024
1 parent e66065d commit d791c7a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 46 deletions.
59 changes: 17 additions & 42 deletions sample_projects/empty_cross/default.nix
Original file line number Diff line number Diff line change
@@ -1,52 +1,27 @@
{ pkgs ? import ../../nix/nixpkgs.nix { config = { }; }
{ pkgs ? import ../../nix/nixpkgs.nix { }
, generatedCargoNix ? ./Cargo.nix { }
}:

let pkgs0 = pkgs; in

let
pkgs = import pkgs0.path {
config = { };
crossSystem = {
# Create a new nixpkgs instance with crossSystem configured.
pkgsCross = import pkgs.path {
crossSystem = pkgs.lib.systems.elaborate {
config = "riscv32-unknown-none-elf";
rustc = {
config = "riscv32i-unknown-none-elf";
};
rust.rustcTarget = "riscv32i-unknown-none-elf";
};
};
inherit (pkgs) lib;

instantiatedBuild = pkgs.callPackage generatedCargoNix {
defaultCrateOverrides = pkgs.defaultCrateOverrides;
buildRustCrateForPkgs = pkgs:
let
isBareMetal = pkgs.stdenv.hostPlatform.parsed.kernel.name == "none";
# Don't need other tools
stdenvBase = if isBareMetal then pkgs.stdenvNoCC else pkgs.stdenv;

stdenv =
if stdenvBase.hostPlatform.extensions ? sharedLibrary
then stdenvBase
else
lib.recursiveUpdate stdenvBase {
# This is used in buildRustCrate. Should probably be optional there.
hostPlatform.extensions.sharedLibrary = "";
};
instantiatedBuild = pkgsCross.callPackage generatedCargoNix {
buildRustCrateForPkgs = pkgsCross: pkgsCross.buildRustCrate.override {
# Don't need other tools for the crate and target in this test.
stdenv = pkgsCross.stdenvNoCC;

fun = pkgs.buildRustCrate.override {
inherit stdenv;

# Don't bother with cross compiler since we don't need stdlib
inherit (pkgs.buildPackages.buildPackages) rust rustc cargo;
};
in
args: fun (args // lib.optionalAttrs isBareMetal {
RUSTC_BOOTSTRAP = true;

# Needed for std for build.rs
nativeBuildInputs = args.nativeBuildInputs or [ ]
++ lib.optional pkgs.stdenv.buildPlatform.isDarwin pkgs.buildPackages.libiconv;
});
# Don't bother with cross compiler since we don't need stdlib, this test only uses core.
inherit (pkgsCross.buildPackages.buildPackages) rustc cargo;
};
};
in
instantiatedBuild.rootCrate.build
instantiatedBuild.rootCrate.build.overrideAttrs {
# error[E0554]: `#![feature]` may not be used on the stable release channel
# Only needed for this test.
RUSTC_BOOTSTRAP = true;
}
4 changes: 0 additions & 4 deletions tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -509,17 +509,13 @@ let
name = "future_util_multi_version";
src = ./sample_projects/future_util_multi_version;
expectedOutput = "Hello, world!";
# FIXME: https://github.com/kolloch/crate2nix/issues/83
skip = true;
}

{
name = "empty_cross";
src = ./sample_projects/empty_cross;
cargoToml = "Cargo.toml";
customBuild = "sample_projects/empty_cross/default.nix";
# # FIXME: https://github.com/nix-community/crate2nix/issues/319
skip = true;
}
];
buildTestDerivationAttrSet =
Expand Down

0 comments on commit d791c7a

Please sign in to comment.