From 912a969bdf6f452b741ed7ab743b9c1a598a071c Mon Sep 17 00:00:00 2001 From: eleonore12345 Date: Wed, 3 Jul 2024 18:14:18 +0200 Subject: [PATCH] premier test fetching avec historique --- performance_tests.sh | 49 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/performance_tests.sh b/performance_tests.sh index fa2b256..e2cb584 100755 --- a/performance_tests.sh +++ b/performance_tests.sh @@ -73,7 +73,7 @@ test3(){ test4(){ section TEST4 run mkdir $REPO_NAME - run echo 'TEST 4 : case of sparse-checking only some files with depth=1' + run echo "TEST 4 : case of sparse-checking only $FILES_TO_KEEP with depth=1" run cd $REPO_NAME run git init -q run git config core.sparsecheckout true @@ -81,7 +81,7 @@ test4(){ run git remote add -f origin file://$1 #&> /dev/null run git pull origin main #&> /dev/null mem4=$(du . | tail -n1 | tr -cd [:digit:]) - echo "memory usage with sparse checking only $FILES_TO_KEEP : $mem4" + echo "memory usage: $mem4" echo "The bandwidth usage is not available through the Git commands." run rm cloning_text run rm -rf $REPO_NAME @@ -108,8 +108,8 @@ test5(){ mem5after=$(du . | tail -n1 | tr -cd [:digit:]) mem5=$(($mem5after-$mem5before)) bw5=$(grep -e "\->" merging_text| grep -o "[[:digit:].]* -> [[:digit:].]* [[:alpha:]]*") - echo "memory usage in a classic fetching and merging : $mem5" - echo "bandwidth usage : $bw5" + echo "memory usage: $mem5" + echo "bandwidth usage: $bw5" cd ../$REMOTE git reset --hard -q a99be63309fc4f4600210000583546d966d12d4f cd ../.. @@ -117,7 +117,7 @@ test5(){ } test6(){ - section TEST5 + section TEST6 run echo 'TEST 6 : case of classic fetching and merging, after removal of a 1M file' run git clone $1 &> /dev/null cd $REPO_NAME @@ -135,18 +135,50 @@ test6(){ mem6after=$(du . | tail -n1 | tr -cd [:digit:]) mem6=$(($mem6after-$mem6before)) bw6=$(grep -e "\->" merging_text| grep -o "[[:digit:].]* -> [[:digit:].]* [[:alpha:]]*") - echo "memory usage in a classic fetching and merging : $mem6" - echo "bandwidth usage : $bw6" + echo "memory usage: $mem6" + echo "bandwidth usage: $bw6" cd ../$REMOTE git reset --hard -q a99be63309fc4f4600210000583546d966d12d4f 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' + run git clone $1 &> /dev/null + cd $REPO_NAME + run git fetch --progress origin &> /dev/null + run git merge --progress origin &> /dev/null + mem7before=$(du . | tail -n1 | tr -cd [:digit:]) + #modification of the remote repo + cd ../$REMOTE + run dd if=/dev/urandom of=sample5 bs=1M count=1 &> /dev/null #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 + run git fetch --progress origin &> fetching_text + run git merge --progress &> merging_text + mem7after=$(du . | tail -n1 | tr -cd [:digit:]) + mem7=$(($mem7after-$mem7before)) + bw7=$(grep -e "\->" merging_text| grep -o "[[:digit:].]* -> [[:digit:].]* [[:alpha:]]*") + echo "memory usage: $mem7" + echo "bandwidth usage unknown" + cd ../$REMOTE + git reset --hard -q a99be63309fc4f4600210000583546d966d12d4f + cd ../.. + rm -rf performance_testing +} #modify to have a history of changes #test 7 : --depth=1 #normalement supprime aussi l'historique + + + while getopts ":hn:a" option; do case $option in h) # display Help @@ -170,6 +202,7 @@ if [ "$ALL_TESTS" = true ]; then test4 $REMOTE test5 $REMOTE test6 $REMOTE + test7 $REMOTE elif [ -n "$TEST_NUM" ]; then case $TEST_NUM in @@ -187,6 +220,8 @@ elif [ -n "$TEST_NUM" ]; then test5 $REMOTE;; 6) test6 $REMOTE;; + 7) + test7 $REMOTE;; *) echo "Error: Invalid test number" die;;