avec submodules mais encore des bugs à régler! et avec reflexion sur la façon de fetch§merge§checkout

This commit is contained in:
eleonore12345 2024-07-06 17:43:57 +02:00
parent bc690f2f11
commit 6b51421fe1
3 changed files with 152 additions and 54 deletions

View File

@ -1,5 +1,5 @@
#!/bin/bash
. driglibash-base
Help()
{
echo "
@ -25,18 +25,19 @@ if [[ "${BASH_SOURCE[0]}" = "${0}" ]]; then
esac
done
fi
create_random_file(){
run dd if=/dev/urandom of=$1 bs=$2 count=1 &> /dev/null
}
REPO_NAME=performance_testing
REPO_PATH=./remote
WITH_SUBMODULE="true"
if [ ! -d $REPO_PATH ]; then
mkdir $REPO_PATH
fi
cd $REPO_PATH
echo $(ls -la)
if [ ! -d $REPO_NAME ]; then
mkdir $REPO_NAME
cd $REPO_NAME
@ -64,6 +65,22 @@ if [ ! -d $REPO_NAME ]; then
rm sample4
git add sample4
git commit -m"sample4 deleted"
if [ "$WITH_SUBMODULE" = "true" ]; then
SUB_NAME="submodule_for_performance_testing"
if [ ! -d $SUB_NAME ]; then
mkdir $SUB_NAME
cd $SUB_NAME
git init
git branch -m main
create_random_file 'sub_sample0' '1M'
git add .
git commit -m"first 1M sample created"
cd ../$REPO_NAME
fi
git submodule add ../submodule_for_performance_testing
git commit -am "adding $SUB_NAME module"
fi
cd ..
fi
cd ..
cd ../..
pwd

BIN
notes.odt

Binary file not shown.

View File

@ -1,6 +1,4 @@
#!/bin/bash
. driglibash-base #test
. creation_repo.sh &> /dev/null
FILES_TO_KEEP='sample0'
@ -52,7 +50,7 @@ get_bandwidth(){
test0(){
section TEST0
echo "TEST 0 : case of classic cloning."
git clone --progress --no-local $1 2> cloning_text
git clone --recurse-submodules --progress --no-local $1 2> cloning_text
get_storage_used "./$REPO_NAME"
get_bandwidth cloning_text
echo "memory usage in a classic cloning : $mem"
@ -64,7 +62,7 @@ test0(){
test1(){
section TEST1
echo "TEST 1 : case of --single-branch cloning."
git clone --progress --single-branch --no-local $1 2> cloning_text
git clone --recurse-submodules --progress --single-branch --no-local $1 2> cloning_text
get_storage_used ./$REPO_NAME
get_bandwidth cloning_text
echo "memory usage in a --single-branch cloning : $mem"
@ -76,7 +74,7 @@ test1(){
test2(){
section TEST2
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 --recurse-submodules --progress --depth=1 --no-local --no-single-branch $1 2> cloning_text
get_storage_used ./$REPO_NAME
get_bandwidth cloning_text
echo "memory usage in a --depth=1 --no-single-branch cloning : $mem"
@ -88,13 +86,13 @@ test2(){
test3(){
section TEST3
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 --recurse-submodules --recurse-submodules --progress --single-branch --no-local --depth=1 $1 2> cloning_text
get_storage_used ./$REPO_NAME
get_bandwidth cloning_text
echo "memory usage in a --depth=1 with single-branch cloning : $mem"
echo "bandwidth usage : $bw"
run rm cloning_text
run rm -rf $REPO_NAME
#run rm -rf $REPO_NAME
}
test4(){
@ -113,19 +111,18 @@ test4(){
echo "memory usage: $mem"
echo "bandwidth usage : unknown"
cd ..
run rm -rf $REPO_NAME
#run rm -rf $REPO_NAME
}
#TESTS ON THE UPDATING OF THE REPOSITORY
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
run git clone --recurse-submodules $1 &> /dev/null
cd $REPO_NAME
#run git submodule update --init --recursive --force --recommend-shallow
run git fetch --progress origin &> /dev/null
run git merge --progress origin &> /dev/null
get_storage_used .
@ -137,16 +134,13 @@ test5(){
run git commit --quiet -m"fourth 1M sample created"
cd ../../$REPO_NAME
#fetching
run git fetch --progress origin &> /dev/null
run git checkout origin/main
run git reset --hard
#run git merge --progress &> fetching_text
run git fetch --progress --tags --depth=1 --recurse-submodules origin &> /dev/null
git checkout -f --recurse-submodules origin/main &> /dev/null
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 HEAD~1
cd ../..
@ -157,7 +151,7 @@ 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
run git clone --recurse-submodules $1 #&> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
@ -168,18 +162,15 @@ test6(){
run git commit --quiet -m"1M sample0 deleted"
cd ../../$REPO_NAME
#fetching
run git fetch --progress origin &> /dev/null
run git checkout origin/main
run git reset --hard
#run git merge --progress &> fetching_text
run git fetch --progress --tags --depth=1 --recurse-submodules origin &> /dev/null
git checkout -f --recurse-submodules origin/main &> /dev/null
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 HEAD~1
git clean -df
cd ../..
#rm -rf performance_testing
}
@ -188,7 +179,7 @@ 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
run git clone --recurse-submodules $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
@ -202,15 +193,12 @@ test7(){
run git commit --quiet -m"1M "sample5" deleted"
cd ../../$REPO_NAME
#fetching
run git fetch --progress origin &> /dev/null
run git checkout origin/main
run git reset --hard
#run git merge --progress &> fetching_text
run git fetch --progress --tags --depth=1 --recurse-submodules origin &> /dev/null
git checkout -f --recurse-submodules origin/main &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
#echo "bandwidth usage : unknown"
cd ../$REMOTE
git reset --hard -q HEAD~2
cd ../..
@ -222,8 +210,9 @@ test8(){
run echo 'TEST 8 : case of fetching --depth=1 and merging, after addition of a 1M file'
#initialization
echo $(pwd)
run git clone $1 &> /dev/null
run git clone --recurse-submodules $1 &> /dev/null
cd $REPO_NAME
echo "un truc écrit en plus" >> untexte
get_storage_used .
mem_before=$mem
#modification of the remote repo
@ -232,18 +221,14 @@ test8(){
run git add sample5
run git commit --quiet -m"fourth 1M sample created"
cd ../../$REPO_NAME
run git fetch --progress --depth=1 origin &> /dev/null
run git checkout origin/main
run git reset --hard
#run git merge --progress --allow-unrelated-histories &> fetching_text
run git fetch --progress --tags --depth=1 --recurse-submodules origin &> /dev/null
git checkout -f --recurse-submodules origin/main &> /dev/null
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 HEAD~1 #does not work cause commits change numbers
git reset --hard -q HEAD~1
cd ../..
#rm -rf performance_testing
}
@ -252,7 +237,7 @@ 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
run git clone --recurse-submodules $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
@ -263,15 +248,12 @@ test9(){
run git commit --quiet -m"1M sample0 deleted"
cd ../../$REPO_NAME
#fetching
run git fetch --progress --depth=1 --prune origin &> text1
run git checkout origin/main
run git reset --hard
#run git merge --progress --allow-unrelated-histories &> text2
run git fetch --progress --tags --depth=1 --recurse-submodules origin &> /dev/null
git checkout -f --recurse-submodules origin/main &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
#echo "bandwidth usage: unknown"
cd ../$REMOTE
git reset --hard -q HEAD~1
cd ../..
@ -281,12 +263,11 @@ test9(){
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
run git clone --recurse-submodules $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
pwd
#modification of the remote repo
cd ../$REMOTE
create_random_file 'sample5' '1M' #adding a 1M file
@ -297,15 +278,105 @@ test10(){
run git commit --quiet -m"1M "sample5" deleted"
cd ../../$REPO_NAME
#fetching
run git fetch --progress --depth=1 origin &> /dev/null
git checkout origin/main
git reset --hard
#run git merge --progress --allow-unrelated-histories &> /dev/null
run git fetch --progress --tags --depth=1 --recurse-submodules origin &> /dev/null
git checkout -f --recurse-submodules origin/main &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
git reset --hard -q HEAD~2
cd ../..
#rm -rf performance_testing
}
test11(){
section TEST11
run echo 'TEST 11 : case of --depth=1 fetching and merging, after addition of a 1M file in submodule'
pwd
run git clone --recurse-submodules $1
cd $REPO_NAME
get_storage_used .
mem_before=$mem
pwd
ls -la
#modification of the remote submodule
cd ../$REMOTE/$SUB_NAME
pwd
create_random_file 'sub_sample1' '1M'
git add sub_sample1
git commit --quiet -m"first 1M sample created"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --recommend-shallow
run git fetch --progress --tags --depth=1 -recursive-submodules origin &> /dev/null
git checkout -f -recursive-submodules origin/main &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
git reset --hard -q HEAD~2
cd ../..
#rm -rf performance_testing
}
test12(){
section TEST12
run echo 'TEST 12 : case of --depth=1 fetching and merging, after removal of a 1M file in submodule'
run git clone --recurse-submodules $1 &> /dev/null
cd $REPO_NAME
get_storage_used .
mem_before=$mem
pwd
#modification of the remote repo
cd ../$REMOTE/$SUB_NAME
ls -la
rm sub_sample1
git add sub_sample1
git commit -m"1M sub_sample1 deleted"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --recommend-shallow
run git fetch --progress --tags --depth=1 --recurse-submodules origin &> /dev/null
git checkout -f --recurse-submodules origin/main &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
cd ../$REMOTE
git reset --hard -q HEAD~2
cd ../..
#rm -rf performance_testing
}
test13(){
section TEST13
run echo 'TEST 13 : case of --depth=1 fetching and merging, after addition then removal of a 1M file in submodule'
run git clone --recurse-submodules $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/$SUB_NAME
create_random_file 'sub_sample1' '5M'
git add sub_sample1
git commit -m"first 1M sample created"
rm sub_sample1
git add sub_sample1
git commit -m"1M sub_sample1 deleted"
cd ../../$REPO_NAME
#fetching
run git submodule update --init --recursive --force --recommend-shallow
run git fetch --progress --tags --depth=1 --recurse-submodules origin &> /dev/null
git checkout -f --recurse-submodules origin/main &> /dev/null
get_storage_used .
mem_after=$mem
mem=$(($mem_after-$mem_before))
echo "memory usage: $mem"
#echo "bandwidth usage : unknown"
cd ../$REMOTE
git reset --hard -q HEAD~2
cd ../..
@ -339,6 +410,10 @@ if [ "$ALL_TESTS" = true ]; then
test8 $REMOTE
test9 $REMOTE
test10 $REMOTE
test11 $REMOTE
test12 $REMOTE
test13 $REMOTE
elif [ -n "$TEST_NUM" ]; then
case $TEST_NUM in
@ -364,6 +439,12 @@ elif [ -n "$TEST_NUM" ]; then
test9 $REMOTE;;
10)
test10 $REMOTE;;
11)
test11 $REMOTE;;
12)
test12 $REMOTE;;
13)
test13 $REMOTE;;
*)
echo "Error: Invalid test number"
die;;