test min-copy-closure
This commit is contained in:
parent
74f2aa6247
commit
2af8f2382a
6 changed files with 140 additions and 0 deletions
|
@ -4,4 +4,5 @@
|
||||||
wlan = import ./wlan/test.nix;
|
wlan = import ./wlan/test.nix;
|
||||||
pppoe = import ./pppoe/test.nix;
|
pppoe = import ./pppoe/test.nix;
|
||||||
jffs2 = import ./jffs2/test.nix;
|
jffs2 = import ./jffs2/test.nix;
|
||||||
|
min-copy-closure = import ./min-copy-closure/test.nix;
|
||||||
}
|
}
|
||||||
|
|
47
tests/min-copy-closure/configuration.nix
Normal file
47
tests/min-copy-closure/configuration.nix
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
{ config, pkgs, lib, ... } :
|
||||||
|
let
|
||||||
|
inherit (pkgs) dropbear;
|
||||||
|
inherit (pkgs.pseudofile) dir symlink;
|
||||||
|
inherit (pkgs.liminix.services) oneshot longrun bundle target;
|
||||||
|
inherit
|
||||||
|
(pkgs.liminix.networking)
|
||||||
|
address
|
||||||
|
udhcpc
|
||||||
|
interface
|
||||||
|
route
|
||||||
|
;
|
||||||
|
in {
|
||||||
|
imports = [
|
||||||
|
../../vanilla-configuration.nix
|
||||||
|
../../modules/squashfs.nix
|
||||||
|
../../modules/jffs2.nix
|
||||||
|
];
|
||||||
|
config = {
|
||||||
|
services.sshd = longrun {
|
||||||
|
name = "sshd";
|
||||||
|
run = ''
|
||||||
|
mkdir -p /run/dropbear
|
||||||
|
${dropbear}/bin/dropbear -E -P /run/dropbear.pid -R -F
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
users.root = {
|
||||||
|
passwd = lib.mkForce "$6$GYDbeLSyoIdgDdZW$EXlz4oI7Jz1igSYd4cxwcWR4lqEc5AWdGWuPuBarQeUskFQsBCpPc0GgIPPDl1k7SgrnC82JzSWxvx5o0bvmx/";
|
||||||
|
openssh.authorizedKeys.keys = [
|
||||||
|
(builtins.readFile ./id.pub)
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# services.dhcpc =
|
||||||
|
# let iface = config.hardware.networkInterfaces.lan;
|
||||||
|
# in (udhcpc iface {
|
||||||
|
# dependencies = [ config.services.hostname ];
|
||||||
|
# }) // { inherit (iface) device; };
|
||||||
|
|
||||||
|
rootfsType = "jffs2";
|
||||||
|
services.default = lib.mkForce (target {
|
||||||
|
name = "default";
|
||||||
|
contents = with config.services; [ loopback ntp defaultroute4 sshd dhcpv4 ];
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
38
tests/min-copy-closure/id
Normal file
38
tests/min-copy-closure/id
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
-----BEGIN OPENSSH PRIVATE KEY-----
|
||||||
|
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABlwAAAAdzc2gtcn
|
||||||
|
NhAAAAAwEAAQAAAYEAzCrNzkxcZlm73f1u1o8XbElUjBNd+++Hikk2t2ksDfmzJ0tRBlxh
|
||||||
|
hccwo7rGy/zvYvSEgvWARpbwvKA+mOPRxk2vJ5SZsFrgyg2qLWpjETYnT6N4WB2qlyeXBu
|
||||||
|
haEKIZRrXOA/rYby1zuAuh6MPt1g4bYacfX5sYFUgq1YRyrtSmfSMhNHsIHYEemVPrj13o
|
||||||
|
RBYISIY9C031wyQjGszYY+B6gi3Py4qzw3kuft9kGOHquml0OMmNvWiPnyfW1ZrIeve5FU
|
||||||
|
tvArCVjsUqN6sl3G+JiyeDNkT27K2Of0g1sxCvJfeHMmB6XPg0JEq57mgBnq9CXHsonZ+q
|
||||||
|
9lfygwg4v87rn4EXwzW2GvEaKVZffGGk6y6ZF5cG8W8EL1ZOg9df4vtjcxdPCmHueU35L3
|
||||||
|
4YZf58ibKNK6w23J2MYD1kXtj3MreMnkOsWBt267qIe/4fvbIDxtDfXdiAQSGDS1/o+btA
|
||||||
|
jGw708CtWMKKLbmwGMKq1k9BFcr7nzmZCHMuILonAAAFiB8p2oQfKdqEAAAAB3NzaC1yc2
|
||||||
|
EA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GNdOr9wkDCNFra1TMOVKwj
|
||||||
|
nl/epYI84bz/umSAxVMcSJ8Wk4laiicYnsjCX1Now53w+Kzt4Qo/SVhZRFmJuR2GixAAAA
|
||||||
|
wQCersXMwaUatzbp2/tJpLDBLVsefNqHN0PZs4CX0NI8uatRJyIYYF/wnxLmNfPZ85YQ82
|
||||||
|
UmIejQODBR35MroRvYsnVZHphBNqX4/wHkQ8QIDlfG35PbOmhVnDHTUoKgg8X0NEriGHRG
|
||||||
|
F2uhysYu8qIhizx7ZsDcbKZ4SDH/xDtTXQIgSqBBsqbdIxWAdudlnVHd6ufuWMEvFBVExW
|
||||||
|
l+Zs3Daa/khpuVaQbI7Saes9bmpJtSE2UJO9KH6lzH4Kwe8sMAAADBAOw6/u30oIcpf13O
|
||||||
|
S4Yk39Ac9ZARpGY1FyyeJ9k6MYeE8uhPkBMLwQS+CWQWthSRk0WO/rFbCu4FJWoC1mZ0i0
|
||||||
|
0CpRApOiwyqm+8DrwEJPOPuC535nRR05aWTCcRwOFChmBrCtsWtRJ24pD+U5oe4aY1dFbZ
|
||||||
|
oIPqqbcHMk9xuATd2J5KucTG2PnSwhz2fArbn5Jz2e0VSi5pRspKz++JiCLsZ0Co/LNJDR
|
||||||
|
/T3rQ2KZNa++HaGT7GRNuL3wfr2uOGWQAAAMEA3UDieFsCTORFRxoWFvg4YKVYTJdj5Fy5
|
||||||
|
vFFoiHP61b4xKADdnMBnmw5wYbKLbTL1oawCpS+063RhSDoMueiylAzgKCQDF1ulkfK0e9
|
||||||
|
Fccs4ZfXg2niel/j+D0x7pk3kFCdCabqgI80avAjItcj8LnmrNEV3GK4VUIOqg//4SDXHV
|
||||||
|
lWYwYGJaImzO4NAUe6U+e7iY6cxCMSh2ETzfhkWi3R3p82XE6i5Q6W1SC9gojH6ARH4oZg
|
||||||
|
FQjzLfyJPuzzR/AAAADWRhbkBsb2FjbGhvc3QBAgMEBQ==
|
||||||
|
-----END OPENSSH PRIVATE KEY-----
|
1
tests/min-copy-closure/id.pub
Normal file
1
tests/min-copy-closure/id.pub
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDMKs3OTFxmWbvd/W7WjxdsSVSME13774eKSTa3aSwN+bMnS1EGXGGFxzCjusbL/O9i9ISC9YBGlvC8oD6Y49HGTa8nlJmwWuDKDaotamMRNidPo3hYHaqXJ5cG6FoQohlGtc4D+thvLXO4C6How+3WDhthpx9fmxgVSCrVhHKu1KZ9IyE0ewgdgR6ZU+uPXehEFghIhj0LTfXDJCMazNhj4HqCLc/LirPDeS5+32QY4eq6aXQ4yY29aI+fJ9bVmsh697kVS28CsJWOxSo3qyXcb4mLJ4M2RPbsrY5/SDWzEK8l94cyYHpc+DQkSrnuaAGer0Jceyidn6r2V/KDCDi/zuufgRfDNbYa8RopVl98YaTrLpkXlwbxbwQvVk6D11/i+2NzF08KYe55Tfkvfhhl/nyJso0rrDbcnYxgPWRe2Pcyt4yeQ6xYG3bruoh7/h+9sgPG0N9d2IBBIYNLX+j5u0CMbDvTwK1YwootubAYwqrWT0EVyvufOZkIcy4guic= dan@loaclhost
|
48
tests/min-copy-closure/test.nix
Normal file
48
tests/min-copy-closure/test.nix
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
{
|
||||||
|
liminix
|
||||||
|
, nixpkgs
|
||||||
|
}:
|
||||||
|
let lmx = (import liminix {
|
||||||
|
device = import "${liminix}/devices/qemu/";
|
||||||
|
liminix-config = ./configuration.nix;
|
||||||
|
});
|
||||||
|
rogue = lmx.pkgs.rogue;
|
||||||
|
img = lmx.outputs.vmroot;
|
||||||
|
pkgs = import <nixpkgs> { overlays = [(import ../../overlay.nix)]; };
|
||||||
|
inherit (pkgs.pkgsBuildBuild) mips-vm;
|
||||||
|
in pkgs.runCommand "check" {
|
||||||
|
nativeBuildInputs = with pkgs; [
|
||||||
|
expect
|
||||||
|
mips-vm
|
||||||
|
socat
|
||||||
|
min-copy-closure
|
||||||
|
rogue
|
||||||
|
] ;
|
||||||
|
} ''
|
||||||
|
killpid(){
|
||||||
|
if test -e $1 && test -d /proc/`cat $1` ; then
|
||||||
|
pid=$(cat $1)
|
||||||
|
kill $pid
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
cleanup(){
|
||||||
|
killpid ./vm/pid
|
||||||
|
}
|
||||||
|
|
||||||
|
trap cleanup EXIT
|
||||||
|
fatal(){
|
||||||
|
err=$?
|
||||||
|
echo "FAIL: command $(eval echo $BASH_COMMAND) exited with code $err"
|
||||||
|
exit $err
|
||||||
|
}
|
||||||
|
trap fatal ERR
|
||||||
|
|
||||||
|
mkdir vm
|
||||||
|
LAN=user,hostfwd=tcp::2022-:22 mips-vm --background ./vm ${img}/vmlinux ${img}/rootfs
|
||||||
|
expect ${./wait-until-ready.expect}
|
||||||
|
export SSH_COMMAND="ssh -o StrictHostKeyChecking=no -p 2022 -i ${./id}"
|
||||||
|
$SSH_COMMAND root@localhost echo ready
|
||||||
|
IN_NIX_BUILD=true min-copy-closure root@localhost ${rogue}
|
||||||
|
$SSH_COMMAND root@localhost ls -l ${rogue} >$out
|
||||||
|
''
|
5
tests/min-copy-closure/wait-until-ready.expect
Normal file
5
tests/min-copy-closure/wait-until-ready.expect
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
set timeout 60
|
||||||
|
|
||||||
|
spawn socat unix-connect:vm/console -
|
||||||
|
send "\r\n"
|
||||||
|
expect "login:"
|
Loading…
Reference in a new issue