mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 17:35:30 +00:00
tools/test-all.sh: Reimplement in golang
Makes future development easier. New features: * A more compact and cleaner results view * Concurrent testing, much quicker across multiple cores * Supports comparing output against an expected file, including a text diff of differences. Also has a flag for updating the expected outputs * Advanced file-globbing support, including scanning for files in subdirectories * Skip lists are now no longer hidden away in the tool, but defined as a SKIP header in the *.expected.* file Change-Id: I4fac80bb084a720ec9a307b4acf9f73792973a1d Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/50903 Commit-Queue: Ben Clayton <bclayton@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
committed by
Commit Bot service account
parent
72f6ba4efe
commit
57b2a06ba7
@@ -22,6 +22,7 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"dawn.googlesource.com/tint/tools/src/match"
|
||||
)
|
||||
@@ -92,7 +93,12 @@ func LoadConfig(path string) (Config, error) {
|
||||
if err != nil {
|
||||
return Config{}, err
|
||||
}
|
||||
d := json.NewDecoder(bytes.NewReader(cfgBody))
|
||||
return ParseConfig(string(cfgBody))
|
||||
}
|
||||
|
||||
// ParseConfig parses the config from a JSON string.
|
||||
func ParseConfig(config string) (Config, error) {
|
||||
d := json.NewDecoder(strings.NewReader(config))
|
||||
cfg := Config{}
|
||||
if err := d.Decode(&cfg); err != nil {
|
||||
return Config{}, err
|
||||
@@ -100,6 +106,17 @@ func LoadConfig(path string) (Config, error) {
|
||||
return cfg, nil
|
||||
}
|
||||
|
||||
// MustParseConfig parses the config from a JSON string, panicing if the config
|
||||
// does not parse
|
||||
func MustParseConfig(config string) Config {
|
||||
d := json.NewDecoder(strings.NewReader(config))
|
||||
cfg := Config{}
|
||||
if err := d.Decode(&cfg); err != nil {
|
||||
panic(fmt.Errorf("Failed to parse config: %w\nConfig:\n%v", err, config))
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
|
||||
// rule is a search path predicate.
|
||||
// root is the project relative path.
|
||||
// cond is the value to return if the rule doesn't either include or exclude.
|
||||
|
||||
Reference in New Issue
Block a user