Skip to content

Commit

Permalink
Merge pull request #7213 from dolthub/db/sysbench
Browse files Browse the repository at this point in the history
[no-release-notes] /go/performance/utils/sysbench_runner/config.go: specify lua scripts to run
  • Loading branch information
coffeegoddd authored Dec 27, 2023
2 parents faa65fa + b34e332 commit d6572ea
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions go/performance/utils/sysbench_runner/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"os"
"path/filepath"
"runtime"
"strings"

"github.com/google/uuid"
)
Expand Down Expand Up @@ -78,6 +77,18 @@ var defaultSysbenchTests = []*ConfigTest{
NewConfigTest("oltp_update_non_index", []string{}, false),
}

var defaultLuaScripts = map[string]string{
"covering_index_scan.lua": "covering_index_scan.lua",
"groupby_scan.lua": "groupby_scan.lua",
"index_join.lua": "index_join.lua",
"index_join_scan.lua": "index_join_scan.lua",
"index_scan.lua": "index_scan.lua",
"oltp_delete_insert.lua": "oltp_delete_insert.lua",
"table_scan.lua": "table_scan.lua",
"types_delete_insert.lua": "types_delete_insert.lua",
"types_table_scan.lua": "types_table_scan.lua",
}

type ServerType string

// Test is a single sysbench test
Expand Down Expand Up @@ -469,7 +480,7 @@ func getDefaultTests(config *Config) ([]*ConfigTest, error) {
defaultTests := make([]*ConfigTest, 0)
defaultTests = append(defaultTests, defaultSysbenchTests...)
if config.ScriptDir != "" {
luaScriptTests, err := getLuaScriptTestsFromDir(config.ScriptDir)
luaScriptTests, err := getLuaScriptTestsFromDir(config.ScriptDir, defaultLuaScripts)
if err != nil {
return nil, err
}
Expand All @@ -478,7 +489,7 @@ func getDefaultTests(config *Config) ([]*ConfigTest, error) {
return defaultTests, nil
}

func getLuaScriptTestsFromDir(dir string) ([]*ConfigTest, error) {
func getLuaScriptTestsFromDir(dir string, toInclude map[string]string) ([]*ConfigTest, error) {
luaScripts := make([]*ConfigTest, 0)
abs, err := filepath.Abs(dir)
if err != nil {
Expand All @@ -489,13 +500,9 @@ func getLuaScriptTestsFromDir(dir string) ([]*ConfigTest, error) {
return err
}

// Append all the lua scripts except for the `_common.lua` scripts which shouldnt be tested directly
if strings.HasSuffix(path, ".lua") && !strings.Contains(path, "_common.lua") {

// todo: make this work with doltgres
if !strings.Contains(path, "postgres") && !strings.Contains(path, "dolt_branches.lua") {
luaScripts = append(luaScripts, NewConfigTest(path, []string{}, true))
}
file := filepath.Base(path)
if _, ok := toInclude[file]; ok {
luaScripts = append(luaScripts, NewConfigTest(path, []string{}, true))
}
return nil
})
Expand Down

0 comments on commit d6572ea

Please sign in to comment.