diff --git a/performance_tests.sh b/performance_tests.sh index b400d9b..3f73b61 100755 --- a/performance_tests.sh +++ b/performance_tests.sh @@ -38,7 +38,10 @@ DESCRIPTION TEST7: classic fetching and merging, after addition then removal of a 1M file TEST8: --depth=1 fetching and merging, after addition of a 1M file TEST9: --depth=1 fetching and merging, after removal of a 1M file - TEST10: --depth=1 fetching and merging, after addition then removal of 1M a file" + TEST10: --depth=1 fetching and merging, after addition then removal of 1M a file + TEST17: --depth=1 fetching and merging, after addition of a 1M file in submodule + TEST18: --depth=1 fetching and merging, after removal of a 1M file in submodule + TEST19: --depth=1 fetching and merging, after addition then removal of a 1M file in submodule" } #USEFUL FUNCTIONS FOR THE TESTS @@ -57,70 +60,87 @@ get_bandwidth(){ } #TESTS ON THE INITIAL POPULATING OF THE REPO +section "Tests on the initial populating of the repository" test0(){ section TEST0 - echo "TEST 0 : case of classic cloning." + 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" get_bandwidth cloning_text - echo "memory usage in a classic cloning : $mem" - echo "bandwidth usage : $bw" + echo "memory usage: $mem" + echo "bandwidth usage (submodule excluded): $bw" run rm cloning_text run rm -rf $REPO_NAME } test1(){ section TEST1 - echo "TEST 1 : case of --single-branch cloning." + 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 get_bandwidth cloning_text - echo "memory usage in a --single-branch cloning : $mem" - echo "bandwidth usage : $bw" + echo "memory usage: $mem" + echo "bandwidth usage (submodule excluded): $bw" run rm cloning_text run rm -rf $REPO_NAME } test2(){ section TEST2 - echo "TEST 2 : case of --depth=1 --no-single-branch" + 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 get_bandwidth cloning_text - echo "memory usage in a --depth=1 --no-single-branch cloning : $mem" - echo "bandwidth usage : $bw" + echo "memory usage: $mem" + echo "bandwidth usage (submodule excluded): $bw" run rm cloning_text run rm -rf $REPO_NAME } test3(){ section TEST3 - echo "TEST 3 : case of --depth=1 with single-branch (default))" + echo "TEST 3: --depth=1 with single-branch (default))" git clone --recurse-submodules --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 get_bandwidth cloning_text - echo "memory usage in a --depth=1 with single-branch cloning : $mem" - echo "bandwidth usage : $bw" + echo "memory usage: $mem" + echo "bandwidth usage (submodule excluded): $bw" run rm cloning_text run rm -rf $REPO_NAME } test4(){ section TEST4 + echo "TEST 4: --depth=1 with single-branch (default) and reflog and gc" + git clone --recurse-submodules --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 run mkdir $REPO_NAME - run echo "TEST 4 : case of sparse-checking only $FILES_TO_KEEP with depth=1" + run echo "TEST 5 : sparse-checking only $FILES_TO_KEEP with depth=1" #creating a git repo with sparse-checking settings run cd $REPO_NAME run git init -q @@ -133,16 +153,16 @@ test4(){ git checkout -f origin/main &> /dev/null get_storage_used . echo "memory usage: $mem" - echo "bandwidth usage : unknown" + echo "bandwidth usage (submodule excluded): unknown" cd .. run rm -rf $REPO_NAME } - -#TESTS ON THE UPDATING OF THE REPOSITORY -test5(){ - section TEST5 - run echo 'TEST 5 : case of classic fetching and merging, after addition of a 1M file' +#Tests on the updating of the repository +#classic fetching +test6(){ + section TEST6 + run echo 'TEST 6: after addition of a 1M file' #initialization git clone --recurse-submodules --progress --no-local $1 &> /dev/null cd $REPO_NAME @@ -168,10 +188,9 @@ test5(){ cd ../.. rm -rf performance_testing } - -test6(){ - section TEST6 - run echo 'TEST 6 : case of classic fetching and merging, after removal of a 1M file' +test7(){ + section TEST7 + run echo 'TEST 7: after removal of a 1M file' #initialization git clone --recurse-submodules --progress --no-local $1 &> /dev/null cd $REPO_NAME @@ -197,10 +216,9 @@ test6(){ cd ../.. rm -rf performance_testing } - -test7(){ - section TEST7 - run echo 'TEST 7 : case of classic fetching and merging, after addition then removal of a 1M file' +test8(){ + section TEST8 + run echo 'TEST 8: after addition then removal of a 1M file' #initialization git clone --recurse-submodules --progress --no-local $1 &> /dev/null cd $REPO_NAME @@ -229,9 +247,10 @@ test7(){ rm -rf performance_testing } -test8(){ - section TEST8 - run echo 'TEST 8 : case of fetching --depth=1 and merging, after addition of a 1M file' +#fetching with --depth=1 +test9(){ + section TEST9 + run echo 'TEST 9: after addition of a 1M file' #initialization git clone --recurse-submodules --progress --no-local $1 &> /dev/null cd $REPO_NAME @@ -256,10 +275,9 @@ test8(){ cd ../.. rm -rf performance_testing } - -test9(){ - section TEST9 - run echo 'TEST 9 : case of --depth=1 fetching and merging, after removal of a 1M file' +test10(){ + section TEST10 + run echo 'TEST 10: after removal of a 1M file' #initialization git clone --recurse-submodules --progress --no-local $1 &> /dev/null cd $REPO_NAME @@ -268,12 +286,12 @@ test9(){ #modification of the remote repo cd ../$REMOTE run rm sample0 - run git add 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 - run git fetch --progress --tags --depth=1 origin &> /dev/null + git fetch --progress --tags --prune --depth=1 origin &> /dev/null git checkout -f origin/main &> /dev/null get_storage_used . mem_after=$mem @@ -284,10 +302,9 @@ test9(){ cd ../.. rm -rf performance_testing } - -test10(){ - section TEST10 - run echo 'TEST 10 : case of --depth=1 fetching and merging, after addition then removal of a 1M file' +test11(){ + section TEST11 + run echo 'TEST 11: after addition then removal of a 1M file' git clone --recurse-submodules --progress --no-local $1 &> /dev/null cd $REPO_NAME get_storage_used . @@ -315,9 +332,274 @@ test10(){ rm -rf performance_testing } -test11(){ - section TEST11 - run echo 'TEST 11 : case of --depth=1 fetching and merging, after addition of a 1M file in submodule' +# --depth=1 fetching with reflog and gc +test12(){ + section TEST12 + run echo 'TEST 12: after addition of a 1M file' + #initialization + git clone --recurse-submodules --progress --no-local $1 &> /dev/null + cd $REPO_NAME + echo "un truc écrit en plus" >> untexte + 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 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 + git clone --recurse-submodules --progress --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 --prune --depth=1 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' + git clone --recurse-submodules --progress --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 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 ../.. + rm -rf performance_testing +} + +#--depth=1 fetching with reset --hard +test15(){ + section TEST15 + run echo 'TEST 15: after addition of a 1M file' + #initialization + git clone --recurse-submodules --progress --no-local $1 &> /dev/null + cd $REPO_NAME + echo "un truc écrit en plus" >> untexte + 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 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 + git clone --recurse-submodules --progress --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 --prune --depth=1 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' + git clone --recurse-submodules --progress --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 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' + git clone --recurse-submodules --progress --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 + run git fetch --progress --tags --depth=1 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 + git clone --recurse-submodules --progress --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 --prune --depth=1 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' + git clone --recurse-submodules --progress --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 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 git clone --recurse-submodules --progress --no-local $1 &> /dev/null cd $REPO_NAME @@ -347,9 +629,9 @@ test11(){ fi } -test12(){ - section TEST12 - run echo 'TEST 12 : case of --depth=1 fetching and merging, after removal of a 1M file in submodule' +test22(){ + section TEST22 + run echo 'TEST 22: after removal of a 1M file' if [ "$WITH_SUBMODULE" = "true" ]; then git clone --recurse-submodules --progress --no-local $1 &> /dev/null cd $REPO_NAME @@ -379,9 +661,9 @@ test12(){ fi } -test13(){ - section TEST13 - run echo 'TEST 13 : case of --depth=1 fetching and merging, after addition then removal of a 1M file in submodule' +test23(){ + section TEST23 + run echo 'TEST 23: after addition then removal of a 1M file' if [ "$WITH_SUBMODULE" = "true" ]; then git clone --recurse-submodules --progress --no-local $1 &> /dev/null cd $REPO_NAME @@ -436,15 +718,31 @@ if [ "$ALL_TESTS" = "true" ]; then test3 $REMOTE test4 $REMOTE test5 $REMOTE + echo $(section "Tests on the updating of the repository") + section "classic fetching" test6 $REMOTE test7 $REMOTE test8 $REMOTE + echo $(section "fetching with --depth=1") test9 $REMOTE test10 $REMOTE test11 $REMOTE + echo $(section "--depth=1 fetching with reflog and gc") test12 $REMOTE test13 $REMOTE - + test14 $REMOTE + echo $(section "--depth=1 fetching with reset --hard") + test15 $REMOTE + test16 $REMOTE + test17 $REMOTE + echo $(section "--depth=1 fetching with reset --hard and reflog and gc") + test18 $REMOTE + test19 $REMOTE + test20 $REMOTE + echo $(section "--depth=1 fetching after modification applied in submodule") + test21 $REMOTE + test22 $REMOTE + test23 $REMOTE elif [ -n "$TEST_NUM" ]; then case $TEST_NUM in @@ -476,6 +774,8 @@ elif [ -n "$TEST_NUM" ]; then test12 $REMOTE;; 13) test13 $REMOTE;; + 21) + test21 $REMOTE;; *) echo "Error: Invalid test number" die;;