saveTestListings creates a copy of test artifacts with given prefix including listings (.lst*), queues (.que) and filters (.flt, .flt.md5)
(prefix string, keepSource bool)
| 1232 | // saveTestListings creates a copy of test artifacts with given prefix |
| 1233 | // including listings (.lst*), queues (.que) and filters (.flt, .flt.md5) |
| 1234 | func (b *bisyncTest) saveTestListings(prefix string, keepSource bool) (err error) { |
| 1235 | count := 0 |
| 1236 | for _, srcFile := range b.listDir(b.workDir) { |
| 1237 | switch fileType(srcFile) { |
| 1238 | case "listing", "queue", "filters": |
| 1239 | // fall thru |
| 1240 | default: |
| 1241 | continue |
| 1242 | } |
| 1243 | count++ |
| 1244 | dstFile := fmt.Sprintf("%s.%s.sav", prefix, b.toGolden(srcFile)) |
| 1245 | src := filepath.Join(b.workDir, srcFile) |
| 1246 | dst := filepath.Join(b.workDir, dstFile) |
| 1247 | if err = bilib.CopyFile(src, dst); err != nil { |
| 1248 | return |
| 1249 | } |
| 1250 | if keepSource { |
| 1251 | continue |
| 1252 | } |
| 1253 | if err = os.Remove(src); err != nil { |
| 1254 | return |
| 1255 | } |
| 1256 | } |
| 1257 | if count == 0 { |
| 1258 | err = errors.New("listings not found") |
| 1259 | } |
| 1260 | return |
| 1261 | } |
| 1262 | |
| 1263 | func (b *bisyncTest) copyFile(ctx context.Context, src, dst, asName string) (err error) { |
| 1264 | fs.Debugf(nil, "copyFile %q to %q as %q", src, dst, asName) |