trackgen: check raceline files in regression tests

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9467 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 63edac72891624206387c7dcc68b430d3f1870fa
Former-commit-id: 836c22843cd8e7731cabf3a59cbddedb8b59aaf2
This commit is contained in:
iobyte 2024-06-29 18:18:04 +00:00
parent 7f246e9029
commit a8224fd5fe
2 changed files with 129 additions and 0 deletions

View file

@ -91,6 +91,70 @@ check () {
printf " %s\n" "${lines[$i]}" printf " %s\n" "${lines[$i]}"
done done
fi fi
if test -f "$pwd/../../../data/tracks/$1/$2/$2-trk-raceline.ac"; then
$trackgen -c $1 -n $2 -i $pwd/../../../data/tracks/$1/$2 -o $temp_dir -r >& $temp_dir/$2.txt
status=$?
if [ $status -eq 0 ]; then
diff $pwd/../../../data/tracks/$1/$2/$2-trk-raceline.ac $temp_dir/$2-trk-raceline.ac > $temp_dir/$2.ac.txt
[ $? -eq 0 ] && echo "$1/$2-trk-raceline.ac GOOD" || echo "$1/$2-trk-raceline.ac BAD"
elif [ $status -eq 3 ]; then
echo " trackgen CRASHED $status"
lines=()
while IFS= read -r line
do
lines+=("$line")
done < <(tail -n 3 $temp_dir/$2.txt)
numLines=${#lines[@]}
for (( i=0; i<${numLines}; i++ ));
do
printf " %s\n" "${lines[$i]}"
done
else
echo " trackgen FAILED $status"
lines=()
while IFS= read -r line
do
lines+=("$line")
done < <(tail -n 3 $temp_dir/$2.txt)
numLines=${#lines[@]}
for (( i=0; i<${numLines}; i++ ));
do
printf " %s\n" "${lines[$i]}"
done
fi
elif test -f "$pwd/../../../data/tracks/$1/$2/$2-trk-raceline-src.ac"; then
$trackgen -c $1 -n $2 -i $pwd/../../../data/tracks/$1/$2 -o $temp_dir -r >& $temp_dir/$2.txt
status=$?
if [ $status -eq 0 ]; then
diff $pwd/../../../data/tracks/$1/$2/$2-trk-raceline-src.ac $temp_dir/$2-trk-raceline.ac > $temp_dir/$2.ac.txt
[ $? -eq 0 ] && echo "$1/$2-trk-raceline.ac GOOD" || echo "$1/$2-trk-raceline.ac BAD"
elif [ $status -eq 3 ]; then
echo " trackgen CRASHED $status"
lines=()
while IFS= read -r line
do
lines+=("$line")
done < <(tail -n 3 $temp_dir/$2.txt)
numLines=${#lines[@]}
for (( i=0; i<${numLines}; i++ ));
do
printf " %s\n" "${lines[$i]}"
done
else
echo " trackgen FAILED $status"
lines=()
while IFS= read -r line
do
lines+=("$line")
done < <(tail -n 3 $temp_dir/$2.txt)
numLines=${#lines[@]}
for (( i=0; i<${numLines}; i++ ));
do
printf " %s\n" "${lines[$i]}"
done
fi
fi
} }
# add tracks here as they are updated # add tracks here as they are updated

View file

@ -99,6 +99,71 @@ check () {
printf " %s\n" "${lines[$i]}" printf " %s\n" "${lines[$i]}"
done done
fi fi
if test -f "$pwd/../../../data/tracks/$1/$2/$2-trk-raceline.ac"; then
$trackgen -c $1 -n $2 -i $pwd/../../../data/tracks/$1/$2 -o $temp_dir -r >& $temp_dir/$2.txt
status=$?
if [ $status -eq 0 ]; then
diff $pwd/../../../data/tracks/$1/$2/$2-trk-raceline.ac $temp_dir/$2-trk-raceline.ac > $temp_dir/$2.ac.txt
[ $? -eq 0 ] && echo " $1/$2-trk-raceline.ac GOOD" || echo " $1/$2-trk-raceline.ac BAD"
elif [ $status -eq 3 ]; then
echo " trackgen CRASHED $status"
lines=()
while IFS= read -r line
do
lines+=("$line")
done < <(tail -n 3 $temp_dir/$2.txt)
numLines=${#lines[@]}
for (( i=0; i<${numLines}; i++ ));
do
printf " %s\n" "${lines[$i]}"
done
else
echo " trackgen FAILED $status"
lines=()
while IFS= read -r line
do
lines+=("$line")
done < <(tail -n 3 $temp_dir/$2.txt)
numLines=${#lines[@]}
for (( i=0; i<${numLines}; i++ ));
do
printf " %s\n" "${lines[$i]}"
done
fi
elif test -f "$pwd/../../../data/tracks/$1/$2/$2-trk-raceline-src.ac"; then
$trackgen -c $1 -n $2 -i $pwd/../../../data/tracks/$1/$2 -o $temp_dir -r >& $temp_dir/$2.txt
status=$?
if [ $status -eq 0 ]; then
echo " FOUND $2-trk-raceline-src.ac"
diff $pwd/../../../data/tracks/$1/$2/$2-trk-raceline-src.ac $temp_dir/$2-trk-raceline.ac > $temp_dir/$2.ac.txt
[ $? -eq 0 ] && echo " $1/$2-trk-raceline.ac GOOD" || echo " $1/$2-trk-raceline.ac BAD"
elif [ $status -eq 3 ]; then
echo " trackgen CRASHED $status"
lines=()
while IFS= read -r line
do
lines+=("$line")
done < <(tail -n 3 $temp_dir/$2.txt)
numLines=${#lines[@]}
for (( i=0; i<${numLines}; i++ ));
do
printf " %s\n" "${lines[$i]}"
done
else
echo " trackgen FAILED $status"
lines=()
while IFS= read -r line
do
lines+=("$line")
done < <(tail -n 3 $temp_dir/$2.txt)
numLines=${#lines[@]}
for (( i=0; i<${numLines}; i++ ));
do
printf " %s\n" "${lines[$i]}"
done
fi
fi
} }
array=(`find $pwd/../../../data/tracks -name "*.xml"`) array=(`find $pwd/../../../data/tracks -name "*.xml"`)