github.com/mvdan/u-root-coreutils@v0.0.0-20230122170626-c2eef2898555/integration/generic-tests/basic_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  //go:build !race
     6  // +build !race
     7  
     8  package integration
     9  
    10  import (
    11  	"testing"
    12  
    13  	"github.com/mvdan/u-root-coreutils/pkg/vmtest"
    14  )
    15  
    16  func TestScript(t *testing.T) {
    17  	q, cleanup := vmtest.QEMUTest(t, &vmtest.Options{
    18  		Name: "ShellScript",
    19  		TestCmds: []string{
    20  			"echo HELLO WORLD",
    21  			"shutdown -h",
    22  		},
    23  	})
    24  	defer cleanup()
    25  
    26  	if err := q.Expect("HELLO WORLD"); err != nil {
    27  		t.Fatal(`expected "HELLO WORLD", got error: `, err)
    28  	}
    29  }