mirror of
https://github.com/opencontainers/runc.git
synced 2026-07-11 06:03:57 +08:00
8358a0ecbb
StartInitialization does not have to be a method of Factory (while it is clear why it was done that way initially, now we only have Linux containers so it does not make sense). Fix callers and docs accordingly. No change in functionality. Also, since this was the only user of libcontainer.New with the empty string as an argument, the corresponding check can now be removed from it. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
34 lines
676 B
Go
34 lines
676 B
Go
package integration
|
|
|
|
import (
|
|
"os"
|
|
"runtime"
|
|
"testing"
|
|
|
|
"github.com/opencontainers/runc/libcontainer"
|
|
_ "github.com/opencontainers/runc/libcontainer/nsenter"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// init runs the libcontainer initialization code because of the busybox style needs
|
|
// to work around the go runtime and the issues with forking
|
|
func init() {
|
|
if len(os.Args) < 2 || os.Args[1] != "init" {
|
|
return
|
|
}
|
|
runtime.GOMAXPROCS(1)
|
|
runtime.LockOSThread()
|
|
if err := libcontainer.StartInitialization(); err != nil {
|
|
logrus.Fatal(err)
|
|
}
|
|
}
|
|
|
|
func TestMain(m *testing.M) {
|
|
logrus.SetOutput(os.Stderr)
|
|
logrus.SetLevel(logrus.InfoLevel)
|
|
|
|
ret := m.Run()
|
|
os.Exit(ret)
|
|
}
|