fix: unittest

This commit is contained in:
debugtalk
2021-12-28 22:51:01 +08:00
parent f2b732a78c
commit ae53e60a50
5 changed files with 10 additions and 5 deletions

View File

@@ -32,4 +32,4 @@ Copyright 2021 debugtalk
* [hrp har2case](hrp_har2case.md) - Convert HAR to json/yaml testcase files
* [hrp run](hrp_run.md) - run API test
###### Auto generated by spf13/cobra on 28-Dec-2021
###### Auto generated by spf13/cobra on 29-Dec-2021

View File

@@ -38,4 +38,4 @@ hrp boom [flags]
* [hrp](hrp.md) - One-stop solution for HTTP(S) testing.
###### Auto generated by spf13/cobra on 28-Dec-2021
###### Auto generated by spf13/cobra on 29-Dec-2021

View File

@@ -23,4 +23,4 @@ hrp har2case harPath... [flags]
* [hrp](hrp.md) - One-stop solution for HTTP(S) testing.
###### Auto generated by spf13/cobra on 28-Dec-2021
###### Auto generated by spf13/cobra on 29-Dec-2021

View File

@@ -31,4 +31,4 @@ hrp run path... [flags]
* [hrp](hrp.md) - One-stop solution for HTTP(S) testing.
###### Auto generated by spf13/cobra on 28-Dec-2021
###### Auto generated by spf13/cobra on 29-Dec-2021

View File

@@ -1,5 +1,6 @@
// +build linux freebsd darwin
// go plugin doesn't support windows
package hrp
import (
@@ -14,7 +15,11 @@ import (
func TestMain(m *testing.M) {
fmt.Println("[TestMain] build go plugin")
cmd := exec.Command("go", "build", "-buildmode=plugin", "-o=examples/debugtalk.so", "examples/plugin/debugtalk.go")
// go tool compile -help
// all=: apply to all packages
// -N: disable optimizations
// -l: disable inlining
cmd := exec.Command("go", "build", "-buildmode=plugin", `-gcflags="all=-N -l"`, "-o=examples/debugtalk.so", "examples/plugin/debugtalk.go")
if err := cmd.Run(); err != nil {
panic(err)
}