Skip to content

Commit

Permalink
Merge branch 'master' into opt-fs
Browse files Browse the repository at this point in the history
# Conflicts:
#	frame_sorter.go
#	frame_sorter_test.go
  • Loading branch information
tobyxdd committed Aug 5, 2023
2 parents 8ab615c + 18d3846 commit e9a8784
Show file tree
Hide file tree
Showing 408 changed files with 17,839 additions and 14,467 deletions.
26 changes: 11 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
version: 2.1
executors:
test-go118:
test-go120:
docker:
- image: "cimg/go:1.18"
environment:
runrace: true
TIMESCALE_FACTOR: 3
test-go119:
docker:
- image: "cimg/go:1.19"
- image: "cimg/go:1.20"
environment:
runrace: true
TIMESCALE_FACTOR: 3

jobs:
"test": &test
executor: test-go118
executor: test-go120
steps:
- checkout
- run:
Expand All @@ -27,20 +21,22 @@ jobs:
- run:
name: "Run self integration tests"
command: go run github.com/onsi/ginkgo/v2/ginkgo -v -randomize-all -trace integrationtests/self
- run:
name: "Run version negotiation tests"
command: go run github.com/onsi/ginkgo/v2/ginkgo -v -randomize-all -trace integrationtests/versionnegotiation
- run:
name: "Run self integration tests with race detector"
command: go run github.com/onsi/ginkgo/v2/ginkgo -race -v -randomize-all -trace integrationtests/self
- run:
name: "Run self integration tests with qlog"
command: go run github.com/onsi/ginkgo/v2/ginkgo -v -randomize-all -trace integrationtests/self -- -qlog
go118:
<<: *test
go119:
- run:
name: "Run version negotiation tests with qlog"
command: go run github.com/onsi/ginkgo/v2/ginkgo -v -randomize-all -trace integrationtests/versionnegotiation -- -qlog
go120:
<<: *test
executor: test-go119

workflows:
workflow:
jobs:
- go118
- go119
- go120
12 changes: 10 additions & 2 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Check that test files don't contain focussed test cases.
errored=false
for f in $(git diff --cached --name-only); do
for f in $(git diff --diff-filter=d --cached --name-only); do
if [[ $f != *_test.go ]]; then continue; fi
output=$(git show :"$f" | grep -n -e "FIt(" -e "FContext(" -e "FDescribe(")
if [ $? -eq 0 ]; then
Expand All @@ -13,8 +13,16 @@ for f in $(git diff --cached --name-only); do
fi
done

pushd ./integrationtests/gomodvendor > /dev/null
go mod tidy
if [[ -n $(git diff --diff-filter=d --name-only -- "go.mod" "go.sum") ]]; then
echo "go.mod / go.sum in integrationtests/gomodvendor not tidied"
errored=true
fi
popd > /dev/null

# Check that all Go files are properly gofumpt-ed.
output=$(gofumpt -d $(git diff --cached --name-only -- '*.go'))
output=$(gofumpt -d $(git diff --diff-filter=d --cached --name-only -- '*.go'))
if [ -n "$output" ]; then
echo "Found files that are not properly gofumpt-ed."
echo "$output"
Expand Down
23 changes: 15 additions & 8 deletions .github/workflows/build-interop-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@ jobs:
interop:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/build-push-action@v1
- uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64,linux/arm64
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
always_pull: true
path: interop/
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
repository: martenseemann/quic-go-interop
tags: latest
tag_with_ref: true
add_git_labels: true
- uses: docker/build-push-action@v4
with:
context: "{{defaultContext}}:interop"
platforms: linux/amd64,linux/arm64
push: true
tags: martenseemann/quic-go-interop:latest
48 changes: 29 additions & 19 deletions .github/workflows/cross-compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,32 @@

set -e

GOVERSION=$(go version | cut -d " " -f 3 | cut -b 3-6)

for dist in $(go tool dist list); do
goos=$(echo $dist | cut -d "/" -f1)
goarch=$(echo $dist | cut -d "/" -f2)
# cross-compiling for android is a pain...
if [[ "$goos" == "android" ]]; then continue; fi
# Go 1.14 lacks syscall.IPV6_RECVTCLASS
if [[ $GOVERSION == "1.14" && $goos == "darwin" && $goarch == "arm" ]]; then continue; fi
# darwin/arm64 requires Cgo for Go < 1.16
if [[ $GOVERSION != "1.16" && "$goos" == "darwin" && $goarch == "arm64" ]]; then continue; fi
# iOS builds require Cgo, see https://github.com/golang/go/issues/43343
# Cgo would then need a C cross compilation setup. Not worth the hassle.
if [[ "$goos" == "ios" ]]; then continue; fi

echo "$dist"
GOOS=$goos GOARCH=$goarch go build -o main example/main.go
rm main
done
dist="$1"
goos=$(echo "$dist" | cut -d "/" -f1)
goarch=$(echo "$dist" | cut -d "/" -f2)

