@@ -12,6 +12,7 @@ import (
12
12
"os"
13
13
"os/exec"
14
14
"path/filepath"
15
+ "runtime"
15
16
"strconv"
16
17
"strings"
17
18
"testing"
@@ -23,6 +24,10 @@ import (
23
24
24
25
func TestMCPCommandStdio (t * testing.T ) {
25
26
// Test that the headless MCP subcommand works, and recognizes file changes.
27
+ if ! (supportsFsnotify (runtime .GOOS )) {
28
+ // See golang/go#74580
29
+ t .Skipf (`skipping on %s; fsnotify is not supported` , runtime .GOOS )
30
+ }
26
31
testenv .NeedsExec (t ) // stdio transport uses execve(2)
27
32
tree := writeTree (t , `
28
33
-- go.mod --
@@ -95,6 +100,10 @@ const B = 2
95
100
96
101
func TestMCPCommandLogging (t * testing.T ) {
97
102
// Test that logging flags for headless MCP subcommand work as intended.
103
+ if ! (supportsFsnotify (runtime .GOOS )) {
104
+ // See golang/go#74580
105
+ t .Skipf (`skipping on %s; fsnotify is not supported` , runtime .GOOS )
106
+ }
98
107
testenv .NeedsExec (t ) // stdio transport uses execve(2)
99
108
100
109
tests := []struct {
@@ -155,6 +164,10 @@ package p
155
164
}
156
165
157
166
func TestMCPCommandHTTP (t * testing.T ) {
167
+ if ! (supportsFsnotify (runtime .GOOS )) {
168
+ // See golang/go#74580
169
+ t .Skipf (`skipping on %s; fsnotify is not supported` , runtime .GOOS )
170
+ }
158
171
testenv .NeedsExec (t )
159
172
tree := writeTree (t , `
160
173
-- go.mod --
@@ -271,3 +284,8 @@ func getRandomPort() int {
271
284
defer listener .Close ()
272
285
return listener .Addr ().(* net.TCPAddr ).Port
273
286
}
287
+
288
+ // supportsFsnotify returns true if fsnotify supports the os.
289
+ func supportsFsnotify (os string ) bool {
290
+ return os == "darwin" || os == "linux" || os == "windows"
291
+ }
0 commit comments