github.com/hugelgupf/u-root@v0.0.0-20191023214958-4807c632154c/integration/io_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 // +build amd64,!race 6 7 package integration 8 9 import ( 10 "testing" 11 12 "github.com/u-root/u-root/pkg/uroot" 13 "github.com/u-root/u-root/pkg/vmtest" 14 ) 15 16 // TestIO tests the string "UART TEST" is written to the serial port on 0x3f8. 17 func TestIO(t *testing.T) { 18 // TODO: support arm 19 if vmtest.TestArch() != "amd64" { 20 t.Skipf("test not supported on %s", vmtest.TestArch()) 21 } 22 23 // Create the CPIO and start QEMU. 24 q, cleanup := vmtest.QEMUTest(t, &vmtest.Options{ 25 BuildOpts: uroot.Opts{ 26 Commands: uroot.BusyBoxCmds( 27 "github.com/u-root/u-root/integration/testcmd/io/uinit", 28 "github.com/u-root/u-root/cmds/core/init", 29 "github.com/u-root/u-root/cmds/core/io", 30 ), 31 }, 32 }) 33 defer cleanup() 34 35 if err := q.Expect("UART TEST"); err != nil { 36 t.Fatal(`expected "UART TEST", got error: `, err) 37 } 38 }