-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
windows run xgo test
error
#4
Comments
Noted,will fix it tomorrow morning. Thanks for feedback |
This has been fixed, see commit a651abf You may need to update xgo to build again: cd xgo
git pull
go run ./script/build-release --local |
P.S. I managed to get a PC on my hand, I will do a thorough test on windows today. Hope all windows issues be settled tonight, please stay tuned! |
Alright, It seems to be a new error: In addition, maybe fix |
👌, will fix it this afternoon |
Update: have fixed a bunch of issues related to windows. |
Excited to announce windows passed all tests, see commit f07938b (tag v1.0.6) With this update, xgo v1.0.6 has been released: https://github.com/xhd2015/xgo/releases/tag/v1.0.6. cd xgo
git pull
go run ./script/build-release --local |
Maybe something wrong? func TestMethodMock(t *testing.T) {
myStruct := &MyStruct{
name: "my struct",
}
otherStruct := &MyStruct{
name: "other struct",
}
mock.Mock(myStruct.name, func(ctx context.Context, fn *core.FuncInfo, args core.Object, results core.Object) error {
results.GetFieldIndex(0).Set("mock struct")
return nil
})
// myStruct is affected
name := myStruct.Name()
if name != "mock struct" {
t.Fatalf("expect myStruct.Name() to be 'mock struct', actual: %s", name)
}
// otherStruct is not affected
otherName := otherStruct.Name()
if otherName != "other struct" {
t.Fatalf("expect otherStruct.Name() to be 'other struct', actual: %s", otherName)
}
} ❯ xgo test -run TestMethodMock -v ./test
# runtime
..\..\..\..\runtime\proc.go:241:1: undefined: __xgo_is_init_finished
..\..\..\..\runtime\proc.go:242:20: undefined: __xgo_on_init_finished_callbacks
..\..\..\..\runtime\proc.go:245:1: undefined: __xgo_on_init_finished_callbacks
..\..\..\..\runtime\proc.go:3627:20: undefined: __xgo_on_goexits
exit status 1
xgo on master [!] via 🐹 v1.20.5
❯ xgo version
1.0.6 |
May I ask what is your |
golang\src\gotest via 🐹 v1.20.5 took 2s
❯ go version
go version go1.20.5 windows/amd64
golang\src\gotest via 🐹 v1.20.5
❯ go env GOROOT
C:\Users\admin\scoop\apps\go\current |
And also the output of |
Got same error, maybe build --local error? See #8, I remove duplicate suffix manually Or maybe I Install golang by scoop? ( |
Ok understood,I've not tested that against a symbolic GOROOT on windows. Can you run |
Not work, got same error |
I just tested with a symbolic link on windows, got error:
It is obvious that windows does not think go1.22.1-sym.lnk to be a directory. Can you verify if your GOROOT installed by scoop is a link? And if it is, can you run the above command with your goroot to check what will happen? |
Ok so I installed scoop, and successfully ran all tests on windows(powershell): cd xgo
$Env:Path="C:\Users\xhd2015\scoop\apps\go\current\bin;C:\Users\xhd2015\.xgo\bin"
xgo test -v .\test\xgo_test\... Output: === RUN TestTrapSet
--- PASS: TestTrapSet (0.00s)
PASS
ok github.com/xhd2015/xgo/test/xgo_test/link_on_init_finished 0.273s
=== RUN TestMemEqual
--- PASS: TestMemEqual (0.00s)
PASS
ok github.com/xhd2015/xgo/test/xgo_test/mem_equal 0.234s
=== RUN TestMethodShouldHaveFMSuffix
--- PASS: TestMethodShouldHaveFMSuffix (0.00s)
PASS
ok github.com/xhd2015/xgo/test/xgo_test/method_fm_suffix 0.255s
=== RUN TestMethodRecvValueShouldBeCopied
--- PASS: TestMethodRecvValueShouldBeCopied (0.00s)
PASS
ok github.com/xhd2015/xgo/test/xgo_test/method_recv_value 0.217s
=== RUN TestMethodValueCompare
--- PASS: TestMethodValueCompare (0.00s)
PASS
ok github.com/xhd2015/xgo/test/xgo_test/method_value_cmp 0.179s
=== RUN TestRewriteChallenge
--- PASS: TestRewriteChallenge (0.00s)
PASS
ok github.com/xhd2015/xgo/test/xgo_test/rewrite_challenge 0.175s
=== RUN TestTrapSet
--- PASS: TestTrapSet (0.00s)
PASS
ok github.com/xhd2015/xgo/test/xgo_test/trap_set 0.178s |
I test in my work computer and got same error, I don't know the reason for this error |
This looks weird, I will add a debug flag to enable log to see what's going on.(The log will contain environment info and building log). By the way, what kind of terminal are you using on windows, powershell or other thing? |
powershell 5.1 |
@WAY29 I have added a flag to log internal compile process, see a90c6ef First, upgrade xgo: cd xgo
git pull
go run ./script/build-release --local Then, run xgo with xgo test --log-debug -run TestMethodMock -v ./test And check 2024-03-25 17:55:24 start: [C:\Users\lukas\AppData\Local\Temp\go-build2111748048\b001\exe\xgo.exe exec --log-debug go version]
2024-03-25 17:55:24 runtime.GOOS=windows
2024-03-25 17:55:24 runtime.GOARCH=amd64
2024-03-25 17:55:24 runtime.Version()=go1.22.1
2024-03-25 17:55:25 effective GOROOT: C:\installed\go1.22.1
2024-03-25 17:55:25 go version: go1.22.1
2024-03-25 17:55:25 instrument dir: C:\Users\lukas\.xgo\go-instrument-dev\go1.22.1_C_in_go_5dd13d4a
2024-03-25 17:55:25 sync goroot C:\installed\go1.22.1 -> C:\Users\lukas\.xgo\go-instrument-dev\go1.22.1_C_in_go_5dd13d4a\go1.22.1
2024-03-25 17:55:25 patch compiler at: C:\Users\lukas\.xgo\go-instrument-dev\go1.22.1_C_in_go_5dd13d4a\go1.22.1
2024-03-25 17:55:26 setup dev dir: C:\Users\lukas\.xgo\go-instrument-dev\go1.22.1_C_in_go_5dd13d4a\go1.22.1
2024-03-25 17:55:27 compiler changed: false
2024-03-25 17:55:27 tool exec flags: -toolexec=C:\Users\lukas\.xgo\bin\exec_tool.exe --enable --
2024-03-25 17:55:27 command: [go version]
2024-03-25 17:55:27 command env: [ALLUSERSPROFILE=C:\ProgramData APPDATA=C:\Users\lukas\AppData\Roaming CHROME_CRASHPAD_PIPE_NAME=\\.\pipe\crashpad_7388_YDEVBNMAIHLMTUHG CommonProgramFiles=C:\Program Files\Common Files CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files CommonProgramW6432=C:\Program Files\Common Files COMPUTERNAME=DESKTOP-Q4TKH82 ComSpec=C:\Windows\system32\cmd.exe DriverData=C:\Windows\System32\Drivers\DriverData FPS_BROWSER_APP_PROFILE_STRING=Internet Explorer FPS_BROWSER_USER_PROFILE_STRING=Default GOPATH=C:\Projects\gopath GOROOT=C:\installed\go1.22.1 HOMEDRIVE=C: HOMEPATH=\Users\lukas LOCALAPPDATA=C:\Users\lukas\AppData\Local LOGONSERVER=\\DESKTOP-Q4TKH82 NUMBER_OF_PROCESSORS=4 OneDrive=C:\Users\lukas\OneDrive ORIGINAL_XDG_CURRENT_DESKTOP=undefined OS=Windows_NT Path=C:\installed\go1.22.1\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\installed\go1.22.1\bin;C:\cygwin64\bin;C:\Users\lukas\.xgo\bin;C:\Projects\gopath\bin;C:\Projects\gopath\bin;C:\Users\lukas\scoop\shims;C:\Users\lukas\AppData\Local\Microsoft\WindowsApps;C:\Users\lukas\AppData\Local\Programs\Microsoft VS Code\bin PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL PROCESSOR_ARCHITECTURE=AMD64 PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 158 Stepping 10, GenuineIntel PROCESSOR_LEVEL=6 PROCESSOR_REVISION=9e0a ProgramData=C:\ProgramData ProgramFiles=C:\Program Files ProgramFiles(x86)=C:\Program Files (x86) ProgramW6432=C:\Program Files PSModulePath=C:\Users\lukas\Documents\WindowsPowerShell\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules PUBLIC=C:\Users\Public SESSIONNAME=Console SystemDrive=C: SystemRoot=C:\Windows TEMP=C:\Users\lukas\AppData\Local\Temp TMP=C:\Users\lukas\AppData\Local\Temp USERDOMAIN=DESKTOP-Q4TKH82 USERDOMAIN_ROAMINGPROFILE=DESKTOP-Q4TKH82 USERNAME=lukas USERPROFILE=C:\Users\lukas windir=C:\Windows TERM_PROGRAM=vscode TERM_PROGRAM_VERSION=1.87.2 LANG=en_US.UTF-8 COLORTERM=truecolor GIT_ASKPASS=c:\Users\lukas\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass.sh VSCODE_GIT_ASKPASS_NODE=C:\Users\lukas\AppData\Local\Programs\Microsoft VS Code\Code.exe VSCODE_GIT_ASKPASS_EXTRA_ARGS= VSCODE_GIT_ASKPASS_MAIN=c:\Users\lukas\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js VSCODE_GIT_IPC_HANDLE=\\.\pipe\vscode-git-3c257e6a92-sock VSCODE_INJECTION=1 GOROOT=C:\Users\lukas\.xgo\go-instrument-dev\go1.22.1_C_in_go_5dd13d4a\go1.22.1 PATH=C:\Users\lukas\.xgo\go-instrument-dev\go1.22.1_C_in_go_5dd13d4a\go1.22.1\bin;C:\installed\go1.22.1\bin;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\installed\go1.22.1\bin;C:\cygwin64\bin;C:\Users\lukas\.xgo\bin;C:\Projects\gopath\bin;C:\Projects\gopath\bin;C:\Users\lukas\scoop\shims;C:\Users\lukas\AppData\Local\Microsoft\WindowsApps;C:\Users\lukas\AppData\Local\Programs\Microsoft VS Code\bin GOCACHE=C:\Users\lukas\.xgo\go-instrument-dev\go1.22.1_C_in_go_5dd13d4a\build-cache XGO_COMPILER_BIN=C:\Users\lukas\.xgo\go-instrument-dev\go1.22.1_C_in_go_5dd13d4a\compile.exe]
2024-03-25 17:55:27 command dir:
2024-03-25 17:55:27 command executable path: C:\installed\go1.22.1\bin\go.exe
2024-03-25 17:55:27 finished successfully |
I try |
I see you are using sudo, can you run it without sudo? |
It got same error. |
And I'm curios that there is |
no. I install it by |
Is there any |
Your shell is busy box? Maybe I can install that on my local machine and try to reproduce |
No, It just a tool sets named busybox |
Yes I found it:
|
Huh, maybe the line |
I know exactly which line caused the problem. I'll fix it. It seems there were something blocking windows from using an existing go runtime. Let me deliver a fix quickly. |
It's because when patching the runtime code, xgo will invoke go to run The implementation that causes this problem is the The incompleteness is caused by this line: dstFile := filepath.Join(goroot, "src", "runtime", "xgo_trap.go")
...
content = bytes.Replace(content, []byte("//go:build ignore\n"), nil, 1) We are using So to fix this issue:
|
Got another error: ❯ xgo test --log-debug -run TestMethodMock -v .\mock_tcp_conn\
# github.com/jtolds/gls
C:\coding\golang\src\gotest\__xgo_autogen_register_func_info.go:2:6: internal compiler error: LookupRuntime: can't find runtime.__xgo_trap
https://go.dev/issue/new
# github.com/agiledragon/gomonkey/v2/creflect
C:\coding\golang\src\gotest\__xgo_autogen_register_func_info.go:2:6: internal compiler error: LookupRuntime: can't find runtime.__xgo_trap
Please file a bug report including a short program that triggers the error.https://go.dev/issue/new
# github.com/xhd2015/xgo/runtime/functab
..\..\pkg\mod\github.com\xhd2015\xgo\runtime@v1.0.6\functab\functab.go:169:6: internal compiler error: LookupRuntime: can't find runtime.__xgo_retrieve_all_funcs_and_clear
Please file a bug report including a short program that triggers the error.https://go.dev/issue/new
# github.com/smartystreets/assertions/internal/go-render/render
C:\coding\golang\src\gotest\__xgo_autogen_register_func_info.go:2:6: internal compiler error: LookupRuntime: can't find runtime.__xgo_trap
Please file a bug report including a short program that triggers the error.https://go.dev/issue/new
# github.com/smartystreets/assertions/internal/oglematchers
C:\coding\golang\src\gotest\__xgo_autogen_register_func_info.go:2:6: internal compiler error: LookupRuntime: can't find runtime.__xgo_trap
Please file a bug report including a short program that triggers the error.https://go.dev/issue/new
# golang.org/x/arch/x86/x86asm
C:\coding\golang\src\gotest\__xgo_autogen_register_func_info.go:2:6: internal compiler error: LookupRuntime: can't find runtime.__xgo_trap
Please file a bug report including a short program that triggers the error.https://go.dev/issue/new
# testing
C:\Users\admin\.xgo\go-instrument\go1.20.5_C_Us_ad_sc_ap_go_cu_90061880\go1.20.5\src\sync\atomic\type.go:43:6: internal compiler error: LookupRuntime: can't find runtime.__xgo_get_test_starts
Please file a bug report including a short program that triggers the error.https://go.dev/issue/new
FAIL gotest/mock_tcp_conn [build failed]
FAIL debug log:
|
Lol 😂 another fix: 42bc808 Please git pull and try again |
Work well. |
Thanks for your patience, the bugs found were so meaningful haha. |
command:
xgo test -run TestMethodMock .\mock_tcp_conn\
error:
create ~/.xgo/log: mkdir C:\Users\admin\.xgo\go-instrument\go1.20.5_C:_Us_ad_sc_ap_go_cu_90061880: The directory name is invalid.
maybe create windows dir/file could not include ":"
The text was updated successfully, but these errors were encountered: