| ... | ... |
@@ -148,26 +148,26 @@ type ( |
| 148 | 148 |
) |
| 149 | 149 |
|
| 150 | 150 |
var ( |
| 151 |
- DmTaskDestroy = dmTaskDestroyFct |
|
| 151 |
+ DmAttachLoopDevice = dmAttachLoopDeviceFct |
|
| 152 |
+ DmGetBlockSize = dmGetBlockSizeFct |
|
| 153 |
+ DmGetLibraryVersion = dmGetLibraryVersionFct |
|
| 154 |
+ DmGetNextTarget = dmGetNextTargetFct |
|
| 155 |
+ DmLogInitVerbose = dmLogInitVerboseFct |
|
| 156 |
+ DmSetDevDir = dmSetDevDirFct |
|
| 157 |
+ DmTaskAddTarget = dmTaskAddTargetFct |
|
| 152 | 158 |
DmTaskCreate = dmTaskCreateFct |
| 159 |
+ DmTaskDestroy = dmTaskDestroyFct |
|
| 160 |
+ DmTaskGetInfo = dmTaskGetInfoFct |
|
| 153 | 161 |
DmTaskRun = dmTaskRunFct |
| 154 |
- DmTaskSetName = dmTaskSetNameFct |
|
| 155 |
- DmTaskSetMessage = dmTaskSetMessageFct |
|
| 156 |
- DmTaskSetSector = dmTaskSetSectorFct |
|
| 157 |
- DmTaskSetCookie = dmTaskSetCookieFct |
|
| 158 | 162 |
DmTaskSetAddNode = dmTaskSetAddNodeFct |
| 163 |
+ DmTaskSetCookie = dmTaskSetCookieFct |
|
| 164 |
+ DmTaskSetMessage = dmTaskSetMessageFct |
|
| 165 |
+ DmTaskSetName = dmTaskSetNameFct |
|
| 159 | 166 |
DmTaskSetRo = dmTaskSetRoFct |
| 160 |
- DmTaskAddTarget = dmTaskAddTargetFct |
|
| 161 |
- DmTaskGetInfo = dmTaskGetInfoFct |
|
| 162 |
- DmGetNextTarget = dmGetNextTargetFct |
|
| 163 |
- DmGetBlockSize = dmGetBlockSizeFct |
|
| 164 |
- DmAttachLoopDevice = dmAttachLoopDeviceFct |
|
| 167 |
+ DmTaskSetSector = dmTaskSetSectorFct |
|
| 165 | 168 |
DmUdevWait = dmUdevWaitFct |
| 166 |
- DmLogInitVerbose = dmLogInitVerboseFct |
|
| 167 |
- DmSetDevDir = dmSetDevDirFct |
|
| 168 |
- DmGetLibraryVersion = dmGetLibraryVersionFct |
|
| 169 |
- LogWithErrnoInit = logWithErrnoInitFct |
|
| 170 | 169 |
GetBlockSize = getBlockSizeFct |
| 170 |
+ LogWithErrnoInit = logWithErrnoInitFct |
|
| 171 | 171 |
) |
| 172 | 172 |
|
| 173 | 173 |
func free(p *C.char) {
|
| ... | ... |
@@ -12,6 +12,68 @@ func init() {
|
| 12 | 12 |
DefaultMetaDataLoopbackSize = 200 * 1024 * 1024 |
| 13 | 13 |
DefaultBaseFsSize = 300 * 1024 * 1024 |
| 14 | 14 |
|
| 15 |
+ // Hijack all calls to libdevmapper with default panics. |
|
| 16 |
+ // Authorized calls are selectively hijacked in each tests. |
|
| 17 |
+ DmTaskCreate = func(t int) *CDmTask {
|
|
| 18 |
+ panic("DmTaskCreate: this method should not be called here")
|
|
| 19 |
+ } |
|
| 20 |
+ DmTaskRun = func(task *CDmTask) int {
|
|
| 21 |
+ panic("DmTaskRun: this method should not be called here")
|
|
| 22 |
+ } |
|
| 23 |
+ DmTaskSetName = func(task *CDmTask, name string) int {
|
|
| 24 |
+ panic("DmTaskSetName: this method should not be called here")
|
|
| 25 |
+ } |
|
| 26 |
+ DmTaskSetMessage = func(task *CDmTask, message string) int {
|
|
| 27 |
+ panic("DmTaskSetMessage: this method should not be called here")
|
|
| 28 |
+ } |
|
| 29 |
+ DmTaskSetSector = func(task *CDmTask, sector uint64) int {
|
|
| 30 |
+ panic("DmTaskSetSector: this method should not be called here")
|
|
| 31 |
+ } |
|
| 32 |
+ DmTaskSetCookie = func(task *CDmTask, cookie *uint, flags uint16) int {
|
|
| 33 |
+ panic("DmTaskSetCookie: this method should not be called here")
|
|
| 34 |
+ } |
|
| 35 |
+ DmTaskSetAddNode = func(task *CDmTask, addNode AddNodeType) int {
|
|
| 36 |
+ panic("DmTaskSetAddNode: this method should not be called here")
|
|
| 37 |
+ } |
|
| 38 |
+ DmTaskSetRo = func(task *CDmTask) int {
|
|
| 39 |
+ panic("DmTaskSetRo: this method should not be called here")
|
|
| 40 |
+ } |
|
| 41 |
+ DmTaskAddTarget = func(task *CDmTask, start, size uint64, ttype, params string) int {
|
|
| 42 |
+ panic("DmTaskAddTarget: this method should not be called here")
|
|
| 43 |
+ } |
|
| 44 |
+ DmTaskGetInfo = func(task *CDmTask, info *Info) int {
|
|
| 45 |
+ panic("DmTaskGetInfo: this method should not be called here")
|
|
| 46 |
+ } |
|
| 47 |
+ DmGetNextTarget = func(task *CDmTask, next uintptr, start, length *uint64, target, params *string) uintptr {
|
|
| 48 |
+ panic("DmGetNextTarget: this method should not be called here")
|
|
| 49 |
+ } |
|
| 50 |
+ DmAttachLoopDevice = func(filename string, fd *int) string {
|
|
| 51 |
+ panic("DmAttachLoopDevice: this method should not be called here")
|
|
| 52 |
+ } |
|
| 53 |
+ DmGetBlockSize = func(fd uintptr) (int64, sysErrno) {
|
|
| 54 |
+ panic("DmGetBlockSize: this method should not be called here")
|
|
| 55 |
+ } |
|
| 56 |
+ DmUdevWait = func(cookie uint) int {
|
|
| 57 |
+ panic("DmUdevWait: this method should not be called here")
|
|
| 58 |
+ } |
|
| 59 |
+ DmSetDevDir = func(dir string) int {
|
|
| 60 |
+ panic("DmSetDevDir: this method should not be called here")
|
|
| 61 |
+ } |
|
| 62 |
+ DmGetLibraryVersion = func(version *string) int {
|
|
| 63 |
+ panic("DmGetLibraryVersion: this method should not be called here")
|
|
| 64 |
+ } |
|
| 65 |
+ DmLogInitVerbose = func(level int) {
|
|
| 66 |
+ panic("DmLogInitVerbose: this method should not be called here")
|
|
| 67 |
+ } |
|
| 68 |
+ DmTaskDestroy = func(task *CDmTask) {
|
|
| 69 |
+ panic("DmTaskDestroy: this method should not be called here")
|
|
| 70 |
+ } |
|
| 71 |
+ GetBlockSize = func(fd uintptr, size *uint64) sysErrno {
|
|
| 72 |
+ panic("GetBlockSize: this method should not be called here")
|
|
| 73 |
+ } |
|
| 74 |
+ LogWithErrnoInit = func() {
|
|
| 75 |
+ panic("LogWithErrnoInit: this method should not be called here")
|
|
| 76 |
+ } |
|
| 15 | 77 |
} |
| 16 | 78 |
|
| 17 | 79 |
func mkTestDirectory(t *testing.T) string {
|