Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

proxy.golang.org : github.com/aibor/go-pidonetest

Package pidonetest provides a simple way for running go tests in an isolated system. It requires QEMU to be present on the system. The easiest way to use this package is to use the "wrapper mode". This does not need any special support by your test package. The downside is, that it can only be used if the target architecture matches the pidonetest binary architecture. See "Library" if you want to test for different architectures. If you have it installed with go install in your PATH: Or build and run on the fly with "go run": There is also support for coverage profiles. Just specify it as usual: It consists of two parts. One part is the library that is intended to be used in your go test package. The other part is the binary that is intended to be used with "go test -exec". The library part is a wrapper for testing.M.Run. Before running the tests some special system file systems are mounted, like /dev, /sys, /proc, /tmp, /run, /sys/fs/bpf/, /sys/kernel/tracing/. In a test package, define your custom TestMain function and call this package's Run function. You may keep this in a separate test file and use build constraints in order to have an easy way of separating such test from normal go tests that can run on the same system: Instead of using Run you can use call the various parts individually, of course, and just mount the file systems you need or additional ones. See Run for the steps it does. With the TestMain function in place, run the test and specify the pidonetest binary in one of the following ways. If the test binary is dynamically linked libraries are resolved. However, if you run into errors try again with "CGO_ENABLED=0", if you don't need cgo. In any case, make sure the QEMU binary used has the same architecture as the test binary. If you have it installed with go install in your PATH: Or build and run on the fly with "go run": There is also support for coverage profiles. Just specify it as usual: Other architectures work as well. You need a kernel for the target architecture and adjust some flags for the platform. Disable KVM if your host architecture differs: See "pidonetest -help" for all flags.

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/aibor/go-pidonetest
Keywords: go, golang, linux, testing, virtualization
License: MIT
Latest release: 6 months ago
First release: 12 months ago
Namespace: github.com/aibor
Stars: 3 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: about 4 hours ago

    Loading...
    Readme
    Loading...