mirror of
https://github.com/safing/portmaster
synced 2025-09-01 18:19:12 +00:00
35 lines
546 B
Go
35 lines
546 B
Go
package environment
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/safing/portbase/modules"
|
|
"github.com/safing/portmaster/core"
|
|
)
|
|
|
|
func TestMain(m *testing.M) {
|
|
// setup
|
|
tmpDir, err := core.InitForTesting()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
// setup package
|
|
netModule := modules.Register("network", nil, nil, nil, "core")
|
|
InitSubModule(netModule)
|
|
err = StartSubModule()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
// run tests
|
|
rv := m.Run()
|
|
|
|
// teardown
|
|
core.StopTesting()
|
|
_ = os.RemoveAll(tmpDir)
|
|
|
|
// exit with test run return value
|
|
os.Exit(rv)
|
|
}
|