diff options
author | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-09-03 00:51:47 -0500 |
---|---|---|
committer | Flu0r1ne <flur01ne@flu0r1ne.net> | 2021-09-03 00:51:47 -0500 |
commit | 0e6b7378a564bb51b3a4289059e80fe9e3c6545b (patch) | |
tree | 9cde120cfc7a7acea9c685f15601dd41d42bd9f1 | |
parent | 287d029975b7718109f81b480079f375f7d8700a (diff) | |
download | planr-0e6b7378a564bb51b3a4289059e80fe9e3c6545b.tar.xz planr-0e6b7378a564bb51b3a4289059e80fe9e3c6545b.zip |
BUG: Fix decoding when no defaults is present
-rw-r--r-- | adapters/gtest/config.go | 11 | ||||
-rw-r--r-- | fs.go | 4 | ||||
-rw-r--r-- | stddirs.go | 11 |
3 files changed, 18 insertions, 8 deletions
diff --git a/adapters/gtest/config.go b/adapters/gtest/config.go index 4105932..457eb64 100644 --- a/adapters/gtest/config.go +++ b/adapters/gtest/config.go @@ -8,11 +8,16 @@ import ( "path" ) +const ( + DEFAULT_TIMEOUT = 1000 +) + type GtestDefaults struct { Name *string Suite *string Testfile *string Srcs *[]string + Timeout *uint } func (child *GtestDefaults) Inherit(p interface{}) { @@ -22,6 +27,7 @@ func (child *GtestDefaults) Inherit(p interface{}) { if(child.Suite == nil) { child.Suite = parent.Suite } if(child.Testfile == nil) { child.Testfile = parent.Testfile } if(child.Srcs == nil) { child.Srcs = parent.Srcs } + if(child.Timeout == nil) { child.Timeout = parent.Timeout } } @@ -37,6 +43,11 @@ func (g GtestConfig) ensureSatisfied(path string) { } else if g.Testfile == nil { log.Fatalf("\"testfile\" is not defined for unit: %s\n", path) } + + if g.Timeout == nil { + g.Timeout = new(uint) + *g.Timeout = DEFAULT_TIMEOUT; + } } func (cfg GtestConfig) srcList(srcDir string) string { @@ -141,7 +141,9 @@ func collectFromDir( log.Fatalf("Error encountered in %s: %v", child, config) } - config.Inherit(*defaults) + if defaults != nil { + config.Inherit(*defaults) + } tc := TestCase { Path: child, @@ -21,13 +21,13 @@ import ( // Env overrides const ( - ENV_CONFIG_DIR="PLANR_PLANR_DIR" - ENV_SRC_DIR="ENV_SRC_DIR" + ENV_CONFIG_DIR="PLANR_CONFIG_DIR" + ENV_SRC_DIR="PLANR_SRC_DIR" ENV_BUILD_DIR="PLANR_BUILD_DIR" ) // Try these search directories -var CONFIG_SEARCH_DIRS = [2] string { +var CONFIG_SEARCH_DIRS = [] string { "planr", ".planr", } @@ -88,7 +88,7 @@ func (c *DirConfig) SetConfigFromTree(cdir string) { for _, dir := range CONFIG_SEARCH_DIRS { configDir = filepath.Join(path, dir) - + if directoryExists(configDir) { return true } @@ -157,9 +157,6 @@ func (c DirConfig) CleanBuild() { log.Fatalf("Cannot build directory %v\n", err) } - // if err := os.Remove(build); err != nil { - // log.Fatalf("Could not remove build directory %v\n", err) - // } } func (c DirConfig) MkBuild() { |