version buggee mais bientôt finie

This commit is contained in:
eleonore12345 2024-07-04 18:29:55 +02:00
parent b2178cfd6e
commit 8bb420be25
3 changed files with 92 additions and 14 deletions

View File

@ -24,9 +24,11 @@ if [[ "${BASH_SOURCE[0]}" = "${0}" ]]; then
exit;; exit;;
esac esac
done done
return 0
fi fi
create_random_file(){
run dd if=/dev/urandom of=$1 bs=$2 count=1 &> /dev/null
}
REPO_NAME=performance_testing REPO_NAME=performance_testing
REPO_PATH=./remote REPO_PATH=./remote
@ -40,23 +42,23 @@ if [ ! -d $REPO_NAME ]; then
cd $REPO_NAME cd $REPO_NAME
git init git init
git branch -m main git branch -m main
dd if=/dev/urandom of=sample0 bs=1M count=1 create_random_file 'sample0' '1M'
git add . git add .
git commit -m"first 1M sample created" git commit -m"first 1M sample created"
git tag start git tag start
dd if=/dev/urandom of=sample1 bs=1M count=1 create_random_file 'sample1' '1M'
git add sample1 git add sample1
git commit -m"second 1M sample created" git commit -m"second 1M sample created"
git branch secondary git branch secondary
git checkout secondary git checkout secondary
dd if=/dev/urandom of=sample2 bs=500K count=1 create_random_file 'sample2' '500K'
git add sample2 git add sample2
git commit -m"first 500K sample created in branch secondary" git commit -m"first 500K sample created in branch secondary"
git checkout main git checkout main
dd if=/dev/urandom of=sample3 bs=1M count=1 create_random_file 'sample3' '1M'
git add sample3 git add sample3
git commit -m"third 1M sample created" git commit -m"third 1M sample created"
dd if=/dev/urandom of=sample4 bs=5M count=1 create_random_file 'sample4' '5M'
git add sample4 git add sample4
git commit -m"first 5M sample created" git commit -m"first 5M sample created"
rm sample4 rm sample4

BIN
notes.odt

Binary file not shown.

View File

@ -117,6 +117,7 @@ test4(){
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'
#initialization
run git clone $1 &> /dev/null run git clone $1 &> /dev/null
cd $REPO_NAME cd $REPO_NAME
run git fetch --progress origin &> /dev/null run git fetch --progress origin &> /dev/null
@ -129,6 +130,7 @@ 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
#fetching
run git fetch --progress origin &> /dev/null run git fetch --progress origin &> /dev/null
run git merge --progress &> fetching_text run git merge --progress &> fetching_text
get_storage_used . get_storage_used .
@ -146,6 +148,7 @@ test5(){
test6(){ test6(){
section TEST6 section TEST6
run echo 'TEST 6 : case of classic fetching and merging, after removal of a 1M file' run echo 'TEST 6 : case of classic fetching and merging, after removal of a 1M file'
#initialization
run git clone $1 &> /dev/null run git clone $1 &> /dev/null
cd $REPO_NAME cd $REPO_NAME
run git fetch --progress origin &> /dev/null run git fetch --progress origin &> /dev/null
@ -158,6 +161,7 @@ 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
#fetching
run git fetch --progress origin &> /dev/null run git fetch --progress origin &> /dev/null
run git merge --progress &> fetching_text run git merge --progress &> fetching_text
get_storage_used . get_storage_used .
@ -175,6 +179,7 @@ test6(){
test7(){ test7(){
section TEST7 section TEST7
run echo 'TEST 7 : case of classic fetching and merging, after addition then removal of a 1M file' run echo 'TEST 7 : case of classic fetching and merging, after addition then removal of a 1M file'
#initialization
run git clone $1 &> /dev/null run git clone $1 &> /dev/null
cd $REPO_NAME cd $REPO_NAME
run git fetch --progress origin &> /dev/null run git fetch --progress origin &> /dev/null
@ -190,6 +195,7 @@ 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
#fetching
run git fetch --progress origin &> /dev/null run git fetch --progress origin &> /dev/null
run git merge --progress &> /dev/null run git merge --progress &> /dev/null
get_storage_used . get_storage_used .
@ -205,11 +211,12 @@ test7(){
test8(){ test8(){
section TEST8 section TEST8
run echo 'TEST 8 : case of classic fetching and merging, after addition of a 1M file' run echo 'TEST 8 : case of fetching --depth=1 and merging, after addition of a 1M file'
run git clone $1 &> /dev/null #initialization
run git clone $1 #&> /dev/null
cd $REPO_NAME cd $REPO_NAME
run git fetch --progress --depth=1 origin &> /dev/null run git fetch --progress origin &> fetching1 #&> /dev/null is this useless?
run git merge --progress origin &> /dev/null run git merge --progress origin &> merging1 #&> /dev/null
get_storage_used . get_storage_used .
mem_before=$mem mem_before=$mem
#modification of the remote repo #modification of the remote repo
@ -218,8 +225,8 @@ test8(){
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 &> /dev/null run git fetch --progress --depth=1 origin &> fetching2 # /dev/null
run git merge --progress &> fetching_text run git merge --progress --allow-unrelated-histories &> merging2
get_storage_used . get_storage_used .
mem_after=$mem mem_after=$mem
mem=$(($mem_after-$mem_before)) mem=$(($mem_after-$mem_before))
@ -227,12 +234,75 @@ test8(){
echo "memory usage: +$mem" echo "memory usage: +$mem"
echo "bandwidth usage: $bw" echo "bandwidth usage: $bw"
cd ../$REMOTE cd ../$REMOTE
git reset --hard -q a99be63309fc4f4600210000583546d966d12d4f #does not work cause commits change numbers
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'
#initialization
run git clone $1 &> /dev/null
cd $REPO_NAME
run git fetch --progress origin &> /dev/null
run git merge --progress origin &> /dev/null
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 fetch --progress --depth=1 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 git reset --hard -q a99be63309fc4f4600210000583546d966d12d4f
cd ../.. cd ../..
rm -rf performance_testing 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'
run git clone $1 &> /dev/null
cd $REPO_NAME
run git fetch --progress origin &> /dev/null
run git merge --progress origin &> /dev/null
get_storage_used .
mem_before=$mem
echo "mem before is $mem_before"
#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 fetch --progress --depth=1 origin &> /fetching_text #dev/null
run git merge --progress &> merging_text #/dev/null
get_storage_used .
mem_after=$mem
echo "mem after is $mem_before"
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
echo "bandwidth usage unknown"
cd ../$REMOTE
git reset --hard -q a99be63309fc4f4600210000583546d966d12d4f
cd ../..
rm -rf performance_testing
}
while getopts ":hn:a" option; do while getopts ":hn:a" option; do
case $option in case $option in
@ -259,6 +329,8 @@ if [ "$ALL_TESTS" = true ]; then
test6 $REMOTE test6 $REMOTE
test7 $REMOTE test7 $REMOTE
test8 $REMOTE test8 $REMOTE
test9 $REMOTE
test10 $REMOTE
elif [ -n "$TEST_NUM" ]; then elif [ -n "$TEST_NUM" ]; then
case $TEST_NUM in case $TEST_NUM in
@ -280,6 +352,10 @@ elif [ -n "$TEST_NUM" ]; then
test7 $REMOTE;; test7 $REMOTE;;
8) 8)
test8 $REMOTE;; test8 $REMOTE;;
9)
test9 $REMOTE;;
10)
test10 $REMOTE;;
*) *)
echo "Error: Invalid test number" echo "Error: Invalid test number"
die;; die;;