# cross-compiling for android is a pain...
if [[ "$goos" == "android" ]]; then exit; fi
# iOS builds require Cgo, see https://github.com/golang/go/issues/43343
# Cgo would then need a C cross compilation setup. Not worth the hassle.
if [[ "$goos" == "ios" ]]; then exit; fi

# Write all log output to a temporary file instead of to stdout.
# That allows running this script in parallel, while preserving the correct order of the output.
log_file=$(mktemp)

error_handler() {
cat "$log_file" >&2
rm "$log_file"
exit 1
}

trap 'error_handler' ERR

echo "$dist" >> "$log_file"
out="main-$goos-$goarch"
GOOS=$goos GOARCH=$goarch go build -o $out example/main.go >> "$log_file" 2>&1
rm $out

cat "$log_file"
rm "$log_file"
12 changes: 6 additions & 6 deletions .github/workflows/cross-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ jobs:
strategy:
fail-fast: false
matrix:
go: [ "1.18.x", "1.19.x" ]
runs-on: ubuntu-latest
go: [ "1.20.x", "1.21.0-rc.3" ]
runs-on: ${{ fromJSON(vars['CROSS_COMPILE_RUNNER_UBUNTU'] || '"ubuntu-latest"') }}
name: "Cross Compilation (Go ${{matrix.go}})"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
stable: '!contains(${{ matrix.go }}, "beta") && !contains(${{ matrix.go }}, "rc")'
go-version: ${{ matrix.go }}
- name: Install build utils
run: |
Expand All @@ -20,4 +19,5 @@ jobs:
- name: Install dependencies
run: go build example/main.go
- name: Run cross compilation
run: .github/workflows/cross-compile.sh
# run in parallel on as many cores as are available on the machine
run: go tool dist list | xargs -I % -P "$(nproc)" .github/workflows/cross-compile.sh %
4 changes: 4 additions & 0 deletions .github/workflows/go-generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ cp -r "$DIR" generated
cd generated
# delete all go-generated files generated (that adhere to the comment convention)
grep --include \*.go -lrIZ "^// Code generated .* DO NOT EDIT\.$" . | xargs --null rm

