Skip to content

Commit

Permalink
Merge branch 'golang:master' into windows_mkwinsyscall_ext
Browse files Browse the repository at this point in the history
  • Loading branch information
ranganath42 authored Jun 28, 2023
2 parents a428f66 + a1a9c4b commit 9b6e537
Show file tree
Hide file tree
Showing 24 changed files with 155 additions and 28 deletions.
10 changes: 5 additions & 5 deletions unix/linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# Get the git sources. If not cached, this takes O(5 minutes).
WORKDIR /git
RUN git config --global advice.detachedHead false
# Linux Kernel: Released 23 Apr 2023
RUN git clone --branch v6.3 --depth 1 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux
# GNU C library: Released 1 Feb 2022
# Linux Kernel: Released 25 June 2023
RUN git clone --branch v6.4 --depth 1 https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux
# GNU C library: Released 1 Feb 2023
RUN git clone --branch release/2.37/master --depth 1 https://sourceware.org/git/glibc.git

# Get Go
ENV GOLANG_VERSION 1.20.5
ENV GOLANG_VERSION 1.21rc2
ENV GOLANG_DOWNLOAD_URL https://golang.org/dl/go$GOLANG_VERSION.linux-amd64.tar.gz
ENV GOLANG_DOWNLOAD_SHA256 d7ec48cde0d3d2be2c69203bc3e0a44de8660b9c09a6e85c4732a3f7dc442612
ENV GOLANG_DOWNLOAD_SHA256 8fe90332727c606019e80a7368e23f5e65ad59520e45ee4010692f15572e45c6

RUN curl -fsSL "$GOLANG_DOWNLOAD_URL" -o golang.tar.gz \
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \
Expand Down
13 changes: 8 additions & 5 deletions unix/linux/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5721,6 +5721,8 @@ const (
TUN_F_TSO6 = C.TUN_F_TSO6
TUN_F_TSO_ECN = C.TUN_F_TSO_ECN
TUN_F_UFO = C.TUN_F_UFO
TUN_F_USO4 = C.TUN_F_USO4
TUN_F_USO6 = C.TUN_F_USO6
)

