@@ -198,14 +198,16 @@ func TestCopyFile(t *testing.T) {
198
198
}
199
199
switch runtime .GOOS {
200
200
case "illumos" , "solaris" :
201
- // On SunOS , We rely on File.Stat to get the size of the source file,
201
+ // On solaris , We rely on File.Stat to get the size of the source file,
202
202
// which doesn't work for pipe.
203
+ // On illumos, We skip anything other than regular files conservatively
204
+ // for the target file, therefore the hook shouldn't have been called.
203
205
if hook .called {
204
- t .Fatalf ("%s: shouldn't have called the hook with a source of pipe" , testName )
206
+ t .Fatalf ("%s: shouldn't have called the hook with a source or a destination of pipe" , testName )
205
207
}
206
208
default :
207
209
if ! hook .called {
208
- t .Fatalf ("%s: should have called the hook with a source of pipe" , testName )
210
+ t .Fatalf ("%s: should have called the hook with both source and destination of pipe" , testName )
209
211
}
210
212
}
211
213
pw2 .Close ()
@@ -231,8 +233,17 @@ func TestCopyFile(t *testing.T) {
231
233
if n != int64 (len (data )) {
232
234
t .Fatalf ("%s: transferred %d, want %d" , testName , n , len (data ))
233
235
}
234
- if ! hook .called {
235
- t .Fatalf ("%s: should have called the hook" , testName )
236
+ switch runtime .GOOS {
237
+ case "illumos" :
238
+ // On illumos, We skip anything other than regular files conservatively
239
+ // for the target file, therefore the hook shouldn't have been called.
240
+ if hook .called {
241
+ t .Fatalf ("%s: shouldn't have called the hook with a destination of pipe" , testName )
242
+ }
243
+ default :
244
+ if ! hook .called {
245
+ t .Fatalf ("%s: should have called the hook with a destination of pipe" , testName )
246
+ }
236
247
}
237
248
pw .Close ()
238
249
mustContainData (t , pr , data )
0 commit comments