Source file src/internal/trace/testtrace/platforms.go

     1  // Copyright 2025 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package testtrace
     6  
     7  import (
     8  	"runtime"
     9  	"testing"
    10  )
    11  
    12  // MustHaveSyscallEvents skips the current test if the current
    13  // platform does not support true system call events.
    14  func MustHaveSyscallEvents(t *testing.T) {
    15  	if HasSyscallEvents() {
    16  		return
    17  	}
    18  	t.Skip("current platform has no true syscall events")
    19  }
    20  
    21  // HasSyscallEvents returns true if the current platform
    22  // has real syscall events available.
    23  func HasSyscallEvents() bool {
    24  	switch runtime.GOOS {
    25  	case "js", "wasip1":
    26  		// js and wasip1 emulate system calls by blocking on channels
    27  		// while yielding back to the environment. They never actually
    28  		// call entersyscall/exitsyscall.
    29  		return false
    30  	}
    31  	return true
    32  }
    33  

View as plain text