test

module
v0.0.0-...-967a1bc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2025 License: MIT

README

Tests of the runtime package

Runnable tests are listed in file ../../script/run-test/main.go.

All tests must be run by xgo.

runtime/test has special access to runtime/internal functions, like trap.Inspect().

Run tests

# all

# patch
go run -tags dev ./cmd/xgo test --with-goroot go1.19.13 --project-dir ./runtime/test/patch

# trace
go run -tags dev ./cmd/xgo test --with-goroot go1.19.13 --project-dir runtime/test ./trace

# specific test
go run -tags dev ./cmd/xgo test --with-goroot go1.17.13 --project-dir ./runtime/test/mock_var -v -run TestThirdPartyTypeMethodVar

# with -cover
go run -tags dev ./cmd/xgo test --with-goroot go1.19.13 -cover --project-dir runtime/test ./patch

Debug tests

# build
go run -tags dev ./cmd/xgo test --with-goroot go1.19.13 -c -o __debug_bin_test -gcflags="all=-N -l" --project-dir runtime/test ./patch

# debug
dlv exec --listen=:2345 --api-version=2 --check-go-version=false --headless -- ./__debug_bin_test -test.run TestPatchTypeMethodCtxArg

# build and run
go run -tags dev ./cmd/xgo test --with-goroot go1.19.13 --log-debug --project-dir runtime/test -c -gcflags="all=-N -l" -o __debug_bin_test ./trace/go_trace && ./__debug_bin_test -test.v -test.run TestGoTraceSync

VSCode launch.json:

{
    "configurations": [
        {
            "name": "Debug dlv localhost:2345",
            "type": "go",
            "debugAdapter": "dlv-dap",
            "request": "attach",
            "mode": "remote",
            "port": 2345,
            "host": "127.0.0.1",
            "cwd": "./"
        }
    ]
}

Debug xgo

go build -o xgo -gcflags="all=-N -l" -tags dev ./cmd/xgo

dlv exec --listen=:2345 --api-version=2 --check-go-version=false --headless --  xgo test --with-goroot go1.19.13 --project-dir runtime/test -c -gcflags="all
=-N -l" -o __debug_bin_test ./patch

Directories

Path Synopsis
bugs
issue_194_asm_func
This file is intentionally left empty.
This file is intentionally left empty.
pocketbase
see https://github.com/xhd2015/xgo/issues/142
see https://github.com/xhd2015/xgo/issues/142
build
dump_ir command
hello_world command
simple command
debug
generic command
pkg
functab
func_info command
id
pkg
mock
mock_res command
sub
std
atomic_generic command
goroutine_trap command
trace
collect_trace command
trap

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL