treewide: parallel tests
All checks were successful
Test / Create distribution (push) Successful in 25s
Test / Hakurei (push) Successful in 44s
Test / Sandbox (push) Successful in 41s
Test / Hakurei (race detector) (push) Successful in 44s
Test / Sandbox (race detector) (push) Successful in 41s
Test / Hpkg (push) Successful in 41s
Test / Flake checks (push) Successful in 1m24s
All checks were successful
Test / Create distribution (push) Successful in 25s
Test / Hakurei (push) Successful in 44s
Test / Sandbox (push) Successful in 41s
Test / Hakurei (race detector) (push) Successful in 44s
Test / Sandbox (race detector) (push) Successful in 41s
Test / Hpkg (push) Successful in 41s
Test / Flake checks (push) Successful in 1m24s
Most tests already had no global state, however parallel was never enabled. This change enables it for all applicable tests. Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
@@ -1,14 +1,11 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"io"
|
||||
"io/fs"
|
||||
"log"
|
||||
"os"
|
||||
"reflect"
|
||||
"slices"
|
||||
"testing"
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"hakurei.app/container/stub"
|
||||
@@ -42,10 +39,12 @@ func checkOpBehaviour(t *testing.T, testCases []opBehaviourTestCase) {
|
||||
|
||||
t.Run("behaviour", func(t *testing.T) {
|
||||
t.Helper()
|
||||
t.Parallel()
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Helper()
|
||||
t.Parallel()
|
||||
|
||||
var ec *Criteria
|
||||
if tc.ec != 0xff {
|
||||
@@ -94,10 +93,12 @@ func checkOpsBuilder(t *testing.T, fname string, testCases []opsBuilderTestCase)
|
||||
|
||||
t.Run("build", func(t *testing.T) {
|
||||
t.Helper()
|
||||
t.Parallel()
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Helper()
|
||||
t.Parallel()
|
||||
|
||||
sys, s := InternalNew(t, tc.exp, tc.uid)
|
||||
defer stub.HandleExit(t)
|
||||
@@ -126,10 +127,12 @@ func checkOpIs(t *testing.T, testCases []opIsTestCase) {
|
||||
|
||||
t.Run("is", func(t *testing.T) {
|
||||
t.Helper()
|
||||
t.Parallel()
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Helper()
|
||||
t.Parallel()
|
||||
|
||||
if got := tc.op.Is(tc.v); got != tc.want {
|
||||
t.Errorf("Is: %v, want %v", got, tc.want)
|
||||
@@ -153,10 +156,12 @@ func checkOpMeta(t *testing.T, testCases []opMetaTestCase) {
|
||||
|
||||
t.Run("meta", func(t *testing.T) {
|
||||
t.Helper()
|
||||
t.Parallel()
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Helper()
|
||||
t.Parallel()
|
||||
|
||||
t.Run("type", func(t *testing.T) {
|
||||
t.Helper()
|
||||
@@ -186,34 +191,6 @@ func checkOpMeta(t *testing.T, testCases []opMetaTestCase) {
|
||||
})
|
||||
}
|
||||
|
||||
type stubFi struct {
|
||||
size int64
|
||||
isDir bool
|
||||
}
|
||||
|
||||
func (stubFi) Name() string { panic("unreachable") }
|
||||
func (fi stubFi) Size() int64 { return fi.size }
|
||||
func (stubFi) Mode() fs.FileMode { panic("unreachable") }
|
||||
func (stubFi) ModTime() time.Time { panic("unreachable") }
|
||||
func (fi stubFi) IsDir() bool { return fi.isDir }
|
||||
func (stubFi) Sys() any { panic("unreachable") }
|
||||
|
||||
type readerOsFile struct {
|
||||
closed bool
|
||||
io.Reader
|
||||
}
|
||||
|
||||
func (*readerOsFile) Name() string { panic("unreachable") }
|
||||
func (*readerOsFile) Write([]byte) (int, error) { panic("unreachable") }
|
||||
func (*readerOsFile) Stat() (fs.FileInfo, error) { panic("unreachable") }
|
||||
func (r *readerOsFile) Close() error {
|
||||
if r.closed {
|
||||
return os.ErrClosed
|
||||
}
|
||||
r.closed = true
|
||||
return nil
|
||||
}
|
||||
|
||||
// InternalNew initialises [I] with a stub syscallDispatcher.
|
||||
func InternalNew(t *testing.T, want stub.Expect, uid int) (*I, *stub.Stub[syscallDispatcher]) {
|
||||
k := &kstub{stub.New(t, func(s *stub.Stub[syscallDispatcher]) syscallDispatcher { return &kstub{s} }, want)}
|
||||
|
||||
Reference in New Issue
Block a user