diff --git a/creation_repo.sh b/creation_repo.sh index fd0554f..cb7e4ac 100755 --- a/creation_repo.sh +++ b/creation_repo.sh @@ -24,9 +24,11 @@ if [[ "${BASH_SOURCE[0]}" = "${0}" ]]; then exit;; esac done - return 0 fi +create_random_file(){ + run dd if=/dev/urandom of=$1 bs=$2 count=1 &> /dev/null +} REPO_NAME=performance_testing REPO_PATH=./remote @@ -40,23 +42,23 @@ if [ ! -d $REPO_NAME ]; then cd $REPO_NAME git init git branch -m main - dd if=/dev/urandom of=sample0 bs=1M count=1 + create_random_file 'sample0' '1M' git add . git commit -m"first 1M sample created" git tag start - dd if=/dev/urandom of=sample1 bs=1M count=1 + create_random_file 'sample1' '1M' git add sample1 git commit -m"second 1M sample created" git branch secondary git checkout secondary - dd if=/dev/urandom of=sample2 bs=500K count=1 + create_random_file 'sample2' '500K' git add sample2 git commit -m"first 500K sample created in branch secondary" git checkout main - dd if=/dev/urandom of=sample3 bs=1M count=1 + create_random_file 'sample3' '1M' git add sample3 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 commit -m"first 5M sample created" rm sample4 diff --git a/notes.odt b/notes.odt index cf63801..92b0b6e 100644 Binary files a/notes.odt and b/notes.odt differ diff --git a/performance_tests.sh b/performance_tests.sh index cd9ad79..49215c4 100755 --- a/performance_tests.sh +++ b/performance_tests.sh @@ -117,6 +117,7 @@ test4(){ test5(){ section TEST5 run echo 'TEST 5 : case of classic fetching and merging, after addition of a 1M file' + #initialization run git clone $1 &> /dev/null cd $REPO_NAME run git fetch --progress origin &> /dev/null @@ -129,6 +130,7 @@ test5(){ run git add sample5 run git commit --quiet -m"fourth 1M sample created" cd ../../$REPO_NAME + #fetching run git fetch --progress origin &> /dev/null run git merge --progress &> fetching_text get_storage_used . @@ -144,8 +146,9 @@ test5(){ } test6(){ - section TEST6 + section TEST6 run echo 'TEST 6 : case of classic 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 @@ -158,6 +161,7 @@ test6(){ run git add sample0 run git commit --quiet -m"1M sample0 deleted" cd ../../$REPO_NAME + #fetching run git fetch --progress origin &> /dev/null run git merge --progress &> fetching_text get_storage_used . @@ -175,6 +179,7 @@ test6(){ test7(){ section TEST7 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 cd $REPO_NAME run git fetch --progress origin &> /dev/null @@ -190,6 +195,7 @@ test7(){ run git add sample5 run git commit --quiet -m"1M "sample5" deleted" cd ../../$REPO_NAME + #fetching run git fetch --progress origin &> /dev/null run git merge --progress &> /dev/null get_storage_used . @@ -205,11 +211,12 @@ test7(){ 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 + run echo 'TEST 8 : case of fetching --depth=1 and merging, after addition of a 1M file' + #initialization + 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 + run git fetch --progress origin &> fetching1 #&> /dev/null is this useless? + run git merge --progress origin &> merging1 #&> /dev/null get_storage_used . mem_before=$mem #modification of the remote repo @@ -218,8 +225,8 @@ test8(){ 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 + run git fetch --progress --depth=1 origin &> fetching2 # /dev/null + run git merge --progress --allow-unrelated-histories &> merging2 get_storage_used . mem_after=$mem mem=$(($mem_after-$mem_before)) @@ -227,12 +234,75 @@ test8(){ echo "memory usage: +$mem" echo "bandwidth usage: $bw" 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 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' + 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 case $option in @@ -259,6 +329,8 @@ if [ "$ALL_TESTS" = true ]; then test6 $REMOTE test7 $REMOTE test8 $REMOTE + test9 $REMOTE + test10 $REMOTE elif [ -n "$TEST_NUM" ]; then case $TEST_NUM in @@ -280,6 +352,10 @@ elif [ -n "$TEST_NUM" ]; then test7 $REMOTE;; 8) test8 $REMOTE;; + 9) + test9 $REMOTE;; + 10) + test10 $REMOTE;; *) echo "Error: Invalid test number" die;;