2
0
Fork 0
mirror of https://github.com/ii64/sonic.git synced 2026-06-20 16:45:22 +08:00

ci: support codecov (#443)

This commit is contained in:
liu 2023-05-30 19:24:55 +08:00 committed by GitHub
parent 1b7b5aed27
commit a4cd15ed52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 38 additions and 35 deletions

View file

@ -28,6 +28,9 @@ jobs:
- name: Unit Test - name: Unit Test
run: | run: |
go test -v ./... go test -race -covermode=atomic -coverprofile=coverage.txt ./...
cd ./external_jsonlib_test cd ./external_jsonlib_test
go test -v ./... go test -v ./...
- name: Codecov
run: bash <(curl -s https://codecov.io/bash)

2
api.go
View file

@ -183,4 +183,4 @@ func Get(src []byte, path ...interface{}) (ast.Node, error) {
// which can reduce unnecessary memory copy. // which can reduce unnecessary memory copy.
func GetFromString(src string, path ...interface{}) (ast.Node, error) { func GetFromString(src string, path ...interface{}) (ast.Node, error) {
return ast.NewSearcher(src).GetByPath(path...) return ast.NewSearcher(src).GetByPath(path...)
} }

View file

@ -148,4 +148,4 @@ func (self *Searcher) GetByPath(path ...interface{}) (Node, error) {
return Node{}, self.parser.ExportError(err) return Node{}, self.parser.ExportError(err)
} }
return newRawNode(self.parser.s[start:self.parser.p], t), nil return newRawNode(self.parser.s[start:self.parser.p], t), nil
} }

View file

@ -256,4 +256,4 @@ func (self *Node) encodeObject(buf *[]byte) error {
*buf = append(*buf, '}') *buf = append(*buf, '}')
return nil return nil
} }

View file

@ -161,4 +161,4 @@ type PairSlice []Pair
func (self PairSlice) Sort() { func (self PairSlice) Sort() {
radixQsort(self, 0, maxDepth(len(self))) radixQsort(self, 0, maxDepth(len(self)))
} }

View file

@ -1805,4 +1805,4 @@ func unwrapError(err error) *Node {
p: unsafe.Pointer(&msg), p: unsafe.Pointer(&msg),
} }
} }
} }

View file

@ -615,4 +615,4 @@ func (self *Parser) ExportError(err types.ParsingError) error {
Src : self.s, Src : self.s,
Code: err, Code: err,
}.Description()) }.Description())
} }

View file

@ -52,4 +52,4 @@ var (
) )
//go:linkname unquoteBytes encoding/json.unquoteBytes //go:linkname unquoteBytes encoding/json.unquoteBytes
func unquoteBytes(s []byte) (t []byte, ok bool) func unquoteBytes(s []byte) (t []byte, ok bool)

View file

@ -105,4 +105,4 @@ var (
// //
// NewStreamEncoder returns a new encoder that write to w. // NewStreamEncoder returns a new encoder that write to w.
NewStreamEncoder = encoder.NewStreamEncoder NewStreamEncoder = encoder.NewStreamEncoder
) )

View file

@ -1989,4 +1989,4 @@ func (self *_Assembler) WriteRecNotAX(i int, ptr obj.Addr, rec obj.Addr, saveDI
self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}") self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Emit("MOVQ", ptr, rec) self.Emit("MOVQ", ptr, rec)
self.Link("_end_writeBarrier" + strconv.Itoa(i) + "_{n}") self.Link("_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
} }

View file

@ -1152,4 +1152,4 @@ func (self *_Compiler) checkIfSkip(p *_Program, vt reflect.Type, c byte) int {
p.pin(j) p.pin(j)
p.int(_OP_add, 1) p.int(_OP_add, 1)
return s return s
} }

View file

@ -67,4 +67,4 @@ func (self *_Assembler) debug_instr(i int, v *_Instr) {
} }
self.force_gc() self.force_gc()
} }
} }

View file

@ -252,4 +252,4 @@ func Skip(data []byte) (start int, end int) {
ret := native.SkipOne(&s, &p, m, uint64(0)) ret := native.SkipOne(&s, &p, m, uint64(0))
types.FreeStateMachine(m) types.FreeStateMachine(m)
return ret, p return ret, p
} }

View file

@ -140,4 +140,4 @@ func findOrCompile(vt *rt.GoType) (_Decoder, error) {
} else { } else {
return nil, err return nil, err
} }
} }

View file

@ -108,4 +108,4 @@ func memclrHasPointers(ptr unsafe.Pointer, n uintptr)
//go:noescape //go:noescape
//go:linkname memclrNoHeapPointers runtime.memclrNoHeapPointers //go:linkname memclrNoHeapPointers runtime.memclrNoHeapPointers
//goland:noinspection GoUnusedParameter //goland:noinspection GoUnusedParameter
func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr) func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)

View file

@ -1199,4 +1199,4 @@ func (self *_Assembler) WriteRecNotAX(i int, ptr obj.Addr, rec obj.Addr) {
self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}") self.Link("_no_writeBarrier" + strconv.Itoa(i) + "_{n}")
self.Emit("MOVQ", ptr, rec) self.Emit("MOVQ", ptr, rec)
self.Link("_end_writeBarrier" + strconv.Itoa(i) + "_{n}") self.Link("_end_writeBarrier" + strconv.Itoa(i) + "_{n}")
} }

View file

@ -202,4 +202,4 @@ func (self *_Assembler) print_ptr(i int, ptr obj.Addr, lea bool) {
self.Emit("MOVQ", _R10, _BX) self.Emit("MOVQ", _R10, _BX)
self.dcall(_F_printptr) self.dcall(_F_printptr)
self.dload(_REG_debug...) self.dload(_REG_debug...)
} }

