mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 20:17:09 +00:00
fix(corpus-sweep): name every missing binary, in flag order
Same map-ranging bug as the sibling tool, and this copy had no test on the missing-binary path at all.
This commit is contained in:
1 parent
5fc91fdca1
commit
d5f48266e8
2 files changed
+63
-9
No files matched your search
@@ -17,23 +17,31 @@ import (
|
||||
// resolveBinaries turns campaign and sanderling into absolute paths before
|
||||
// anything is served. Each campaign runs from the sweep's own directory, and a
|
||||
// binary that is missing altogether has to stop the sweep here rather than fail
|
||||
// once per implementation and seed.
|
||||
// once per implementation and seed. Every one that is missing is named
|
||||
// together, in flag order: stopping at the first turns that single stop into
|
||||
// one rerun per missing binary.
|
||||
func resolveBinaries(configuration *config) error {
|
||||
for name, value := range map[string]*string{
|
||||
"--campaign": &configuration.campaignPath,
|
||||
"--sanderling": &configuration.sanderlingPath,
|
||||
var missing []error
|
||||
for _, binary := range []struct {
|
||||
name string
|
||||
value *string
|
||||
}{
|
||||
{"--campaign", &configuration.campaignPath},
|
||||
{"--sanderling", &configuration.sanderlingPath},
|
||||
} {
|
||||
resolved, err := exec.LookPath(*value)
|
||||
resolved, err := exec.LookPath(*binary.value)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s: %w", name, err)
|
||||
missing = append(missing, fmt.Errorf("%s: %w", binary.name, err))
|
||||
continue
|
||||
}
|
||||
absolute, err := filepath.Abs(resolved)
|
||||
if err != nil {
|
||||
return fmt.Errorf("%s: %w", name, err)
|
||||
missing = append(missing, fmt.Errorf("%s: %w", binary.name, err))
|
||||
continue
|
||||
}
|
||||
*value = absolute
|
||||
*binary.value = absolute
|
||||
}
|
||||
return nil
|
||||
return errors.Join(missing...)
|
||||
}
|
||||
|
||||
type sweep struct {
|
||||
|
||||
Reference in new issue
Block a user