Skip to content

Commit

Permalink
[backport] feat: add support for OpenBSD
Browse files Browse the repository at this point in the history
This diff backports #703
to the release/3.14 branch.

See ooni/probe#2067
  • Loading branch information
Erethon authored and bassosimone committed Apr 12, 2022
1 parent 2f95f49 commit 5dcd8a0
Show file tree
Hide file tree
Showing 5 changed files with 310 additions and 4 deletions.
112 changes: 112 additions & 0 deletions internal/netxlite/errno_openbsd.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

188 changes: 188 additions & 0 deletions internal/netxlite/errno_openbsd_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion internal/netxlite/internal/generrno/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ var Specs = []*ErrorSpec{
// of the related golang.org/x/sys/$name library.
func mapSystemToLibrary(system string) string {
switch system {
case "darwin", "freebsd", "linux":
case "darwin", "freebsd", "openbsd", "linux":
return "unix"
case "windows":
return "windows"
Expand Down Expand Up @@ -364,6 +364,7 @@ func writeSystemSpecificTestFile(system string) {
var SupportedSystems = []string{
"darwin",
"freebsd",
"openbsd",
"linux",
"windows",
}
Expand Down
6 changes: 4 additions & 2 deletions internal/platform/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ import "runtime"
//
// 5. "freebsd"
//
// 6. "unknown"
// 6. "openbsd"
//
// 7. "unknown"
//
// You should use this name to annotate measurements.
func Name() string {
Expand All @@ -32,7 +34,7 @@ func name(goos string) string {
//
// See https://golang.org/doc/go1.16#darwin
switch goos {
case "android", "freebsd", "ios", "linux", "windows":
case "android", "freebsd", "openbsd", "ios", "linux", "windows":
return goos
case "darwin":
return "macos"
Expand Down
5 changes: 4 additions & 1 deletion internal/platform/platform_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
func TestGood(t *testing.T) {
var expected bool
switch Name() {
case "android", "freebsd", "ios", "linux", "macos", "windows":
case "android", "freebsd", "openbsd", "ios", "linux", "macos", "windows":
expected = true
}
if !expected {
Expand All @@ -26,6 +26,9 @@ func TestName(t *testing.T) {
}, {
expected: "freebsd",
goos: "freebsd",
}, {
expected: "openbsd",
goos: "openbsd",
}, {
expected: "ios",
goos: "ios",
Expand Down

0 comments on commit 5dcd8a0

Please sign in to comment.