github.com/u-root/u-root@v7.0.1-0.20200915234505-ad7babab0a8e+incompatible/pkg/mount/mtd/linux_test.go (about)

     1  // Copyright 2019 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 mtd
     6  
     7  import (
     8  	"os"
     9  	"testing"
    10  )
    11  
    12  func TestOpen(t *testing.T) {
    13  	// If there's no such device then don't bother with the
    14  	// test.
    15  	if _, err := os.Stat(DevName); err != nil {
    16  		t.Skip("No device to test")
    17  	}
    18  	m, err := NewDev(DevName)
    19  	if err != nil {
    20  		t.Fatal(err)
    21  	}
    22  	if err := m.Close(); err != nil {
    23  		t.Fatal(err)
    24  	}
    25  }