mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
chore: update ffmpeg tests (#4249)
Signed-off-by: Keith Zantow <kzantow@gmail.com>
This commit is contained in:
parent
605a275dd3
commit
9217f2099f
@ -1399,7 +1399,7 @@ func Test_Cataloger_PositiveCases(t *testing.T) {
|
||||
Version: "5.1.4",
|
||||
Type: "binary",
|
||||
PURL: "pkg:generic/ffmpeg@5.1.4",
|
||||
Locations: locations("libavcodec"),
|
||||
Locations: locations("libavcodec-9aae324f.so.59.37.100"),
|
||||
Metadata: metadata("ffmpeg-library"),
|
||||
},
|
||||
},
|
||||
|
||||
Binary file not shown.
@ -838,7 +838,4 @@ from-images:
|
||||
platform: linux/amd64
|
||||
paths:
|
||||
- /usr/local/lib/python3.11/site-packages/opencv_contrib_python.libs/libavcodec-9aae324f.so.59.37.100
|
||||
- /usr/local/lib/python3.11/site-packages/opencv_contrib_python.libs/libavformat-3ff1be5b.so.59.27.100
|
||||
- /usr/local/lib/python3.11/site-packages/opencv_contrib_python.libs/libavutil-a0a0531e.so.57.28.100
|
||||
- /usr/local/lib/python3.11/site-packages/opencv_contrib_python.libs/libswresample-2ec4394e.so.4.7.100
|
||||
|
||||
|
||||
@ -2,11 +2,15 @@ package internal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"iter"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"slices"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/exp/maps"
|
||||
|
||||
"github.com/anchore/syft/syft/pkg/cataloger/binary/test-fixtures/manager/internal/config"
|
||||
)
|
||||
|
||||
@ -195,3 +199,17 @@ func (e Entries) BinaryFromImageHasSnippet(cfg config.BinaryFromImage) bool {
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (e Entries) Sorted() iter.Seq2[LogicalEntryKey, EntryInfo] {
|
||||
keys := maps.Keys(e)
|
||||
slices.SortFunc(keys, func(a, b LogicalEntryKey) int {
|
||||
return strings.Compare(a.Path(), b.Path())
|
||||
})
|
||||
return func(yield func(LogicalEntryKey, EntryInfo) bool) {
|
||||
for _, k := range keys {
|
||||
if !yield(k, e[k]) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ func SnippetOrBinary(t *testing.T, path string, requireBinary bool) string {
|
||||
require.NoError(t, err)
|
||||
|
||||
var fixturePath string
|
||||
for k, v := range entries {
|
||||
for k, v := range entries.Sorted() {
|
||||
if filepath.Dir(k.Path()) == path {
|
||||
// prefer the snippet over the binary
|
||||
if !requireBinary {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user