1// Copyright 2020 The BoringSSL Authors 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// https://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package testconfig 16 17import ( 18 "encoding/json" 19 "os" 20) 21 22type Test struct { 23 Cmd []string `json:"cmd"` 24 Env []string `json:"env"` 25 SkipSDE bool `json:"skip_sde"` 26 Shard bool `json:"shard"` 27} 28 29func ParseTestConfig(filename string) ([]Test, error) { 30 in, err := os.Open(filename) 31 if err != nil { 32 return nil, err 33 } 34 defer in.Close() 35 36 decoder := json.NewDecoder(in) 37 var result []Test 38 if err := decoder.Decode(&result); err != nil { 39 return nil, err 40 } 41 return result, nil 42} 43