mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-24 01:24:26 +01:00
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>
36 lines
650 B
Go
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)
|
|
}
|