// generated by:
Expand All @@ -5734,9 +5736,10 @@ const (
// generated by:
// perl -nlE '/^#define (VIRTIO_NET_HDR_GSO_\w+)/ && say "$1 = C.$1"' include/uapi/linux/virtio_net.h
const (
VIRTIO_NET_HDR_GSO_NONE = C.VIRTIO_NET_HDR_GSO_NONE
VIRTIO_NET_HDR_GSO_TCPV4 = C.VIRTIO_NET_HDR_GSO_TCPV4
VIRTIO_NET_HDR_GSO_UDP = C.VIRTIO_NET_HDR_GSO_UDP
VIRTIO_NET_HDR_GSO_TCPV6 = C.VIRTIO_NET_HDR_GSO_TCPV6
VIRTIO_NET_HDR_GSO_ECN = C.VIRTIO_NET_HDR_GSO_ECN
VIRTIO_NET_HDR_GSO_NONE = C.VIRTIO_NET_HDR_GSO_NONE
VIRTIO_NET_HDR_GSO_TCPV4 = C.VIRTIO_NET_HDR_GSO_TCPV4
VIRTIO_NET_HDR_GSO_UDP = C.VIRTIO_NET_HDR_GSO_UDP
VIRTIO_NET_HDR_GSO_TCPV6 = C.VIRTIO_NET_HDR_GSO_TCPV6
VIRTIO_NET_HDR_GSO_UDP_L4 = C.VIRTIO_NET_HDR_GSO_UDP_L4
VIRTIO_NET_HDR_GSO_ECN = C.VIRTIO_NET_HDR_GSO_ECN
)
12 changes: 9 additions & 3 deletions unix/zerrors_linux.go

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

1 change: 1 addition & 0 deletions unix/zsysnum_linux_s390x.go

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

21 changes: 12 additions & 9 deletions unix/ztypes_linux.go

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

2 changes: 2 additions & 0 deletions unix/ztypes_linux_386.go

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

2 changes: 2 additions & 0 deletions unix/ztypes_linux_amd64.go

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

2 changes: 2 additions & 0 deletions unix/ztypes_linux_arm.go

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

2 changes: 2 additions & 0 deletions unix/ztypes_linux_arm64.go

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

2 changes: 2 additions & 0 deletions unix/ztypes_linux_loong64.go

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

2 changes: 2 additions & 0 deletions unix/ztypes_linux_mips.go

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

2 changes: 2 additions & 0 deletions unix/ztypes_linux_mips64.go

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

2 changes: 2 additions & 0 deletions unix/ztypes_linux_mips64le.go

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

2 changes: 2 additions & 0 deletions unix/ztypes_linux_mipsle.go

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

2 changes: 2 additions & 0 deletions unix/ztypes_linux_ppc.go

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

2 changes: 2 additions & 0 deletions unix/ztypes_linux_ppc64.go

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

2 changes: 2 additions & 0 deletions unix/ztypes_linux_ppc64le.go

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

2 changes: 2 additions & 0 deletions unix/ztypes_linux_riscv64.go

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

2 changes: 2 additions & 0 deletions unix/ztypes_linux_s390x.go

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

2 changes: 2 additions & 0 deletions unix/ztypes_linux_sparc64.go

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

4 changes: 4 additions & 0 deletions windows/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ type SERVICE_FAILURE_ACTIONS struct {
Actions *SC_ACTION
}

type SERVICE_FAILURE_ACTIONS_FLAG struct {
FailureActionsOnNonCrashFailures int32
}

type SC_ACTION struct {
Type uint32
Delay uint32
Expand Down
54 changes: 54 additions & 0 deletions windows/svc/mgr/mgr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,57 @@ func testRecoveryCommand(t *testing.T, s *mgr.Service, should string) {
}
}

func testRecoveryActionsOnNonCrashFailures(t *testing.T, s *mgr.Service, should bool) {
err := s.SetRecoveryActionsOnNonCrashFailures(should)
if err != nil {
t.Fatalf("SetRecoveryActionsOnNonCrashFailures failed: %v", err)
}
is, err := s.RecoveryActionsOnNonCrashFailures()
if err != nil {
t.Fatalf("RecoveryActionsOnNonCrashFailures failed: %v", err)
}
if should != is {
t.Errorf("RecoveryActionsOnNonCrashFailures mismatch: flag is %v, but should have %v", is, should)
}
}

func testMultipleRecoverySettings(t *testing.T, s *mgr.Service, rebootMsgShould, recoveryCmdShould string, actionsFlagShould bool) {
err := s.SetRebootMessage(rebootMsgShould)
if err != nil {
t.Fatalf("SetRebootMessage failed: %v", err)
}
err = s.SetRecoveryActionsOnNonCrashFailures(actionsFlagShould)
if err != nil {
t.Fatalf("SetRecoveryActionsOnNonCrashFailures failed: %v", err)
}
err = s.SetRecoveryCommand(recoveryCmdShould)
if err != nil {
t.Fatalf("SetRecoveryCommand failed: %v", err)
}

rebootMsgIs, err := s.RebootMessage()
if err != nil {
t.Fatalf("RebootMessage failed: %v", err)
}
if rebootMsgShould != rebootMsgIs {
t.Errorf("reboot message mismatch: message is %q, but should have %q", rebootMsgIs, rebootMsgShould)
}
recoveryCommandIs, err := s.RecoveryCommand()
if err != nil {
t.Fatalf("RecoveryCommand failed: %v", err)
}
if recoveryCmdShould != recoveryCommandIs {
t.Errorf("recovery command mismatch: command is %q, but should have %q", recoveryCommandIs, recoveryCmdShould)
}
actionsFlagIs, err := s.RecoveryActionsOnNonCrashFailures()
if err != nil {
t.Fatalf("RecoveryActionsOnNonCrashFailures failed: %v", err)
}
if actionsFlagShould != actionsFlagIs {
t.Errorf("RecoveryActionsOnNonCrashFailures mismatch: flag is %v, but should have %v", actionsFlagIs, actionsFlagShould)
}
}

func testControl(t *testing.T, s *mgr.Service, c svc.Cmd, expectedErr error, expectedStatus svc.Status) {
status, err := s.Control(c)
if err != expectedErr {
Expand Down Expand Up @@ -305,6 +356,9 @@ func TestMyService(t *testing.T) {
testRebootMessage(t, s, "") // delete reboot message
testRecoveryCommand(t, s, fmt.Sprintf("sc query %s", name))
testRecoveryCommand(t, s, "") // delete recovery command
testRecoveryActionsOnNonCrashFailures(t, s, true)
testRecoveryActionsOnNonCrashFailures(t, s, false)
testMultipleRecoverySettings(t, s, fmt.Sprintf("%s failed", name), fmt.Sprintf("sc query %s", name), true)

expectedStatus := svc.Status{
State: svc.Stopped,
Expand Down
Loading

0 comments on commit 9b6e537

Please sign in to comment.