mirror of
https://github.com/NixOS/mobile-nixos.git
synced 2024-12-16 03:32:02 +03:00
cross-canary: Add simple test to validate cross work
At least, to a basic level.
This commit is contained in:
parent
b07dc19062
commit
db8e7eb0aa
45
overlay/mobile-nixos/cross-canary/test.nix
Normal file
45
overlay/mobile-nixos/cross-canary/test.nix
Normal file
@ -0,0 +1,45 @@
|
||||
{ stdenv, runCommandNoCC, runtimeShell, busybox, hello-mruby, pkgsBuildBuild }:
|
||||
|
||||
let
|
||||
inherit (stdenv) system;
|
||||
emulators = {
|
||||
"aarch64-linux" = "qemu-aarch64";
|
||||
"armv7l-linux" = "qemu-arm";
|
||||
};
|
||||
emulator =
|
||||
if stdenv.buildPlatform == stdenv.hostPlatform then ""
|
||||
else "${pkgsBuildBuild.qemu}/bin/${emulators.${system}}"
|
||||
;
|
||||
mkTest = what: script: runCommandNoCC "cross-canary-${what}-${stdenv.system}" {} ''
|
||||
(
|
||||
PS4=" $ "
|
||||
set -x
|
||||
|
||||
${script}
|
||||
|
||||
)
|
||||
|
||||
# Everything went okay, mark the build as a success!
|
||||
touch $out
|
||||
'';
|
||||
in
|
||||
|
||||
# We're not creating a "useless" canary when there is no cross compilation.
|
||||
if stdenv.buildPlatform == stdenv.hostPlatform then {} else
|
||||
{
|
||||
busybox = mkTest "busybox" ''
|
||||
# Checks that busybox works
|
||||
${emulator} ${busybox}/bin/busybox uname -a
|
||||
${emulator} ${busybox}/bin/busybox sh -c 'echo busybox works...'
|
||||
'';
|
||||
|
||||
mruby = mkTest "mruby" ''
|
||||
# Checks that mruby works at its most basic.
|
||||
${emulator} ${hello-mruby}/bin/hello
|
||||
'';
|
||||
|
||||
runtimeShell = mkTest "runtimeShell" ''
|
||||
# And what about runtimeShell?
|
||||
${emulator} ${runtimeShell} -c 'echo runtimeShell works...'
|
||||
'';
|
||||
}
|
@ -136,6 +136,8 @@ in
|
||||
make-flashable-zip = callPackage ./mobile-nixos/android-flashable-zip/make-flashable-zip.nix {};
|
||||
|
||||
map-dtbs = callPackage ./mobile-nixos/map-dtbs {};
|
||||
|
||||
cross-canary-test = callPackage ./mobile-nixos/cross-canary/test.nix {};
|
||||
};
|
||||
|
||||
imageBuilder = callPackage ../lib/image-builder {};
|
||||
|
Loading…
Reference in New Issue
Block a user