From b2178cfd6ece6d4e09743d98c99cec6140e14c98 Mon Sep 17 00:00:00 2001 From: eleonore12345 Date: Thu, 4 Jul 2024 16:42:39 +0200 Subject: [PATCH] =?UTF-8?q?bw=20d=C3=A9bugg=C3=A9e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- performance_tests.sh | 62 +++++++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/performance_tests.sh b/performance_tests.sh index 137fe8c..cd9ad79 100755 --- a/performance_tests.sh +++ b/performance_tests.sh @@ -35,13 +35,12 @@ get_storage_used(){ } get_bandwidth(){ - if [ "$2"="cloning"]; then + bw="unknown" + if [ "$1" = "cloning_text" ]; then bw=$(grep -e "Receiving objects:" $1 | grep -o "Receiving objects: [[:alnum:]%/(),. ]*" | tail -n1) - echo "1 : $bw" bw=${bw#*,} - echo "2 : $bw" - elif [ "$2"="fetching" ]; then - bw=$(grep -e "\->" merging_text| grep -o "[[:digit:].]* -> [[:digit:].]* [[:alpha:]]*") + elif [ "$1" = "fetching_text" ]; then + bw=$(grep -e "\->" fetching_text| grep -o "[[:digit:].]* -> [[:digit:].]* [[:alpha:]]*") echo "bw vaut $bw" fi } @@ -115,7 +114,6 @@ test4(){ } #TESTS ON THE UPDATING OF THE REPOSITORY -#WITHOUT CHANGING ANYTHING test5(){ section TEST5 run echo 'TEST 5 : case of classic fetching and merging, after addition of a 1M file' @@ -123,7 +121,7 @@ test5(){ cd $REPO_NAME run git fetch --progress origin &> /dev/null run git merge --progress origin &> /dev/null - get_storage_used . + get_storage_used . mem_before=$mem #modification of the remote repo cd ../$REMOTE @@ -131,12 +129,12 @@ test5(){ run git add sample5 run git commit --quiet -m"fourth 1M sample created" cd ../../$REPO_NAME - run git fetch --progress origin &> fetching_text - run git merge --progress &> merging_text + run git fetch --progress origin &> /dev/null + run git merge --progress &> fetching_text get_storage_used . mem_after=$mem mem=$(($mem_after-$mem_before)) - get_bandwidth . fetching + get_bandwidth fetching_text echo "memory usage: +$mem" echo "bandwidth usage: $bw" cd ../$REMOTE @@ -160,12 +158,12 @@ test6(){ run git add sample0 run git commit --quiet -m"1M sample0 deleted" cd ../../$REPO_NAME - run git fetch --progress origin &> fetching_text - run git merge --progress &> merging_text + run git fetch --progress origin &> /dev/null + run git merge --progress &> fetching_text get_storage_used . mem_after=$mem mem=$(($mem_after-$mem_before)) - get_bandwidth . fetching + get_bandwidth fetching_text echo "memory usage: $mem" echo "bandwidth usage: $bw" cd ../$REMOTE @@ -192,8 +190,8 @@ test7(){ run git add sample5 run git commit --quiet -m"1M "sample5" deleted" cd ../../$REPO_NAME - run git fetch --progress origin &> fetching_text - run git merge --progress &> merging_text + run git fetch --progress origin &> /dev/null + run git merge --progress &> /dev/null get_storage_used . mem_after=$mem mem=$(($mem_after-$mem_before)) @@ -205,9 +203,34 @@ test7(){ rm -rf performance_testing } -#test 7 : --depth=1 -#normalement supprime aussi l'historique - +test8(){ + section TEST8 + run echo 'TEST 8 : case of classic fetching and merging, after addition of a 1M file' + run git clone $1 &> /dev/null + cd $REPO_NAME + run git fetch --progress --depth=1 origin &> /dev/null + run git merge --progress origin &> /dev/null + 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 fetch --progress origin &> /dev/null + run git merge --progress &> fetching_text + get_storage_used . + mem_after=$mem + mem=$(($mem_after-$mem_before)) + get_bandwidth fetching_text + echo "memory usage: +$mem" + echo "bandwidth usage: $bw" + cd ../$REMOTE + git reset --hard -q a99be63309fc4f4600210000583546d966d12d4f + cd ../.. + rm -rf performance_testing +} @@ -235,6 +258,7 @@ if [ "$ALL_TESTS" = true ]; then test5 $REMOTE test6 $REMOTE test7 $REMOTE + test8 $REMOTE elif [ -n "$TEST_NUM" ]; then case $TEST_NUM in @@ -254,6 +278,8 @@ elif [ -n "$TEST_NUM" ]; then test6 $REMOTE;; 7) test7 $REMOTE;; + 8) + test8 $REMOTE;; *) echo "Error: Invalid test number" die;;