git_update/performance_tests.sh

1042 lines
34 KiB
Bash
Raw Normal View History

#!/bin/bash
2024-07-08 10:53:38 +00:00
. driglibash-base
2024-07-08 10:53:38 +00:00
REPO_NAME=performance_testing
REPO_PATH=./remote
WITH_SUBMODULE="true"
SUB_NAME="submodule_for_performance_testing"
2024-07-02 16:00:35 +00:00
FILES_TO_KEEP='sample0'
2024-07-03 12:51:49 +00:00
REMOTE="./remote/performance_testing"
if [ "$WITH_SUBMODULE" = "true" ]; then
2024-07-08 10:53:38 +00:00
bash creation_repo.sh -s &> /dev/null
else
bash creation_repo.sh &> /dev/null
fi
Help()
{
echo "
NAME
performance_tests.sh
SYNOPSIS
performance_tests.sh [-a] [-h] [-n number]
OPTIONS
-a excutes all the tests.
-n number executes test number
-h prints the help.
DESCRIPTION
This script is in writing. It allows you to measure memory and bandwidth usage. The first four test different cloning methods. Te following apply changes to the local remote before testing fetching and merging commands.
TEST0: classic cloning
TEST1: --single-branch cloning
TEST2: --depth=1 --no-single-branch cloning
TEST3: --depth=1 cloning
2024-07-10 16:02:01 +00:00
TEST4: --depth=1 with reflog and gc cloning
TEST5: sparse-checking 1M sample0 cloning
_________________
2024-07-10 16:02:01 +00:00
TEST6: classic fetching+checking out after addition of a 1M file
TEST7: classic fetching+checking out after removal of a 1M file
TEST8: classic fetching+checking out after addition then removal of a 1M file
TEST9: --depth=1 fetching+checking out after addition of a 1M file
TEST10: --depth=1 fetching+checking out after removal of a 1M file
TEST11: --depth=1 fetching+checking out after addition then removal of 1M a file
TEST12: --depth=1 fetching+checking out with reflog annd gc after addition of a 1M file
TEST13: --depth=1 fetching+checking out with reflog annd gc after removal of a 1M file
TEST14: --depth=1 fetching+checking out with reflog annd gc after addition then removal of a 1M file
TEST15: --depth=1 fetching+ --reset=hard after addition of a 1M file
TEST16: --depth=1 fetching+ --reset=hard after removal of a 1M file
TEST17: --depth=1 fetching+ --reset=hard after addition then removal of a 1M file
TEST18: --depth=1 fetching+ --reset=hard and reflog and gc after addition of a 1M file
TEST19: --depth=1 fetching+ --reset=hard and reflog and gc after removal of a 1M file
TEST20: --depth=1 fetching+ --reset=hard and reflog and gc after addition then removal of a 1M file
TEST21: --depth=1 fetching+checking out after addition of a 1M file in submodule
TEST22: --depth=1 fetching+checking out after removal of a 1M file in submodule
TEST23: --depth=1 fetching+checking out after addition then removal of a 1M file in submodule
TEST24: --depth=1 fetching+merging -X theirs with reflog and gc after addition of a 1M file
TEST25: --depth=1 fetching+merging -X theirs with reflog and gc after removal of a 1M file
TEST26: --depth=1 fetching+merging -X theirs with reflog and gc after addition then removal of a 1M file
TEST27: --depth=1 fetching+merging -s ours with reflog and gc after addition of a 1M file
TEST28: --depth=1 fetching+merging -s ours with reflog and gc after removal of a 1M file
TEST29: --depth=1 fetching+merging -s ours with reflog and gc after addition then removal of a 1M file"
}
#USEFUL FUNCTIONS FOR THE TESTS
2024-07-08 10:53:38 +00:00
create_random_file(){
run dd if=/dev/urandom of=$1 bs=$2 count=1 &> /dev/null
}
get_storage_used(){
mem=$(du $1 | tail -n1 | tr -cd [:digit:])
}
2024-07-04 13:53:47 +00:00
get_bandwidth(){
2024-07-04 14:42:39 +00:00
bw="unknown"
bw=$(grep -e "Receiving objects:" $1 | grep -o "Receiving objects: [[:alnum:]%/(),. ]*" | tail -n1)
bw=${bw#*,}
2024-07-04 13:53:47 +00:00
}
2024-07-04 13:53:47 +00:00
#TESTS ON THE INITIAL POPULATING OF THE REPO
section "Tests on the initial populating of the repository"
test0(){
section TEST0
echo "TEST 0: classic cloning."
git clone --recurse-submodules --progress --no-local $1 &> cloning_text
cd $REPO_NAME
run git submodule update --init --recursive --force --remote --progress &> /dev/null
cd ..
get_storage_used "./$REPO_NAME"
2024-07-04 13:53:47 +00:00
get_bandwidth cloning_text
echo "memory usage: $mem"
echo "bandwidth usage (submodule excluded): $bw"
2024-07-03 12:51:49 +00:00
run rm cloning_text
2024-07-08 11:10:56 +00:00
run rm -rf $REPO_NAME
}
test1(){
section TEST1
echo "TEST 1: --single-branch cloning."
git clone --recurse-submodules --progress --single-branch --no-local $1 &> cloning_text
cd $REPO_NAME
run git submodule update --init --recursive --force --remote --progress &> /dev/null
cd ..
get_storage_used ./$REPO_NAME
2024-07-04 13:53:47 +00:00
get_bandwidth cloning_text
echo "memory usage: $mem"
echo "bandwidth usage (submodule excluded): $bw"
2024-07-03 12:51:49 +00:00
run rm cloning_text
run rm -rf $REPO_NAME
2024-06-28 16:29:11 +00:00
}
test2(){
section TEST2
echo "TEST 2: --depth=1 --no-single-branch"
git clone --recurse-submodules --progress --depth=1 --no-local --no-single-branch $1 &> cloning_text
cd $REPO_NAME
run git submodule update --init --recursive --force --remote --progress --depth=1 --no-single-branch &> /dev/null
cd ..
get_storage_used ./$REPO_NAME
2024-07-04 13:53:47 +00:00
get_bandwidth cloning_text
echo "memory usage: $mem"
echo "bandwidth usage (submodule excluded): $bw"
2024-07-03 12:51:49 +00:00
run rm cloning_text
run rm -rf $REPO_NAME
2024-06-28 16:29:11 +00:00
}
test3(){
section TEST3
echo "TEST 3: --depth=1 with single-branch (default))"
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --single-branch --no-local --depth=1 $1 &> cloning_text
cd $REPO_NAME
run git submodule update --init --recursive --force --remote --progress --depth=1 &> /dev/null
cd ..
get_storage_used ./$REPO_NAME
2024-07-04 13:53:47 +00:00
get_bandwidth cloning_text
echo "memory usage: $mem"
echo "bandwidth usage (submodule excluded): $bw"
2024-07-03 12:51:49 +00:00
run rm cloning_text
2024-07-08 11:10:56 +00:00
run rm -rf $REPO_NAME
}
2024-07-01 15:57:28 +00:00
test4(){
section TEST4
echo "TEST 4: --depth=1 with single-branch (default) and reflog and gc"
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --single-branch --no-local --depth=1 $1 &> cloning_text
cd $REPO_NAME
run git submodule update --init --recursive --force --remote --progress --depth=1 &> /dev/null
git reset --hard
cd ..
get_storage_used ./$REPO_NAME
get_bandwidth cloning_text
echo "memory usage: $mem"
echo "bandwidth usage (submodule excluded): $bw"
run rm cloning_text
run rm -rf $REPO_NAME
}
test5(){
section TEST5
2024-07-02 16:00:35 +00:00
run mkdir $REPO_NAME
run echo "TEST 5 : sparse-checking only $FILES_TO_KEEP with depth=1"
2024-07-04 13:53:47 +00:00
#creating a git repo with sparse-checking settings
2024-07-02 16:00:35 +00:00
run cd $REPO_NAME
2024-07-01 15:57:28 +00:00
run git init -q
run git config core.sparsecheckout true
2024-07-02 16:00:35 +00:00
run echo $FILES_TO_KEEP >> .git/info/sparse-checkout
2024-07-04 13:53:47 +00:00
#pulling from the remote with sparse-checking enabled
run git remote add -f origin ../$1 &> /dev/null
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
2024-07-10 16:02:01 +00:00
run git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git checkout -f origin/main &> /dev/null
get_storage_used .
echo "memory usage: $mem"
echo "bandwidth usage (submodule excluded): unknown"
cd ..
2024-07-08 11:10:56 +00:00
run rm -rf $REPO_NAME
2024-07-02 16:00:35 +00:00
}
#Tests on the updating of the repository
#classic fetching
test6(){
section TEST6
run echo 'TEST 6: after addition of a 1M file'
2024-07-04 16:29:55 +00:00
#initialization
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
2024-07-02 16:00:35 +00:00
cd $REPO_NAME
#run git submodule update --init --recursive --force --depth=1
2024-07-04 14:42:39 +00:00
get_storage_used .
mem_before=$mem
2024-07-03 12:51:49 +00:00
#modification of the remote repo
2024-07-03 14:55:26 +00:00
cd ../$REMOTE
create_random_file 'sample5' '1M' #adding a 1M file
2024-07-03 14:55:26 +00:00
run git add sample5
run git commit --quiet -m"fourth 1M sample created"
cd ../../$REPO_NAME
2024-07-04 16:29:55 +00:00
#fetching
run git submodule update --init --recursive --force --remote &> /dev/null
2024-07-10 16:02:01 +00:00
run git fetch --progress --tags --prune --prune-tags origin &> /dev/null
git checkout -f origin/main &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: +$mem"
2024-07-03 14:55:26 +00:00
cd ../$REMOTE
2024-07-05 07:41:50 +00:00
git reset --hard -q HEAD~1
2024-07-03 14:55:26 +00:00
cd ../..
2024-07-08 11:10:56 +00:00
rm -rf performance_testing
2024-07-01 15:57:28 +00:00
}
test7(){
section TEST7
run echo 'TEST 7: after removal of a 1M file'
2024-07-04 16:29:55 +00:00
#initialization
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
run rm sample0
run git add sample0
run git commit --quiet -m"1M sample0 deleted"
cd ../../$REPO_NAME
2024-07-04 16:29:55 +00:00
#fetching
run git submodule update --init --recursive --force --remote &> /dev/null
2024-07-10 16:02:01 +00:00
run git fetch --progress --tags --prune --prune-tags origin &> /dev/null
git checkout -f origin/main &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
2024-07-05 07:41:50 +00:00
git reset --hard -q HEAD~1
git clean -df
cd ../..
2024-07-08 11:10:56 +00:00
rm -rf performance_testing
}
test8(){
section TEST8
run echo 'TEST 8: after addition then removal of a 1M file'
2024-07-04 16:29:55 +00:00
#initialization
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
2024-07-03 16:14:18 +00:00
cd $REPO_NAME
get_storage_used .
mem_before=$mem
2024-07-03 16:14:18 +00:00
#modification of the remote repo
cd ../$REMOTE
create_random_file 'sample5' '1M' #adding a 1M file
2024-07-03 16:14:18 +00:00
run git add sample5
run git commit --quiet -m"fourth 1M sample created"
run rm sample5
run git add sample5
run git commit --quiet -m"1M "sample5" deleted"
cd ../../$REPO_NAME
2024-07-04 16:29:55 +00:00
#fetching
run git submodule update --init --recursive --force --remote &> /dev/null
2024-07-10 16:02:01 +00:00
run git fetch --progress --tags --prune --prune-tags origin &> /dev/null
git checkout -f origin/main &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
2024-07-03 16:14:18 +00:00
cd ../$REMOTE
2024-07-05 07:41:50 +00:00
git reset --hard -q HEAD~2
2024-07-03 16:14:18 +00:00
cd ../..
2024-07-08 11:10:56 +00:00
rm -rf performance_testing
2024-07-03 16:14:18 +00:00
}
#fetching with --depth=1
test9(){
section TEST9
run echo 'TEST 9: after addition of a 1M file'
2024-07-04 16:29:55 +00:00
#initialization
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
2024-07-04 14:42:39 +00:00
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
create_random_file 'sample5' '1M' #adding a 1M file
run git add sample5
run git commit --quiet -m"fourth 1M sample created"
cd ../../$REPO_NAME
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
2024-07-10 16:02:01 +00:00
run git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git checkout -f origin/main &> /dev/null
2024-07-04 16:29:55 +00:00
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: +$mem"
cd ../$REMOTE
git reset --hard -q HEAD~1
2024-07-04 16:29:55 +00:00
cd ../..
2024-07-08 11:10:56 +00:00
rm -rf performance_testing
2024-07-04 16:29:55 +00:00
}
test10(){
section TEST10
run echo 'TEST 10: after removal of a 1M file'
2024-07-04 16:29:55 +00:00
#initialization
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
2024-07-04 16:29:55 +00:00
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
run rm sample0
run git add sample0
2024-07-04 16:29:55 +00:00
run git commit --quiet -m"1M sample0 deleted"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
2024-07-10 16:02:01 +00:00
git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git checkout -f origin/main &> /dev/null
2024-07-04 14:42:39 +00:00
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
2024-07-04 16:29:55 +00:00
echo "memory usage: $mem"
2024-07-04 14:42:39 +00:00
cd ../$REMOTE
2024-07-05 07:41:50 +00:00
git reset --hard -q HEAD~1
2024-07-04 14:42:39 +00:00
cd ../..
2024-07-08 11:10:56 +00:00
rm -rf performance_testing
2024-07-04 14:42:39 +00:00
}
test11(){
section TEST11
run echo 'TEST 11: after addition then removal of a 1M file'
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
create_random_file 'sample5' '1M' #adding a 1M file
run git add sample5
run git commit --quiet -m"fourth 1M sample created"
run rm sample5
run git add sample5
run git commit --quiet -m"1M "sample5" deleted"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
2024-07-10 16:02:01 +00:00
run git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git checkout -f origin/main &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
git reset --hard -q HEAD~2
cd ../..
rm -rf performance_testing
}
2024-07-03 16:14:18 +00:00
# --depth=1 fetching with reflog and gc
test12(){
section TEST12
run echo 'TEST 12: after addition of a 1M file'
#initialization
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
create_random_file 'sample5' '1M' #adding a 1M file
run git add sample5
run git commit --quiet -m"fourth 1M sample created"
cd ../../$REPO_NAME
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
2024-07-10 16:02:01 +00:00
run git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git checkout -f origin/main &> /dev/null
git reflog expire --expire=now --all &> /dev/null
git gc --aggressive --prune=now &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: +$mem"
cd ../$REMOTE
git reset --hard -q HEAD~1
cd ../..
rm -rf performance_testing
}
test13(){
section TEST13
run echo 'TEST 13: after removal of a 1M file'
#initialization
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
run rm sample0
run git add sample0
run git commit --quiet -m"1M sample0 deleted"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
2024-07-10 16:02:01 +00:00
git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git checkout -f origin/main &> /dev/null
git reflog expire --expire=now --all &> /dev/null
git gc --aggressive --prune=now &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
git reset --hard -q HEAD~1
cd ../..
rm -rf performance_testing
}
test14(){
section TEST14
run echo 'TEST 14: after addition then removal of a 1M file'
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
2024-07-04 16:29:55 +00:00
cd $REPO_NAME
get_storage_used .
2024-07-05 07:41:50 +00:00
mem_before=$mem
2024-07-04 16:29:55 +00:00
#modification of the remote repo
cd ../$REMOTE
create_random_file 'sample5' '1M' #adding a 1M file
run git add sample5
run git commit --quiet -m"fourth 1M sample created"
run rm sample5
run git add sample5
run git commit --quiet -m"1M "sample5" deleted"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
2024-07-10 16:02:01 +00:00
run git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git checkout -f origin/main &> /dev/null
git reflog expire --expire=now --all &> /dev/null
git gc --aggressive --prune=now &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
git reset --hard -q HEAD~2
cd ../..
2024-07-08 11:10:56 +00:00
rm -rf performance_testing
}
#--depth=1 fetching with reset --hard
test15(){
section TEST15
run echo 'TEST 15: after addition of a 1M file'
#initialization
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
create_random_file 'sample5' '1M' #adding a 1M file
run git add sample5
run git commit --quiet -m"fourth 1M sample created"
cd ../../$REPO_NAME
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
2024-07-10 16:02:01 +00:00
run git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git reset --hard origin/main &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: +$mem"
cd ../$REMOTE
git reset --hard -q HEAD~1
cd ../..
rm -rf performance_testing
}
test16(){
section TEST16
run echo 'TEST 16: after removal of a 1M file'
#initialization
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
run rm sample0
run git add sample0
run git commit --quiet -m"1M sample0 deleted"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
2024-07-10 16:02:01 +00:00
git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git reset --hard origin/main &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
git reset --hard -q HEAD~1
cd ../..
rm -rf performance_testing
}
test17(){
section TEST17
run echo 'TEST 17: after addition then removal of a 1M file'
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
create_random_file 'sample5' '1M' #adding a 1M file
run git add sample5
run git commit --quiet -m"fourth 1M sample created"
run rm sample5
run git add sample5
run git commit --quiet -m"1M "sample5" deleted"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
2024-07-10 16:02:01 +00:00
run git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git reset --hard origin/main &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
git reset --hard -q HEAD~2
cd ../..
rm -rf performance_testing
}
#--depth=1 fetching with reset --hard and reflog and gc
test18(){
section TEST18
run echo 'TEST 18: after addition of a 1M file'
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
create_random_file 'sample5' '1M' #adding a 1M file
run git add sample5
run git commit --quiet -m"fourth 1M sample created"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
2024-07-10 16:02:01 +00:00
run git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git reset --hard origin/main &> /dev/null
git reflog expire --expire=now --all &> /dev/null
git gc --aggressive --prune=now &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
git reset --hard -q HEAD~1
cd ../..
rm -rf performance_testing
}
test19(){
section TEST19
run echo 'TEST 19: after removal of a 1M file'
#initialization
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
run rm sample0
run git add sample0
run git commit --quiet -m"1M sample0 deleted"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
2024-07-10 16:02:01 +00:00
git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git reset --hard origin/main &> /dev/null
git reflog expire --expire=now --all &> /dev/null
git gc --aggressive --prune=now &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
git reset --hard -q HEAD~1
cd ../..
rm -rf performance_testing
}
test20(){
section TEST20
run echo 'TEST 20: after addition then removal of a 1M file'
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
create_random_file 'sample5' '1M' #adding a 1M file
run git add sample5
run git commit --quiet -m"fourth 1M sample created"
run rm sample5
run git add sample5
run git commit --quiet -m"1M "sample5" deleted"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
2024-07-10 16:02:01 +00:00
run git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git reset --hard origin/main &> /dev/null
git reflog expire --expire=now --all &> /dev/null
git gc --aggressive --prune=now &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
git reset --hard -q HEAD~2
cd ../..
rm -rf performance_testing
}
#--depth=1 fetching after modification applied in submodule
test21(){
section TEST21
run echo 'TEST 21: after addition of a 1M file'
if [ "$WITH_SUBMODULE" = "true" ]; then
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote submodule
cd ..
cd $REPO_PATH/$SUB_NAME
create_random_file 'sub_sample1' '1M'
git add sub_sample1
git commit --quiet -m"second 1M sample created"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
2024-07-10 16:02:01 +00:00
run git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git checkout -f origin/main &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REPO_PATH/$SUB_NAME
git reset --hard -q HEAD~1
cd ../..
rm -rf performance_testing
else
echo "This test will not be performed because we are in no-submodule mode. Change boolean \$WITH_SUBMODULE to switch."
fi
}
test22(){
section TEST22
run echo 'TEST 22: after removal of a 1M file'
if [ "$WITH_SUBMODULE" = "true" ]; then
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote submodule
cd ..
cd $REPO_PATH/$SUB_NAME
rm sub_sample0
git add sub_sample0
git commit --quiet -m"1M 'sub_sample0' deleted"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
2024-07-10 16:02:01 +00:00
run git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git checkout -f origin/main &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REPO_PATH/$SUB_NAME
git reset --hard -q HEAD~1
cd ../..
rm -rf performance_testing
else
echo "This test will not be performed because we are in no-submodule mode. Change boolean \$WITH_SUBMODULE to switch."
fi
}
test23(){
section TEST23
run echo 'TEST 23: after addition then removal of a 1M file'
if [ "$WITH_SUBMODULE" = "true" ]; then
2024-07-10 16:02:01 +00:00
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote submodule
cd ..
cd $REPO_PATH/$SUB_NAME
create_random_file 'sub_sample1' '1M'
git add sub_sample1
git commit --quiet -m"second 1M sample created"
rm sub_sample1
git add sub_sample1
git commit --quiet -m"1M 'sub_sample1' deleted"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
2024-07-10 16:02:01 +00:00
run git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git checkout -f origin/main &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REPO_PATH/$SUB_NAME
git reset --hard -q HEAD~2
cd ../..
rm -rf performance_testing
else
echo "This test will not be performed because we are in no-submodule mode. Change boolean \$WITH_SUBMODULE to switch."
fi
2024-07-04 16:29:55 +00:00
}
2024-07-03 16:14:18 +00:00
2024-07-10 16:02:01 +00:00
# --depth=1 fetching+merging -X theirs with reflog and gc
test24(){
section TEST24
run echo 'TEST 24: after addition of a 1M file'
#initialization
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
create_random_file 'sample5' '1M' #adding a 1M file
run git add sample5
run git commit --quiet -m"fourth 1M sample created"
cd ../../$REPO_NAME
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
run git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git merge -X theirs --allow-unrelated-histories &> /dev/null
git reflog expire --expire=now --all &> /dev/null
git gc --aggressive --prune=now &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: +$mem"
cd ../$REMOTE
git reset --hard -q HEAD~1
cd ../..
rm -rf performance_testing
}
test25(){
section TEST25
run echo 'TEST 25: after removal of a 1M file'
#initialization
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
run rm sample0
run git add sample0
run git commit --quiet -m"1M sample0 deleted"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git merge -X theirs --allow-unrelated-histories &> /dev/null
git reflog expire --expire=now --all &> /dev/null
git gc --aggressive --prune=now &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
git reset --hard -q HEAD~1
cd ../..
rm -rf performance_testing
}
test26(){
section TEST26
run echo 'TEST 26: after addition then removal of a 1M file'
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
create_random_file 'sample5' '1M' #adding a 1M file
run git add sample5
run git commit --quiet -m"fourth 1M sample created"
run rm sample5
run git add sample5
run git commit --quiet -m"1M "sample5" deleted"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
run git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git merge -X theirs --allow-unrelated-histories &> /dev/null
git reflog expire --expire=now --all &> /dev/null
git gc --aggressive --prune=now &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
git reset --hard -q HEAD~2
cd ../..
rm -rf performance_testing
}
# --depth=1 fetching+merging -s ours with reflog and gc
test27(){
section TEST27
run echo 'TEST 27: after addition of a 1M file'
#initialization
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
create_random_file 'sample5' '1M' #adding a 1M file
run git add sample5
run git commit --quiet -m"fourth 1M sample created"
cd ../../$REPO_NAME
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
run git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git switch -c temp origin/main &> /dev/null #creating a temporary branch identical to origin/main
git merge -s ours --allow-unrelated-histories main &> /dev/null
git checkout main &> /dev/null
git merge --allow-unrelated-histories temp &> /dev/null
git branch -D temp &> /dev/null
git reflog expire --expire=now --all &> /dev/null
git gc --aggressive --prune=now &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: +$mem"
cd ../$REMOTE
git reset --hard -q HEAD~1
cd ../..
rm -rf performance_testing
}
test28(){
section TEST28
run echo 'TEST 28: after removal of a 1M file'
#initialization
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
run rm sample0
run git add sample0
run git commit --quiet -m"1M sample0 deleted"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git switch -c temp origin/main &> /dev/null #creating a temporary branch identical to origin/main
git merge -s ours --allow-unrelated-histories main &> /dev/null
git checkout main &> /dev/null
git merge --allow-unrelated-histories temp &> /dev/null
git branch -D temp &> /dev/null
git reflog expire --expire=now --all &> /dev/null
git gc --aggressive --prune=now &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
git reset --hard -q HEAD~1
cd ../..
rm -rf performance_testing
}
test29(){
section TEST29
run echo 'TEST 29: after addition then removal of a 1M file'
git clone --recurse-submodules --progress --depth=1 --no-local $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
#modification of the remote repo
cd ../$REMOTE
create_random_file 'sample5' '1M' #adding a 1M file
run git add sample5
run git commit --quiet -m"fourth 1M sample created"
run rm sample5
run git add sample5
run git commit --quiet -m"1M "sample5" deleted"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --depth=1 --remote &> /dev/null
run git fetch --progress --tags --depth=1 --prune --prune-tags origin &> /dev/null
git switch -c temp origin/main &> /dev/null #creating a temporary branch identical to origin/main
git merge -s ours --allow-unrelated-histories main &> /dev/null
git checkout main &> /dev/null
#git merge --allow-unrelated-histories temp &> /dev/null
git branch -D temp &> /dev/null
git reflog expire --expire=now --all &> /dev/null
git gc --aggressive --prune=now &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
git reset --hard -q HEAD~2
cd ../..
rm -rf performance_testing
}
while getopts ":hn:a" option; do
case $option in
h) # display Help
Help
exit;;
n)
TEST_NUM=$OPTARG;;
a)
ALL_TESTS=true;;
2024-07-03 12:51:49 +00:00
\?) # Invalid option
echo "Error: Invalid option here"
exit;;
esac
done
if [ "$ALL_TESTS" = "true" ]; then
2024-07-03 12:51:49 +00:00
test0 $REMOTE
test1 $REMOTE
test2 $REMOTE
test3 $REMOTE
test4 $REMOTE
test5 $REMOTE
echo $(section "Tests on the updating of the repository")
2024-07-10 16:02:01 +00:00
section "classic fetching+checking out"
test6 $REMOTE
2024-07-03 16:14:18 +00:00
test7 $REMOTE
2024-07-04 14:42:39 +00:00
test8 $REMOTE
2024-07-10 16:02:01 +00:00
echo $(section "fetching+checking out with --depth=1")
2024-07-04 16:29:55 +00:00
test9 $REMOTE
test10 $REMOTE
test11 $REMOTE
2024-07-10 16:02:01 +00:00
echo $(section "--depth=1 fetching+checking out reflog and gc")
test12 $REMOTE
test13 $REMOTE
test14 $REMOTE
2024-07-10 16:02:01 +00:00
echo $(section "--depth=1 fetching+ reset --hard")
test15 $REMOTE
test16 $REMOTE
test17 $REMOTE
2024-07-10 16:02:01 +00:00
echo $(section "--depth=1 fetching+ reset --hard and reflog and gc")
test18 $REMOTE
test19 $REMOTE
test20 $REMOTE
2024-07-10 16:02:01 +00:00
echo $(section "--depth=1 fetching+checking out after modification applied in submodule")
test21 $REMOTE
test22 $REMOTE
test23 $REMOTE
2024-07-10 16:02:01 +00:00
echo $(section "--depth=1 fetching+merging -X theirs with reflog and gc")
test24 $REMOTE
test25 $REMOTE
test26 $REMOTE
echo $(section "--depth=1 fetching+merging -s ours with reflog and gc")
test27 $REMOTE
test28 $REMOTE
test29 $REMOTE
2024-06-28 16:29:11 +00:00
elif [ -n "$TEST_NUM" ]; then
case $TEST_NUM in
0)
2024-07-03 12:51:49 +00:00
test0 $REMOTE;;
1)
2024-07-03 12:51:49 +00:00
test1 $REMOTE;;
2024-06-28 16:29:11 +00:00
2)
2024-07-03 12:51:49 +00:00
test2 $REMOTE;;
2024-06-28 16:29:11 +00:00
3)
2024-07-03 12:51:49 +00:00
test3 $REMOTE;;
2024-07-01 15:57:28 +00:00
4)
2024-07-03 12:51:49 +00:00
test4 $REMOTE;;
2024-07-02 16:00:35 +00:00
5)
2024-07-03 12:51:49 +00:00
test5 $REMOTE;;
6)
test6 $REMOTE;;
2024-07-03 16:14:18 +00:00
7)
test7 $REMOTE;;
2024-07-04 14:42:39 +00:00
8)
test8 $REMOTE;;
2024-07-04 16:29:55 +00:00
9)
test9 $REMOTE;;
10)
test10 $REMOTE;;
11)
test11 $REMOTE;;
12)
test12 $REMOTE;;
13)
test13 $REMOTE;;
2024-07-10 16:02:01 +00:00
14)
test14 $REMOTE;;
15)
test15 $REMOTE;;
16)
test16 $REMOTE;;
17)
test17 $REMOTE;;
18)
test18 $REMOTE;;
19)
test19 $REMOTE;;
20)
test20 $REMOTE;;
21)
test21 $REMOTE;;
2024-07-10 16:02:01 +00:00
22)
test22 $REMOTE;;
23)
test23 $REMOTE;;
24)
test24 $REMOTE;;
25)
test25 $REMOTE;;
26)
test26 $REMOTE;;
26)
test26 $REMOTE;;
27)
test27 $REMOTE;;
28)
test28 $REMOTE;;
29)
test29 $REMOTE;;
*)
echo "Error: Invalid test number"
die;;
esac
else
Help
fi
#add the submodules management to the cloning
#add run