| 158 | } |
| 159 | |
| 160 | func Load(dirname string) ([]Bundle, error) { |
| 161 | var bundles []Bundle |
| 162 | fileinfos, err := os.ReadDir(dirname) |
| 163 | if err != nil { |
| 164 | return nil, err |
| 165 | } |
| 166 | for _, fi := range fileinfos { |
| 167 | filename := fi.Name() |
| 168 | if !strings.HasSuffix(filename, ".yaml") { |
| 169 | continue |
| 170 | } |
| 171 | filename = filepath.Join(dirname, filename) |
| 172 | zts, err := FromYAMLFile(filename) |
| 173 | if err != nil { |
| 174 | bundles = append(bundles, Bundle{filename, nil, err}) |
| 175 | continue |
| 176 | } |
| 177 | for _, zt := range zts { |
| 178 | bundles = append(bundles, Bundle{filename, zt, nil}) |
| 179 | } |
| 180 | } |
| 181 | return bundles, nil |
| 182 | } |
| 183 | |
| 184 | // Run runs the ztests in the directory named dirname. For each file f.yaml in |
| 185 | // the directory, Run calls FromYAMLFile to load a ztest and then runs it in |