gitee.com/mirrors_u-root/u-root@v7.0.0+incompatible/pkg/uefivars/testmain_test.go (about)

     1  // Copyright 2020 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  // SPDX-License-Identifier: BSD-3-Clause
     6  //
     7  
     8  package uefivars
     9  
    10  import (
    11  	"os"
    12  	"testing"
    13  
    14  	"github.com/u-root/u-root/pkg/uefivars/vartest"
    15  )
    16  
    17  // main is needed to extract the testdata from a zip to temp dir, and to clean
    18  // up the temp dir after
    19  func TestMain(m *testing.M) {
    20  	efiVarDir, cleanup, err := vartest.SetupVarZip("testdata/sys_fw_efi_vars.zip")
    21  	if err != nil {
    22  		panic(err)
    23  	}
    24  	EfiVarDir = efiVarDir
    25  	rc := m.Run()
    26  	cleanup()
    27  	os.Exit(rc)
    28  }