github.com/shaardie/u-root@v4.0.1-0.20190127173353-f24a1c26aa2e+incompatible/integration/kexec_test.go (about) 1 // Copyright 2018 the u-root Authors. All rights reserved 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package integration 6 7 import ( 8 "testing" 9 ) 10 11 // TestMountKexec runs an init which mounts a filesystem and kexecs a kernel. 12 func TestMountKexec(t *testing.T) { 13 // TODO: support arm 14 if TestArch() != "amd64" { 15 t.Skipf("test not supported on %s", TestArch()) 16 } 17 18 // Create the CPIO and start QEMU. 19 q, cleanup := QEMUTest(t, &Options{ 20 Cmds: []string{ 21 "github.com/u-root/u-root/integration/testcmd/kexec/uinit", 22 "github.com/u-root/u-root/cmds/init", 23 "github.com/u-root/u-root/cmds/mount", 24 "github.com/u-root/u-root/cmds/kexec", 25 }, 26 }) 27 defer cleanup() 28 29 if err := q.Expect("KEXECCOUNTER=0"); err != nil { 30 t.Fatal(err) 31 } 32 if err := q.Expect("KEXECCOUNTER=1"); err != nil { 33 t.Fatal(err) 34 } 35 }