Compare commits

..

No commits in common. "b2178cfd6ece6d4e09743d98c99cec6140e14c98" and "e597acad2c2d94e550c6db59fe41269fdff1eb94" have entirely different histories.

View File

@ -34,28 +34,18 @@ get_storage_used(){
mem=$(du $1 | tail -n1 | tr -cd [:digit:]) mem=$(du $1 | tail -n1 | tr -cd [:digit:])
} }
get_bandwidth(){
bw="unknown"
if [ "$1" = "cloning_text" ]; then
bw=$(grep -e "Receiving objects:" $1 | grep -o "Receiving objects: [[:alnum:]%/(),. ]*" | tail -n1)
bw=${bw#*,}
elif [ "$1" = "fetching_text" ]; then
bw=$(grep -e "\->" fetching_text| grep -o "[[:digit:].]* -> [[:digit:].]* [[:alpha:]]*")
echo "bw vaut $bw"
fi
}
#TESTS ON THE INITIAL POPULATING OF THE REPO #TESTS ON THE INITIAL CLONING
test0(){ test0(){
section TEST0 section TEST0
echo "TEST 0 : case of classic cloning." echo "TEST 0 : case of classic cloning."
git clone --progress --no-local $1 2> cloning_text git clone --progress --no-local $1 2> cloning_text
get_storage_used "./$REPO_NAME" get_storage_used "./$REPO_NAME"
get_bandwidth cloning_text bw0=$(grep -e "Receiving objects:" cloning_text| grep -o "[[:digit:].]* MiB " | tail -n1)
echo "memory usage in a classic cloning : $mem" echo "memory usage in a classic cloning : $mem"
echo "bandwidth usage : $bw" echo "bandwidth usage : $bw0"
run rm cloning_text run rm cloning_text
run rm -rf $REPO_NAME run rm -rf $REPO_NAME
} }
test1(){ test1(){
@ -63,9 +53,9 @@ test1(){
echo "TEST 1 : case of --single-branch cloning." echo "TEST 1 : case of --single-branch cloning."
git clone --progress --single-branch --no-local $1 2> cloning_text git clone --progress --single-branch --no-local $1 2> cloning_text
get_storage_used ./$REPO_NAME get_storage_used ./$REPO_NAME
get_bandwidth cloning_text bw1=$(grep -e "Receiving objects:" cloning_text| grep -o "[[:digit:].]* MiB " | tail -n1)
echo "memory usage in a --single-branch cloning : $mem" echo "memory usage in a --single-branch cloning : $mem"
echo "bandwidth usage : $bw" echo "bandwidth usage : $bw1"
run rm cloning_text run rm cloning_text
run rm -rf $REPO_NAME run rm -rf $REPO_NAME
} }
@ -75,9 +65,9 @@ test2(){
echo "TEST 2 : case of --depth=1 --no-single-branch" echo "TEST 2 : case of --depth=1 --no-single-branch"
git clone --progress --depth=1 --no-local --no-single-branch $1 2> cloning_text git clone --progress --depth=1 --no-local --no-single-branch $1 2> cloning_text
get_storage_used ./$REPO_NAME get_storage_used ./$REPO_NAME
get_bandwidth cloning_text bw2=$(grep -e "Receiving objects:" cloning_text| grep -o "[[:digit:].]* MiB " | tail -n1)
echo "memory usage in a --depth=1 --no-single-branch cloning : $mem" echo "memory usage in a --depth=1 --no-single-branch cloning : $mem"
echo "bandwidth usage : $bw" echo "bandwidth usage : $bw2"
run rm cloning_text run rm cloning_text
run rm -rf $REPO_NAME run rm -rf $REPO_NAME
} }
@ -87,9 +77,9 @@ test3(){
echo "TEST 3 : case of --depth=1 with single-branch (default))" echo "TEST 3 : case of --depth=1 with single-branch (default))"
git clone --progress --single-branch --no-local --depth=1 $1 2> cloning_text git clone --progress --single-branch --no-local --depth=1 $1 2> cloning_text
get_storage_used ./$REPO_NAME get_storage_used ./$REPO_NAME
get_bandwidth cloning_text bw3=$(grep -e "Receiving objects:" cloning_text| grep -o "[[:digit:].]* MiB " | tail -n1)
echo "memory usage in a --depth=1 with single-branch cloning : $mem" echo "memory usage in a --depth=1 with single-branch cloning : $mem"
echo "bandwidth usage : $bw" echo "bandwidth usage : $bw3"
run rm cloning_text run rm cloning_text
run rm -rf $REPO_NAME run rm -rf $REPO_NAME
} }
@ -98,12 +88,10 @@ test4(){
section TEST4 section TEST4
run mkdir $REPO_NAME run mkdir $REPO_NAME
run echo "TEST 4 : case of sparse-checking only $FILES_TO_KEEP with depth=1" run echo "TEST 4 : case of sparse-checking only $FILES_TO_KEEP with depth=1"
#creating a git repo with sparse-checking settings
run cd $REPO_NAME run cd $REPO_NAME
run git init -q run git init -q
run git config core.sparsecheckout true run git config core.sparsecheckout true
run echo $FILES_TO_KEEP >> .git/info/sparse-checkout run echo $FILES_TO_KEEP >> .git/info/sparse-checkout
#pulling from the remote with sparse-checking enabled
run git remote add -f origin ../$1 &> /dev/null run git remote add -f origin ../$1 &> /dev/null
run git pull origin main &> /dev/null run git pull origin main &> /dev/null
get_storage_used . get_storage_used .
@ -114,6 +102,7 @@ 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'
@ -121,7 +110,7 @@ test5(){
cd $REPO_NAME cd $REPO_NAME
run git fetch --progress origin &> /dev/null run git fetch --progress origin &> /dev/null
run git merge --progress origin &> /dev/null run git merge --progress origin &> /dev/null
get_storage_used . get_storage_used .
mem_before=$mem mem_before=$mem
#modification of the remote repo #modification of the remote repo
cd ../$REMOTE cd ../$REMOTE
@ -129,14 +118,14 @@ 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 &> /dev/null run git fetch --progress origin &> fetching_text
run git merge --progress &> fetching_text run git merge --progress &> merging_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_text bw5=$(grep -e "\->" merging_text| grep -o "[[:digit:].]* -> [[:digit:].]* [[:alpha:]]*")
echo "memory usage: +$mem" echo "memory usage: +$mem"
echo "bandwidth usage: $bw" echo "bandwidth usage: $bw5"
cd ../$REMOTE cd ../$REMOTE
git reset --hard -q a99be63309fc4f4600210000583546d966d12d4f git reset --hard -q a99be63309fc4f4600210000583546d966d12d4f
cd ../.. cd ../..
@ -158,14 +147,14 @@ 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 &> /dev/null run git fetch --progress origin &> fetching_text
run git merge --progress &> fetching_text run git merge --progress &> merging_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_text bw6=$(grep -e "\->" merging_text| grep -o "[[:digit:].]* -> [[:digit:].]* [[:alpha:]]*")
echo "memory usage: $mem" echo "memory usage: $mem"
echo "bandwidth usage: $bw" echo "bandwidth usage: $bw6"
cd ../$REMOTE cd ../$REMOTE
git reset --hard -q a99be63309fc4f4600210000583546d966d12d4f git reset --hard -q a99be63309fc4f4600210000583546d966d12d4f
cd ../.. cd ../..
@ -173,7 +162,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'
run git clone $1 &> /dev/null run git clone $1 &> /dev/null
cd $REPO_NAME cd $REPO_NAME
@ -190,8 +179,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 &> /dev/null run git fetch --progress origin &> fetching_text
run git merge --progress &> /dev/null run git merge --progress &> merging_text
get_storage_used . get_storage_used .
mem_after=$mem mem_after=$mem
mem=$(($mem_after-$mem_before)) mem=$(($mem_after-$mem_before))
@ -203,34 +192,9 @@ test7(){
rm -rf performance_testing rm -rf performance_testing
} }
test8(){ #test 7 : --depth=1
section TEST8 #normalement supprime aussi l'historique
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
}
@ -258,7 +222,6 @@ 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
@ -278,8 +241,6 @@ 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;;