premier test fetching avec historique

This commit is contained in:
eleonore12345 2024-07-03 18:14:18 +02:00
parent f468cd0ba2
commit 912a969bdf

View File

@ -73,7 +73,7 @@ test3(){
test4(){
section TEST4
run mkdir $REPO_NAME
run echo 'TEST 4 : case of sparse-checking only some files with depth=1'
run echo "TEST 4 : case of sparse-checking only $FILES_TO_KEEP with depth=1"
run cd $REPO_NAME
run git init -q
run git config core.sparsecheckout true
@ -81,7 +81,7 @@ test4(){
run git remote add -f origin file://$1 #&> /dev/null
run git pull origin main #&> /dev/null
mem4=$(du . | tail -n1 | tr -cd [:digit:])
echo "memory usage with sparse checking only $FILES_TO_KEEP : $mem4"
echo "memory usage: $mem4"
echo "The bandwidth usage is not available through the Git commands."
run rm cloning_text
run rm -rf $REPO_NAME
@ -108,7 +108,7 @@ test5(){
mem5after=$(du . | tail -n1 | tr -cd [:digit:])
mem5=$(($mem5after-$mem5before))
bw5=$(grep -e "\->" merging_text| grep -o "[[:digit:].]* -> [[:digit:].]* [[:alpha:]]*")
echo "memory usage in a classic fetching and merging : $mem5"
echo "memory usage: $mem5"
echo "bandwidth usage: $bw5"
cd ../$REMOTE
git reset --hard -q a99be63309fc4f4600210000583546d966d12d4f
@ -117,7 +117,7 @@ test5(){
}
test6(){
section TEST5
section TEST6
run echo 'TEST 6 : case of classic fetching and merging, after removal of a 1M file'
run git clone $1 &> /dev/null
cd $REPO_NAME
@ -135,7 +135,7 @@ test6(){
mem6after=$(du . | tail -n1 | tr -cd [:digit:])
mem6=$(($mem6after-$mem6before))
bw6=$(grep -e "\->" merging_text| grep -o "[[:digit:].]* -> [[:digit:].]* [[:alpha:]]*")
echo "memory usage in a classic fetching and merging : $mem6"
echo "memory usage: $mem6"
echo "bandwidth usage: $bw6"
cd ../$REMOTE
git reset --hard -q a99be63309fc4f4600210000583546d966d12d4f
@ -143,10 +143,42 @@ test6(){
rm -rf performance_testing
}
test7(){
section TEST7
run echo 'TEST 7 : case of classic 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
mem7before=$(du . | tail -n1 | tr -cd [:digit:])
#modification of the remote repo
cd ../$REMOTE
run dd if=/dev/urandom of=sample5 bs=1M count=1 &> /dev/null #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
run git fetch --progress origin &> fetching_text
run git merge --progress &> merging_text
mem7after=$(du . | tail -n1 | tr -cd [:digit:])
mem7=$(($mem7after-$mem7before))
bw7=$(grep -e "\->" merging_text| grep -o "[[:digit:].]* -> [[:digit:].]* [[:alpha:]]*")
echo "memory usage: $mem7"
echo "bandwidth usage unknown"
cd ../$REMOTE
git reset --hard -q a99be63309fc4f4600210000583546d966d12d4f
cd ../..
rm -rf performance_testing
}
#modify to have a history of changes
#test 7 : --depth=1
#normalement supprime aussi l'historique
while getopts ":hn:a" option; do
case $option in
h) # display Help
@ -170,6 +202,7 @@ if [ "$ALL_TESTS" = true ]; then
test4 $REMOTE
test5 $REMOTE
test6 $REMOTE
test7 $REMOTE
elif [ -n "$TEST_NUM" ]; then
case $TEST_NUM in
@ -187,6 +220,8 @@ elif [ -n "$TEST_NUM" ]; then
test5 $REMOTE;;
6)
test6 $REMOTE;;
7)
test7 $REMOTE;;
*)
echo "Error: Invalid test number"
die;;