Skip to content

Instantly share code, notes, and snippets.

@aszlig
Last active February 2, 2019 19:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aszlig/10d4a8541826d7cc922bcc86476f5376 to your computer and use it in GitHub Desktop.
Save aszlig/10d4a8541826d7cc922bcc86476f5376 to your computer and use it in GitHub Desktop.
import <nixpkgs/nixos/tests/make-test.nix> {
name = "linux-hashbang-regression";
machine = { pkgs, lib, ... }: {
virtualisation.writableStore = false;
boot.kernelPackages = let
linuxBisect = pkgs.buildLinux {
version = "4.20";
modDirVersion = "4.20.0";
extraMeta.branch = "4.20";
src = pkgs.fetchFromGitHub {
owner = "torvalds";
repo = "linux";
rev = "e0c38a4d1f196a4b17d2eba36afff8f656a4f1de";
sha256 = "18afcacgrzngid67p13xkhgfjjzyqvy778qi721k8fvl7acycn35";
};
kernelPatches = [
pkgs.kernelPatches.modinst_arg_list_too_long
];
};
in pkgs.linuxPackagesFor linuxBisect;
environment.systemPackages = let
hashbangArgs = lib.concatMapStringsSep " " toString (lib.range 1 128);
in lib.singleton (pkgs.writeScriptBin "testme" ''
#!${pkgs.stdenv.shell}
output="$(${pkgs.writeScript "long-hashbang" ''
#!${pkgs.coreutils}/bin/echo ${hashbangArgs}
''})"
if [ -z "$output" ]; then
echo 'Hashbang was truncated:' "$output" >&2
exit 1
fi
'');
};
testScript = ''
$machine->waitForUnit('multi-user.target');
$machine->succeed('testme');
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment