-
Notifications
You must be signed in to change notification settings - Fork 0
/
regenerate_test_output.sh
34 lines (30 loc) · 1.14 KB
/
regenerate_test_output.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Navigate to the script directory
cd "$(dirname "$0")"
# Find all testdata directories
for dir in testdata/*; do
if [ -d "$dir" ]; then
# Assuming the input and output structure is consistent across test cases
input="$dir/in/bom.json"
dockerfile="$dir/image/Dockerfile"
dirinput="$dir/dir"
output="$dir/out/bom.json"
# Check if input and Dockerfile exist
if [ -f "$input" ]; then
echo "Regenerating output for test case in $dir"
if [ -d "$dir/dir" ]; then
go run cbomkit-theia.go dir -b "$input" "$dirinput" > "$output"
elif [ -d "$dir/image" ]; then
if [ ! -f "$dockerfile" ]; then
echo "Dockerfile not found in $dir/image, skipping..."
continue
fi
go run cbomkit-theia.go image build -b "$input" "$dockerfile" > "$output"
else
echo "Directory 'dir' or 'image' not found in $dir, skipping..."
fi
else
echo "Input or Dockerfile missing in $dir, skipping..."
fi
fi
done