Skip to content

Commit

Permalink
add workflows test
Browse files Browse the repository at this point in the history
  • Loading branch information
keengo99 committed Dec 5, 2024
1 parent 75555aa commit 5df9de7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/kangle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: prepare
run: sudo apt -y install g++ liburing-dev libjemalloc-dev libz-dev libpcre3-dev libbrotli-dev libssl-dev cmake libsqlite3-dev
run: sudo apt -y install g++ golang liburing-dev libjemalloc-dev libz-dev libpcre3-dev libbrotli-dev libssl-dev cmake libsqlite3-dev
- name: submodule
run: git submodule init && git submodule update
- name: cmake
run: mkdir build && cd build && cmake .. -DLINUX_IOURING=ON -DENABLE_BROTLI=1
- name: make
run: cd build && make
- name: build test
run: cd test && ./build.sh
- name: test
run: cd test && ./test.sh

3 changes: 2 additions & 1 deletion test/test_framework/common/assert.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ func Assert(test_name string, expression bool) bool {
success_count++
return true
}
func Report() {
func Report() (sc int, fc int) {
fmt.Printf("success_count=[%d],failed_count=[%d]\n", success_count, failed_count)
if failed_count == 0 {
fmt.Printf("***************test passed**********\n")
} else {
fmt.Printf("@@@@@@@@@@@@@@@test failed@@@@@@@@@@\n")
}
return success_count, failed_count
}
15 changes: 9 additions & 6 deletions test/test_framework/framework/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var (
prepare_config *bool = flag.Bool("p", false, "only prepare config")
)

func ProcessSuites(suites []string) {
func ProcessSuites(suites []string) (success_count int, failed_count int) {
defer func() {
if err := recover(); err != nil {
fmt.Println(err) //这里的err其实就是panic传入的内容,55
Expand Down Expand Up @@ -62,7 +62,7 @@ func ProcessSuites(suites []string) {
}
}
if *prepare_config {
return
return 0, 0
}
if *server_model {
server.Start()
Expand Down Expand Up @@ -93,11 +93,12 @@ func ProcessSuites(suites []string) {
}
}
}
common.Report()
success_count, fc := common.Report()
if len(*kangle_exe) > 0 {
suite.Clean(suites)
kangle.Close()
}
return success_count, fc
}
func handle_signal() {
c := make(chan os.Signal, 1)
Expand Down Expand Up @@ -147,7 +148,9 @@ func Main() {
suites = strings.Split(*test_case, ",")
}
go handle_signal()
ProcessSuites(suites)
b := make([]byte, 1)
os.Stdin.Read(b)
_, fc := ProcessSuites(suites)
if fc > 0 {
os.Exit(1)
}
os.Exit(0)
}

0 comments on commit 5df9de7

Please sign in to comment.