volcano-sh / volcano

A Cloud Native Batch System (Project under CNCF)
https://volcano.sh
Apache License 2.0
4.06k stars 936 forks source link

gomonkey@v2.1.0 doesn't support arm64, need to upgrade to v2.2.0 or higher #2804

Closed lowang-bh closed 1 year ago

lowang-bh commented 1 year ago

gomockey undefined: buildJmpDirective relative issue has been solved, FYI: https://github.com/agiledragon/gomonkey/issues/38 https://github.com/agiledragon/gomonkey/pull/55

What happened: go test -timeout 30s -run ^TestSyncJobFunc$ volcano.sh/volcano/pkg/controllers/job

# github.com/agiledragon/gomonkey/v2
go/src/github.com/volcano/vendor/github.com/agiledragon/gomonkey/v2/patch.go:163:10: undefined: buildJmpDirective
FAIL    volcano.sh/volcano/pkg/controllers/job [build failed]
FAIL

What you expected to happen:

Succeed to run unit-test

How to reproduce it (as minimally and precisely as possible): go test -timeout 30s -run ^TestSyncJobFunc$ volcano.sh/volcano/pkg/controllers/job or make unit-test

Anything else we need to know?:

Just open code on macbook m1/m2, the lint will tells the error or run make unit-test on m1/m2

After upgrade this package, there is another issue permission denied,

Environment:

lowang-bh commented 1 year ago

see issue https://github.com/agiledragon/gomonkey/issues/38 and mr https://github.com/agiledragon/gomonkey/pull/55

lowang-bh commented 1 year ago

/assign

renwenlong-github commented 1 year ago

update gomonkey v2.1.0 to v2.2.0

go test -timeout 30s  -run ^TestSyncJobFunc$ volcano.sh/volcano/pkg/controllers/job
--- FAIL: TestSyncJobFunc (0.00s)
    --- FAIL: TestSyncJobFunc/SyncJob_success_Case (0.00s)
panic: permission denied [recovered]
        panic: permission denied
lowang-bh commented 1 year ago

update gomonkey v2.1.0 to v2.2.0

go test -timeout 30s  -run ^TestSyncJobFunc$ volcano.sh/volcano/pkg/controllers/job
--- FAIL: TestSyncJobFunc (0.00s)
    --- FAIL: TestSyncJobFunc/SyncJob_success_Case (0.00s)
panic: permission denied [recovered]
        panic: permission denied

Can not solve this. It has no permit to change darwin's machine instruction. You can run make unit-test in docker.

lowang-bh commented 1 year ago

Please check those solutions: https://github.com/agiledragon/gomonkey/issues/10 https://github.com/agiledragon/gomonkey/issues/70

I have tried all those solution, it doesn't works.

     page := entryAddress(pageStart(target), syscall.Getpagesize())
-    err := syscall.Mprotect(page, syscall.PROT_READ|syscall.PROT_WRITE|syscall.PROT_EXEC)
+    err := syscall.Mprotect(page, syscall.PROT_READ|syscall.PROT_WRITE)
     if err != nil {

https://blog.csdn.net/weixin_42873928/article/details/129957307

lowang-bh commented 1 year ago

update gomonkey v2.1.0 to v2.2.0

@xiefan-github This upgrade solves issue the buildJmpDirective not support on ARM64 so that it can build successfully.

The permission denied is another issue. I usally run make unit-test in a docker on macos to pass this problem.

renwenlong-github commented 1 year ago

it seems to work for me sleep 1s

lowang-bh commented 1 year ago

it seems to work for me sleep 1s

which one ?

renwenlong-github commented 1 year ago

sorry it has two change, you can get it https://github.com/agiledragon/gomonkey/issues/70#issuecomment-1558475808

renwenlong-github commented 1 year ago

I usally run make unit-test in a docker on macos to pass this problem.

can you give me a docker command?pls

lowang-bh commented 1 year ago

agiledragon/gomonkey#70 (comment)

I usally run make unit-test in a docker on macos to pass this problem.

can you give me a docker command?pls

docker run --rm -it -v ./:/go/src/volcano.sh/ -w /go/src/volcano.sh/ golang:1.19.4 make unit-test