From 61957e6cdfa9b39fba04b23b7a61d7ee0c162e4a Mon Sep 17 00:00:00 2001 From: Mark Kremer Date: Sat, 27 Mar 2021 20:46:33 +0100 Subject: [PATCH 1/5] Add subdirectories to tested folders in Github workflow --- .github/workflows/.go.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/.go.yml b/.github/workflows/.go.yml index c323ab7..28b5d41 100644 --- a/.github/workflows/.go.yml +++ b/.github/workflows/.go.yml @@ -40,8 +40,8 @@ jobs: uses: actions/checkout@v2 - name: Run tests run: | - go test -v -race - go test -race -tags=${{ matrix.tags }} + go test ./... -v -race + go test ./... -race -tags=${{ matrix.tags }} coverage: env: @@ -70,7 +70,7 @@ jobs: - name: Calc coverage run: | export PATH=$PATH:$(go env GOPATH)/bin - go test -v -covermode=atomic -coverprofile=coverage.out + go test ./... -v -covermode=atomic -coverprofile=coverage.out - name: Convert coverage to lcov uses: jandelgado/gcov2lcov-action@v1.0.0 with: From b1438d2580f16fc509940daaf249646199987f51 Mon Sep 17 00:00:00 2001 From: Mark Kremer Date: Sat, 27 Mar 2021 21:30:00 +0100 Subject: [PATCH 2/5] Fix Header test --- internal/storage/header_test.go | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/internal/storage/header_test.go b/internal/storage/header_test.go index c59fe58..bf6ed73 100644 --- a/internal/storage/header_test.go +++ b/internal/storage/header_test.go @@ -3,7 +3,6 @@ package storage import ( "reflect" "testing" - "unsafe" "github.com/stretchr/testify/assert" ) @@ -14,16 +13,16 @@ func TestFill(t *testing.T) { b := headerFromSlice([]int{10, 11}) copied := Fill(reflect.TypeOf(1), &a, &b) - assert.Equal(t, copied, 5) - assert.Equal(t, a.Ints(), []int{10, 11, 10, 11, 10}) + assert.Equal(t, 5, copied) + assert.Equal(t, []int{10, 11, 10, 11, 10}, a.Ints()) // B longer than A a = headerFromSlice([]int{10, 11}) b = headerFromSlice([]int{0, 1, 2, 3, 4}) copied = Fill(reflect.TypeOf(1), &a, &b) - assert.Equal(t, copied, 2) - assert.Equal(t, a.Ints(), []int{0, 1}) + assert.Equal(t, 2, copied) + assert.Equal(t, []int{0, 1}, a.Ints()) } func headerFromSlice(x interface{}) Header { @@ -31,13 +30,9 @@ func headerFromSlice(x interface{}) Header { if xT.Kind() != reflect.Slice { panic("Expected a slice") } - xV := reflect.ValueOf(x) - uptr := unsafe.Pointer(xV.Pointer()) - + size := uintptr(xV.Len()) * xT.Elem().Size() return Header{ - Ptr: uptr, - L: xV.Len(), - C: xV.Cap(), + Raw: FromMemory(xV.Pointer(), size), } } From 428af06918fa58838e9f46d5dae785e8bf0b742e Mon Sep 17 00:00:00 2001 From: Mark Kremer Date: Sat, 27 Mar 2021 21:31:06 +0100 Subject: [PATCH 3/5] Fix Fprint redundant newline errors --- genlib2/dense_io.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/genlib2/dense_io.go b/genlib2/dense_io.go index 814067f..4a63ddd 100644 --- a/genlib2/dense_io.go +++ b/genlib2/dense_io.go @@ -657,12 +657,12 @@ func init() { func generateDenseIO(f io.Writer, generic Kinds) { mk := Kinds{Kinds: filter(generic.Kinds, isNumber)} - fmt.Fprintln(f, "/* GOB SERIALIZATION */\n") + fmt.Fprint(f, "/* GOB SERIALIZATION */\n\n") gobEncode.Execute(f, mk) gobDecode.Execute(f, mk) fmt.Fprint(f, "\n") - fmt.Fprintln(f, "/* NPY SERIALIZATION */\n") + fmt.Fprint(f, "/* NPY SERIALIZATION */\n\n") fmt.Fprintln(f, npyDescRE) fmt.Fprintln(f, rowOrderRE) fmt.Fprintln(f, shapeRE) @@ -670,16 +670,16 @@ func generateDenseIO(f io.Writer, generic Kinds) { readNpy.Execute(f, mk) fmt.Fprint(f, "\n") - fmt.Fprintln(f, "/* CSV SERIALIZATION */\n") + fmt.Fprint(f, "/* CSV SERIALIZATION */\n\n") fmt.Fprintln(f, writeCSVRaw) readCSV.Execute(f, mk) fmt.Fprint(f, "\n") - fmt.Fprintln(f, "/* FB SERIALIZATION */\n") + fmt.Fprint(f, "/* FB SERIALIZATION */\n\n") fmt.Fprintln(f, fbEncodeDecodeRaw) fmt.Fprint(f, "\n") - fmt.Fprintln(f, "/* PB SERIALIZATION */\n") + fmt.Fprint(f, "/* PB SERIALIZATION */\n\n") fmt.Fprintln(f, pbEncodeDecodeRaw) fmt.Fprint(f, "\n") From 589e8444ce240346e4e181ea13f61ff2ce6eff16 Mon Sep 17 00:00:00 2001 From: Mark Kremer Date: Mon, 29 Mar 2021 16:54:49 +0200 Subject: [PATCH 4/5] Increase Github workflow timeout for test job --- .github/workflows/.go.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/.go.yml b/.github/workflows/.go.yml index 28b5d41..c0ef348 100644 --- a/.github/workflows/.go.yml +++ b/.github/workflows/.go.yml @@ -20,6 +20,7 @@ jobs: allowfail: true runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.allowfail }} + timeout-minutes: 5 steps: - name: Install Go ${{ matrix.go }} on ${{ matrix.os }} if: matrix.go != 'tip' From 925bc06387bb47c21ff5f7830e00fbc8ba8782e1 Mon Sep 17 00:00:00 2001 From: Mark Kremer Date: Mon, 29 Mar 2021 17:20:14 +0200 Subject: [PATCH 5/5] Update set-env and add-path in Github workflow https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/ --- .github/workflows/.go.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/.go.yml b/.github/workflows/.go.yml index c0ef348..f658e9a 100644 --- a/.github/workflows/.go.yml +++ b/.github/workflows/.go.yml @@ -35,8 +35,8 @@ jobs: git clone --depth=1 https://go.googlesource.com/go $HOME/gotip cd $HOME/gotip/src ./make.bash - echo "::set-env name=GOROOT::$HOME/gotip" - echo "::add-path::$HOME/gotip/bin" + echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV + echo "$HOME/gotip/bin" >> $GITHUB_PATH - name: Checkout code uses: actions/checkout@v2 - name: Run tests