Files
kata-containers/virtcontainers/utils/utils_linux_test.go
Alice Frosi 04ce4c05df virtcontainers: change uint32 to uint64 for ioctl
The PR changes the parameter args from uint32 to uint64 for ioctl function.
That leads to an endianess bug.

Fixes: #947

Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
2018-11-29 14:51:06 +00:00

36 lines
650 B
Go

// Copyright (c) 2018 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
package utils
import (
"errors"
"testing"
"github.com/stretchr/testify/assert"
)
func TestFindContextID(t *testing.T) {
assert := assert.New(t)
ioctlFunc = func(fd uintptr, request int, arg1 uint64) error {
return errors.New("ioctl")
}
orgVHostVSockDevicePath := VHostVSockDevicePath
orgMaxUInt := maxUInt
defer func() {
VHostVSockDevicePath = orgVHostVSockDevicePath
maxUInt = orgMaxUInt
}()
VHostVSockDevicePath = "/dev/null"
maxUInt = uint32(1000000)
f, cid, err := FindContextID()
assert.Nil(f)
assert.Zero(cid)
assert.Error(err)
}