mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 08:53:15 +01:00
test: update script to size 600 bytes
Signed-off-by: Christopher Phillips <christopher.phillips@anchore.com>
This commit is contained in:
parent
d1f3d1197b
commit
0b4f9ad9bb
13
.github/scripts/check_binary_fixture_size.sh
vendored
13
.github/scripts/check_binary_fixture_size.sh
vendored
@ -1,5 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
# current limit for fixture size
|
||||
size=600
|
||||
|
||||
# Check if a directory is provided as an argument
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: $0 <directory>"
|
||||
@ -20,19 +23,19 @@ fi
|
||||
# Use find to locate all files in the directory and its subdirectories
|
||||
found_large_files=0
|
||||
while IFS= read -r -d '' file; do
|
||||
# Check if the file size is greater than 100 bytes
|
||||
if [ $(wc -c < "$file") -gt 100 ]; then
|
||||
echo "File $file is greater than 100 bytes."
|
||||
# Check if the file size is greater than 600 bytes
|
||||
if [ $(wc -c < "$file") -gt $size ]; then
|
||||
echo "File $file is greater than 600 bytes."
|
||||
found_large_files=1
|
||||
fi
|
||||
done < <(find "$directory" -type f -print0)
|
||||
|
||||
# Check if any large files were found
|
||||
if [ "$found_large_files" -eq 1 ]; then
|
||||
echo "Script failed: Some files are greater than 100 bytes."
|
||||
echo "Script failed: Some files are greater than 600 bytes."
|
||||
exit 1
|
||||
else
|
||||
echo "All files in $directory and its subdirectories are 100 bytes or smaller. Script passed."
|
||||
echo "All files in $directory and its subdirectories are 600 bytes or smaller. Script passed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user