diff options
Diffstat (limited to 'fluent-bit/tests/runtime/wasm')
-rw-r--r-- | fluent-bit/tests/runtime/wasm/go/Makefile | 24 | ||||
-rw-r--r-- | fluent-bit/tests/runtime/wasm/go/append_tag.go | 39 | ||||
-rw-r--r-- | fluent-bit/tests/runtime/wasm/go/drop_record.go | 8 | ||||
-rw-r--r-- | fluent-bit/tests/runtime/wasm/go/go.mod | 9 | ||||
-rw-r--r-- | fluent-bit/tests/runtime/wasm/go/go.sum | 10 | ||||
-rw-r--r-- | fluent-bit/tests/runtime/wasm/go/modify_record.go | 39 | ||||
-rw-r--r-- | fluent-bit/tests/runtime/wasm/go/numeric_records.go | 44 | ||||
-rw-r--r-- | fluent-bit/tests/runtime/wasm/go/say_hello.go | 14 |
8 files changed, 0 insertions, 187 deletions
diff --git a/fluent-bit/tests/runtime/wasm/go/Makefile b/fluent-bit/tests/runtime/wasm/go/Makefile deleted file mode 100644 index ddd32f88..00000000 --- a/fluent-bit/tests/runtime/wasm/go/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -.PHONY: build - -build: append_tag numeric_records say_hello modify_record - -append_tag: - tinygo build -wasm-abi=generic -target=wasi -o $@.wasm $@.go - -modify_record: - tinygo build -wasm-abi=generic -target=wasi -o $@.wasm $@.go - -numeric_records: - tinygo build -wasm-abi=generic -target=wasi -o $@.wasm $@.go - -say_hello: - tinygo build -wasm-abi=generic -target=wasi -o $@.wasm $@.go - -drop_record: - tinygo build -wasm-abi=generic -target=wasi -o $@.wasm $@.go - -testdata: - cp *.wasm ../../data/wasm - -clean: - rm -f *.wasm diff --git a/fluent-bit/tests/runtime/wasm/go/append_tag.go b/fluent-bit/tests/runtime/wasm/go/append_tag.go deleted file mode 100644 index 813afc51..00000000 --- a/fluent-bit/tests/runtime/wasm/go/append_tag.go +++ /dev/null @@ -1,39 +0,0 @@ -package main - -import ( - "fmt" - "time" - "unsafe" - - "github.com/valyala/fastjson" -) - -//export filter_append_tag -func filter_append_tag(tag *uint8, tag_len uint, time_sec uint, time_nsec uint, record *uint8, record_len uint) *uint8 { - btag := unsafe.Slice(tag, tag_len) // Note, requires Go 1.17+ (tinygo 0.20+) - brecord := unsafe.Slice(record, record_len) - _ = time.Unix(int64(time_sec), int64(time_nsec)) - - br := string(brecord) - var p fastjson.Parser - value, err := p.Parse(br) - if err != nil { - fmt.Println(err) - return nil - } - obj, err := value.Object() - if err != nil { - fmt.Println(err) - return nil - } - - var arena fastjson.Arena - obj.Set("tag", arena.NewString(string(btag))) - s := obj.String() - s += string(rune(0)) // Note: explicit null terminator. - rv := []byte(s) - - return &rv[0] -} - -func main() {} diff --git a/fluent-bit/tests/runtime/wasm/go/drop_record.go b/fluent-bit/tests/runtime/wasm/go/drop_record.go deleted file mode 100644 index 30be9711..00000000 --- a/fluent-bit/tests/runtime/wasm/go/drop_record.go +++ /dev/null @@ -1,8 +0,0 @@ -package main - -//export filter_drop_record -func filter_drop_record(tag *uint8, tag_len uint, time_sec uint, time_nsec uint, record *uint8, record_len uint) *uint8 { - return nil -} - -func main() {} diff --git a/fluent-bit/tests/runtime/wasm/go/go.mod b/fluent-bit/tests/runtime/wasm/go/go.mod deleted file mode 100644 index 8250a72d..00000000 --- a/fluent-bit/tests/runtime/wasm/go/go.mod +++ /dev/null @@ -1,9 +0,0 @@ -module filter_wasm_go - -go 1.18 - -require ( - github.com/valyala/fastjson v1.6.3 // indirect - github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect - github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect -) diff --git a/fluent-bit/tests/runtime/wasm/go/go.sum b/fluent-bit/tests/runtime/wasm/go/go.sum deleted file mode 100644 index 8e55f9a7..00000000 --- a/fluent-bit/tests/runtime/wasm/go/go.sum +++ /dev/null @@ -1,10 +0,0 @@ -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/valyala/fastjson v1.6.3 h1:tAKFnnwmeMGPbwJ7IwxcTPCNr3uIzoIj3/Fh90ra4xc= -github.com/valyala/fastjson v1.6.3/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= -github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= -github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/fluent-bit/tests/runtime/wasm/go/modify_record.go b/fluent-bit/tests/runtime/wasm/go/modify_record.go deleted file mode 100644 index 8a53a87f..00000000 --- a/fluent-bit/tests/runtime/wasm/go/modify_record.go +++ /dev/null @@ -1,39 +0,0 @@ -package main - -import ( - "fmt" - "time" - "unsafe" - - "github.com/valyala/fastjson" -) - -//export filter_modify_record -func filter_modify_record(tag *uint8, tag_len uint, time_sec uint, time_nsec uint, record *uint8, record_len uint) *uint8 { - _ = unsafe.Slice(tag, tag_len) // Note, requires Go 1.17+ (tinygo 0.20+) - brecord := unsafe.Slice(record, record_len) - _ = time.Unix(int64(time_sec), int64(time_nsec)) - - br := string(brecord) - var p fastjson.Parser - value, err := p.Parse(br) - if err != nil { - fmt.Println(err) - return nil - } - obj, err := value.Object() - if err != nil { - fmt.Println(err) - return nil - } - - var arena fastjson.Arena - obj.Set("modify", arena.NewString(string("yes"))) - s := obj.String() - s += string(rune(0)) // Note: explicit null terminator. - rv := []byte(s) - - return &rv[0] -} - -func main() {} diff --git a/fluent-bit/tests/runtime/wasm/go/numeric_records.go b/fluent-bit/tests/runtime/wasm/go/numeric_records.go deleted file mode 100644 index 4604f454..00000000 --- a/fluent-bit/tests/runtime/wasm/go/numeric_records.go +++ /dev/null @@ -1,44 +0,0 @@ -package main - -import ( - "fmt" - "time" - "unsafe" - - "github.com/valyala/fastjson" -) - -//export filter_numeric_records -func filter_numeric_records(tag *uint8, tag_len uint, time_sec uint, time_nsec uint, record *uint8, record_len uint) *uint8 { - _ = unsafe.Slice(tag, tag_len) // Note, requires Go 1.17+ (tinygo 0.20+) - brecord := unsafe.Slice(record, record_len) - _ = time.Unix(int64(time_sec), int64(time_nsec)) - - br := string(brecord) - var p fastjson.Parser - value, err := p.Parse(br) - if err != nil { - fmt.Println(err) - return nil - } - obj, err := value.Object() - if err != nil { - fmt.Println(err) - return nil - } - - var arena fastjson.Arena - obj.Set("wasm_int1", arena.NewNumberInt(10)) - obj.Set("wasm_int2", arena.NewNumberInt(100)) - obj.Set("wasm_float1", arena.NewNumberFloat64(10.5)) - obj.Set("wasm_float2", arena.NewNumberFloat64(100.5)) - obj.Set("wasm_truncate_float", arena.NewNumberFloat64(120.0)) - obj.Set("wasm_exp_float", arena.NewNumberFloat64(3.54789e-3)) - s := obj.String() - s += string(rune(0)) // Note: explicit null terminator. - rv := []byte(s) - - return &rv[0] -} - -func main() {} diff --git a/fluent-bit/tests/runtime/wasm/go/say_hello.go b/fluent-bit/tests/runtime/wasm/go/say_hello.go deleted file mode 100644 index e5efa3f9..00000000 --- a/fluent-bit/tests/runtime/wasm/go/say_hello.go +++ /dev/null @@ -1,14 +0,0 @@ -package main - -import ( - "fmt" -) - -//export filter_say_hello -func filter_say_hello(tag *uint8, tag_len uint, time_sec uint, time_nsec uint, record *uint8, record_len uint) *uint8 { - fmt.Println("Hello from WASM!") - - return record -} - -func main() {} |