remove s3cmd as a dependency and provide a script to list all the available benchmarks

This commit is contained in:
Tamo 2021-06-01 14:43:47 +02:00 committed by Tamo
parent 61fe422a88
commit bc4f4ee829
No known key found for this signature in database
GPG Key ID: 20CD8020AFA88D69
2 changed files with 25 additions and 12 deletions

23
benchmarks/scripts/compare.sh Normal file → Executable file
View File

@ -1,8 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Requirements: # Requirements:
# - s3cmd and being logged to the DO Space "milli-benchmarks". See: https://docs.digitalocean.com/products/spaces/resources/s3cmd/
# - critcmp. See: https://github.com/BurntSushi/critcmp # - critcmp. See: https://github.com/BurntSushi/critcmp
# - wget
# Usage # Usage
# $ bash compare.sh json_file1 json_file1 # $ bash compare.sh json_file1 json_file1
@ -17,11 +17,10 @@ if [[ "$?" -ne 0 ]]; then
exit 1 exit 1
fi fi
# Checking that s3cmd is installed # Checking that wget is installed
command -v s3cmd > /dev/null 2>&1 command -v wget > /dev/null 2>&1
if [[ "$?" -ne 0 ]]; then if [[ "$?" -ne 0 ]]; then
echo 'You must install s3cmd to make this script working.' echo 'You must install wget to make this script working.'
echo 'See: https://github.com/s3tools/s3cmd'
exit 1 exit 1
fi fi
@ -37,16 +36,16 @@ fi
file1="$1" file1="$1"
file2="$2" file2="$2"
s3_path='s3://milli-benchmarks/critcmp_results' s3_url='https://milli-benchmarks.fra1.digitaloceanspaces.com/critcmp_results'
file1_s3_path="$s3_path/$file1" file1_s3_url="$s3_url/$file1"
file2_s3_path="$s3_path/$file2" file2_s3_url="$s3_url/$file2"
file1_local_path="/tmp/$file1" file1_local_path="/tmp/$file1"
file2_local_path="/tmp/$file2" file2_local_path="/tmp/$file2"
if [[ ! -f "$file1_local_path" ]]; then if [[ ! -f "$file1_local_path" ]]; then
s3cmd get "$file1_s3_path" "$file1_local_path" wget "$file1_s3_url" -O "$file1_local_path"
if [[ "$?" -ne 0 ]]; then if [[ "$?" -ne 0 ]]; then
echo 's3cmd command failed. Check your configuration' echo 'wget command failed. Check your configuration'
exit 1 exit 1
fi fi
else else
@ -54,9 +53,9 @@ else
fi fi
if [[ ! -f "$file2_local_path" ]]; then if [[ ! -f "$file2_local_path" ]]; then
s3cmd get "$file2_s3_path" "$file2_local_path" wget "$file2_s3_url" -O "$file2_local_path"
if [[ "$?" -ne 0 ]]; then if [[ "$?" -ne 0 ]]; then
echo 's3cmd command failed. Check your configuration' echo 'wget command failed. Check your configuration'
exit 1 exit 1
fi fi
else else

14
benchmarks/scripts/list.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
# Requirements:
# - curl
# - grep
res=$(curl -s https://milli-benchmarks.fra1.digitaloceanspaces.com | grep -oP "(?<=<Key>)[^<]+" | grep -oP --color=never "(?<=^critcmp_results/).+")
for pattern in "$@"
do
res=$(echo "$res" | grep $pattern)
done
echo "$res"