Skip to content

Commit cb07497

Browse files
authoredMar 29, 2021
Add subdirectories to tested folders in Github workflow (#108)
* Add subdirectories to tested folders in Github workflow * Fix Header test * Fix Fprint redundant newline errors * Increase Github workflow timeout for test job * 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/
1 parent dd4ab8f commit cb07497

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed
 

‎.github/workflows/.go.yml

+6-5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ jobs:
2020
allowfail: true
2121
runs-on: ${{ matrix.os }}
2222
continue-on-error: ${{ matrix.allowfail }}
23+
timeout-minutes: 5
2324
steps:
2425
- name: Install Go ${{ matrix.go }} on ${{ matrix.os }}
2526
if: matrix.go != 'tip'
@@ -34,14 +35,14 @@ jobs:
3435
git clone --depth=1 https://go.googlesource.com/go $HOME/gotip
3536
cd $HOME/gotip/src
3637
./make.bash
37-
echo "::set-env name=GOROOT::$HOME/gotip"
38-
echo "::add-path::$HOME/gotip/bin"
38+
echo "GOROOT=$HOME/gotip" >> $GITHUB_ENV
39+
echo "$HOME/gotip/bin" >> $GITHUB_PATH
3940
- name: Checkout code
4041
uses: actions/checkout@v2
4142
- name: Run tests
4243
run: |
43-
go test -v -race
44-
go test -race -tags=${{ matrix.tags }}
44+
go test ./... -v -race
45+
go test ./... -race -tags=${{ matrix.tags }}
4546
4647
coverage:
4748
env:
@@ -70,7 +71,7 @@ jobs:
7071
- name: Calc coverage
7172
run: |
7273
export PATH=$PATH:$(go env GOPATH)/bin
73-
go test -v -covermode=atomic -coverprofile=coverage.out
74+
go test ./... -v -covermode=atomic -coverprofile=coverage.out
7475
- name: Convert coverage to lcov
7576
uses: jandelgado/gcov2lcov-action@v1.0.0
7677
with:

‎genlib2/dense_io.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -657,29 +657,29 @@ func init() {
657657
func generateDenseIO(f io.Writer, generic Kinds) {
658658
mk := Kinds{Kinds: filter(generic.Kinds, isNumber)}
659659

660-
fmt.Fprintln(f, "/* GOB SERIALIZATION */\n")
660+
fmt.Fprint(f, "/* GOB SERIALIZATION */\n\n")
661661
gobEncode.Execute(f, mk)
662662
gobDecode.Execute(f, mk)
663663
fmt.Fprint(f, "\n")
664664

665-
fmt.Fprintln(f, "/* NPY SERIALIZATION */\n")
665+
fmt.Fprint(f, "/* NPY SERIALIZATION */\n\n")
666666
fmt.Fprintln(f, npyDescRE)
667667
fmt.Fprintln(f, rowOrderRE)
668668
fmt.Fprintln(f, shapeRE)
669669
fmt.Fprintln(f, writeNpyRaw)
670670
readNpy.Execute(f, mk)
671671
fmt.Fprint(f, "\n")
672672

673-
fmt.Fprintln(f, "/* CSV SERIALIZATION */\n")
673+
fmt.Fprint(f, "/* CSV SERIALIZATION */\n\n")
674674
fmt.Fprintln(f, writeCSVRaw)
675675
readCSV.Execute(f, mk)
676676
fmt.Fprint(f, "\n")
677677

678-
fmt.Fprintln(f, "/* FB SERIALIZATION */\n")
678+
fmt.Fprint(f, "/* FB SERIALIZATION */\n\n")
679679
fmt.Fprintln(f, fbEncodeDecodeRaw)
680680
fmt.Fprint(f, "\n")
681681

682-
fmt.Fprintln(f, "/* PB SERIALIZATION */\n")
682+
fmt.Fprint(f, "/* PB SERIALIZATION */\n\n")
683683
fmt.Fprintln(f, pbEncodeDecodeRaw)
684684
fmt.Fprint(f, "\n")
685685

‎internal/storage/header_test.go

+6-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package storage
33
import (
44
"reflect"
55
"testing"
6-
"unsafe"
76

87
"github.com/stretchr/testify/assert"
98
)
@@ -14,30 +13,26 @@ func TestFill(t *testing.T) {
1413
b := headerFromSlice([]int{10, 11})
1514
copied := Fill(reflect.TypeOf(1), &a, &b)
1615

17-
assert.Equal(t, copied, 5)
18-
assert.Equal(t, a.Ints(), []int{10, 11, 10, 11, 10})
16+
assert.Equal(t, 5, copied)
17+
assert.Equal(t, []int{10, 11, 10, 11, 10}, a.Ints())
1918

2019
// B longer than A
2120
a = headerFromSlice([]int{10, 11})
2221
b = headerFromSlice([]int{0, 1, 2, 3, 4})
2322
copied = Fill(reflect.TypeOf(1), &a, &b)
2423

25-
assert.Equal(t, copied, 2)
26-
assert.Equal(t, a.Ints(), []int{0, 1})
24+
assert.Equal(t, 2, copied)
25+
assert.Equal(t, []int{0, 1}, a.Ints())
2726
}
2827

2928
func headerFromSlice(x interface{}) Header {
3029
xT := reflect.TypeOf(x)
3130
if xT.Kind() != reflect.Slice {
3231
panic("Expected a slice")
3332
}
34-
3533
xV := reflect.ValueOf(x)
36-
uptr := unsafe.Pointer(xV.Pointer())
37-
34+
size := uintptr(xV.Len()) * xT.Elem().Size()
3835
return Header{
39-
Ptr: uptr,
40-
L: xV.Len(),
41-
C: xV.Cap(),
36+
Raw: FromMemory(xV.Pointer(), size),
4237
}
4338
}

0 commit comments

Comments
 (0)