View file

@ -325,4 +325,4 @@ func Valid(data []byte) (ok bool, start int) {
} }
return true, ret return true, ret
} }

View file

@ -62,4 +62,4 @@ func goPanic(code int, val unsafe.Pointer) {
default: default:
panic("encoder error!") panic("encoder error!")
} }
} }

View file

@ -190,4 +190,4 @@ func pretouchRec(vtm map[reflect.Type]uint8, opts option.CompileOptions) error {
} }
opts.RecursiveDepth -= 1 opts.RecursiveDepth -= 1
return pretouchRec(next, opts) return pretouchRec(next, opts)
} }

View file

@ -165,4 +165,4 @@ func asJson(v unsafe.Pointer) (string, error) {
text := assertI2I(_T_json_Marshaler, *(*rt.GoIface)(v)) text := assertI2I(_T_json_Marshaler, *(*rt.GoIface)(v))
r, e := (*(*json.Marshaler)(unsafe.Pointer(&text))).MarshalJSON() r, e := (*(*json.Marshaler)(unsafe.Pointer(&text))).MarshalJSON()
return rt.Mem2Str(r), e return rt.Mem2Str(r), e
} }

View file

@ -81,4 +81,4 @@ func (enc *StreamEncoder) Encode(val interface{}) (err error) {
free_bytes: free_bytes:
freeBytes(out) freeBytes(out)
return err return err
} }

View file

@ -63,4 +63,4 @@ func memclrNoHeapPointers(ptr unsafe.Pointer, n uintptr)
var _runtime_writeBarrier uintptr var _runtime_writeBarrier uintptr
//go:linkname gcWriteBarrierAX runtime.gcWriteBarrier //go:linkname gcWriteBarrierAX runtime.gcWriteBarrier
func gcWriteBarrierAX() func gcWriteBarrierAX()

View file

@ -132,4 +132,4 @@ func __validate_utf8(s *string, p *int, m *types.StateMachine) (ret int)
//go:nosplit //go:nosplit
//go:noescape //go:noescape
//goland:noinspection GoUnusedParameter //goland:noinspection GoUnusedParameter
func __validate_utf8_fast(s *string) (ret int) func __validate_utf8_fast(s *string) (ret int)

View file

@ -132,4 +132,4 @@ func __validate_utf8(s *string, p *int, m *types.StateMachine) (ret int)
//go:nosplit //go:nosplit
//go:noescape //go:noescape
//goland:noinspection GoUnusedParameter //goland:noinspection GoUnusedParameter
func __validate_utf8_fast(s *string) (ret int) func __validate_utf8_fast(s *string) (ret int)

View file

@ -130,4 +130,4 @@ func __validate_utf8(s *string, p *int, m *types.StateMachine) (ret int)
//go:nosplit //go:nosplit
//go:noescape //go:noescape
//goland:noinspection GoUnusedParameter //goland:noinspection GoUnusedParameter
func __validate_utf8_fast(s *string) (ret int) func __validate_utf8_fast(s *string) (ret int)

View file

@ -132,4 +132,4 @@ func __validate_utf8(s *string, p *int, m *types.StateMachine) (ret int)
//go:nosplit //go:nosplit
//go:noescape //go:noescape
//goland:noinspection GoUnusedParameter //goland:noinspection GoUnusedParameter
func __validate_utf8_fast(s *string) (ret int) func __validate_utf8_fast(s *string) (ret int)

View file

@ -141,4 +141,4 @@ func funcNameParts(name string) (string, string, string) {
return name, "", "" return name, "", ""
} }
return name[:i], "[...]", name[j+1:] return name[:i], "[...]", name[j+1:]
} }

View file

@ -542,4 +542,4 @@ func makePctab(funcs []Func, cuOffset []uint32, nameOffset []int32) (pctab []byt
return return
} }
func registerFunction(name string, pc uintptr, textSize uintptr, fp int, args int, size uintptr, argptrs uintptr, localptrs uintptr) {} func registerFunction(name string, pc uintptr, textSize uintptr, fp int, args int, size uintptr, argptrs uintptr, localptrs uintptr) {}

View file

@ -34,4 +34,4 @@ type Loader struct {
Name string // module name Name string // module name
File string // file name File string // file name
Options Options
} }

View file

@ -101,4 +101,4 @@ func Load(text []byte, funcs []Func, modulename string, filenames []string) (out
out[i] = Function(&m) out[i] = Function(&m)
} }
return return
} }

View file

@ -139,4 +139,4 @@ func TestLoad(t *testing.T) {
require.Equal(t, 2, j) require.Equal(t, 2, j)
require.Equal(t, "hook1", hstr) require.Equal(t, "hook1", hstr)
} }

View file

@ -42,4 +42,4 @@ func mprotect(p uintptr, nb int) {
if _, _, err := syscall.RawSyscall(syscall.SYS_MPROTECT, p, uintptr(nb), _RX); err != 0 { if _, _, err := syscall.RawSyscall(syscall.SYS_MPROTECT, p, uintptr(nb), _RX); err != 0 {
panic(err) panic(err)
} }
} }

View file

@ -97,4 +97,4 @@ func (self Pcdata) MarshalBinary() (data []byte, err error) {
sv = v.Val sv = v.Val
} }
return return
} }

View file

@ -68,4 +68,4 @@ func Validate(src []byte) bool {
// ValidateString as Validate, but for string. // ValidateString as Validate, but for string.
func ValidateString(src string) bool { func ValidateString(src string) bool {
return native.ValidateUTF8Fast(&src) == 0 return native.ValidateUTF8Fast(&src) == 0
} }