-
Notifications
You must be signed in to change notification settings - Fork 719
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/linux: skip some tests on non-Linux platforms
Skip most tests in the package, with the exception of the vdso tests that use testdata. For those we need to make the string manipulation functions in package unix work on Windows. Signed-off-by: Lorenz Bauer <lmb@isovalent.com>
- Loading branch information
Showing
9 changed files
with
65 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package linux | ||
|
||
import ( | ||
"errors" | ||
"testing" | ||
|
||
"github.com/cilium/ebpf/internal" | ||
) | ||
|
||
// skipIfNotSupportedOnOS is a copy of testutils.SkipIfNotSupported to avoid | ||
// a circular dependency. | ||
func skipIfNotSupportedOnOS(tb testing.TB, err error) { | ||
tb.Helper() | ||
|
||
if err == internal.ErrNotSupportedOnOS { | ||
tb.Fatal("Unwrapped ErrNotSupportedOnOS") | ||
} | ||
|
||
if errors.Is(err, internal.ErrNotSupportedOnOS) { | ||
tb.Skip(err.Error()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//go:build !linux && !windows | ||
|
||
package unix | ||
|
||
func BytePtrFromString(s string) (*byte, error) { | ||
return nil, errNonLinux() | ||
} | ||
|
||
func ByteSliceToString(s []byte) string { | ||
return "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package unix | ||
|
||
import ( | ||
"syscall" | ||
|
||
"golang.org/x/sys/windows" | ||
) | ||
|
||
func BytePtrFromString(s string) (*byte, error) { | ||
p, err := windows.BytePtrFromString(s) | ||
if err == syscall.EINVAL { | ||
err = EINVAL | ||
} | ||
return p, err | ||
} | ||
|
||
func ByteSliceToString(s []byte) string { | ||
return windows.ByteSliceToString(s) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters