Files
simbench/run.sh

66 lines
1.3 KiB
Bash
Raw Normal View History

2023-06-11 16:15:40 +03:00
#!/usr/bin/env bash
BUILD=__build.sh
RUN=__run.sh
if [ "$1" == "all" ]
then
tests=$(ls -1d test-*)
elif [ -n "$1" ]
2023-06-11 16:15:40 +03:00
then
2023-06-15 17:47:42 +03:00
tests="$@"
2023-06-11 16:15:40 +03:00
else
echo "Usage: $0 <TEST_DIRECTORY | all>"
exit -1
2023-06-11 16:15:40 +03:00
fi
## Log header
2023-06-11 16:15:40 +03:00
echo >> results.txt
echo "---------- Simulator's benchmark -----------" >> results.txt
echo $(date) >> results.txt
echo >> results.txt
## Run tests
2023-06-11 16:15:40 +03:00
for test_dir in $tests
do
if [ ! -d "$test_dir" ]
then
echo "Directory $test_dir is not exists"
2023-06-11 16:15:40 +03:00
exit -1
fi
if [ -e $test_dir/$BUILD -a -e $test_dir/$RUN ]
then
echo "#### Run benchmark in $test_dir"
cd $test_dir
2023-06-11 16:15:40 +03:00
./$BUILD
if [ $? -eq 0 ]
then
start_ms=$(date +%s%N | cut -b1-13)
./$RUN
if [ $? -eq 0 ]
then
stop_ms=$(date +%s%N | cut -b1-13)
ms=$(expr $stop_ms - $start_ms)
echo "#### $test_dir: $ms milliseconds"
else
ms="RUN FAIL"
echo "#### $test_dir: run fail"
fi
else
ms="BUILD FAIL"
echo "#### $test_dir: build fail"
fi
echo ""
2023-06-11 16:15:40 +03:00
cd ..
echo "$test_dir: $ms" >> results.txt
else
echo "Skip $test_dir directory"
fi
done