# First regenerate sys_conn_buffers_write.go.
# If it doesn't exist, the following mockgen calls will fail.
go generate -run "sys_conn_buffers_write.go"
# now generate everything
go generate ./...
cd ..
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/go-generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ jobs:
gogenerate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.19.x"
go-version: "1.20.x"
- name: Install dependencies
run: go build
- name: Run code generators
Expand Down
33 changes: 23 additions & 10 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,45 @@ jobs:
strategy:
fail-fast: false
matrix:
go: [ "1.18.x", "1.19.x" ]
runs-on: ubuntu-latest
go: [ "1.20.x", "1.21.0-rc.3" ]
runs-on: ${{ fromJSON(vars['INTEGRATION_RUNNER_UBUNTU'] || '"ubuntu-latest"') }}
env:
DEBUG: false # set this to true to export qlogs and save them as artifacts
TIMESCALE_FACTOR: 3
name: Integration Tests (Go ${{ matrix.go }})
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
stable: '!contains(${{ matrix.go }}, "beta") && !contains(${{ matrix.go }}, "rc")'
go-version: ${{ matrix.go }}
- run: go version
- name: set qlogger
if: env.DEBUG == 'true'
run: echo "QLOGFLAG=-- -qlog" >> $GITHUB_ENV
- name: Run tests
run: echo "QLOGFLAG= -qlog" >> $GITHUB_ENV
- name: Run other tests
run: |
go run github.com/onsi/ginkgo/v2/ginkgo -r -v -randomize-all -randomize-suites -trace -skip-package self integrationtests
go run github.com/onsi/ginkgo/v2/ginkgo -r -v -randomize-all -randomize-suites -trace integrationtests/self ${{ env.QLOGFLAG }}
go run github.com/onsi/ginkgo/v2/ginkgo -r -v -randomize-all -randomize-suites -trace -skip-package self,versionnegotiation integrationtests
go run github.com/onsi/ginkgo/v2/ginkgo -r -v -randomize-all -randomize-suites -trace integrationtests/versionnegotiation -- ${{ env.QLOGFLAG }}
- name: Run self tests, using QUIC v1
if: success() || failure() # run this step even if the previous one failed
run: go run github.com/onsi/ginkgo/v2/ginkgo -r -v -randomize-all -randomize-suites -trace integrationtests/self -- -version=1 ${{ env.QLOGFLAG }}
- name: Run self tests, using QUIC v2
if: success() || failure() # run this step even if the previous one failed
run: go run github.com/onsi/ginkgo/v2/ginkgo -r -v -randomize-all -randomize-suites -trace integrationtests/self -- -version=2 ${{ env.QLOGFLAG }}
- name: Run set tests, with GSO enabled
if: success() || failure() # run this step even if the previous one failed
env:
QUIC_GO_ENABLE_GSO: true
run: go run github.com/onsi/ginkgo/v2/ginkgo -r -v -randomize-all -randomize-suites -trace integrationtests/self -- -version=1 ${{ env.QLOGFLAG }}
- name: Run tests (32 bit)
if: success() || failure() # run this step even if the previous one failed
env:
GOARCH: 386
run: |
go run github.com/onsi/ginkgo/v2/ginkgo -r -v -randomize-all -randomize-suites -trace -skip-package self integrationtests
go run github.com/onsi/ginkgo/v2/ginkgo -r -v -randomize-all -randomize-suites -trace integrationtests/self ${{ env.QLOGFLAG }}
go run github.com/onsi/ginkgo/v2/ginkgo -r -v -randomize-all -randomize-suites -trace -skip-package self,versionnegotiation integrationtests
go run github.com/onsi/ginkgo/v2/ginkgo -r -v -randomize-all -randomize-suites -trace integrationtests/versionnegotiation -- ${{ env.QLOGFLAG }}
go run github.com/onsi/ginkgo/v2/ginkgo -r -v -randomize-all -randomize-suites -trace integrationtests/self -- ${{ env.QLOGFLAG }}
- name: save qlogs
if: ${{ always() && env.DEBUG == 'true' }}
uses: actions/upload-artifact@v2
Expand Down
55 changes: 47 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.19.x"
skip-pkg-cache: true
go-version: "1.20.x"
- name: Check that no non-test files import Ginkgo or Gomega
run: .github/workflows/no_ginkgo.sh
- name: Check that go.mod is tidied
Expand All @@ -24,11 +25,49 @@ jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: "1.19.x"
- name: golangci-lint
go-version: "1.20.x"
- name: golangci-lint (Linux)
uses: golangci/golangci-lint-action@v3
with:
version: v1.48.0
skip-pkg-cache: true
args: --timeout=3m
version: v1.52.2
- name: golangci-lint (Windows)
if: success() || failure() # run this step even if the previous one failed
uses: golangci/golangci-lint-action@v3
env:
GOOS: "windows"
with:
skip-pkg-cache: true
args: --timeout=3m
version: v1.52.2
- name: golangci-lint (OSX)
if: success() || failure() # run this step even if the previous one failed
uses: golangci/golangci-lint-action@v3
env:
GOOS: "darwin"
with:
skip-pkg-cache: true
args: --timeout=3m
version: v1.52.2
- name: golangci-lint (FreeBSD)
if: success() || failure() # run this step even if the previous one failed
uses: golangci/golangci-lint-action@v3
env:
GOOS: "freebsd"
with:
skip-pkg-cache: true
args: --timeout=3m
version: v1.52.2
- name: golangci-lint (others)
if: success() || failure() # run this step even if the previous one failed
uses: golangci/golangci-lint-action@v3
env:
GOOS: "solaris" # some OS that we don't have any build tags for
with:
skip-pkg-cache: true
args: --timeout=3m
version: v1.52.2
23 changes: 16 additions & 7 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,29 @@ jobs:
fail-fast: false
matrix:
os: [ "ubuntu", "windows", "macos" ]
go: [ "1.18.x", "1.19.x" ]
runs-on: ${{ matrix.os }}-latest
go: [ "1.20.x", "1.21.0-rc.3" ]
runs-on: ${{ fromJSON(vars[format('UNIT_RUNNER_{0}', matrix.os)] || format('"{0}-latest"', matrix.os)) }}
name: Unit tests (${{ matrix.os}}, Go ${{ matrix.go }})
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
stable: '!contains(${{ matrix.go }}, "beta") && !contains(${{ matrix.go }}, "rc")'
go-version: ${{ matrix.go }}
- run: go version
- name: Run tests
env:
TIMESCALE_FACTOR: 10
run: go run github.com/onsi/ginkgo/v2/ginkgo -r -v -cover -randomize-all -randomize-suites -trace -skip-package integrationtests
- name: Run tests as root
if: ${{ matrix.os == 'ubuntu' }}
env:
TIMESCALE_FACTOR: 10
FILE: sys_conn_helper_linux_test.go
run: |
test -f $FILE # make sure the file actually exists
go run github.com/onsi/ginkgo/v2/ginkgo build -cover -tags root .
sudo ./quic-go.test -ginkgo.v -ginkgo.trace -ginkgo.randomize-all -ginkgo.focus-file=$FILE -test.coverprofile coverage-root.txt
rm quic-go.test
- name: Run tests (32 bit)
if: ${{ matrix.os != 'macos' }} # can't run 32 bit tests on OSX.
env:
Expand All @@ -33,7 +42,7 @@ jobs:
TIMESCALE_FACTOR: 20
run: go run github.com/onsi/ginkgo/v2/ginkgo -r -v -race -randomize-all -randomize-suites -trace -skip-package integrationtests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
file: coverage.txt
files: coverage.txt,coverage-root.txt
env_vars: OS=${{ matrix.os }}, GO=${{ matrix.go }}
Loading

0 comments on commit e9a8784

Please sign in to comment.