Skip to content

Commit

Permalink
force to exit when timeout (#80)
Browse files Browse the repository at this point in the history
Signed-off-by: wjhuang2016 <[email protected]>
  • Loading branch information
wjhuang2016 authored Apr 22, 2024
1 parent bfb7207 commit 435af32
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"database/sql"
"flag"
"fmt"
"os"
"time"

. "github.com/PingCAP-QE/schrddl/ddl"
Expand Down Expand Up @@ -63,6 +64,11 @@ func prepareEnv() {
mysql.SetLogger(log.Logger())
}

func timeoutExitLoop(timeout time.Duration) {
time.Sleep(timeout + 20*time.Second)
os.Exit(0)
}

func main() {
flag.Parse()
if *output != "" {
Expand Down Expand Up @@ -94,5 +100,8 @@ func main() {
log.Fatalf("unknown test mode: %s", *mode)
}
prepareEnv()
go func() {
timeoutExitLoop(*testTime)
}()
Run(*dbAddr, *dbName, *concurrency, *tablesToCreate, *mysqlCompatible, testType, *testTime)
}

0 comments on commit 435af32

Please sign in to comment.