bw débuggée

This commit is contained in:
eleonore12345 2024-07-04 16:42:39 +02:00
parent b01eae167f
commit b2178cfd6e

View File

@ -35,13 +35,12 @@ get_storage_used(){
} }
get_bandwidth(){ 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) bw=$(grep -e "Receiving objects:" $1 | grep -o "Receiving objects: [[:alnum:]%/(),. ]*" | tail -n1)
echo "1 : $bw"
bw=${bw#*,} bw=${bw#*,}
echo "2 : $bw" elif [ "$1" = "fetching_text" ]; then
elif [ "$2"="fetching" ]; then bw=$(grep -e "\->" fetching_text| grep -o "[[:digit:].]* -> [[:digit:].]* [[:alpha:]]*")
bw=$(grep -e "\->" merging_text| grep -o "[[:digit:].]* -> [[:digit:].]* [[:alpha:]]*")
echo "bw vaut $bw" echo "bw vaut $bw"
fi fi
} }
@ -115,7 +114,6 @@ test4(){
} }
#TESTS ON THE UPDATING OF THE REPOSITORY #TESTS ON THE UPDATING OF THE REPOSITORY
#WITHOUT CHANGING ANYTHING
test5(){ test5(){
section TEST5 section TEST5
run echo 'TEST 5 : case of classic fetching and merging, after addition of a 1M file' run echo 'TEST 5 : case of classic fetching and merging, after addition of a 1M file'
@ -131,12 +129,12 @@ test5(){
run git add sample5 run git add sample5
run git commit --quiet -m"fourth 1M sample created" run git commit --quiet -m"fourth 1M sample created"
cd ../../$REPO_NAME cd ../../$REPO_NAME
run git fetch --progress origin &> fetching_text run git fetch --progress origin &> /dev/null
run git merge --progress &> merging_text run git merge --progress &> fetching_text
get_storage_used . get_storage_used .
mem_after=$mem mem_after=$mem
mem=$(($mem_after-$mem_before)) mem=$(($mem_after-$mem_before))
get_bandwidth . fetching get_bandwidth fetching_text
echo "memory usage: +$mem" echo "memory usage: +$mem"
echo "bandwidth usage: $bw" echo "bandwidth usage: $bw"
cd ../$REMOTE cd ../$REMOTE
@ -160,12 +158,12 @@ test6(){
run git add sample0 run git add sample0
run git commit --quiet -m"1M sample0 deleted" run git commit --quiet -m"1M sample0 deleted"
cd ../../$REPO_NAME cd ../../$REPO_NAME
run git fetch --progress origin &> fetching_text run git fetch --progress origin &> /dev/null
run git merge --progress &> merging_text run git merge --progress &> fetching_text
get_storage_used . get_storage_used .
mem_after=$mem mem_after=$mem
mem=$(($mem_after-$mem_before)) mem=$(($mem_after-$mem_before))
get_bandwidth . fetching get_bandwidth fetching_text
echo "memory usage: $mem" echo "memory usage: $mem"
echo "bandwidth usage: $bw" echo "bandwidth usage: $bw"
cd ../$REMOTE cd ../$REMOTE
@ -192,8 +190,8 @@ test7(){
run git add sample5 run git add sample5
run git commit --quiet -m"1M "sample5" deleted" run git commit --quiet -m"1M "sample5" deleted"
cd ../../$REPO_NAME cd ../../$REPO_NAME
run git fetch --progress origin &> fetching_text run git fetch --progress origin &> /dev/null
run git merge --progress &> merging_text run git merge --progress &> /dev/null
get_storage_used . get_storage_used .
mem_after=$mem mem_after=$mem
mem=$(($mem_after-$mem_before)) mem=$(($mem_after-$mem_before))
@ -205,9 +203,34 @@ test7(){
rm -rf performance_testing rm -rf performance_testing
} }
#test 7 : --depth=1 test8(){
#normalement supprime aussi l'historique 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 test5 $REMOTE
test6 $REMOTE test6 $REMOTE
test7 $REMOTE test7 $REMOTE
test8 $REMOTE
elif [ -n "$TEST_NUM" ]; then elif [ -n "$TEST_NUM" ]; then
case $TEST_NUM in case $TEST_NUM in
@ -254,6 +278,8 @@ elif [ -n "$TEST_NUM" ]; then
test6 $REMOTE;; test6 $REMOTE;;
7) 7)
test7 $REMOTE;; test7 $REMOTE;;
8)
test8 $REMOTE;;
*) *)
echo "Error: Invalid test number" echo "Error: Invalid test number"
die;; die;;